@@ -105,18 +105,18 @@ static const char *men_dummy[] = { NULL };
105105#endif //MENU_ERROR
106106
107107
108- #define RES_HW_SCREEN_HORIZONTAL 240
109- #define RES_HW_SCREEN_VERTICAL 240
108+ #define RES_HW_SCREEN_HORIZONTAL 240
109+ #define RES_HW_SCREEN_VERTICAL 240
110110#define SCREEN_HORIZONTAL_SIZE 240
111111#define SCREEN_VERTICAL_SIZE 240
112112
113- #define SCROLL_SPEED_PX 240 //This means no anumations but also no tearing effect
114- #define FPS_MENU 30
113+ #define SCROLL_SPEED_PX 30
114+ #define FPS_MENU 50
115115#define ARROWS_PADDING 8
116116
117117#define MENU_ZONE_WIDTH SCREEN_HORIZONTAL_SIZE
118118#define MENU_ZONE_HEIGHT SCREEN_VERTICAL_SIZE
119- #define MENU_BG_SQUARE_WIDTH 180
119+ #define MENU_BG_SQUARE_WIDTH 180
120120#define MENU_BG_SQUARE_HEIGHT 140
121121
122122#define MENU_FONT_NAME_TITLE "/usr/games/menu_resources/OpenSans-Bold.ttf"
@@ -176,10 +176,12 @@ int brightness_percentage = 0;
176176#undef X
177177#define X (a , b ) b,
178178const char * aspect_ratio_name [] = {ASPECT_RATIOS };
179- int aspect_ratio = ASPECT_RATIOS_TYPE_STRECHED ;
179+ int aspect_ratio = ASPECT_RATIOS_TYPE_STRETCHED ;
180180int aspect_ratio_factor_percent = 50 ;
181181int aspect_ratio_factor_step = 10 ;
182182
183+ int quick_load_slot_chosen = 0 ;
184+
183185#undef X
184186#define X (a , b ) b,
185187const char * resume_options_str [] = {RESUME_OPTIONS };
@@ -479,7 +481,7 @@ void init_menu_system_values(){
479481
480482void menu_screen_refresh (int menuItem , int prevItem , int scroll , uint8_t menu_confirmation , uint8_t menu_action ){
481483 /// --------- Vars ---------
482- int print_arrows = 1 ;
484+ int print_arrows = ( scroll == 0 )? 1 : 0 ;
483485
484486 /// --------- Clear HW screen ----------
485487 //SDL_FillRect(draw_screen, NULL, SDL_MapRGB(draw_screen->format, 255, 0, 0));
@@ -573,7 +575,12 @@ void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_co
573575
574576 case MENU_TYPE_LOAD :
575577 /// ---- Write slot -----
576- sprintf (text_tmp , "FROM SLOT < %d >" , state_slot + 1 );
578+ if (quick_load_slot_chosen ){
579+ sprintf (text_tmp , "FROM AUTO SAVE" );
580+ }
581+ else {
582+ sprintf (text_tmp , "FROM SLOT < %d >" , state_slot + 1 );
583+ }
577584 text_surface = TTF_RenderText_Blended (menu_info_font , text_tmp , text_color );
578585 text_pos .x = (draw_screen -> w - MENU_ZONE_WIDTH )/2 + (MENU_ZONE_WIDTH - text_surface -> w )/2 ;
579586 text_pos .y = draw_screen -> h - MENU_ZONE_HEIGHT /2 - text_surface -> h /2 ;
@@ -589,17 +596,22 @@ void menu_screen_refresh(int menuItem, int prevItem, int scroll, uint8_t menu_co
589596 text_surface = TTF_RenderText_Blended (menu_info_font , text_tmp , text_color );
590597 }
591598 else {
592- fname = emu_get_save_fname (1 , 0 , state_slot , NULL );
593- if (fname == NULL ) {
594- text_surface = TTF_RenderText_Blended (menu_info_font , "Free" , text_color );
595- }
596- else {
597- printf ("Found saved file: %s\n" , fname );
598- char * p = strrchr (fname , '/' );
599- char * basename = p ? p + 1 : (char * ) fname ;
600- if (strlen (basename ) > limit_filename_size ){basename [limit_filename_size ]= 0 ;} //limiting size
601- text_surface = TTF_RenderText_Blended (menu_small_info_font , basename , text_color );
602- }
599+ if (quick_load_slot_chosen ){
600+ text_surface = TTF_RenderText_Blended (menu_info_font , " " , text_color );
601+ }
602+ else {
603+ fname = emu_get_save_fname (1 , 0 , state_slot , NULL );
604+ if (fname == NULL ) {
605+ text_surface = TTF_RenderText_Blended (menu_info_font , "Free" , text_color );
606+ }
607+ else {
608+ printf ("Found saved file: %s\n" , fname );
609+ char * p = strrchr (fname , '/' );
610+ char * basename = p ? p + 1 : (char * ) fname ;
611+ if (strlen (basename ) > limit_filename_size ){basename [limit_filename_size ]= 0 ;} //limiting size
612+ text_surface = TTF_RenderText_Blended (menu_small_info_font , basename , text_color );
613+ }
614+ }
603615 }
604616 }
605617 text_pos .x = (draw_screen -> w - MENU_ZONE_WIDTH )/2 + (MENU_ZONE_WIDTH - text_surface -> w )/2 ;
@@ -806,8 +818,21 @@ void run_menu_loop()
806818 }
807819 else if (idx_menus [menuItem ] == MENU_TYPE_LOAD ){
808820 MENU_DEBUG_PRINTF ("Load Slot DOWN\n" );
809- //idx_load_slot = (!idx_load_slot)?(MAX_SAVE_SLOTS-1):(idx_load_slot-1);
810- state_slot = (!state_slot )?(MAX_SAVE_SLOTS - 1 ):(state_slot - 1 );
821+
822+ /** Choose quick save file or standard saveslot for loading */
823+ if (!quick_load_slot_chosen &&
824+ state_slot == 0 &&
825+ access (quick_save_file , F_OK ) != -1 ){
826+ quick_load_slot_chosen = 1 ;
827+ }
828+ else if (quick_load_slot_chosen ){
829+ quick_load_slot_chosen = 0 ;
830+ state_slot = MAX_SAVE_SLOTS - 1 ;
831+ }
832+ else {
833+ state_slot = (!state_slot )?(MAX_SAVE_SLOTS - 1 ):(state_slot - 1 );
834+ }
835+
811836 /// ------ Refresh screen ------
812837 screen_refresh = 1 ;
813838 }
@@ -860,8 +885,21 @@ void run_menu_loop()
860885 }
861886 else if (idx_menus [menuItem ] == MENU_TYPE_LOAD ){
862887 MENU_DEBUG_PRINTF ("Load Slot UP\n" );
863- //idx_load_slot = (idx_load_slot+1)%MAX_SAVE_SLOTS;
864- state_slot = (state_slot + 1 )%MAX_SAVE_SLOTS ;
888+
889+ /** Choose quick save file or standard saveslot for loading */
890+ if (!quick_load_slot_chosen &&
891+ state_slot == MAX_SAVE_SLOTS - 1 &&
892+ access (quick_save_file , F_OK ) != -1 ){
893+ quick_load_slot_chosen = 1 ;
894+ }
895+ else if (quick_load_slot_chosen ){
896+ quick_load_slot_chosen = 0 ;
897+ state_slot = 0 ;
898+ }
899+ else {
900+ state_slot = (state_slot + 1 )%MAX_SAVE_SLOTS ;
901+ }
902+
865903 /// ------ Refresh screen ------
866904 screen_refresh = 1 ;
867905 }
@@ -915,7 +953,13 @@ void run_menu_loop()
915953 menu_screen_refresh (menuItem , prevItem , scroll , menu_confirmation , 1 );
916954
917955 /// ------ Load game ------
918- int ret = emu_save_load_game (1 , 0 );
956+ int ret ;
957+ if (quick_load_slot_chosen ){
958+ ret = emu_save_load_game_from_file (1 , quick_save_file );
959+ }
960+ else {
961+ ret = emu_save_load_game (1 , 0 );
962+ }
919963
920964 /// ----- Hud Msg -----
921965 if (ret ){
@@ -924,8 +968,14 @@ void run_menu_loop()
924968 SHELL_CMD_NOTIF , NOTIF_SECONDS_DISP );
925969 }
926970 else {
927- sprintf (shell_cmd , "%s %d \" LOADED FROM SLOT %d\"" ,
928- SHELL_CMD_NOTIF , NOTIF_SECONDS_DISP , state_slot + 1 );
971+ if (quick_load_slot_chosen ){
972+ sprintf (shell_cmd , "%s %d \" LOADED FROM AUTO SAVE\"" ,
973+ SHELL_CMD_NOTIF , NOTIF_SECONDS_DISP );
974+ }
975+ else {
976+ sprintf (shell_cmd , "%s %d \" LOADED FROM SLOT %d\"" ,
977+ SHELL_CMD_NOTIF , NOTIF_SECONDS_DISP , state_slot + 1 );
978+ }
929979 }
930980 fp = popen (shell_cmd , "r" );
931981 if (fp == NULL ) {
0 commit comments