int RISCOS_VideoInit(_THIS, SDL_PixelFormat *vformat) { _kernel_swi_regs regs; if (RISCOS_InitTask() == 0) { SDL_SetError("Unable to start task"); return 0; } regs.r[0] = -1; /* Current mode */ regs.r[1] = 9; /* Log base 2 bpp */ _kernel_swi(OS_ReadModeVariable, ®s, ®s); vformat->BitsPerPixel = (1 << regs.r[2]); /* Minimum bpp for SDL is 8 */ if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8; switch (vformat->BitsPerPixel) { case 15: case 16: vformat->Bmask = 0x00007c00; vformat->Gmask = 0x000003e0; vformat->Rmask = 0x0000001f; vformat->BitsPerPixel = 16; /* SDL wants actual number of bits used */ vformat->BytesPerPixel = 2; break; case 24: case 32: vformat->Bmask = 0x00ff0000; vformat->Gmask = 0x0000ff00; vformat->Rmask = 0x000000ff; vformat->BytesPerPixel = 4; break; default: vformat->Bmask = 0; vformat->Gmask = 0; vformat->Rmask = 0; vformat->BytesPerPixel = 1; break; } /* Fill in some window manager capabilities */ this->info.wm_available = 1; /* We're done! */ return(0); }
int RISCOS_VideoInit(_THIS, SDL_PixelFormat *vformat) { _kernel_swi_regs regs; int vars[4], vals[3]; if (RISCOS_InitTask() == 0) { SDL_SetError("Unable to start task"); return 0; } vars[0] = 9; /* Log base 2 bpp */ vars[1] = 11; /* XWndLimit - num x pixels -1 */ vars[2] = 12; /* YWndLimit - num y pixels -1 */ vars[3] = -1; /* Terminate list */ regs.r[0] = (int)vars; regs.r[1] = (int)vals; _kernel_swi(OS_ReadVduVariables, ®s, ®s); vformat->BitsPerPixel = (1 << vals[0]); /* Determine the current screen size */ this->info.current_w = vals[1] + 1; this->info.current_h = vals[2] + 1; /* Minimum bpp for SDL is 8 */ if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8; switch (vformat->BitsPerPixel) { case 15: case 16: vformat->Bmask = 0x00007c00; vformat->Gmask = 0x000003e0; vformat->Rmask = 0x0000001f; vformat->BitsPerPixel = 16; /* SDL wants actual number of bits used */ vformat->BytesPerPixel = 2; break; case 24: case 32: vformat->Bmask = 0x00ff0000; vformat->Gmask = 0x0000ff00; vformat->Rmask = 0x000000ff; vformat->BytesPerPixel = 4; break; default: vformat->Bmask = 0; vformat->Gmask = 0; vformat->Rmask = 0; vformat->BytesPerPixel = 1; break; } /* Fill in some window manager capabilities */ this->info.wm_available = 1; /* We're done! */ return(0); }