--- BasiliskII/src/SDL/video_sdl.cpp 2007/01/22 00:32:25 1.31 +++ BasiliskII/src/SDL/video_sdl.cpp 2007/06/14 14:45:54 1.33 @@ -197,7 +197,19 @@ extern void SysMountFirstFloppy(void); static void *vm_acquire_framebuffer(uint32 size) { - return vm_acquire(size); + // always try to reallocate framebuffer at the same address + static void *fb = VM_MAP_FAILED; + if (fb != VM_MAP_FAILED) { + if (vm_acquire_fixed(fb, size) < 0) { +#ifndef SHEEPSHAVER + printf("FATAL: Could not reallocate framebuffer at previous address\n"); +#endif + fb = VM_MAP_FAILED; + } + } + if (fb == VM_MAP_FAILED) + fb = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT); + return fb; } static inline void vm_release_framebuffer(void *fb, uint32 size) @@ -719,7 +731,7 @@ void driver_base::restore_mouse_accel(vo * Windowed display driver */ -static int SDL_display_opened = FALSE; +static bool SDL_display_opened = false; // Open display driver_window::driver_window(SDL_monitor_desc &m) @@ -735,20 +747,19 @@ driver_window::driver_window(SDL_monitor // This is ugly: // If we're switching resolutions (ie, not setting it for the first time), // there's a bug in SDL where the SDL_Surface created will not be properly - // setup. The solution is to SDL_Quit() before calling SDL_SetVideoMode for - // the second time (SDL_SetVideoMode will call SDL_Init() and all will be - // well). Without this, the video becomes corrupted (at least on Mac OS X), - // after the resolution switch (for the second and subsequent times). -// EDIT: Ack, this breaks audio! -// if (SDL_display_opened) -// SDL_Quit(); + // setup. The solution is to SDL_QuitSubSystem(SDL_INIT_VIDEO) before calling + // SDL_SetVideoMode for the second time (SDL_SetVideoMode will call SDL_Init() + // and all will be well). Without this, the video becomes corrupted (at least + // on Mac OS X), after the resolution switch. + if (SDL_display_opened) + SDL_QuitSubSystem(SDL_INIT_VIDEO); // Create surface int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH); if ((s = SDL_SetVideoMode(width, height, depth, SDL_HWSURFACE)) == NULL) return; - SDL_display_opened = TRUE; + SDL_display_opened = true; #ifdef ENABLE_VOSF use_vosf = true;