input stuff some kind of fixed, read comments for more info lol

This commit is contained in:
CaH4e3 2009-03-22 17:36:35 +00:00
parent 13f923675a
commit cce590ab26
3 changed files with 33 additions and 20 deletions

View File

@ -416,15 +416,15 @@ bool ShouldDisplayMapping(int mapn, int filter, const int* conflictTable)
}
else if(filter == EMUCMDTYPE_MAX + 1) /* Assigned */
{
return FCEUD_CommandMapping[mapn] != 0;
return FCEUD_CommandMapping[FCEUI_CommandTable[mapn].cmd] != 0;
}
else if(filter == EMUCMDTYPE_MAX + 2) /* Unassigned */
{
return FCEUD_CommandMapping[mapn] == 0;
return FCEUD_CommandMapping[FCEUI_CommandTable[mapn].cmd] == 0;
}
else if(filter == EMUCMDTYPE_MAX + 3) /* Conflicts */
{
return conflictTable[mapn] != 0;
return conflictTable[FCEUI_CommandTable[mapn].cmd] != 0;
}
else
{
@ -501,7 +501,7 @@ void PopulateMappingDisplay(HWND hwndDlg)
lvi.iItem = idx;
lvi.iSubItem = 0;
lvi.pszText = (char*)FCEUI_CommandTypeNames[FCEUI_CommandTable[i].type];
lvi.lParam = (LPARAM)i;
lvi.lParam = (LPARAM)FCEUI_CommandTable[i].cmd;
if(newItemCount<num)
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
@ -522,7 +522,7 @@ void PopulateMappingDisplay(HWND hwndDlg)
lvi.mask = LVIF_TEXT;
lvi.iItem = idx;
lvi.iSubItem = 2;
lvi.pszText = GetKeyComboName(FCEUD_CommandMapping[i]);
lvi.pszText = GetKeyComboName(FCEUD_CommandMapping[FCEUI_CommandTable[i].cmd]);
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);

View File

@ -617,7 +617,11 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_FRAME_ADVANCE, EMUCMDTYPE_MISC, FCEUI_FrameAdvance, FCEUI_FrameAdvanceEnd, 0, "Frame Advance", EMUCMDFLAG_TASEDIT },
{ EMUCMD_SCREENSHOT, EMUCMDTYPE_MISC, FCEUI_SaveSnapshot, 0, 0, "Screenshot", EMUCMDFLAG_TASEDIT },
{ EMUCMD_HIDE_MENU_TOGGLE, EMUCMDTYPE_MISC, FCEUD_HideMenuToggle, 0, 0, "Hide Menu Toggle", EMUCMDFLAG_TASEDIT },
//{ EMUCMD_EXIT, EMUCMDTYPE_MISC, DoFCEUExit, 0, 0, "Exit", 0}, //adelikat: This can't be added here without throwing off the entire enum table (which causes the default mappings to be incorrect and can lead to some crashes). Sorry, needs to be added to the end of the enum or more workarounds need to be done
//fixed: current command key handling handle only command table record index with
//the same as cmd enumerarot index, or else does wrong key mapping
//...i returned it back.
//adelikat, try to find true cause of problem before reversing it
{ EMUCMD_EXIT, EMUCMDTYPE_MISC, DoFCEUExit, 0, 0, "Exit", 0},
{ EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", 0 },
{ EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", 0 },
@ -725,34 +729,40 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
#define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0]))
static int execcmd;
// jabberwoocky my son, don't be aware lol
// this is much mindfucking thing i ever seen here
// even when i fixed it, there is a lot of possibilities to break all key input stuff with one
// unarranged command enumerator.
static int execcmd, i;
void FCEUI_HandleEmuCommands(TestCommandState* testfn)
{
bool tasedit = FCEUMOV_Mode(MOVIEMODE_TASEDIT);
for(execcmd=0; execcmd<NUM_EMU_CMDS; ++execcmd)
for(i=0; i<NUM_EMU_CMDS; ++i)
{
int new_state = (*testfn)(execcmd);
int old_state = FCEUI_CommandTable[execcmd].state;
int new_state;
int old_state = FCEUI_CommandTable[i].state;
execcmd = FCEUI_CommandTable[i].cmd;
new_state = (*testfn)(execcmd);
//in tasedit, forbid commands without the tasedit flag
bool allow = true;
if(tasedit && !(FCEUI_CommandTable[execcmd].flags & EMUCMDFLAG_TASEDIT))
if(tasedit && !(FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDIT))
allow = false;
if(allow)
{
if (new_state == 1 && old_state == 0 && FCEUI_CommandTable[execcmd].fn_on)
(*(FCEUI_CommandTable[execcmd].fn_on))();
else if (new_state == 0 && old_state == 1 && FCEUI_CommandTable[execcmd].fn_off)
(*(FCEUI_CommandTable[execcmd].fn_off))();
if (new_state == 1 && old_state == 0 && FCEUI_CommandTable[i].fn_on)
(*(FCEUI_CommandTable[i].fn_on))();
else if (new_state == 0 && old_state == 1 && FCEUI_CommandTable[i].fn_off)
(*(FCEUI_CommandTable[i].fn_off))();
}
FCEUI_CommandTable[execcmd].state = new_state;
FCEUI_CommandTable[i].state = new_state;
}
}
static void CommandUnImpl(void)
{
FCEU_DispMessage("command '%s' unimplemented.", FCEUI_CommandTable[execcmd].name);
FCEU_DispMessage("command '%s' unimplemented.", FCEUI_CommandTable[i].name);
}
static void CommandToggleDip(void)

View File

@ -108,6 +108,11 @@ enum EMUCMD
EMUCMD_FRAME_ADVANCE,
EMUCMD_SCREENSHOT,
EMUCMD_HIDE_MENU_TOGGLE,
//fixed: current command key handling handle only command table record index with
//the same as cmd enumerarot index, or else does wrong key mapping, fixed it but placed this enum here anyway
//...i returned it back.
//adelikat, try to find true cause of problem before reversing it
EMUCMD_EXIT,
EMUCMD_SPEED_SLOWEST,
EMUCMD_SPEED_SLOWER,
@ -213,9 +218,7 @@ enum EMUCMD
//-----------------------------
EMUCMD_MISC_DISPLAY_MOVIESUBTITLES,
EMUCMD_MISC_UNDOREDOSAVESTATE,
EMUCMD_MAX,
//For campatibility with old configuration files
//EMUCMD_EXIT //adelikat, EXIT hotkey commented out in input.cpp so commented out here too
EMUCMD_MAX
};
enum EMUCMDTYPE