int FULLSCREEN_ToggleFromWimp(_THIS) { int width = this->screen->w; int height = this->screen->h; int bpp = this->screen->format->BitsPerPixel; RISCOS_StoreWimpMode(); if (FULLSCREEN_SetMode(width, height, bpp)) { char *buffer = this->hidden->alloc_bank; if (riscos_backbuffer == 0) riscos_backbuffer = 1; FULLSCREEN_SetupBanks(this); this->hidden->bank[0] = buffer + 60; if (bpp == 8) this->hidden->bank[0] += 2048; this->hidden->current_bank = 0; this->screen->pixels = this->hidden->bank[0]; SDL_memcpy(this->hidden->bank[1], this->hidden->bank[0], width * height * this->screen->format->BytesPerPixel); FULLSCREEN_SetDeviceMode(this); return 1; } else RISCOS_RestoreWimpMode(); return 0; }
int FULLSCREEN_ToggleFromWimp(_THIS) { int width = this->screen->w; int height = this->screen->h; int bpp = this->screen->format->BitsPerPixel; RISCOS_StoreWimpMode(); if (FULLSCREEN_SetMode(width, height, bpp)) { char *buffer = this->hidden->alloc_bank; /* This is start of sprite data */ /* Support back buffer mode only */ riscos_backbuffer = 1; FULLSCREEN_SetupBanks(this); this->hidden->bank[0] = buffer + 60; /* Start of sprite data */ if (bpp == 8) this->hidden->bank[0] += 2048; /* 8bpp sprite have palette first */ this->hidden->current_bank = 0; this->screen->pixels = this->hidden->bank[0]; /* Copy back buffer to screen memory */ memcpy(this->hidden->bank[1], this->hidden->bank[0], width * height * this->screen->format->BytesPerPixel); FULLSCREEN_SetDeviceMode(this); return 1; } else RISCOS_RestoreWimpMode(); return 0; }
/* Set up video mode */ SDL_Surface *RISCOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) { if (flags & SDL_FULLSCREEN) { RISCOS_StoreWimpMode(); /* Dump wimp window on switch to full screen */ if (this->hidden->window_handle) WIMP_DeleteWindow(this); return FULLSCREEN_SetVideoMode(this, current, width, height, bpp, flags); } else { RISCOS_RestoreWimpMode(); return WIMP_SetVideoMode(this, current, width, height, bpp, flags); } }
/* Toggle to window from full screen */ int WIMP_ToggleFromFullScreen(_THIS) { int width = this->screen->w; int height = this->screen->h; int bpp = this->screen->format->BitsPerPixel; char *buffer = NULL; char *old_bank[2]; char *old_alloc_bank; /* Ensure flags are OK */ this->screen->flags &= ~(SDL_DOUBLEBUF|SDL_HWSURFACE); if (this->hidden->bank[0] == this->hidden->alloc_bank || riscos_backbuffer == 0) { /* Need to create a sprite for the screen and copy the data to it */ char *data; buffer = WIMP_CreateBuffer(width, height, bpp); data = buffer + 60; /* Start of sprite data */ if (bpp == 8) data += 2048; /* 8bpp sprite have palette first */ if (buffer == NULL) return 0; SDL_memcpy(data, this->hidden->bank[0], width * height * this->screen->format->BytesPerPixel); } /* else We've switch to full screen before so we already have a sprite */ old_bank[0] = this->hidden->bank[0]; old_bank[1] = this->hidden->bank[1]; old_alloc_bank = this->hidden->alloc_bank; if (buffer != NULL) this->hidden->alloc_bank = buffer; this->hidden->bank[1] = this->hidden->alloc_bank; this->hidden->bank[0] = this->hidden->bank[1] + 60; /* Start of sprite data */ if (bpp == 8) this->hidden->bank[0] += 2048; /* 8bpp sprite have palette first */ this->hidden->current_bank = 0; this->screen->pixels = this->hidden->bank[0]; RISCOS_RestoreWimpMode(); WIMP_ReadModeInfo(this); if (WIMP_SetupWindow(this, this->screen)) { WIMP_SetDeviceMode(this); WIMP_SetupPlotInfo(this); if (riscos_backbuffer == 0) riscos_backbuffer = 1; if (buffer && old_alloc_bank) SDL_free(old_alloc_bank); return 1; } else { /* Drop back to full screen mode on failure */ this->hidden->bank[0] = old_bank[0]; this->hidden->bank[1] = old_bank[1]; this->hidden->alloc_bank = old_alloc_bank; if (buffer) SDL_free(buffer); RISCOS_StoreWimpMode(); FULLSCREEN_SetMode(width, height, bpp); } return 0; }