diff --git a/src/gui/render_scalers.cpp b/src/gui/render_scalers.cpp index 4bd312f..c083575 100644 --- a/src/gui/render_scalers.cpp +++ b/src/gui/render_scalers.cpp @@ -173,7 +173,11 @@ ScalerLineBlock_t ScalerCache = { ScalerSimpleBlock_t ScaleNormal1x = { "Normal", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 1,1,{ { Normal1x_8_8_L, Normal1x_8_15_L , Normal1x_8_16_L , Normal1x_8_32_L }, { 0, Normal1x_15_15_L, Normal1x_15_16_L, Normal1x_15_32_L}, @@ -190,7 +194,11 @@ ScalerSimpleBlock_t ScaleNormal1x = { ScalerSimpleBlock_t ScaleNormalDw = { "Normal", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 2,1,{ { NormalDw_8_8_L, NormalDw_8_15_L , NormalDw_8_16_L , NormalDw_8_32_L }, { 0, NormalDw_15_15_L, NormalDw_15_16_L, NormalDw_15_32_L}, @@ -207,7 +215,11 @@ ScalerSimpleBlock_t ScaleNormalDw = { ScalerSimpleBlock_t ScaleNormalDh = { "Normal", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 1,2,{ { NormalDh_8_8_L, NormalDh_8_15_L , NormalDh_8_16_L , NormalDh_8_32_L }, { 0, NormalDh_15_15_L, NormalDh_15_16_L, NormalDh_15_32_L}, @@ -224,7 +236,11 @@ ScalerSimpleBlock_t ScaleNormalDh = { ScalerSimpleBlock_t ScaleNormal2x = { "Normal2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 2,2,{ { Normal2x_8_8_L, Normal2x_8_15_L, Normal2x_8_16_L, Normal2x_8_32_L }, { 0, Normal2x_15_15_L, Normal2x_15_16_L, Normal2x_15_32_L}, @@ -241,7 +257,11 @@ ScalerSimpleBlock_t ScaleNormal2x = { ScalerSimpleBlock_t ScaleNormal3x = { "Normal3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 3,3,{ { Normal3x_8_8_L, Normal3x_8_15_L , Normal3x_8_16_L , Normal3x_8_32_L }, { 0, Normal3x_15_15_L, Normal3x_15_16_L, Normal3x_15_32_L}, @@ -259,7 +279,11 @@ ScalerSimpleBlock_t ScaleNormal3x = { #if RENDER_USE_ADVANCED_SCALERS>0 ScalerSimpleBlock_t ScaleTV2x = { "TV2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2,{ { 0, TV2x_8_15_L , TV2x_8_16_L , TV2x_8_32_L }, { 0, TV2x_15_15_L, TV2x_15_16_L, TV2x_15_32_L}, @@ -276,7 +300,11 @@ ScalerSimpleBlock_t ScaleTV2x = { ScalerSimpleBlock_t ScaleTV3x = { "TV3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 3,3,{ { 0, TV3x_8_15_L , TV3x_8_16_L , TV3x_8_32_L }, { 0, TV3x_15_15_L, TV3x_15_16_L, TV3x_15_32_L}, @@ -293,7 +321,11 @@ ScalerSimpleBlock_t ScaleTV3x = { ScalerSimpleBlock_t ScaleScan2x = { "Scan2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2,{ { 0, Scan2x_8_15_L , Scan2x_8_16_L , Scan2x_8_32_L }, { 0, Scan2x_15_15_L, Scan2x_15_16_L, Scan2x_15_32_L}, @@ -310,7 +342,11 @@ ScalerSimpleBlock_t ScaleScan2x = { ScalerSimpleBlock_t ScaleScan3x = { "Scan3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 3,3,{ { 0, Scan3x_8_15_L , Scan3x_8_16_L , Scan3x_8_32_L }, { 0, Scan3x_15_15_L, Scan3x_15_16_L, Scan3x_15_32_L}, @@ -327,7 +363,11 @@ ScalerSimpleBlock_t ScaleScan3x = { ScalerSimpleBlock_t ScaleRGB2x = { "RGB2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2,{ { 0, RGB2x_8_15_L , RGB2x_8_16_L , RGB2x_8_32_L }, { 0, RGB2x_15_15_L, RGB2x_15_16_L, RGB2x_15_32_L}, @@ -344,7 +384,11 @@ ScalerSimpleBlock_t ScaleRGB2x = { ScalerSimpleBlock_t ScaleRGB3x = { "RGB3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 3,3,{ { 0, RGB3x_8_15_L , RGB3x_8_16_L , RGB3x_8_32_L }, { 0, RGB3x_15_15_L, RGB3x_15_16_L, RGB3x_15_32_L}, @@ -366,7 +410,11 @@ ScalerSimpleBlock_t ScaleRGB3x = { #if RENDER_USE_ADVANCED_SCALERS>2 ScalerComplexBlock_t ScaleAdvMame2x ={ "AdvMame2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 2,2, { AdvMame2x_8_L,AdvMame2x_16_L,AdvMame2x_16_L,AdvMame2x_32_L}, { AdvMame2x_8_R,AdvMame2x_16_R,AdvMame2x_16_R,AdvMame2x_32_R} @@ -374,7 +422,11 @@ ScalerComplexBlock_t ScaleAdvMame2x ={ ScalerComplexBlock_t ScaleAdvMame3x = { "AdvMame3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32, +#endif 3,3, { AdvMame3x_8_L,AdvMame3x_16_L,AdvMame3x_16_L,AdvMame3x_32_L}, { AdvMame3x_8_R,AdvMame3x_16_R,AdvMame3x_16_R,AdvMame3x_32_R} @@ -383,7 +435,11 @@ ScalerComplexBlock_t ScaleAdvMame3x = { /* These need specific 15bpp versions */ ScalerComplexBlock_t ScaleHQ2x ={ "HQ2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2, { 0,HQ2x_16_L,HQ2x_16_L,HQ2x_32_L}, { 0,HQ2x_16_R,HQ2x_16_R,HQ2x_32_R} @@ -391,7 +447,11 @@ ScalerComplexBlock_t ScaleHQ2x ={ ScalerComplexBlock_t ScaleHQ3x ={ "HQ3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 3,3, { 0,HQ3x_16_L,HQ3x_16_L,HQ3x_32_L}, { 0,HQ3x_16_R,HQ3x_16_R,HQ3x_32_R} @@ -399,7 +459,11 @@ ScalerComplexBlock_t ScaleHQ3x ={ ScalerComplexBlock_t ScaleSuper2xSaI ={ "Super2xSaI", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2, { 0,Super2xSaI_16_L,Super2xSaI_16_L,Super2xSaI_32_L}, { 0,Super2xSaI_16_R,Super2xSaI_16_R,Super2xSaI_32_R} @@ -407,7 +471,11 @@ ScalerComplexBlock_t ScaleSuper2xSaI ={ ScalerComplexBlock_t Scale2xSaI ={ "2xSaI", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2, { 0,_2xSaI_16_L,_2xSaI_16_L,_2xSaI_32_L}, { 0,_2xSaI_16_R,_2xSaI_16_R,_2xSaI_32_R} @@ -415,7 +483,11 @@ ScalerComplexBlock_t Scale2xSaI ={ ScalerComplexBlock_t ScaleSuperEagle ={ "SuperEagle", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2, { 0,SuperEagle_16_L,SuperEagle_16_L,SuperEagle_32_L}, { 0,SuperEagle_16_R,SuperEagle_16_R,SuperEagle_32_R} @@ -423,7 +495,11 @@ ScalerComplexBlock_t ScaleSuperEagle ={ ScalerComplexBlock_t ScaleAdvInterp2x = { "AdvInterp2x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 2,2, { 0,AdvInterp2x_15_L,AdvInterp2x_16_L,AdvInterp2x_32_L}, { 0,AdvInterp2x_15_R,AdvInterp2x_16_R,AdvInterp2x_32_R} @@ -431,7 +507,11 @@ ScalerComplexBlock_t ScaleAdvInterp2x = { ScalerComplexBlock_t ScaleAdvInterp3x = { "AdvInterp3x", +#ifdef HW_RVL GFX_CAN_16, +#else + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY, +#endif 3,3, { 0,AdvInterp3x_15_L,AdvInterp3x_16_L,AdvInterp3x_32_L}, { 0,AdvInterp3x_15_R,AdvInterp3x_16_R,AdvInterp3x_32_R} diff --git a/src/gui/sdl_gui.cpp b/src/gui/sdl_gui.cpp index 46cd7c3..af616ef 100644 --- a/src/gui/sdl_gui.cpp +++ b/src/gui/sdl_gui.cpp @@ -111,7 +111,12 @@ static GUI::ScreenSDL *UI_Startup(GUI::ScreenSDL *screen) { old_unicode = SDL_EnableUNICODE(1); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL); +#ifdef HW_RVL + // This won't work because the Masks are wrong for 16-bit. screenshot = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 16, GUI::Color::RedMask, GUI::Color::GreenMask, GUI::Color::BlueMask, 0); +#else + screenshot = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, GUI::Color::RedMask, GUI::Color::GreenMask, GUI::Color::BlueMask, 0); +#endif // create screenshot for fade effect int rs = screenshot->format->Rshift, gs = screenshot->format->Gshift, bs = screenshot->format->Bshift, am = GUI::Color::AlphaMask; @@ -124,7 +129,12 @@ static GUI::ScreenSDL *UI_Startup(GUI::ScreenSDL *screen) { } } +#ifdef HW_RVL + // This won't work because the Masks are wrong for 16-bit. background = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 16, GUI::Color::RedMask, GUI::Color::GreenMask, GUI::Color::BlueMask, GUI::Color::AlphaMask); +#else + background = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, GUI::Color::RedMask, GUI::Color::GreenMask, GUI::Color::BlueMask, GUI::Color::AlphaMask); +#endif // use a blurred and sepia-toned screenshot as menu background for (int y = 0; y < h; y++) { Bit32u *bg = (Bit32u*)(y*background->pitch + (char*)background->pixels); @@ -151,7 +161,11 @@ static GUI::ScreenSDL *UI_Startup(GUI::ScreenSDL *screen) { mousetoggle = mouselocked; if (mouselocked) GFX_CaptureMouse(); +#ifdef HW_RVL SDL_Surface* sdlscreen = SDL_SetVideoMode(w, h, 16, SDL_SWSURFACE|(fs?SDL_FULLSCREEN:0)); +#else + SDL_Surface* sdlscreen = SDL_SetVideoMode(w, h, 32, SDL_SWSURFACE|(fs?SDL_FULLSCREEN:0)); +#endif if (sdlscreen == NULL) E_Exit("Could not initialize video mode %ix%ix32 for UI: %s", w, h, SDL_GetError()); // fade out diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index 3e223c9..1b9e842 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -2283,7 +2283,11 @@ void MAPPER_Run(bool pressed) { /* Be sure that there is no update in progress */ GFX_EndUpdate( 0 ); +#ifdef HW_RVL mapper.surface=SDL_SetVideoMode(640,480,16,0); +#else + mapper.surface=SDL_SetVideoMode(640,480,8,0); +#endif if (mapper.surface == NULL) E_Exit("Could not initialize video mode for mapper: %s",SDL_GetError()); /* Set some palette entries */ diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 25cc29f..4ce79da 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -980,9 +980,9 @@ static void GUI_StartUp(Section * sec) { /* Set Icon (must be done before any sdl_setvideomode call) */ /* But don't set it on OS X, as we use a nicer external icon there. */ #if WORDS_BIGENDIAN - SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,16,128,0xff000000,0x00ff0000,0x0000ff00,0); + SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0xff000000,0x00ff0000,0x0000ff00,0); #else - SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,16,128,0x000000ff,0x0000ff00,0x00ff0000,0); + SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0x000000ff,0x0000ff00,0x00ff0000,0); #endif SDL_WM_SetIcon(logos,NULL); #endif @@ -1666,6 +1666,15 @@ int main(int argc, char* argv[]) { SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_ShowCursor(SDL_ENABLE); +#ifdef HW_RVL + printf("Press A to return to homebrew channel.\n"); + while (1) { + WPAD_ScanPads(); + u16 buttonsDown = WPAD_ButtonsDown(0); + if( buttonsDown & WPAD_BUTTON_A ) break; + if( buttonsDown & WPAD_BUTTON_HOME ) exit(0); + } +#endif SDL_Quit();//Let's hope sdl will quit as well when it catches an exception return 0; }; diff --git a/src/libs/gui_tk/gui_tk.cpp b/src/libs/gui_tk/gui_tk.cpp index 565a041..4399fe9 100644 --- a/src/libs/gui_tk/gui_tk.cpp +++ b/src/libs/gui_tk/gui_tk.cpp @@ -1566,12 +1566,21 @@ int main(int argc, char *argv[]) atexit(SDL_Quit); +#ifdef HW_RVL screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE); + if (screen == NULL) { + fprintf(stderr, "Couldn't set 640x480x16 video mode: %s\n", SDL_GetError()); + exit(1); + } + printf("GUI:: color depth %i\n",screen->format->BitsPerPixel); +#else + screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); if (screen == NULL) { fprintf(stderr, "Couldn't set 640x480x32 video mode: %s\n", SDL_GetError()); exit(1); } printf("GUI:: color depth %i\n",screen->format->BitsPerPixel); +#endif SDL_EnableUNICODE(true); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL); diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index ba2ff7a..0e34da2 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -635,7 +635,7 @@ void SHELL_Init() { SHELL_ProgramStart(&first_shell); #ifdef HW_RVL - printf("Press A to continue to a crash, or Home to exit.\n"); + printf("Press A to continue (or Home to exit).\n"); while (1) { WPAD_ScanPads(); u16 buttonsDown = WPAD_ButtonsDown(0);