X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gui.c;h=fe913a873c34d2407526bcf0ed312a9b04285b54;hb=4b1350926e1b426ff2f83f08c579e1a819e9358c;hp=cd8f4f30175c67ed66f85bfca042d3426531708f;hpb=bbba320911a86c0ee373f8297f80a2b82de22039;p=gpsp.git diff --git a/gui.c b/gui.c index cd8f4f3..fe913a8 100644 --- a/gui.c +++ b/gui.c @@ -42,7 +42,7 @@ #define FILE_LIST_ROWS 25 #define FILE_LIST_POSITION 5 -#define DIR_LIST_POSITION 360 +#define DIR_LIST_POSITION (resolution_width * 3 / 4) #endif @@ -762,12 +762,17 @@ static const char *scale_options[] = #endif }; +const char *filter2_options[] = +{ + "none", "scale2x", "scale3x", "eagle2x" +}; + s32 load_game_config_file() { char game_config_filename[512]; u32 file_loaded = 0; u32 i; - change_ext(gamepak_filename, game_config_filename, ".cfg"); + make_rpath(game_config_filename, sizeof(game_config_filename), ".cfg"); file_open(game_config_file, game_config_filename, read); @@ -808,7 +813,7 @@ s32 load_game_config_file() for(i = 0; i < 10; i++) { - cheats[i].cheat_active = file_options[3 + i] % 2; + cheats[i].cheat_active = file_options[4 + i] % 2; cheats[i].cheat_name[0] = 0; } @@ -837,15 +842,13 @@ s32 load_game_config_file() return -1; } +#define FILE_OPTION_COUNT 24 + s32 load_config_file() { char config_path[512]; - #if defined(_WIN32) || defined(_WIN32_WCE) - sprintf(config_path, "%s\\%s", main_path, GPSP_CONFIG_FILENAME); - #else - sprintf(config_path, "%s/%s", main_path, GPSP_CONFIG_FILENAME); - #endif + sprintf(config_path, "%s" PATH_SEPARATOR "%s", main_path, GPSP_CONFIG_FILENAME); file_open(config_file, config_path, read); @@ -854,7 +857,7 @@ s32 load_config_file() u32 file_size = file_length(config_path, config_file); // Sanity check: File size must be the right size - if(file_size == 92) + if(file_size == FILE_OPTION_COUNT * 4) { u32 file_options[file_size / 4]; file_read_array(config_file, file_options); @@ -863,6 +866,8 @@ s32 load_config_file() (sizeof(scale_options) / sizeof(scale_options[0])); screen_filter = file_options[1] % 2; global_enable_audio = file_options[2] % 2; + screen_filter2 = file_options[23] % + (sizeof(filter2_options) / sizeof(filter2_options[0])); #ifdef PSP_BUILD audio_buffer_size_number = file_options[3] % 10; @@ -915,7 +920,7 @@ s32 save_game_config_file() char game_config_filename[512]; u32 i; - change_ext(gamepak_filename, game_config_filename, ".cfg"); + make_rpath(game_config_filename, sizeof(game_config_filename), ".cfg"); file_open(game_config_file, game_config_filename, write); @@ -947,11 +952,7 @@ s32 save_config_file() { char config_path[512]; - #if (defined(PSP_BUILD) || defined(ARM_ARCH)) && !defined(_WIN32_WCE) - sprintf(config_path, "%s/%s", main_path, GPSP_CONFIG_FILENAME); - #else - sprintf(config_path, "%s\\%s", main_path, GPSP_CONFIG_FILENAME); - #endif + sprintf(config_path, "%s" PATH_SEPARATOR "%s", main_path, GPSP_CONFIG_FILENAME); file_open(config_file, config_path, write); @@ -959,7 +960,7 @@ s32 save_config_file() if(file_check_valid(config_file)) { - u32 file_options[23]; + u32 file_options[FILE_OPTION_COUNT]; file_options[0] = screen_scale; file_options[1] = screen_filter; @@ -968,6 +969,7 @@ s32 save_config_file() file_options[4] = update_backup_flag; file_options[5] = global_enable_analog; file_options[6] = analog_sensitivity_level; + file_options[23] = screen_filter2; #ifndef PC_BUILD u32 i; @@ -1044,22 +1046,18 @@ void get_savestate_snapshot(char *savestate_filename) #endif } -void get_savestate_filename(u32 slot, char *name_buffer) +void get_savestate_filename_noshot(u32 slot, char *name_buffer) { char savestate_ext[16]; sprintf(savestate_ext, "%d.svs", slot); - change_ext(gamepak_filename, name_buffer, savestate_ext); - - get_savestate_snapshot(name_buffer); + make_rpath(name_buffer, 512, savestate_ext); } -void get_savestate_filename_noshot(u32 slot, char *name_buffer) +void get_savestate_filename(u32 slot, char *name_buffer) { - char savestate_ext[16]; - - sprintf(savestate_ext, "%d.svs", slot); - change_ext(gamepak_filename, name_buffer, savestate_ext); + get_savestate_filename_noshot(slot, name_buffer); + get_savestate_snapshot(name_buffer); } #ifdef PSP_BUILD @@ -1338,6 +1336,12 @@ u32 menu(u16 *original_screen) "scaling the screen. Selecting this will produce a more even and\n" "smooth image, at the cost of being blurry and having less vibrant\n" "colors.", 3), +#endif +#ifdef PND_BUILD + string_selection_option(NULL, "Scaling filter", filter2_options, + (u32 *)(&screen_filter2), + sizeof(filter2_options) / sizeof(filter2_options[0]), + "Optional pixel art scaling filter", 4), #endif string_selection_option(NULL, "Frameskip type", frameskip_options, (u32 *)(¤t_frameskip_type), 3, @@ -1385,7 +1389,8 @@ u32 menu(u16 *original_screen) "This option requires gpSP to be restarted before it will take effect.", #else "Set the size (in bytes) of the audio buffer.\n" - "This option requires gpSP restart to take effect.", + "This option requires gpSP restart to take effect.\n" + "Settable values may be limited by SDL implementation.", #endif 10), submenu_option(NULL, "Back", "Return to the main menu.", 12)