pkgsrc/emulators/vba/patches/patch-ac
wiz 8f295b0577 Update to 1.7.2, from dillo@.
SDL code majorly hacked so it works (by dillo@).
I had this lying around for ages, so I'll just commit it now.

Version 1.7.2:
Core changes:
- fixed bugs on ELF clean up
- improved CodeBreaker 0xDxxxxxxx code support
- updated Scale2x filter to version 2.0
- improved memory timing
- added support for z2 (delete break on write) so that gdb can use break on write

Windows:
- added search for base language dll
- fixed GDI problems with selected bitmap being deleted
- added JPEG and PNG support for skins
- changed import/export battery file to default to battery directory
- fixed the translation bug with viewers
- fixed the GB map view flickering
- fixed skin bugs

SDL versions:
- now it exits when closing the window

Other:
- added a new interface using GTK+, which implements a first part of the Windows version

Version 1.7.1:
Core changes:
- added SWI call (0xf9 in thumb mode) to exit emulator in SDL version
- avoid crash when loading an invalid ELF file
- avoid turning sound on if soundOffFlag is true
- disabled remove intros option
- fixed memory leak in ELF support code
- fixed memory corruption if loading a bigger file than the memory to hold it
- fixed some compile warnings in the profiling code
- merged some big endian fixes into the code
- update battery files more often (a bit after the save memory is last updated)

Gameboy:
- fixed bug with window support introduced in version 1.7
- fixed HALT bug when no matching bits for interrupt

Windows:
- added cartridge save strings to bug report
- changed default button on disassembly views to Go instead of Close
- changed power management/screen saver disabling code again to avoid problems
- fixed compilation problems on VC 7
- fixed multi-monitor support
- fixed bug loading memory dumps
- fixed crash onb map/oam/tile viewers
- fixed problem 320x240 mode open/save dialogs
- fixed bug where user selected Gameboy colors were reset and not stored
- fixed bug rendering the translator URL
- fixed memory leak in OpenGL code which caused nasty problems
- store throttle value between restarts of the emulator
- updated FAQ and URL links to the new site

Version 1.7:
Core changes:
- added fixes to video filters done by Flea for Mac OS X
- added/fixed ArcTan/ArcTan2 emulation
- added sound volume .25 and.50
- added hq2x/lq2x filters
- aded global cheat disable
- some code clean up
- fixed some CBA cheat support
- fixed ARM/Thumb instruction timing, including memory access
- fixed minor bugs in STMDx ARM instructions
- fixed ARM LDRx instructions when base equals dest

Gameboy:
- added support for 8M roms
- (re)added support for 2-4 playes in SGB mode
- added sprite limit emulation (thanks Ricky of KiGB)
- cancel pending EI when imediately followed by DI
- implemented DI/HALT bug
- implemented STAT write bug during VBLANK or HBLANK when in GB mode
- implemented GDMA delay in GBC mode (thanks TM of GEST)
- fixed priority between OBJ and Window
- fixed some SGB border problems
- fixed window rendering problems in some cases
- fixed CGB initial background palette to white
- fixed initial save memory value to 0xFF instead of 0x00 (thanks TM of GEST)
- fixed LCD interrupts to only occur once per line
- fixed incorrect display when BG is off
- modified interrut delay to 6 clock ticks instead of 2
- moved scanline update to beginning of HBLANK


Windows:
- added predefined Gameboy palettes (thanks Kojote)
- added GBA IO Viewer to view/modify GBA hardware registers
- added menu entry to load most recent save state
- added menu entry to save state into oldest slot
- added option to auto load the most recent save state upon loading
- added fullscreen max scale option
- chnaged the bug report option to be a little more friendly
- enhanced save state submenus to show date/time of when save was made
- enhanced logging window to capture data even if not being displayed
- fixed Direct3D/OpenGL "green" bug with Motion Blur Interframe Blending
- fixed Direct3D full screen with Gameboy roms
- fixed minor bugs when saving images in the different viewers
- fixed power management disabling: should avoid monitor turning off now
- improved cheat input to be more flexible and easy to enter
- migrated whole GUI code to MFC
2006-04-17 14:50:47 +00:00

271 lines
7 KiB
Text

