X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fmenu.c;h=7af718e4df793217bb091ae0031427d0170c82bd;hp=9654221ce4c50f32a43eb008a798b4704393b1a7;hb=da710571b75db7031b82924ab3ad47eb645ce215;hpb=456f1b86b44a631e7c58e42ae72ce07970843944 diff --git a/frontend/menu.c b/frontend/menu.c index 9654221c..7af718e4 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -32,10 +32,10 @@ #include "../libpcsxcore/cdrom.h" #include "../libpcsxcore/cdriso.h" #include "../libpcsxcore/cheat.h" -#include "../libpcsxcore/psemu_plugin_defs.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" -#include "../plugins/dfinput/main.h" +#include "../plugins/dfinput/externals.h" #include "../plugins/gpulib/cspace.h" +#include "psemu_plugin_defs.h" #include "revision.h" #define REARMED_BIRTHDAY_TIME 1293306830 /* 25 Dec 2010 */ @@ -73,23 +73,25 @@ typedef enum MA_OPT_SAVECFG_GAME, MA_OPT_CPU_CLOCKS, MA_OPT_DISP_OPTS, - MA_OPT_SCALER, + MA_OPT_VARSCALER, + MA_OPT_VARSCALER_C, MA_OPT_SCALER2, MA_OPT_HWFILTER, MA_OPT_SWFILTER, MA_OPT_GAMMA, - MA_OPT_SCALER_C, + MA_OPT_VIDOVERLAY, } menu_id; static int last_vout_w, last_vout_h, last_vout_bpp; static int cpu_clock, cpu_clock_st, volume_boost, frameskip; static char rom_fname_reload[MAXPATHLEN]; static char last_selected_fname[MAXPATHLEN]; -static int warned_about_bios, region, in_type_sel1, in_type_sel2; +static int config_save_counter, region, in_type_sel1, in_type_sel2; static int psx_clock; static int memcard1_sel, memcard2_sel; int g_opts, g_scaler, g_gamma = 100; int soft_scaling, analog_deadzone; // for Caanoo +int g_use_overlay, g_fullscreen; int filter, soft_filter; #ifdef __ARM_ARCH_7A__ @@ -112,6 +114,18 @@ static const char *spu_plugins[16]; static const char *memcards[32]; static int bios_sel, gpu_plugsel, spu_plugsel; +#ifndef UI_FEATURES_H +#define MENU_BIOS_PATH "bios/" +#define MENU_SHOW_VARSCALER 0 +#define MENU_SHOW_VIDOVERLAY 1 +#define MENU_SHOW_SCALER2 0 +#define MENU_SHOW_NUBS_BTNS 0 +#define MENU_SHOW_VIBRATION 0 +#define MENU_SHOW_DEADZONE 0 +#define MENU_SHOW_MINIMIZE 0 +#define MENU_SHOW_FULLSCREEN 1 +#define MENU_SHOW_VOLUME 0 +#endif static int min(int x, int y) { return x < y ? x : y; } static int max(int x, int y) { return x > y ? x : y; } @@ -217,6 +231,8 @@ static void menu_set_defconfig(void) analog_deadzone = 50; soft_scaling = 1; soft_filter = 0; + g_use_overlay = 1; + g_fullscreen = 0; psx_clock = DEFAULT_PSX_CLOCK; region = 0; @@ -238,6 +254,9 @@ static void menu_set_defconfig(void) #define CE_INTVAL(val) \ { #val, sizeof(val), &val } +#define CE_INTVAL_N(name, val) \ + { name, sizeof(val), &val } + #define CE_INTVAL_P(val) \ { #val, sizeof(pl_rearmed_cbs.val), &pl_rearmed_cbs.val } @@ -279,12 +298,16 @@ static const struct { CE_INTVAL(g_layer_h), CE_INTVAL(filter), CE_INTVAL(soft_filter), + CE_INTVAL(g_use_overlay), + CE_INTVAL(g_fullscreen), CE_INTVAL(state_slot), CE_INTVAL(cpu_clock), CE_INTVAL(g_opts), CE_INTVAL(in_type_sel1), CE_INTVAL(in_type_sel2), CE_INTVAL(analog_deadzone), + CE_INTVAL_N("adev0_is_nublike", in_adev_is_nublike[0]), + CE_INTVAL_N("adev1_is_nublike", in_adev_is_nublike[1]), CE_INTVAL_V(frameskip, 3), CE_INTVAL_P(gpu_peops.iUseDither), CE_INTVAL_P(gpu_peops.dwActFixes), @@ -308,7 +331,7 @@ static const struct { CE_INTVAL_V(iUseReverb, 3), CE_INTVAL_V(iXAPitch, 3), CE_INTVAL_V(iUseInterpolation, 3), - CE_INTVAL(warned_about_bios), + CE_INTVAL(config_save_counter), CE_INTVAL(in_evdev_allow_abs_only), CE_INTVAL(volume_boost), CE_INTVAL(psx_clock), @@ -347,6 +370,8 @@ static int menu_write_config(int is_game) FILE *f; int i; + config_save_counter++; + make_cfg_fname(cfgfile, sizeof(cfgfile), is_game); f = fopen(cfgfile, "w"); if (f == NULL) { @@ -607,12 +632,18 @@ static void draw_savestate_bg(int slot) x = gpu->ulControl[5] & 0x3ff; y = (gpu->ulControl[5] >> 10) & 0x1ff; - s = (u16 *)gpu->psxVRam + y * 1024 + x; w = psx_widths[(gpu->ulStatus >> 16) & 7]; tmp = gpu->ulControl[7]; h = ((tmp >> 10) & 0x3ff) - (tmp & 0x3ff); if (gpu->ulStatus & 0x80000) // doubleheight h *= 2; + if (h <= 0 || h > 512) + goto out; + if (y > 512 - 64) + y = 0; + if (y + h > 512) + h = 512 - y; + s = (u16 *)gpu->psxVRam + y * 1024 + x; x = max(0, g_menuscreen_w - w) & ~3; y = max(0, g_menuscreen_h / 2 - h / 2); @@ -666,17 +697,23 @@ me_bind_action emuctrl_actions[] = { "Next Save Slot ", 1 << SACTION_NEXT_SSLOT }, { "Toggle Frameskip ", 1 << SACTION_TOGGLE_FSKIP }, { "Take Screenshot ", 1 << SACTION_SCREENSHOT }, - { "Fast Forward ", 1 << SACTION_FAST_FORWARD }, -#ifdef __ARM_ARCH_7A__ /* XXX */ + { "Show/Hide FPS ", 1 << SACTION_TOGGLE_FPS }, +#ifdef __ARM_ARCH_7A__ { "Switch Renderer ", 1 << SACTION_SWITCH_DISPMODE }, +#endif + { "Fast Forward ", 1 << SACTION_FAST_FORWARD }, +#if MENU_SHOW_MINIMIZE { "Minimize ", 1 << SACTION_MINIMIZE }, +#endif +#if MENU_SHOW_FULLSCREEN + { "Toggle fullscreen", 1 << SACTION_TOGGLE_FULLSCREEN }, #endif { "Enter Menu ", 1 << SACTION_ENTER_MENU }, { "Gun Trigger ", 1 << SACTION_GUN_TRIGGER }, { "Gun A button ", 1 << SACTION_GUN_A }, { "Gun B button ", 1 << SACTION_GUN_B }, { "Gun Offscreen Trigger", 1 << SACTION_GUN_TRIGGER2 }, -#ifndef __ARM_ARCH_7A__ /* XXX */ +#if MENU_SHOW_VOLUME { "Volume Up ", 1 << SACTION_VOLUME_UP }, { "Volume Down ", 1 << SACTION_VOLUME_DOWN }, #endif @@ -894,17 +931,21 @@ static int key_config_loop_wrap(int id, int keys) return 0; } +static const char h_nubmode[] = "Maps nub-like analog controls to PSX ones better\n" + "Might cause problems with real analog sticks"; static const char *adevnames[IN_MAX_DEVS + 2]; static int stick_sel[2]; static menu_entry e_menu_keyconfig_analog[] = { - mee_enum ("Left stick (L3)", 0, stick_sel[0], adevnames), - mee_range(" X axis", 0, in_adev_axis[0][0], 0, 7), - mee_range(" Y axis", 0, in_adev_axis[0][1], 0, 7), - mee_enum ("Right stick (R3)", 0, stick_sel[1], adevnames), - mee_range(" X axis", 0, in_adev_axis[1][0], 0, 7), - mee_range(" Y axis", 0, in_adev_axis[1][1], 0, 7), + mee_enum ("Left stick (L3)", 0, stick_sel[0], adevnames), + mee_range (" X axis", 0, in_adev_axis[0][0], 0, 7), + mee_range (" Y axis", 0, in_adev_axis[0][1], 0, 7), + mee_onoff_h(" nub mode", 0, in_adev_is_nublike[0], 1, h_nubmode), + mee_enum ("Right stick (R3)", 0, stick_sel[1], adevnames), + mee_range (" X axis", 0, in_adev_axis[1][0], 0, 7), + mee_range (" Y axis", 0, in_adev_axis[1][1], 0, 7), + mee_onoff_h(" nub mode", 0, in_adev_is_nublike[1], 1, h_nubmode), mee_end, }; @@ -1044,6 +1085,7 @@ static const char *men_soft_filter[] = { "None", static const char *men_dummy[] = { NULL }; static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n" "using d-pad or move it using R+d-pad"; +static const char h_overlay[] = "Overlay provides hardware accelerated scaling"; static const char h_soft_filter[] = "Works only if game uses low resolution modes"; static const char h_gamma[] = "Gamma/brightness adjustment (default 100)"; @@ -1101,13 +1143,14 @@ static int menu_loop_cscaler(int id, int keys) static menu_entry e_menu_gfx_options[] = { - mee_enum ("Scaler", MA_OPT_SCALER, g_scaler, men_scaler), + mee_enum ("Scaler", MA_OPT_VARSCALER, g_scaler, men_scaler), + mee_onoff_h ("Use video overlay", MA_OPT_VIDOVERLAY, g_use_overlay, 1, h_overlay), mee_onoff ("Software Scaling", MA_OPT_SCALER2, soft_scaling, 1), mee_enum ("Hardware Filter", MA_OPT_HWFILTER, filter, men_dummy), mee_enum_h ("Software Filter", MA_OPT_SWFILTER, soft_filter, men_soft_filter, h_soft_filter), mee_range_h ("Gamma adjustment", MA_OPT_GAMMA, g_gamma, 1, 200, h_gamma), // mee_onoff ("Vsync", 0, vsync, 1), - mee_cust_h ("Setup custom scaler", MA_OPT_SCALER_C, menu_loop_cscaler, NULL, h_cscaler), + mee_cust_h ("Setup custom scaler", MA_OPT_VARSCALER_C, menu_loop_cscaler, NULL, h_cscaler), mee_end, }; @@ -1644,11 +1687,8 @@ static void menu_bios_warn(void) static const char msg[] = "You don't seem to have copied any BIOS\n" "files to\n" -#ifdef __ARM_ARCH_7A__ // XXX - "/pandora/appdata/pcsx_rearmed/bios/\n\n" -#else - "pcsx_rearmed/bios/\n\n" -#endif + MENU_BIOS_PATH "\n\n" + "While many games work fine with fake\n" "(HLE) BIOS, others (like MGS and FF8)\n" "require BIOS to work.\n" @@ -1829,7 +1869,7 @@ static int run_cd_image(const char *fname) return -1; } - emu_on_new_cd(); + emu_on_new_cd(1); ready_to_go = 1; return 0; @@ -2049,13 +2089,22 @@ static void menu_leave_emu(void); void menu_loop(void) { + static int warned_about_bios = 0; static int sel = 0; menu_leave_emu(); - if (bioses[1] == NULL && !warned_about_bios) { - menu_bios_warn(); - warned_about_bios = 1; + if (config_save_counter == 0) { + // assume first run + if (bioses[1] != NULL) { + // autoselect BIOS to make user's life easier + snprintf(Config.Bios, sizeof(Config.Bios), "%s", bioses[1]); + bios_sel = 1; + } + else if (!warned_about_bios) { + menu_bios_warn(); + warned_about_bios = 1; + } } me_enable(e_menu_main, MA_MAIN_RESUME_GAME, ready_to_go); @@ -2271,16 +2320,16 @@ void menu_init(void) me_enable(e_menu_gfx_options, MA_OPT_GAMMA, plat_target.gamma_set != NULL); -#ifndef __ARM_ARCH_7A__ /* XXX */ - me_enable(e_menu_gfx_options, MA_OPT_SCALER, 0); - me_enable(e_menu_gfx_options, MA_OPT_SCALER_C, 0); +#ifndef __ARM_ARCH_7A__ me_enable(e_menu_gfx_options, MA_OPT_SWFILTER, 0); - me_enable(e_menu_keyconfig, MA_CTRL_NUBS_BTNS, 0); -#else - me_enable(e_menu_gfx_options, MA_OPT_SCALER2, 0); - me_enable(e_menu_keyconfig, MA_CTRL_VIBRATION, 0); - me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0); #endif + me_enable(e_menu_gfx_options, MA_OPT_VARSCALER, MENU_SHOW_VARSCALER); + me_enable(e_menu_gfx_options, MA_OPT_VIDOVERLAY, MENU_SHOW_VIDOVERLAY); + me_enable(e_menu_gfx_options, MA_OPT_VARSCALER_C, MENU_SHOW_VARSCALER); + me_enable(e_menu_gfx_options, MA_OPT_SCALER2, MENU_SHOW_SCALER2); + me_enable(e_menu_keyconfig, MA_CTRL_NUBS_BTNS, MENU_SHOW_NUBS_BTNS); + me_enable(e_menu_keyconfig, MA_CTRL_VIBRATION, MENU_SHOW_VIBRATION); + me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, MENU_SHOW_DEADZONE); } void menu_notify_mode_change(int w, int h, int bpp)