Skip to content

Commit b65b9ff

Browse files
committed
scroll animation in menu, stretched instead of streched, quick_save_file accessible as load file option
Signed-off-by: Vincent-FK <[email protected]>
1 parent 0edb7f7 commit b65b9ff

File tree

3 files changed

+73
-91
lines changed

3 files changed

+73
-91
lines changed

src/drivers/dingux-sdl/dingoo-video.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ void BlitScreen(uint8 *XBuf) {
527527
//printf("s_tlines = %d, s_srendline=%d, NOFFSET = %d, NWIDTH=%d\n", s_tlines, s_srendline, NOFFSET, NWIDTH);
528528

529529
switch (aspect_ratio) {
530-
case ASPECT_RATIOS_TYPE_STRECHED:
531-
/* Streched NN*/
530+
case ASPECT_RATIOS_TYPE_STRETCHED:
531+
/* Stretched NN*/
532532
flip_NNOptimized_AllowOutOfScreen_NES(pBuf, hw_screen, hw_screen->w, hw_screen->h);
533533
break;
534534

@@ -540,7 +540,7 @@ void BlitScreen(uint8 *XBuf) {
540540

541541
default:
542542
aspect_ratio = ASPECT_RATIOS_TYPE_CROPPED;
543-
/* Streched NN*/
543+
/* Cropped NN*/
544544
flip_NNOptimized_AllowOutOfScreen_NES(pBuf, hw_screen, NWIDTH, s_tlines);
545545
break;
546546
}

src/drivers/dingux-sdl/menu.cpp

Lines changed: 69 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#define SCREEN_HORIZONTAL_SIZE RES_HW_SCREEN_HORIZONTAL
4747
#define SCREEN_VERTICAL_SIZE RES_HW_SCREEN_VERTICAL
4848

49-
#define SCROLL_SPEED_PX 240 //This means no animations but also no tearing effect
50-
#define FPS_MENU 30
49+
#define SCROLL_SPEED_PX 30
50+
#define FPS_MENU 50
5151
#define ARROWS_PADDING 8
5252

5353
#define MENU_ZONE_WIDTH SCREEN_HORIZONTAL_SIZE
@@ -120,6 +120,7 @@ int aspect_ratio_factor_step = 10;
120120
const char *resume_options_str[] = {RESUME_OPTIONS};
121121

122122
int savestate_slot = 0;
123+
static int quick_load_slot_chosen = 0;
123124

124125

125126
/// -------------- FUNCTIONS DECLARATION --------------
@@ -426,7 +427,7 @@ void init_menu_system_values(){
426427

427428
void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_confirmation, uint8_t menu_action){
428429
/// --------- Vars ---------
429-
int print_arrows = 1;
430+
int print_arrows = (scroll==0)?1:0;
430431

431432
/// --------- Clear HW screen ----------
432433
if(SDL_BlitSurface(backup_hw_screen, NULL, draw_screen, NULL)){
@@ -519,7 +520,12 @@ void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_co
519520

520521
case MENU_TYPE_LOAD:
521522
/// ---- Write slot -----
522-
sprintf(text_tmp, "FROM SLOT < %d >", savestate_slot+1);
523+
if(quick_load_slot_chosen){
524+
sprintf(text_tmp, "FROM AUTO SAVE");
525+
}
526+
else{
527+
sprintf(text_tmp, "FROM SLOT < %d >", savestate_slot+1);
528+
}
523529
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
524530
text_pos.x = (draw_screen->w - MENU_ZONE_WIDTH)/2 + (MENU_ZONE_WIDTH - text_surface->w)/2;
525531
text_pos.y = draw_screen->h - MENU_ZONE_HEIGHT/2 - text_surface->h/2;
@@ -535,17 +541,22 @@ void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_co
535541
text_surface = TTF_RenderText_Blended(menu_info_font, text_tmp, text_color);
536542
}
537543
else{
538-
/// ---- Write current Save state ----
539-
strcpy(fname, FCEU_MakeFName(FCEUMKF_STATE,savestate_slot,NULL).c_str());
540-
if(file_exists(fname))
541-
{
542-
printf("Found Load slot: %s\n", basename(fname));
543-
char *bname = basename(fname);
544-
if(strlen(bname) > limit_filename_size){bname[limit_filename_size]=0;} //limiting size
545-
text_surface = TTF_RenderText_Blended(menu_small_info_font,bname, text_color);
544+
if(quick_load_slot_chosen){
545+
text_surface = TTF_RenderText_Blended(menu_info_font, " ", text_color);
546546
}
547547
else{
548-
text_surface = TTF_RenderText_Blended(menu_info_font, "Free", text_color);
548+
/// ---- Write current Save state ----
549+
strcpy(fname, FCEU_MakeFName(FCEUMKF_STATE,savestate_slot,NULL).c_str());
550+
if(file_exists(fname))
551+
{
552+
printf("Found Load slot: %s\n", basename(fname));
553+
char *bname = basename(fname);
554+
if(strlen(bname) > limit_filename_size){bname[limit_filename_size]=0;} //limiting size
555+
text_surface = TTF_RenderText_Blended(menu_small_info_font,bname, text_color);
556+
}
557+
else{
558+
text_surface = TTF_RenderText_Blended(menu_info_font, "Free", text_color);
559+
}
549560
}
550561
}
551562
}
@@ -737,8 +748,21 @@ void run_menu_loop()
737748
}
738749
else if(idx_menus[menuItem] == MENU_TYPE_LOAD){
739750
MENU_DEBUG_PRINTF("Load Slot DOWN\n");
740-
//idx_load_slot = (!idx_load_slot)?(MAX_SAVE_SLOTS-1):(idx_load_slot-1);
741-
savestate_slot = (!savestate_slot)?(MAX_SAVE_SLOTS-1):(savestate_slot-1);
751+
752+
/** Choose quick save file or standard saveslot for loading */
753+
if(!quick_load_slot_chosen &&
754+
savestate_slot == 0 &&
755+
access(quick_save_file, F_OK ) != -1){
756+
quick_load_slot_chosen = 1;
757+
}
758+
else if(quick_load_slot_chosen){
759+
quick_load_slot_chosen = 0;
760+
savestate_slot = MAX_SAVE_SLOTS-1;
761+
}
762+
else{
763+
savestate_slot = (!savestate_slot)?(MAX_SAVE_SLOTS-1):(savestate_slot-1);
764+
}
765+
742766
/// ------ Refresh screen ------
743767
screen_refresh = 1;
744768
}
@@ -791,8 +815,21 @@ void run_menu_loop()
791815
}
792816
else if(idx_menus[menuItem] == MENU_TYPE_LOAD){
793817
MENU_DEBUG_PRINTF("Load Slot UP\n");
794-
//idx_load_slot = (idx_load_slot+1)%MAX_SAVE_SLOTS;
795-
savestate_slot = (savestate_slot+1)%MAX_SAVE_SLOTS;
818+
819+
/** Choose quick save file or standard saveslot for loading */
820+
if(!quick_load_slot_chosen &&
821+
savestate_slot == MAX_SAVE_SLOTS-1 &&
822+
access(quick_save_file, F_OK ) != -1){
823+
quick_load_slot_chosen = 1;
824+
}
825+
else if(quick_load_slot_chosen){
826+
quick_load_slot_chosen = 0;
827+
savestate_slot = 0;
828+
}
829+
else{
830+
savestate_slot = (savestate_slot+1)%MAX_SAVE_SLOTS;
831+
}
832+
796833
/// ------ Refresh screen ------
797834
screen_refresh = 1;
798835
}
@@ -840,12 +877,23 @@ void run_menu_loop()
840877
menu_screen_refresh(menuItem, prevItem, scroll, menu_confirmation, 1);
841878

842879
/// ------ Load game ------
843-
FCEUI_SelectState(savestate_slot, 0);
844-
FCEUI_LoadState(NULL);
880+
if(quick_load_slot_chosen){
881+
FCEUI_LoadState(quick_save_file);
882+
}
883+
else{
884+
FCEUI_SelectState(savestate_slot, 0);
885+
FCEUI_LoadState(NULL);
886+
}
845887

846888
/// ----- Hud Msg -----
847-
sprintf(shell_cmd, "%s %d \" LOADED FROM SLOT %d\"",
848-
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, savestate_slot+1);
889+
if(quick_load_slot_chosen){
890+
sprintf(shell_cmd, "%s %d \" LOADED FROM AUTO SAVE\"",
891+
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP);
892+
}
893+
else{
894+
sprintf(shell_cmd, "%s %d \" LOADED FROM SLOT %d\"",
895+
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, savestate_slot+1);
896+
}
849897
fp = popen(shell_cmd, "r");
850898
if (fp == NULL) {
851899
MENU_ERROR_PRINTF("Failed to run command %s\n", shell_cmd);
@@ -1131,64 +1179,3 @@ int launch_resume_menu_loop()
11311179

11321180
return option_idx;
11331181
}
1134-
1135-
1136-
1137-
1138-
1139-
1140-
1141-
1142-
1143-
1144-
1145-
1146-
1147-
1148-
1149-
1150-
1151-
1152-
1153-
1154-
1155-
1156-
1157-
1158-
1159-
1160-
1161-
1162-
1163-
1164-
1165-
1166-
1167-
1168-
1169-
1170-
1171-
1172-
1173-
1174-
1175-
1176-
1177-
1178-
1179-
1180-
1181-
1182-
1183-
1184-
1185-
1186-
1187-
1188-
1189-
1190-
1191-
1192-
1193-
1194-

src/drivers/dingux-sdl/menu.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef enum{
1717
///------ Definition of the different aspect ratios
1818
#define ASPECT_RATIOS \
1919
X(ASPECT_RATIOS_TYPE_CROPPED, "CROPPED") \
20-
X(ASPECT_RATIOS_TYPE_STRECHED, "STRECHED") \
20+
X(ASPECT_RATIOS_TYPE_STRETCHED, "STRETCHED") \
2121
X(NB_ASPECT_RATIOS_TYPES, "")
2222

2323
////------ Enumeration of the different aspect ratios ------
@@ -83,8 +83,3 @@ int launch_resume_menu_loop();
8383

8484

8585
#endif /* _MENU_H_ */
86-
87-
88-
89-
90-

0 commit comments

Comments
 (0)