diff --git a/src/drivers/ps2/browser.c b/src/drivers/ps2/browser.c index 105a474..8d9155a 100644 --- a/src/drivers/ps2/browser.c +++ b/src/drivers/ps2/browser.c @@ -32,7 +32,7 @@ extern GSFONTM *gsFontM; /************************************/ /* Pad Variables */ /************************************/ -extern u32 old_pad[2]; +extern u32 old_pad[4]; static struct padButtonStatus buttons[2]; extern int defaultx, defaulty; @@ -639,7 +639,7 @@ char* Browser(int files_too, int menu_id) if (selection != oldselect) { gsKit_clear(gsGlobal, GS_SETREG_RGBAQ(0x00, 0x00, 0x00, 0x80, 0x00)); - browser_primitive("FCEUltra PS2 B0.93 [x.3.0]", "Browser", &BG_TEX, menu_x1, menu_y1, menu_x2, menu_y2); + browser_primitive("FCEUltra PS2 B0.93 [x.3.1]", "Browser", &BG_TEX, menu_x1, menu_y1, menu_x2, menu_y2); if (selection > max_item) { list_offset = text_line - (selection - max_item) * FONT_HEIGHT; diff --git a/src/drivers/ps2/cnfsettings.c b/src/drivers/ps2/cnfsettings.c index d27b901..4bf744c 100644 --- a/src/drivers/ps2/cnfsettings.c +++ b/src/drivers/ps2/cnfsettings.c @@ -175,15 +175,16 @@ void Load_Global_CNF(char *CNF_path_p) for (var_cnt = 0; get_CNF_string(&CNF_p, &name, &value); var_cnt++) { // A variable was found, now we dispose of its value. printf("Found variable \"%s\" with value \"%s\"\r\n", name, value); - if (!strcmp(name, "OffsetX")) { Settings.offset_x = atoi(value); } - else if (!strcmp(name, "OffsetY")) { Settings.offset_y = atoi(value); } - else if (!strcmp(name, "Display")) { Settings.display = atoi(value); } - else if (!strcmp(name, "Emulation")) { Settings.emulation = atoi(value); } - else if (!strcmp(name, "Interlace")) { Settings.interlace = atoi(value); } - else if (!strcmp(name, "Filter")) { Settings.filter = atoi(value); } - else if (!strcmp(name, "AspectRatio")) { Settings.aspect_ratio = atoi(value); } - else if (!strcmp(name, "Sound")) { Settings.sound = atoi(value); } - else if (!strcmp(name, "Palette")) { Settings.current_palette = atoi(value); } + if (!strcmp(name, "OffsetX")) { Settings.offset_x = atoi(value); } + else if (!strcmp(name, "OffsetY")) { Settings.offset_y = atoi(value); } + else if (!strcmp(name, "Display")) { Settings.display = atoi(value); } + else if (!strcmp(name, "Emulation")) { Settings.emulation = atoi(value); } + else if (!strcmp(name, "Interlace")) { Settings.interlace = atoi(value); } + else if (!strcmp(name, "Filter")) { Settings.filter = atoi(value); } + else if (!strcmp(name, "AspectRatio")) { Settings.aspect_ratio = atoi(value); } + else if (!strcmp(name, "Sound")) { Settings.sound = atoi(value); } + else if (!strcmp(name, "AutofirePattern")) { Settings.autofire_pattern = atoi(value); } + else if (!strcmp(name, "Palette")) { Settings.current_palette = atoi(value); } else if (!strcmp(name, "Elfpath")) { strcpy(Settings.elfpath, value); } else if (!strcmp(name, "Savepath")) { strcpy(Settings.savepath, value); } else if (!strcmp(name, "Skinpath")) { strcpy(Settings.skinpath, value); } @@ -447,18 +448,19 @@ void Save_Global_CNF(char *CNF_path_p) "# FCEULTRA.CNF == Configuration file for the emulator FCEUltra\r\n" "# CNF Handling Code (c)2006 Ronald Andersson aka dlanor \r\n" "# ------------------------------------------------------------\r\n" - "OffsetX = %d\r\n" - "OffsetY = %d\r\n" - "Display = %d\r\n" - "Emulation = %d\r\n" - "Interlace = %d\r\n" - "Filter = %d\r\n" - "AspectRatio = %d\r\n" - "Sound = %d\r\n" - "Palette = %d\r\n" - "Elfpath = %s\r\n" - "Savepath = %s\r\n" - "Skinpath = %s\r\n" + "OffsetX = %d\r\n" + "OffsetY = %d\r\n" + "Display = %d\r\n" + "Emulation = %d\r\n" + "Interlace = %d\r\n" + "Filter = %d\r\n" + "AspectRatio = %d\r\n" + "Sound = %d\r\n" + "AutofirePattern = %d\r\n" + "Palette = %d\r\n" + "Elfpath = %s\r\n" + "Savepath = %s\r\n" + "Skinpath = %s\r\n" ";Player 1 Controls\r\n" "JOY1_Menu = 0x%04x\r\n" "JOY1_SaveState = 0x%04x\r\n" @@ -519,6 +521,7 @@ void Save_Global_CNF(char *CNF_path_p) Settings.filter, Settings.aspect_ratio, Settings.sound, + Settings.autofire_pattern, Settings.current_palette, temp1, temp2, @@ -632,6 +635,7 @@ void Default_Global_CNF() Settings.aspect_ratio = 0; // Full Screen Settings.sound = 2; // 22050Hz Settings.input_4p_adaptor = 0; // False + Settings.autofire_pattern = 0; // 0 - 1-on, 1-off Settings.current_palette = 0; // 0 - Default strcpy(Settings.elfpath, "mc0:/BOOT/BOOT.ELF"); strcpy(Settings.savepath, "mc0:/FCEUMM/"); diff --git a/src/drivers/ps2/menu.c b/src/drivers/ps2/menu.c index 1fb81c6..d49a85f 100644 --- a/src/drivers/ps2/menu.c +++ b/src/drivers/ps2/menu.c @@ -53,7 +53,7 @@ extern GSTEXTURE MENU_TEX; /************************************/ /* Pad Variables */ /************************************/ -extern u32 old_pad[2]; +extern u32 old_pad[4]; static struct padButtonStatus buttons[2]; extern u8 fdsswap; @@ -538,9 +538,9 @@ void Ingame_Menu() { "Filtering: "}, { "Aspect Ratio: "}, { "Sound: " }, - { "4-Players Adaptor: " }, { "Configure Input >" }, { "---" }, + { "---" }, { "Reset Game" }, { "Exit Game" }, { "Exit Menu" }, @@ -574,10 +574,6 @@ void Ingame_Menu() sprintf(options_state[i], "%dHz", SND_GetCurrSampleRate()); break; case 6: - if (Settings.input_4p_adaptor) - strcpy(options_state[i], "On"); - else - strcpy(options_state[i], "Off"); break; case 7: break; @@ -686,19 +682,9 @@ void Ingame_Menu() option_changed = 1; break; case 6: - Settings.input_4p_adaptor ^= 1; - if (Settings.input_4p_adaptor) { - FCEUI_SetInputFC(SIFC_4PLAYER, NULL, 0); - strcpy(options_state[i], "On"); - } - else { - FCEUI_SetInputFC(SIFC_NONE, NULL, 0); - strcpy(options_state[i], "Off"); - } - option_changed = 1; + Ingame_Menu_Controls(); break; case 7: - Ingame_Menu_Controls(); break; case 8: break; @@ -805,8 +791,8 @@ void padbuttonToStr(u16 button, char button_name[9]) strcpy(button_name, buttons[i]); } -#define CONTROLS_N 12 -#define CONTROLS_OFFSET 2 +#define CONTROLS_N 14 +#define CONTROLS_OFFSET (CONTROLS_N - 10) void Ingame_Menu_Controls() { @@ -824,6 +810,8 @@ void Ingame_Menu_Controls() char options[CONTROLS_N][32] = { { "< Back" }, + { "Autofire Pattern: "}, + { "4-Players Adaptor: " }, { "Player: "}, { "Joy A | " }, { "Joy B | " }, @@ -843,7 +831,12 @@ void Ingame_Menu_Controls() int is_changing_button = 0; u32 new_button = 0; - strcpy(options_state[1], "1"); + sprintf(options_state[1], "1 on, %d off", Settings.autofire_pattern + 1); + if (Settings.input_4p_adaptor) + strcpy(options_state[2], "On"); + else + strcpy(options_state[2], "Off"); + strcpy(options_state[3], "1"); for (i = 0; i < 10; i++) { padbuttonToStr(Settings.PlayerInput[player][i + 5], options_state[i + CONTROLS_OFFSET]); } @@ -870,11 +863,11 @@ void Ingame_Menu_Controls() strcat(buffer, options_state[i]); if (selection == i) { //font_print(gsGlobal, menu_x1+10.0f, text_line + i*FONT_HEIGHT, 2, DarkYellowFont, options[i]); - printXY(buffer, menu_x1+10, text_line + i*FONT_HEIGHT, 4, FCEUSkin.highlight, 1, 0); + printXY(buffer, menu_x1+10, FONT_HEIGHT + text_line + i*FONT_HEIGHT, 4, FCEUSkin.highlight, 1, 0); } else { //font_print(gsGlobal, menu_x1+10.0f, text_line + i*FONT_HEIGHT, 2, WhiteFont, options[i]); - printXY(buffer, menu_x1+10, text_line + i*FONT_HEIGHT, 4, FCEUSkin.textcolor, 1, 0); + printXY(buffer, menu_x1+10, FONT_HEIGHT + text_line + i*FONT_HEIGHT, 4, FCEUSkin.textcolor, 1, 0); } } @@ -893,6 +886,26 @@ void Ingame_Menu_Controls() return; } else if (i == 1) { + Settings.autofire_pattern++; + if (Settings.autofire_pattern >= 5) { + Settings.autofire_pattern = 0; + } + sprintf(options_state[1], "1 on, %d off", Settings.autofire_pattern + 1); + option_changed = 1; + } + else if (i == 2) { + Settings.input_4p_adaptor ^= 1; + if (Settings.input_4p_adaptor) { + FCEUI_SetInputFC(SIFC_4PLAYER, NULL, 0); + strcpy(options_state[i], "On"); + } + else { + FCEUI_SetInputFC(SIFC_NONE, NULL, 0); + strcpy(options_state[i], "Off"); + } + option_changed = 1; + } + else if (i == 3) { player++; if (player >= 4) { player = 0; diff --git a/src/drivers/ps2/ps2fceu.h b/src/drivers/ps2/ps2fceu.h index 3e83221..a42c989 100644 --- a/src/drivers/ps2/ps2fceu.h +++ b/src/drivers/ps2/ps2fceu.h @@ -16,13 +16,14 @@ typedef struct { u8 emulation; u8 interlace; u8 filter; - u8 aspect_ratio; + int aspect_ratio; u8 sound; char elfpath[1024]; char savepath[1024]; char skinpath[1024]; u16 PlayerInput[4][15]; u8 input_4p_adaptor; + int autofire_pattern; int current_palette; } vars; diff --git a/src/drivers/ps2/ps2input.c b/src/drivers/ps2/ps2input.c index c58b510..9d8bb10 100644 --- a/src/drivers/ps2/ps2input.c +++ b/src/drivers/ps2/ps2input.c @@ -246,20 +246,20 @@ static unsigned char Get_PS2Input(int mport) } // Turbo A if (paddata[mport] & Settings.PlayerInput[mport][13]) { - rapid_a[mport] ^= 1; - if (rapid_a[mport]) { + if (!rapid_a[mport]) { P |= JOY_A; } + rapid_a[mport] = (rapid_a[mport] + 1) % (Settings.autofire_pattern + 2); } if (!(paddata[mport] & Settings.PlayerInput[mport][13]) && rapid_a[mport]) { rapid_a[mport] = 0; } // Turbo B if (paddata[mport] & Settings.PlayerInput[mport][14]) { - rapid_b[mport] ^= 1; - if (rapid_b[mport]) { + if (!rapid_b[mport]) { P |= JOY_B; } + rapid_b[mport] = (rapid_b[mport] + 1) % (Settings.autofire_pattern + 2); } if (!(paddata[mport] & Settings.PlayerInput[mport][14]) && rapid_b[mport]) { rapid_b[mport] = 0;