Autofire pattern now remembered in config file.

This commit is contained in:
adelikat 2008-07-03 15:33:04 +00:00
parent 0a4d291e64
commit 13de73daf2
5 changed files with 35 additions and 2 deletions

View File

@ -57,6 +57,7 @@ extern int CDLogger_wndx, CDLogger_wndy;
extern int GGConv_wndx, GGConv_wndy;
extern int TasEdit_wndx, TasEdit_wndy;
extern int EnableAutosave;
extern int AFon, AFoff;
//Structure that contains configuration information
static CFGSTRUCT fceuconfig[] = {
@ -189,6 +190,8 @@ static CFGSTRUCT fceuconfig[] = {
AC(TasEdit_wndy),
AC(pauseAfterPlayback),
AC(AFon),
AC(AFoff),
//ACS(memwLastfile[2048]),
ENDCFGSTRUCT

View File

@ -664,7 +664,7 @@ int main(int argc,char *argv[])
}
if (MemWatchLoadOnStart) CreateMemWatch();
if (PauseAfterLoad) FCEUI_ToggleEmulationPause();
SetAutoFirePattern(AFon, AFoff);
UpdateCheckedMenuItems();
doloopy:
UpdateFCEUWindow();

View File

@ -39,6 +39,8 @@ extern int input_display;
extern int allowUDLR;
extern int pauseAfterPlayback;
extern int EnableBackgroundInput;
extern int AFon;
extern int AFoff;
extern int vmod;

View File

@ -112,6 +112,30 @@ static uint32 mousex,mousey,mouseb;
static int vchanged = 0;
int GetCheckedAutoFirePattern();
int GetCheckedAutoFirePattern()
{
//adelikat: sorry, I'm sure there is an easier way to accomplish this.
//This function allows the proper check to be displayed on the auto-fire pattern offset at start up when another autofire pattern is saved in config
if (AFon == 1 && AFoff == 2) return MENU_AUTOFIRE_PATTERN_2;
if (AFon == 1 && AFoff == 3) return MENU_AUTOFIRE_PATTERN_3;
if (AFon == 1 && AFoff == 4) return MENU_AUTOFIRE_PATTERN_4;
if (AFon == 1 && AFoff == 5) return MENU_AUTOFIRE_PATTERN_5;
if (AFon == 2 && AFoff == 1) return MENU_AUTOFIRE_PATTERN_6;
if (AFon == 2 && AFoff == 2) return MENU_AUTOFIRE_PATTERN_7;
if (AFon == 2 && AFoff == 3) return MENU_AUTOFIRE_PATTERN_8;
if (AFon == 2 && AFoff == 4) return MENU_AUTOFIRE_PATTERN_9;
if (AFon == 3 && AFoff == 1) return MENU_AUTOFIRE_PATTERN_10;
if (AFon == 3 && AFoff == 2) return MENU_AUTOFIRE_PATTERN_11;
if (AFon == 3 && AFoff == 3) return MENU_AUTOFIRE_PATTERN_12;
if (AFon == 4 && AFoff == 1) return MENU_AUTOFIRE_PATTERN_13;
if (AFon == 4 && AFoff == 2) return MENU_AUTOFIRE_PATTERN_14;
if (AFon == 5 && AFoff == 1) return MENU_AUTOFIRE_PATTERN_15;
return MENU_AUTOFIRE_PATTERN_1;
}
// Internal functions
void SplitRecentArchiveFilename(std::string src, std::string& archive, std::string& file)
@ -311,7 +335,7 @@ void UpdateCheckedMenuItems()
0};
x = 0;
CheckedAutoFirePattern = GetCheckedAutoFirePattern();
while(AutoFirePatternIDs[x])
{
CheckMenuItem(fceumenu, AutoFirePatternIDs[x],

View File

@ -52,10 +52,13 @@
//TODO - we really need some kind of global platform-specific options api
#ifdef WIN32
#include "drivers/win/main.h"
#else
#include "drivers/sdl/sdl.h"
#endif
int AFon, AFoff;
static void CloseGame(void)
{
if(GameInfo)
@ -465,6 +468,7 @@ void SetAutoFirePattern(int onframes, int offframes)
{
AutoFirePatternLength = onframes + offframes;
}
AFon = onframes; AFoff = offframes;
}
void SetAutoFireOffset(int offset)