$NetBSD: patch-ac,v 1.1 2006/04/17 14:50:47 wiz Exp $
--- src/sdl/SDL.cpp.orig 2004-05-21 22:16:58.000000000 +0200
+++ src/sdl/SDL.cpp
@@ -98,6 +98,7 @@ extern void MotionBlurIB32(u8*,u32,int,i
void Init_Overlay(SDL_Surface *surface, int overlaytype);
void Quit_Overlay(void);
void Draw_Overlay(SDL_Surface *surface, int size);
+SDL_Surface *Set_Video(bool first);
extern void remoteInit();
extern void remoteCleanUp();
@@ -248,8 +249,12 @@ bool screenMessage = false;
char screenMessageBuffer[21];
u32 screenMessageTime = 0;
+#if 0
SDL_cond *cond = NULL;
SDL_mutex *mutex = NULL;
+#else
+SDL_sem *rsem, *wsem;
+#endif
u8 sdlBuffer[4096];
int sdlSoundLen = 0;
@@ -886,8 +891,8 @@ FILE *sdlFindFile(const char *name)
char *home = getenv("HOME");
if(home != NULL) {
- fprintf(stderr, "Searching home directory: %s\n", home);
- sprintf(path, "%s%c%s", home, FILE_SEP, name);
+ fprintf(stderr, "Searching home directory: %s%c.vba\n", home, FILE_SEP);
+ sprintf(path, "%s%c.vba%c%s", home, FILE_SEP, FILE_SEP, name);
f = fopen(path, "r");
if(f != NULL)
return f;
@@ -1744,11 +1749,8 @@ void sdlPollEvents()
case SDLK_f:
if(!(event.key.keysym.mod & MOD_NOCTRL) &&
(event.key.keysym.mod & KMOD_CTRL)) {
- int flags = 0;
fullscreen = !fullscreen;
- if(fullscreen)
- flags |= SDL_FULLSCREEN;
- SDL_SetVideoMode(destWidth, destHeight, systemColorDepth, flags);
+ Set_Video(false);
// if(SDL_WM_ToggleFullScreen(surface))
// fullscreen = !fullscreen;
}
@@ -2320,9 +2322,7 @@ int main(int argc, char **argv)
destWidth = (sizeOption+1)*srcWidth;
destHeight = (sizeOption+1)*srcHeight;
- surface = SDL_SetVideoMode(destWidth, destHeight, 16,
- SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF|
- (fullscreen ? SDL_FULLSCREEN : 0));
+ surface = Set_Video(true);
if(surface == NULL) {
systemMessage(0, "Failed to set video mode");
@@ -2916,6 +2916,7 @@ void soundCallback(void *,u8 *stream,int
{
if(!emulating)
return;
+#if 0
SDL_mutexP(mutex);
// printf("Locked mutex\n");
if(!speedup && !throttle) {
@@ -2926,19 +2927,27 @@ void soundCallback(void *,u8 *stream,int
break;
}
}
+#else
+ SDL_SemWait(rsem);
+#endif
if(emulating) {
// printf("Copying data\n");
memcpy(stream, sdlBuffer, len);
}
sdlSoundLen = 0;
+#if 0
if(mutex)
SDL_mutexV(mutex);
+#else
+ SDL_SemPost(wsem);
+#endif
}
void systemWriteDataToSoundBuffer()
{
if(SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)
SDL_PauseAudio(0);
+#if 0
bool cont = true;
while(cont && !speedup && !throttle) {
SDL_mutexP(mutex);
@@ -2976,6 +2985,11 @@ soundBufferLen);
memcpy(&sdlBuffer[sdlSoundLen], soundFinalWave, soundBufferLen);
sdlSoundLen += soundBufferLen;
}
+#else
+ memcpy(sdlBuffer, soundFinalWave, soundBufferLen);
+ SDL_SemPost(rsem);
+ SDL_SemWait(wsem);
+#endif
}
bool systemSoundInit()
@@ -2998,7 +3012,7 @@ bool systemSoundInit()
}
audio.format=AUDIO_S16SYS;
audio.channels = 2;
- audio.samples = 1024;
+ audio.samples = soundBufferLen/4;
audio.callback = soundCallback;
audio.userdata = NULL;
if(SDL_OpenAudio(&audio, NULL)) {
@@ -3006,8 +3020,13 @@ bool systemSoundInit()
return false;
}
soundBufferTotalLen = soundBufferLen*10;
+#if 0
cond = SDL_CreateCond();
mutex = SDL_CreateMutex();
+#else
+ rsem = SDL_CreateSemaphore(0);
+ wsem = SDL_CreateSemaphore(0);
+#endif
sdlSoundLen = 0;
systemSoundOn = true;
return true;
@@ -3015,6 +3034,7 @@ bool systemSoundInit()
void systemSoundShutdown()
{
+#if 0
SDL_mutexP(mutex);
SDL_CondSignal(cond);
SDL_mutexV(mutex);
@@ -3022,7 +3042,15 @@ void systemSoundShutdown()
cond = NULL;
SDL_DestroyMutex(mutex);
mutex = NULL;
+#else
+ SDL_SemPost(rsem);
+#endif
SDL_CloseAudio();
+#if 0
+#else
+ SDL_DestroySemaphore(rsem);
+ SDL_DestroySemaphore(wsem);
+#endif
}
void systemSoundPause()
@@ -3139,9 +3167,15 @@ bool systemPauseOnFrame()
void Init_Overlay(SDL_Surface *gbascreen, int overlaytype)
{
-
- overlay = SDL_CreateYUVOverlay( GBA_WIDTH,
- GBA_HEIGHT,
+ int width;
+
+ if (overlaytype == SDL_YUY2_OVERLAY)
+ width = srcWidth *2;
+ else
+ width = srcWidth;
+
+ overlay = SDL_CreateYUVOverlay( width,
+ srcHeight,
overlaytype, gbascreen);
fprintf(stderr, "Created %dx%dx%d %s %s overlay\n",
overlay->w,overlay->h,overlay->planes,
@@ -3304,19 +3338,15 @@ inline void ConvertRGBtoYUY2(SDL_Overlay
SDL_LockYUVOverlay(o);
- for(y=0; y<160 && y<o->h; y++) {
+ for(y=0; y<srcHeight && y<o->h; y++) {
p=(Uint8 *)pix+srcPitch*y;
op=o->pixels[0]+o->pitches[0]*y;
- for(x=0; x<240 && x<o->w; x++) {
+ for(x=0; x<srcWidth && x<o->w; x++) {
RGBtoYUV(p,yuv);
- if(x%2==0) {
- *(op++)=yuv[0];
- *(op++)=yuv[1];
- op[1]=yuv[2];
- } else {
- *op=yuv[0];
- op+=2;
- }
+ *(op++)=yuv[0];
+ *(op++)=yuv[1];
+ *(op++)=yuv[0];
+ *(op++)=yuv[2];
p+=4; //s->format->BytesPerPixel;
}
@@ -3358,11 +3388,6 @@ inline void Draw_Overlay(SDL_Surface *di
Convert32bit(display);
- overlay_rect.x = 0;
- overlay_rect.y = 0;
- overlay_rect.w = GBA_WIDTH * size;
- overlay_rect.h = GBA_HEIGHT * size;
-
SDL_DisplayYUVOverlay(overlay, &overlay_rect);
SDL_UnlockYUVOverlay(overlay);
}
@@ -3378,9 +3403,8 @@ void systemGbBorderOn()
destWidth = (sizeOption+1)*srcWidth;
destHeight = (sizeOption+1)*srcHeight;
- surface = SDL_SetVideoMode(destWidth, destHeight, 16,
- SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF|
- (fullscreen ? SDL_FULLSCREEN : 0));
+ surface = Set_Video(true);
+
#ifndef C_CORE
sdlMakeStretcher(srcWidth);
#else
@@ -3440,3 +3464,46 @@ void systemGbBorderOn()
srcPitch = srcWidth*3;
}
}
+
+SDL_Surface *
+Set_Video(bool first)
+{
+ int flags;
+
+ flags = SDL_HWSURFACE|SDL_DOUBLEBUF;
+ if (first) {
+ flags |= SDL_ANYFORMAT;
+ systemColorDepth = 16;
+ }
+
+ if(fullscreen)
+ flags |= SDL_FULLSCREEN;
+
+ destWidth = srcWidth*(sizeOption+1);
+ destHeight = srcHeight*(sizeOption+1);
+
+ if (yuv) {
+ double mul, mul2;
+
+ if (fullscreen) {
+ SDL_Rect **mode;
+ if ((mode=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE))
+ != NULL) {
+ destWidth = mode[0]->w;
+ destHeight = mode[0]->h;
+ }
+ }
+
+ mul = (double)destWidth/srcWidth;
+ mul2 = (double)destHeight/srcHeight;
+ if (mul2 < mul)
+ mul = mul2;
+
+ overlay_rect.w = (Uint16)(srcWidth*mul);
+ overlay_rect.h = (Uint16)(srcHeight*mul);
+ overlay_rect.x = (destWidth-overlay_rect.w)/2;
+ overlay_rect.y = (destHeight-overlay_rect.h)/2;
+ }
+
+ return SDL_SetVideoMode(destWidth, destHeight, systemColorDepth, flags);
+}