diff options
-rw-r--r-- | CATSFC/system/language.msg | 48 | ||||
-rw-r--r-- | source/nds/displaymodes.cpp | 4 | ||||
-rw-r--r-- | source/nds/entry.cpp | 50 | ||||
-rw-r--r-- | source/nds/gui.c | 57 | ||||
-rw-r--r-- | source/nds/gui.h | 3 | ||||
-rw-r--r-- | source/nds/message.h | 4 |
6 files changed, 134 insertions, 32 deletions
diff --git a/CATSFC/system/language.msg b/CATSFC/system/language.msg index 8a2f7da..6e207fc 100644 --- a/CATSFC/system/language.msg +++ b/CATSFC/system/language.msg @@ -60,6 +60,8 @@ Aspect ratio %s Fast-forward %s #FMT_VIDEO_FRAME_SKIPPING Frame skipping %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND Sound %s #FMT_AUDIO_RETRO_SOUND @@ -164,6 +166,10 @@ New game [9] Show 1 in 10 frames #MSG_VIDEO_FRAME_SKIPPING_10 [10] Show 1 in 11 frames +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF Off #MSG_GENERAL_ON @@ -271,6 +277,8 @@ STARTCHINESESIM 游戏快进 %s #FMT_VIDEO_FRAME_SKIPPING 跳帧方式 %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND 声音开关 %s #FMT_AUDIO_RETRO_SOUND @@ -375,6 +383,10 @@ CPU主频 %s [9] 显示 1/10 #MSG_VIDEO_FRAME_SKIPPING_10 [10] 显示 1/11 +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF 关 #MSG_GENERAL_ON @@ -482,6 +494,8 @@ Format d'image %s Avance rapide %s #FMT_VIDEO_FRAME_SKIPPING Omission d'images %s +#FMT_VIDEO_GAME_SCREEN +Écran de jeu %s #FMT_AUDIO_SOUND Son %s #FMT_AUDIO_RETRO_SOUND @@ -586,6 +600,10 @@ Nouveau jeu [9] Montrer 1 image sur 10 #MSG_VIDEO_FRAME_SKIPPING_10 [10] Montrer 1 image sur 11 +#MSG_VIDEO_GAME_SCREEN_TOP +Écran supérieur +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Écran inférieur #MSG_GENERAL_OFF Hors fonction #MSG_GENERAL_ON @@ -694,6 +712,8 @@ Bildformat %s Schnellvorlauf %s #FMT_VIDEO_FRAME_SKIPPING Frames übersp. %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND Ton %s #FMT_AUDIO_RETRO_SOUND @@ -798,6 +818,10 @@ Neues Spiel [9] Zeige 1 von 10 Frames #MSG_VIDEO_FRAME_SKIPPING_10 [10] Zeige 1 von 11 Frames +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF Aus #MSG_GENERAL_ON @@ -906,6 +930,8 @@ Beeldverhouding %s Vooruitspoelen %s #FMT_VIDEO_FRAME_SKIPPING Beeld overslaan %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND Geluid %s #FMT_AUDIO_RETRO_SOUND @@ -1010,6 +1036,10 @@ Nieuw spel [9] 1 uit 10 beelden tonen #MSG_VIDEO_FRAME_SKIPPING_10 [10] 1 uit 11 beelden tonen +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF Uit #MSG_GENERAL_ON @@ -1118,6 +1148,8 @@ Modo de pantalla %s Modo avance rápido %s #FMT_VIDEO_FRAME_SKIPPING Salto de fotogramas %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND Sonido %s #FMT_AUDIO_RETRO_SOUND @@ -1222,6 +1254,10 @@ Nuevo juego [9] Mostrar 1/10 #MSG_VIDEO_FRAME_SKIPPING_10 [10] Mostrar 1/11 +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF Apagado #MSG_GENERAL_ON @@ -1329,6 +1365,8 @@ Modalità video %s Avanzamento rapido %s #FMT_VIDEO_FRAME_SKIPPING Salto fotogrammi %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND Audio %s #FMT_AUDIO_RETRO_SOUND @@ -1433,6 +1471,10 @@ Nuovo gioco [9] Mostra 1 su 10 fotogrammi #MSG_VIDEO_FRAME_SKIPPING_10 [10] Mostra 1 su 11 fotogrammi +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF Disabilita #MSG_GENERAL_ON @@ -1540,6 +1582,8 @@ Proporção %s Avanço de quadro %s #FMT_VIDEO_FRAME_SKIPPING Pulo de quadros %s +#FMT_VIDEO_GAME_SCREEN +Game screen %s #FMT_AUDIO_SOUND Som %s #FMT_AUDIO_RETRO_SOUND @@ -1644,6 +1688,10 @@ Novo jogo [9] Mostrar 1 em 10 frames #MSG_VIDEO_FRAME_SKIPPING_10 [10] Mostrar 1 em 11 frames +#MSG_VIDEO_GAME_SCREEN_TOP +Upper Screen +#MSG_VIDEO_GAME_SCREEN_BOTTOM +Lower Screen #MSG_GENERAL_OFF Desligado #MSG_GENERAL_ON diff --git a/source/nds/displaymodes.cpp b/source/nds/displaymodes.cpp index c45f7c1..ead3c93 100644 --- a/source/nds/displaymodes.cpp +++ b/source/nds/displaymodes.cpp @@ -56,10 +56,10 @@ static uint16 SevenToSixScanlineResize (uint16 TopColour, uint16 BottomColour, u ; } -void NDSSFCDrawFrameAntialiased () +void NDSSFCDrawFrameAntialiased (void* screen_addr) { uint16 X, Y; - uint16 *SrcTop = (uint16 *) GFX.Screen, *SrcBottom = SrcTop + 256, *Dest = (uint16 *) up_screen_addr; + uint16 *SrcTop = (uint16 *) GFX.Screen, *SrcBottom = SrcTop + 256, *Dest = (uint16 *) screen_addr; for (Y = 0; Y < 224; Y += 7) { diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp index 456f078..1270d01 100644 --- a/source/nds/entry.cpp +++ b/source/nds/entry.cpp @@ -140,22 +140,29 @@ bool8 S9xInitUpdate () } -extern void NDSSFCDrawFrameAntialiased(); +extern void NDSSFCDrawFrameAntialiased(void* screen_addr); bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) { + void* screen_addr = emu_config.BottomScreenGame + ? down_screen_addr + : up_screen_addr; + SCREEN_ID screen_num = emu_config.BottomScreenGame + ? DOWN_SCREEN + : UP_SCREEN; + switch(game_config.graphic) { //Up case 1: #ifdef DS2_DMA __dcache_writeback_all(); - ds2_DMAcopy_32Byte(1 /* channel: graphics */, up_screen_addr, GFX.Screen + 256 * 32 * 2, 256 * 192 * 2); + ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen + 256 * 32 * 2, 256 * 192 * 2); ds2_DMA_wait(1); ds2_DMA_stop(1); #else - memcpy(up_screen_addr, GFX.Screen+256*32*2, 256*192*2); + memcpy(screen_addr, GFX.Screen+256*32*2, 256*192*2); #endif break; @@ -163,11 +170,11 @@ bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) case 2: #ifdef DS2_DMA __dcache_writeback_all(); - ds2_DMAcopy_32Byte(1 /* channel: graphics */, up_screen_addr, GFX.Screen, 256 * 192 * 2); + ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen, 256 * 192 * 2); ds2_DMA_wait(1); ds2_DMA_stop(1); #else - memcpy(up_screen_addr, GFX.Screen, 256*192*2); + memcpy(screen_addr, GFX.Screen, 256*192*2); #endif break; @@ -175,16 +182,16 @@ bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) case 3: #ifdef DS2_DMA __dcache_writeback_all(); - ds2_DMAcopy_32Byte(1 /* channel: graphics */, up_screen_addr, GFX.Screen + 256 * 16 * 2, 256 * 192 * 2); + ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen + 256 * 16 * 2, 256 * 192 * 2); ds2_DMA_wait(1); ds2_DMA_stop(1); #else - memcpy(up_screen_addr, GFX.Screen+256*16*2, 256*192*2); + memcpy(screen_addr, GFX.Screen+256*16*2, 256*192*2); #endif break; case 4: - NDSSFCDrawFrameAntialiased (); + NDSSFCDrawFrameAntialiased (screen_addr); break; @@ -197,7 +204,7 @@ bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) register unsigned int m; src = GFX.Screen; - dst = (unsigned char*)up_screen_addr; + dst = (unsigned char*)screen_addr; for(m = 0; m < 32; m++) { #ifdef DS2_DMA @@ -214,7 +221,7 @@ bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/) break; } - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); + ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD); // A problem with update method 1 (wait, double buffer) means that, after // about 15 minutes of play time, the screen starts to half-redraw every // frame. With update method 0, this is mitigated. (Method 2 is too slow.) @@ -648,7 +655,19 @@ int sfc_main (int argc, char **argv) S9xSetSoundMute (TRUE); unsigned short screen[256*192]; - copy_screen((void*)screen, up_screen_addr, 0, 0, 256, 192); + if (FirstInvocation) { + memset(screen, 0, sizeof(screen)); + } + else { + S9xDeinitUpdate(256, 224, TRUE); + + void* screen_addr = emu_config.BottomScreenGame + ? down_screen_addr + : up_screen_addr; + + copy_screen((void*)screen, screen_addr, 0, 0, 256, 192); + } + menu(screen, FirstInvocation); FirstInvocation = FALSE; game_disableAudio(); @@ -1262,10 +1281,13 @@ uint32 S9xReadJoypad (int which1) mdelay(1); } while (inputdata.key & KEY_LID); ds2_wakeup(); - // Before starting to emulate again, turn off the lower - // screen's backlight. + // Before starting to emulate again, turn on only the + // game screen's backlight. + SCREEN_ID screen_num = emu_config.BottomScreenGame + ? DOWN_SCREEN + : UP_SCREEN; mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(2); + ds2_setBacklight(3 - screen_num); GameFrequencyCPU(); } diff --git a/source/nds/gui.c b/source/nds/gui.c index ca5a016..4b9c129 100644 --- a/source/nds/gui.c +++ b/source/nds/gui.c @@ -2728,6 +2728,9 @@ u32 menu(u16 *screen, bool8 FirstInvocation) char *sound_seletion[] = { (char*)&msg[MSG_AUDIO_MUTED], (char*)&msg[MSG_AUDIO_ENABLED] }; + char *game_screen_options[] = { (char*)&msg[MSG_VIDEO_GAME_SCREEN_TOP], (char*)&msg[MSG_VIDEO_GAME_SCREEN_BOTTOM] }; + + // char *snap_frame_options[] = { (char*)&msg[MSG_SNAP_FRAME_0], (char*)&msg[MSG_SNAP_FRAME_1] }; // char *enable_disable_options[] = { (char*)&msg[MSG_EN_DIS_ABLE_0], (char*)&msg[MSG_EN_DIS_ABLE_1] }; @@ -2755,7 +2758,11 @@ u32 menu(u16 *screen, bool8 FirstInvocation) &game_config.frameskip_value, 12 /* auto (0) and 0..10 (1..11) make 12 option values */, NULL, ACTION_TYPE, 5), /* 06 */ STRING_SELECTION_OPTION(game_set_retro, NULL, &msg[FMT_AUDIO_RETRO_SOUND], on_off_options, - &game_config.RetroSound, 2, NULL, ACTION_TYPE, 6) + &game_config.RetroSound, 2, NULL, ACTION_TYPE, 6), + + /* 07 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_VIDEO_GAME_SCREEN], game_screen_options, + &emu_config.BottomScreenGame, 2, NULL, PASSIVE_TYPE, 7) + }; MAKE_MENU(graphics, NULL, NULL, NULL, NULL, 1, 1); @@ -3569,12 +3576,9 @@ u32 menu(u16 *screen, bool8 FirstInvocation) } else { - /* - * It's pretty complicated. These two flips are needed because, - * otherwise, the menu freezes if S9xAutoSaveSRAM was called after - * loading from a save state. - */ + copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); ds2_flipScreen(UP_SCREEN, 1); + copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); ds2_flipScreen(UP_SCREEN, 1); } @@ -4022,14 +4026,31 @@ u32 menu(u16 *screen, bool8 FirstInvocation) if(bg_screenp != NULL) free((void*)bg_screenp); - ds2_clearScreen(DOWN_SCREEN, 0); - ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); - copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192); - ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD); + void* screen_addr; + SCREEN_ID screen_num; + if (emu_config.BottomScreenGame) + { + screen_addr = down_screen_addr; + screen_num = DOWN_SCREEN; + ds2_clearScreen(UP_SCREEN, 0); + ds2_flipScreen(UP_SCREEN, DOWN_SCREEN_UPDATE_METHOD); + } + else + { + screen_addr = up_screen_addr; + screen_num = UP_SCREEN; + ds2_clearScreen(DOWN_SCREEN, 0); + ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); + } + + copy_screen(screen_addr, (void*) screen, 0, 0, 256, 192); + ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD); + copy_screen(screen_addr, (void*) screen, 0, 0, 256, 192); + ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD); wait_Allkey_release(0); mdelay(100); // to prevent ds2_setBacklight() from crashing - ds2_setBacklight(2); + ds2_setBacklight(3 - screen_num); GameFrequencyCPU(); @@ -4623,9 +4644,12 @@ void QuickLoadState (void) { char BaseName[MAX_PATH + 1]; get_savestate_filename(0, BaseName); + SCREEN_ID screen_num = emu_config.BottomScreenGame + ? DOWN_SCREEN + : UP_SCREEN; mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(3); + ds2_setBacklight((3 - DOWN_SCREEN) | (3 - screen_num)); ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0)); draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0); @@ -4647,16 +4671,19 @@ void QuickLoadState (void) ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(2); + ds2_setBacklight(3 - screen_num); } void QuickSaveState (void) { char BaseName[MAX_PATH + 1]; get_savestate_filename(0, BaseName); + SCREEN_ID screen_num = emu_config.BottomScreenGame + ? DOWN_SCREEN + : UP_SCREEN; mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(3); + ds2_setBacklight((3 - DOWN_SCREEN) | (3 - screen_num)); ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0)); draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0); @@ -4680,7 +4707,7 @@ void QuickSaveState (void) ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD); mdelay(100); // needed to avoid ds2_setBacklight crashing - ds2_setBacklight(2); + ds2_setBacklight(3 - screen_num); } void ToggleFullScreen (void) diff --git a/source/nds/gui.h b/source/nds/gui.h index 570afe6..980553b 100644 --- a/source/nds/gui.h +++ b/source/nds/gui.h @@ -86,7 +86,8 @@ struct _EMU_CONFIG u32 HotkeyQuickLoadState; u32 HotkeyQuickSaveState; u32 HotkeyToggleFullScreen; - u32 Reserved[58]; + u32 BottomScreenGame; + u32 Reserved[57]; }; struct _GAME_CONFIG diff --git a/source/nds/message.h b/source/nds/message.h index 07799ec..98f64ab 100644 --- a/source/nds/message.h +++ b/source/nds/message.h @@ -37,6 +37,7 @@ enum MSG FMT_VIDEO_ASPECT_RATIO, FMT_VIDEO_FAST_FORWARD, FMT_VIDEO_FRAME_SKIPPING, + FMT_VIDEO_GAME_SCREEN, FMT_AUDIO_SOUND, FMT_AUDIO_RETRO_SOUND, FMT_SAVED_STATE_CREATE, @@ -92,6 +93,9 @@ enum MSG MSG_VIDEO_FRAME_SKIPPING_9, MSG_VIDEO_FRAME_SKIPPING_10, + MSG_VIDEO_GAME_SCREEN_TOP, + MSG_VIDEO_GAME_SCREEN_BOTTOM, + MSG_GENERAL_OFF, MSG_GENERAL_ON, |