X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gui.c;h=17796562627a115988ebd3aea1395b4924aea6b2;hb=862e940b8c108fb0d29f9a1644be7a5360d7230d;hp=fe913a873c34d2407526bcf0ed312a9b04285b54;hpb=e38fee1b96c0b904d7f221a349fb2492258d5789;p=gpsp.git diff --git a/gui.c b/gui.c index fe913a8..1779656 100644 --- a/gui.c +++ b/gui.c @@ -78,7 +78,7 @@ clock_speed = (clock_speed_number + 1) * 33 #define get_clock_speed_number() \ clock_speed_number = (clock_speed / 33) - 1 -#elif defined(WIZ_BUILD) +#elif defined(POLLUX_BUILD) static const char *clock_speed_options[] = { "300MHz", "333MHz", "366MHz", "400MHz", "433MHz", @@ -552,7 +552,7 @@ typedef enum NUMBER_SELECTION_OPTION = 0x01, STRING_SELECTION_OPTION = 0x02, SUBMENU_OPTION = 0x04, - ACTION_OPTION = 0x08 + ACTION_OPTION = 0x08, } menu_option_type_enum; struct _menu_type @@ -735,7 +735,7 @@ u32 gamepad_config_line_to_button[] = #ifdef GP2X_BUILD u32 gamepad_config_line_to_button[] = - { 0, 2, 1, 3, 8, 9, 10, 11, 6, 7, 4, 5, 14 }; + { 0, 2, 1, 3, 8, 9, 10, 11, 6, 7, 4, 5, 14, 15 }; #endif @@ -746,6 +746,13 @@ u32 gamepad_config_line_to_button[] = #endif +#ifdef RPI_BUILD + +u32 gamepad_config_line_to_button[] = + { 0, 2, 1, 3, 8, 9, 10, 11, 6, 7, 4, 5, 12, 13, 14, 15 }; + +#endif + static const char *scale_options[] = { #ifdef PSP_BUILD @@ -753,10 +760,14 @@ static const char *scale_options[] = #elif defined(WIZ_BUILD) "unscaled 3:2", "scaled 3:2 (slower)", "unscaled 3:2 (anti-tear)", "scaled 3:2 (anti-tear)" +#elif defined(POLLUX_BUILD) + "unscaled 3:2", "scaled 3:2 (slower)" #elif defined(PND_BUILD) "unscaled", "2x", "3x", "fullscreen" #elif defined(GP2X_BUILD) "unscaled 3:2", "scaled 3:2", "fullscreen", "scaled 3:2 (software)" +#elif defined(RPI_BUILD) + "fullscreen" #else "unscaled 3:2" #endif @@ -767,6 +778,22 @@ const char *filter2_options[] = "none", "scale2x", "scale3x", "eagle2x" }; +#ifndef PSP_BUILD +static const char *audio_buffer_options[] = +{ + "16 bytes", "32 bytes", "64 bytes", + "128 bytes", "256 bytes", "512 bytes", "1024 bytes", "2048 bytes", + "4096 bytes", "8192 bytes", "16284 bytes" +}; +#else +const char *audio_buffer_options[] = +{ + "3072 bytes", "4096 bytes", "5120 bytes", "6144 bytes", "7168 bytes", + "8192 bytes", "9216 bytes", "10240 bytes", "11264 bytes", "12288 bytes" +}; +#endif + + s32 load_game_config_file() { char game_config_filename[512]; @@ -791,7 +818,7 @@ s32 load_game_config_file() random_skip = file_options[2] % 2; clock_speed = file_options[3]; -#ifdef WIZ_BUILD +#ifdef POLLUX_BUILD if(clock_speed > 900) clock_speed = 533; #elif defined(GP2X_BUILD) @@ -825,10 +852,15 @@ s32 load_game_config_file() if(file_loaded) return 0; +#ifdef RPI_BUILD + current_frameskip_type = manual_frameskip; + frameskip_value = 1; +#else current_frameskip_type = auto_frameskip; frameskip_value = 4; -#ifdef WIZ_BUILD +#ifdef POLLUX_BUILD frameskip_value = 1; +#endif #endif random_skip = 0; clock_speed = default_clock_speed; @@ -842,7 +874,22 @@ s32 load_game_config_file() return -1; } -#define FILE_OPTION_COUNT 24 +enum file_options { + fo_screen_scale = 0, + fo_screen_filter, + fo_global_enable_audio, + fo_audio_buffer_size, + fo_update_backup_flag, + fo_global_enable_analog, + fo_analog_sensitivity_level, + fo_screen_filter2, + fo_main_option_count, +}; + +#ifdef PC_BUILD +#define PLAT_BUTTON_COUNT 0 +#endif +#define FILE_OPTION_COUNT (fo_main_option_count + PLAT_BUTTON_COUNT) s32 load_config_file() { @@ -862,22 +909,19 @@ s32 load_config_file() u32 file_options[file_size / 4]; file_read_array(config_file, file_options); - screen_scale = file_options[0] % + screen_scale = file_options[fo_screen_scale] % (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] % + screen_filter = file_options[fo_screen_filter] % 2; + global_enable_audio = file_options[fo_global_enable_audio] % 2; + screen_filter2 = file_options[fo_screen_filter2] % (sizeof(filter2_options) / sizeof(filter2_options[0])); -#ifdef PSP_BUILD - audio_buffer_size_number = file_options[3] % 10; -#else - audio_buffer_size_number = file_options[3] % 11; -#endif + audio_buffer_size_number = file_options[fo_audio_buffer_size] % + (sizeof(audio_buffer_options) / sizeof(audio_buffer_options[0])); - update_backup_flag = file_options[4] % 2; - global_enable_analog = file_options[5] % 2; - analog_sensitivity_level = file_options[6] % 8; + update_backup_flag = file_options[fo_update_backup_flag] % 2; + global_enable_analog = file_options[fo_global_enable_analog] % 2; + analog_sensitivity_level = file_options[fo_analog_sensitivity_level] % 8; #ifdef PSP_BUILD scePowerSetClockFrequency(clock_speed, clock_speed, clock_speed / 2); @@ -889,9 +933,9 @@ s32 load_config_file() #ifndef PC_BUILD u32 i; s32 menu_button = -1; - for(i = 0; i < 16; i++) + for(i = 0; i < PLAT_BUTTON_COUNT; i++) { - gamepad_config_map[i] = file_options[7 + i] % + gamepad_config_map[i] = file_options[fo_main_option_count + i] % (BUTTON_ID_NONE + 1); if(gamepad_config_map[i] == BUTTON_ID_MENU) @@ -900,9 +944,9 @@ s32 load_config_file() } } - if(menu_button == -1) + if(menu_button == -1 && PLAT_MENU_BUTTON >= 0) { - gamepad_config_map[0] = BUTTON_ID_MENU; + gamepad_config_map[PLAT_MENU_BUTTON] = BUTTON_ID_MENU; } #endif @@ -962,20 +1006,20 @@ s32 save_config_file() { u32 file_options[FILE_OPTION_COUNT]; - file_options[0] = screen_scale; - file_options[1] = screen_filter; - file_options[2] = global_enable_audio; - file_options[3] = audio_buffer_size_number; - file_options[4] = update_backup_flag; - file_options[5] = global_enable_analog; - file_options[6] = analog_sensitivity_level; - file_options[23] = screen_filter2; + file_options[fo_screen_scale] = screen_scale; + file_options[fo_screen_filter] = screen_filter; + file_options[fo_global_enable_audio] = global_enable_audio; + file_options[fo_audio_buffer_size] = audio_buffer_size_number; + file_options[fo_update_backup_flag] = update_backup_flag; + file_options[fo_global_enable_analog] = global_enable_analog; + file_options[fo_analog_sensitivity_level] = analog_sensitivity_level; + file_options[fo_screen_filter2] = screen_filter2; #ifndef PC_BUILD u32 i; - for(i = 0; i < 16; i++) + for(i = 0; i < PLAT_BUTTON_COUNT; i++) { - file_options[7 + i] = gamepad_config_map[i]; + file_options[fo_main_option_count + i] = gamepad_config_map[i]; } #endif @@ -1183,10 +1227,6 @@ u32 menu(u16 *original_screen) reg[CHANGED_PC_STATUS] = 1; menu_update_clock(); } - else - { - choose_menu(current_menu); - } } void menu_restart() @@ -1296,26 +1336,12 @@ u32 menu(u16 *original_screen) const char *frameskip_options[] = { "automatic", "manual", "off" }; const char *frameskip_variation_options[] = { "uniform", "random" }; -#ifndef PSP_BUILD - static const char *audio_buffer_options[] = - { - "16 bytes", "32 bytes", "64 bytes", - "128 bytes", "256 bytes", "512 bytes", "1024 bytes", "2048 bytes", - "4096 bytes", "8192 bytes", "16284 bytes" - }; -#else - const char *audio_buffer_options[] = - { - "3072 bytes", "4096 bytes", "5120 bytes", "6144 bytes", "7168 bytes", - "8192 bytes", "9216 bytes", "10240 bytes", "11264 bytes", "12288 bytes" - }; -#endif - static const char *update_backup_options[] = { "Exit only", "Automatic" }; // Marker for help information, don't go past this mark (except \n)------* - menu_option_type graphics_sound_options[] = - { + menu_option_type graphics_sound_options[] = + { +#ifndef RPI_BUILD string_selection_option(NULL, "Display scaling", scale_options, (u32 *)(&screen_scale), sizeof(scale_options) / sizeof(scale_options[0]), @@ -1329,6 +1355,8 @@ u32 menu(u16 *original_screen) #endif #endif "", 2), +#endif + #ifndef GP2X_BUILD string_selection_option(NULL, "Screen filtering", yes_no_options, (u32 *)(&screen_filter), 2, @@ -1337,7 +1365,7 @@ u32 menu(u16 *original_screen) "smooth image, at the cost of being blurry and having less vibrant\n" "colors.", 3), #endif -#ifdef PND_BUILD +#if defined (PND_BUILD) string_selection_option(NULL, "Scaling filter", filter2_options, (u32 *)(&screen_filter2), sizeof(filter2_options) / sizeof(filter2_options[0]), @@ -1518,18 +1546,25 @@ u32 menu(u16 *original_screen) gamepad_config_option("Right Trigger", 9), #ifdef WIZ_BUILD gamepad_config_option("Menu ", 10), -#else + gamepad_config_option("Select ", 11), +#elif defined(POLLUX_BUILD) + gamepad_config_option("I ", 10), + gamepad_config_option("II ", 11), + gamepad_config_option("Push ", 12), + gamepad_config_option("Home ", 13), +#elif defined(PND_BUILD) gamepad_config_option("Start ", 10), -#endif gamepad_config_option("Select ", 11), -#if !defined(WIZ_BUILD) && !defined(PND_BUILD) - gamepad_config_option("Stick Push ", 12), -#endif -#ifdef PND_BUILD gamepad_config_option("1 ", 12), gamepad_config_option("2 ", 13), gamepad_config_option("3 ", 14), gamepad_config_option("4 ", 15), +#else // GP2X + gamepad_config_option("Start ", 10), + gamepad_config_option("Select ", 11), + gamepad_config_option("Stick Push ", 12), +#endif +#ifdef PND_BUILD submenu_option(NULL, "Back", "Return to the main menu.", 16) #else submenu_option(NULL, "Back", "Return to the main menu.", 14) @@ -1539,12 +1574,18 @@ u32 menu(u16 *original_screen) menu_option_type analog_config_options[] = { +#if defined(POLLUX_BUILD) + numeric_selection_option(NULL, "Analog sensitivity", + &analog_sensitivity_level, 10, + "Determine sensitivity/responsiveness of the analog input.\n" + "Lower numbers are less sensitive.", 8), +#endif submenu_option(NULL, "Back", "Return to the main menu.", 11) }; #endif -#ifdef PC_BUILD +#if defined(PC_BUILD) || defined(RPI_BUILD) menu_option_type gamepad_config_options[] = { @@ -1583,9 +1624,9 @@ u32 menu(u16 *original_screen) submenu_option(&gamepad_config_menu, "Configure gamepad input", "Select to change the in-game behavior of buttons\n" "and d-pad.", 6), -#ifndef GP2X_BUILD +#ifndef WIZ_BUILD submenu_option(&analog_config_menu, "Configure analog input", - "Select to change the in-game behavior of the PSP analog nub.", 7), + "Select to change the in-game behavior of the analog nub.", 7), #endif submenu_option(&cheats_misc_menu, "Cheats and Miscellaneous options", "Select to manage cheats, set backup behavior,\n" @@ -1773,6 +1814,10 @@ u32 menu(u16 *original_screen) if(current_option->option_type & SUBMENU_OPTION) choose_menu(current_option->sub_menu); + + if(current_menu == &main_menu) + choose_menu(&main_menu); + break; default: