Merge remote-tracking branch 'TasVideos/master'
This commit is contained in:
commit
afdf192a46
Binary file not shown.
|
@ -9,7 +9,7 @@ cd %PROJECT_ROOT%\vc
|
||||||
REM Create Zip Archive
|
REM Create Zip Archive
|
||||||
|
|
||||||
cd %PROJECT_ROOT%\output
|
cd %PROJECT_ROOT%\output
|
||||||
..\vc\zip -X -9 -j ..\vc\fceux64.zip ..\vc\x64\Release\fceux64.exe ..\src\drivers\win\lua\x64\lua5.1.dll ..\src\drivers\win\lua\x64\lua51.dll ..\src\auxlib.lua ..\src\drivers\win\7z.dll
|
..\vc\zip -X -9 -j ..\vc\fceux64.zip ..\vc\x64\Release\fceux64.exe ..\src\drivers\win\lua\x64\lua5.1.dll ..\src\drivers\win\lua\x64\lua51.dll ..\src\auxlib.lua ..\src\drivers\win\7z_64.dll
|
||||||
@if ERRORLEVEL 1 goto end
|
@if ERRORLEVEL 1 goto end
|
||||||
..\vc\zip -X -9 -u -r ..\vc\fceux64.zip fceux.chm taseditor.chm palettes luaScripts tools
|
..\vc\zip -X -9 -u -r ..\vc\fceux64.zip fceux.chm taseditor.chm palettes luaScripts tools
|
||||||
@if ERRORLEVEL 1 goto end
|
@if ERRORLEVEL 1 goto end
|
||||||
|
|
|
@ -23,16 +23,21 @@ void LoadFCEUConfig(const char *filename, CFGSTRUCT *cfgst);
|
||||||
// isn't really hurting much.
|
// isn't really hurting much.
|
||||||
|
|
||||||
// Single piece of data(integer).
|
// Single piece of data(integer).
|
||||||
#define AC(x) { #x,&x,sizeof(x)}
|
#define AC(x) {#x,&x,sizeof(x)}
|
||||||
#define NAC(w,x) { #w,&x,sizeof(x)}
|
#define NAC(w,x) {#w,&x,sizeof(x)}
|
||||||
|
// VAC intruduced for backward compatibility with
|
||||||
|
// configuration files of previous versions
|
||||||
|
#define VAC(x,version) {#x "_V" #version,&x,sizeof(x)}
|
||||||
|
|
||||||
// Array.
|
// Array.
|
||||||
#define ACA(x) {#x,x,sizeof(x)}
|
#define ACA(x) {#x,x,sizeof(x)}
|
||||||
#define NACA(w,x) {#w,x,sizeof(x)}
|
#define NACA(w,x) {#w,x,sizeof(x)}
|
||||||
|
#define VACA(x,version) {#x "_V" #version,x,sizeof(x)}
|
||||||
|
|
||||||
// String(pointer) with automatic memory allocation.
|
// String(pointer) with automatic memory allocation.
|
||||||
#define ACS(x) {#x,&x,0}
|
#define ACS(x) {#x,&x,0}
|
||||||
#define NACS(w,x) {#w,&x,0}
|
#define NACS(w,x) {#w,&x,0}
|
||||||
|
#define VACS(x,version) {#x "_V" #version,&x,0}
|
||||||
|
|
||||||
#define _DRIVERS_CONFIGH
|
#define _DRIVERS_CONFIGH
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
extern CFGSTRUCT NetplayConfig[];
|
extern CFGSTRUCT NetplayConfig[];
|
||||||
extern CFGSTRUCT InputConfig[];
|
extern CFGSTRUCT InputConfig[];
|
||||||
extern CFGSTRUCT HotkeyConfig[];
|
extern CFGSTRUCT HotkeyConfig[];
|
||||||
extern int autoHoldKey, autoHoldClearKey;
|
|
||||||
extern int frameAdvance_Delay;
|
extern int frameAdvance_Delay;
|
||||||
extern int EnableAutosave, AutosaveQty, AutosaveFrequency;
|
extern int EnableAutosave, AutosaveQty, AutosaveFrequency;
|
||||||
extern int AFon, AFoff, AutoFireOffset;
|
extern int AFon, AFoff, AutoFireOffset;
|
||||||
|
@ -272,8 +271,6 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
ADDCFGSTRUCT(InputConfig),
|
ADDCFGSTRUCT(InputConfig),
|
||||||
ADDCFGSTRUCT(HotkeyConfig),
|
ADDCFGSTRUCT(HotkeyConfig),
|
||||||
|
|
||||||
AC(autoHoldKey),
|
|
||||||
AC(autoHoldClearKey),
|
|
||||||
AC(frame_display),
|
AC(frame_display),
|
||||||
AC(rerecord_display),
|
AC(rerecord_display),
|
||||||
AC(input_display),
|
AC(input_display),
|
||||||
|
|
|
@ -98,7 +98,7 @@ void ParseGIInput(FCEUGI *gi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ButtConfig autoHoldKeys, autoHoldClearKeys;
|
||||||
static uint8 QuizKingData=0;
|
static uint8 QuizKingData=0;
|
||||||
static uint8 HyperShotData=0;
|
static uint8 HyperShotData=0;
|
||||||
static uint32 MahjongData=0;
|
static uint32 MahjongData=0;
|
||||||
|
@ -108,7 +108,7 @@ static uint32 FamiNetSysData = 0;
|
||||||
|
|
||||||
static void UpdateFKB(void);
|
static void UpdateFKB(void);
|
||||||
static void UpdateSuborKB(void);
|
static void UpdateSuborKB(void);
|
||||||
void UpdateGamepad(void);
|
void UpdateGamepad(bool snes);
|
||||||
static void UpdateQuizKing(void);
|
static void UpdateQuizKing(void);
|
||||||
static void UpdateHyperShot(void);
|
static void UpdateHyperShot(void);
|
||||||
static void UpdateMahjong(void);
|
static void UpdateMahjong(void);
|
||||||
|
@ -122,8 +122,6 @@ int NoWaiting=0;
|
||||||
bool turbo = false;
|
bool turbo = false;
|
||||||
|
|
||||||
#include "keyscan.h"
|
#include "keyscan.h"
|
||||||
static unsigned int *keys=0;
|
|
||||||
static unsigned int *keys_nr=0;
|
|
||||||
static int DIPS=0;
|
static int DIPS=0;
|
||||||
|
|
||||||
//#define KEY(__a) keys_nr[MKK(__a)]
|
//#define KEY(__a) keys_nr[MKK(__a)]
|
||||||
|
@ -183,28 +181,6 @@ int GetAutoFireDesynch()
|
||||||
return DesynchAutoFire;
|
return DesynchAutoFire;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test button state using current keyboard data.
|
|
||||||
// Clone of DTestButton, but uses local variables.
|
|
||||||
int DTestButtonImmediate(ButtConfig *bc)
|
|
||||||
{
|
|
||||||
uint32 x;//mbg merge 7/17/06 changed to uint
|
|
||||||
|
|
||||||
static unsigned int *keys_im=GetKeyboard_nr();
|
|
||||||
|
|
||||||
for(x=0;x<bc->NumC;x++)
|
|
||||||
{
|
|
||||||
if(bc->ButtType[x]==BUTTC_KEYBOARD)
|
|
||||||
{
|
|
||||||
if(keys_im[bc->ButtonNum[x]])
|
|
||||||
{
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(DTestButtonJoy(bc)) return(1); // Needs joystick.h. Tested with PPJoy mapped with Print Screen
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 GetGamepadPressedImmediate()
|
uint32 GetGamepadPressedImmediate()
|
||||||
{
|
{
|
||||||
// Get selected joypad buttons, ignoring NES polling
|
// Get selected joypad buttons, ignoring NES polling
|
||||||
|
@ -220,7 +196,7 @@ uint32 GetGamepadPressedImmediate()
|
||||||
{
|
{
|
||||||
|
|
||||||
for(x=0;x<8;x++)
|
for(x=0;x<8;x++)
|
||||||
if(DTestButtonImmediate(&GamePadConfig[wg][x]))
|
if(DTestButton(&GamePadConfig[wg][x]))
|
||||||
JSButtons|=(1<<x)<<(wg<<3);
|
JSButtons|=(1<<x)<<(wg<<3);
|
||||||
|
|
||||||
// Check if U+D/L+R is disabled
|
// Check if U+D/L+R is disabled
|
||||||
|
@ -236,22 +212,66 @@ uint32 GetGamepadPressedImmediate()
|
||||||
return JSButtons;
|
return JSButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DTestButton(ButtConfig *bc)
|
int DTestButton(ButtConfig *bc, uint8_t just_down)
|
||||||
{
|
{
|
||||||
uint32 x;//mbg merge 7/17/06 changed to uint
|
static unsigned int *keys_data = !just_down ? GetKeyboard_nr() : GetKeyboard_jd();
|
||||||
|
|
||||||
for(x=0;x<bc->NumC;x++)
|
for(int x=0; x < bc->NumC; x++)
|
||||||
{
|
{
|
||||||
if(bc->ButtType[x]==BUTTC_KEYBOARD)
|
if(bc->ButtType[x] == BUTTC_KEYBOARD)
|
||||||
{
|
{
|
||||||
if(keys_nr[bc->ButtonNum[x]])
|
int cmd = bc->ButtonNum[x];
|
||||||
|
int cmdmask = cmd&CMD_KEY_MASK;
|
||||||
|
|
||||||
|
/* test CTRL, SHIFT, ALT */
|
||||||
|
if (cmd & CMD_KEY_ALT)
|
||||||
{
|
{
|
||||||
return(1);
|
int ctlstate = (cmd & CMD_KEY_LALT) ? keys_data[SCAN_LEFTALT] : 0;
|
||||||
|
ctlstate |= (cmd & CMD_KEY_RALT) ? keys_data[SCAN_RIGHTALT] : 0;
|
||||||
|
if (!ctlstate)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if ((cmdmask != SCAN_LEFTALT && keys_data[SCAN_LEFTALT]) || (cmdmask != SCAN_RIGHTALT && keys_data[SCAN_RIGHTALT]))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (cmd & CMD_KEY_CTRL)
|
||||||
|
{
|
||||||
|
int ctlstate = (cmd & CMD_KEY_LCTRL) ? keys_data[SCAN_LEFTCONTROL] : 0;
|
||||||
|
ctlstate |= (cmd & CMD_KEY_RCTRL) ? keys_data[SCAN_RIGHTCONTROL] : 0;
|
||||||
|
if (!ctlstate)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ((cmdmask != SCAN_LEFTCONTROL && keys_data[SCAN_LEFTCONTROL]) || (cmdmask != SCAN_RIGHTCONTROL && keys_data[SCAN_RIGHTCONTROL]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (cmd & CMD_KEY_SHIFT)
|
||||||
|
{
|
||||||
|
int ctlstate = (cmd & CMD_KEY_LSHIFT) ? keys_data[SCAN_LEFTSHIFT] : 0;
|
||||||
|
ctlstate |= (cmd & CMD_KEY_RSHIFT) ? keys_data[SCAN_RIGHTSHIFT] : 0;
|
||||||
|
if (!ctlstate)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ((cmdmask != SCAN_LEFTSHIFT && keys_data[SCAN_LEFTSHIFT]) || (cmdmask != SCAN_RIGHTSHIFT && keys_data[SCAN_RIGHTSHIFT]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (cmd & CMD_KEY_WIN)
|
||||||
|
{
|
||||||
|
int ctlstate = (cmd & CMD_KEY_LWIN) ? keys_data[SCAN_LEFTWIN] : 0;
|
||||||
|
ctlstate |= (cmd & CMD_KEY_RWIN) ? keys_data[SCAN_RIGHTWIN] : 0;
|
||||||
|
if (!ctlstate)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ((cmdmask != SCAN_LEFTWIN && keys_data[SCAN_LEFTWIN]) || (cmdmask != SCAN_RIGHTWIN && keys_data[SCAN_RIGHTWIN]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(keys_data[cmdmask])
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(DTestButtonJoy(bc)) return(1);
|
if (DTestButtonJoy(bc)) return 1;
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateGamepad(bool snes)
|
void UpdateGamepad(bool snes)
|
||||||
|
@ -852,23 +872,22 @@ static void UpdateFTrainer(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DWaitButton(HWND hParent, const uint8 *text, ButtConfig *bc);
|
|
||||||
int DWaitSimpleButton(HWND hParent, const uint8 *text);
|
|
||||||
|
|
||||||
CFGSTRUCT InputConfig[]={
|
CFGSTRUCT InputConfig[]={
|
||||||
AC(powerpadsc),
|
VAC(powerpadsc, 2),
|
||||||
AC(QuizKingButtons),
|
VAC(QuizKingButtons, 2),
|
||||||
AC(FTrainerButtons),
|
VAC(FTrainerButtons, 2),
|
||||||
AC(HyperShotButtons),
|
VAC(HyperShotButtons, 2),
|
||||||
AC(MahjongButtons),
|
VAC(MahjongButtons, 2),
|
||||||
AC(GamePadConfig),
|
VAC(GamePadConfig, 2),
|
||||||
AC(GamePadPreset1),
|
VAC(GamePadPreset1, 2),
|
||||||
AC(GamePadPreset2),
|
VAC(GamePadPreset2, 2),
|
||||||
AC(GamePadPreset3),
|
VAC(GamePadPreset3, 2),
|
||||||
AC(fkbmap),
|
VAC(fkbmap, 2),
|
||||||
AC(suborkbmap),
|
VAC(suborkbmap, 2),
|
||||||
AC(virtualboysc),
|
VAC(virtualboysc, 2),
|
||||||
AC(lcdcompzappersc),
|
VAC(lcdcompzappersc, 2),
|
||||||
|
AC(autoHoldKeys),
|
||||||
|
AC(autoHoldClearKeys),
|
||||||
ENDCFGSTRUCT
|
ENDCFGSTRUCT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -908,9 +927,15 @@ void InitInputStuff(void)
|
||||||
for (x = 0; x < 2; x++)
|
for (x = 0; x < 2; x++)
|
||||||
for (y = 0; y < 2; y++)
|
for (y = 0; y < 2; y++)
|
||||||
JoyClearBC(&lcdcompzappersc[x][y]);
|
JoyClearBC(&lcdcompzappersc[x][y]);
|
||||||
|
|
||||||
|
JoyClearBC(&autoHoldKeys);
|
||||||
|
JoyClearBC(&autoHoldClearKeys);
|
||||||
|
|
||||||
|
for (x = 0; x<EMUCMD_MAX; x++)
|
||||||
|
JoyClearBC(&FCEUD_CommandMapping[x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *MakeButtString(ButtConfig *bc)
|
char *MakeButtString(ButtConfig *bc, int appendKB)
|
||||||
{
|
{
|
||||||
uint32 x; //mbg merge 7/17/06 changed to uint
|
uint32 x; //mbg merge 7/17/06 changed to uint
|
||||||
char tmpstr[512];
|
char tmpstr[512];
|
||||||
|
@ -924,11 +949,74 @@ static char *MakeButtString(ButtConfig *bc)
|
||||||
|
|
||||||
if(bc->ButtType[x] == BUTTC_KEYBOARD)
|
if(bc->ButtType[x] == BUTTC_KEYBOARD)
|
||||||
{
|
{
|
||||||
strcat(tmpstr,"KB: ");
|
if (appendKB)
|
||||||
if(!GetKeyNameText(((bc->ButtonNum[x] & 0x7F) << 16) | ((bc->ButtonNum[x] & 0x80) << 17), tmpstr+strlen(tmpstr), 16))
|
strcat(tmpstr,"KB: ");
|
||||||
|
|
||||||
|
if ((bc->ButtonNum[x] & CMD_KEY_CTRL) == CMD_KEY_CTRL)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Ctrl + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_CTRL) == CMD_KEY_LCTRL)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Left Ctrl + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_CTRL) == CMD_KEY_RCTRL)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Right Ctrl + ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bc->ButtonNum[x] & CMD_KEY_ALT) == CMD_KEY_ALT)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Alt + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_ALT) == CMD_KEY_LALT)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Left Alt + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_ALT) == CMD_KEY_RALT)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Right Alt + ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bc->ButtonNum[x] & CMD_KEY_SHIFT) == CMD_KEY_SHIFT)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Shift + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_SHIFT) == CMD_KEY_LSHIFT)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Left Shift + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_SHIFT) == CMD_KEY_RSHIFT)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Right Shift + ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bc->ButtonNum[x] & CMD_KEY_WIN) == CMD_KEY_WIN)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Win + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_WIN) == CMD_KEY_LWIN)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Left Win + ");
|
||||||
|
}
|
||||||
|
else if ((bc->ButtonNum[x] & CMD_KEY_WIN) == CMD_KEY_RWIN)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Right Win + ");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For some weird reason NumLock and Pause keys are messed up */
|
||||||
|
if (bc->ButtonNum[x] == SCAN_NUMLOCK)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "NumLock");
|
||||||
|
}
|
||||||
|
else if (bc->ButtonNum[x] == SCAN_PAUSE)
|
||||||
|
{
|
||||||
|
strcat(tmpstr, "Pause");
|
||||||
|
}
|
||||||
|
else if (!GetKeyNameText(((bc->ButtonNum[x] & 0x7F) << 16) | ((bc->ButtonNum[x] & 0x80) << 17), tmpstr + strlen(tmpstr), 16))
|
||||||
{
|
{
|
||||||
// GetKeyNameText wasn't able to provide a name for the key, then just show scancode
|
// GetKeyNameText wasn't able to provide a name for the key, then just show scancode
|
||||||
sprintf(tmpstr+strlen(tmpstr),"%03d",bc->ButtonNum[x]);
|
sprintf(tmpstr + strlen(tmpstr), "%03d", bc->ButtonNum[x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(bc->ButtType[x] == BUTTC_JOYSTICK)
|
else if(bc->ButtType[x] == BUTTC_JOYSTICK)
|
||||||
|
@ -937,8 +1025,8 @@ static char *MakeButtString(ButtConfig *bc)
|
||||||
sprintf(tmpstr+strlen(tmpstr), "%d ", bc->DeviceNum[x]);
|
sprintf(tmpstr+strlen(tmpstr), "%d ", bc->DeviceNum[x]);
|
||||||
if(bc->ButtonNum[x] & 0x8000)
|
if(bc->ButtonNum[x] & 0x8000)
|
||||||
{
|
{
|
||||||
char *asel[3]={"x","y","z"};
|
char *asel[6]={"x","y","z","rx","ry","rz"};
|
||||||
sprintf(tmpstr+strlen(tmpstr), "axis %s%s", asel[bc->ButtonNum[x] & 3],(bc->ButtonNum[x]&0x4000)?"-":"+");
|
sprintf(tmpstr+strlen(tmpstr), "axis %s%s", asel[bc->ButtonNum[x] & 7],(bc->ButtonNum[x]&0x4000)?"-":"+");
|
||||||
}
|
}
|
||||||
else if(bc->ButtonNum[x] & 0x2000)
|
else if(bc->ButtonNum[x] & 0x2000)
|
||||||
{
|
{
|
||||||
|
@ -958,39 +1046,147 @@ static char *MakeButtString(ButtConfig *bc)
|
||||||
return(astr);
|
return(astr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint8 keyonce[MKK_COUNT];
|
||||||
|
|
||||||
|
static int IsNewpressed(int a)
|
||||||
|
{
|
||||||
|
unsigned int *keys_nr = GetKeyboard_nr();
|
||||||
|
if (keys_nr[a])
|
||||||
|
{
|
||||||
|
if (!keyonce[a])
|
||||||
|
{
|
||||||
|
keyonce[a] = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
keyonce[a] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetKeyPressed()
|
||||||
|
{
|
||||||
|
int key = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
unsigned int keys_nr = *GetKeyboard_nr();
|
||||||
|
|
||||||
|
for (i = 0; i < 256 && !key; ++i)
|
||||||
|
{
|
||||||
|
if (IsNewpressed(i))
|
||||||
|
{
|
||||||
|
key = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int NothingPressed()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
unsigned int *keys_nr = GetKeyboard_nr();
|
||||||
|
|
||||||
|
for (i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
if (keys_nr[i])
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetKeyMeta(int key)
|
||||||
|
{
|
||||||
|
int meta = key & (~CMD_KEY_MASK);
|
||||||
|
|
||||||
|
switch (key & CMD_KEY_MASK)
|
||||||
|
{
|
||||||
|
case SCAN_LEFTCONTROL:
|
||||||
|
case SCAN_RIGHTCONTROL:
|
||||||
|
return CMD_KEY_CTRL | meta;
|
||||||
|
|
||||||
|
case SCAN_LEFTALT:
|
||||||
|
case SCAN_RIGHTALT:
|
||||||
|
return CMD_KEY_ALT | meta;
|
||||||
|
|
||||||
|
case SCAN_LEFTSHIFT:
|
||||||
|
case SCAN_RIGHTSHIFT:
|
||||||
|
return CMD_KEY_SHIFT | meta;
|
||||||
|
|
||||||
|
case SCAN_LEFTWIN:
|
||||||
|
case SCAN_RIGHTWIN:
|
||||||
|
return CMD_KEY_WIN | meta;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ClearExtraMeta(int* key)
|
||||||
|
{
|
||||||
|
switch ((*key) & 0xff)
|
||||||
|
{
|
||||||
|
case SCAN_LEFTCONTROL:
|
||||||
|
case SCAN_RIGHTCONTROL:
|
||||||
|
*key &= ~(CMD_KEY_CTRL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCAN_LEFTALT:
|
||||||
|
case SCAN_RIGHTALT:
|
||||||
|
*key &= ~(CMD_KEY_ALT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCAN_LEFTSHIFT:
|
||||||
|
case SCAN_RIGHTSHIFT:
|
||||||
|
*key &= ~(CMD_KEY_SHIFT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int DWBStarted;
|
static int DWBStarted;
|
||||||
static ButtConfig *DWBButtons;
|
static ButtConfig *DWBButtons;
|
||||||
static const uint8 *DWBText;
|
static ButtConfig DWBButtonsBackup;
|
||||||
|
static const char *DWBText;
|
||||||
|
static uint8 DWBFirstPress;
|
||||||
|
|
||||||
static HWND die;
|
static HWND die;
|
||||||
|
|
||||||
static INT_PTR CALLBACK DWBCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static INT_PTR CALLBACK DWBCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
static int key = 0;
|
||||||
switch(uMsg) {
|
switch(uMsg) {
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
die = NULL;
|
die = NULL;
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
{
|
{
|
||||||
uint8 devicenum;
|
uint8 devicenum;
|
||||||
uint16 buttonnum;
|
uint16 buttonnum;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
|
ButtConfig *bc = DWBButtons;
|
||||||
|
char *nstr;
|
||||||
|
|
||||||
if(DoJoyWaitTest(&guid, &devicenum, &buttonnum))
|
if(DoJoyWaitTest(&guid, &devicenum, &buttonnum))
|
||||||
{
|
{
|
||||||
ButtConfig *bc = DWBButtons;
|
if (DWBFirstPress)
|
||||||
char *nstr;
|
|
||||||
int wc;
|
|
||||||
if(DWBStarted)
|
|
||||||
{
|
{
|
||||||
ButtConfig *bc = DWBButtons;
|
|
||||||
bc->NumC = 0;
|
bc->NumC = 0;
|
||||||
DWBStarted = 0;
|
DWBFirstPress = 0;
|
||||||
}
|
}
|
||||||
wc = bc->NumC;
|
int wc = bc->NumC;
|
||||||
//FCEU_printf("%d: %d\n",devicenum,buttonnum);
|
|
||||||
bc->ButtType[wc]=BUTTC_JOYSTICK;
|
bc->ButtType[wc]=BUTTC_JOYSTICK;
|
||||||
bc->DeviceNum[wc]=devicenum;
|
bc->DeviceNum[wc]=devicenum;
|
||||||
bc->ButtonNum[wc]=buttonnum;
|
bc->ButtonNum[wc]=buttonnum;
|
||||||
|
@ -1010,58 +1206,84 @@ static INT_PTR CALLBACK DWBCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
||||||
free(nstr);
|
free(nstr);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
int newkey;
|
||||||
|
int meta = GetKeyMeta(key);
|
||||||
|
|
||||||
|
KeyboardUpdateState();
|
||||||
|
|
||||||
|
if ((newkey = GetKeyPressed()) != 0)
|
||||||
|
{
|
||||||
|
key = newkey | meta;
|
||||||
|
ClearExtraMeta(&key);
|
||||||
|
if (DWBFirstPress)
|
||||||
|
{
|
||||||
|
bc->NumC = 0;
|
||||||
|
DWBFirstPress = 0;
|
||||||
|
}
|
||||||
|
int wc = bc->NumC;
|
||||||
|
bc->ButtType[wc] = BUTTC_KEYBOARD;
|
||||||
|
bc->DeviceNum[wc] = 0;
|
||||||
|
bc->ButtonNum[wc] = key;
|
||||||
|
|
||||||
|
/* Stop config if the user pushes the same button twice in a row. */
|
||||||
|
if (wc && bc->ButtType[wc] == bc->ButtType[wc - 1] && bc->DeviceNum[wc] == bc->DeviceNum[wc - 1] &&
|
||||||
|
bc->ButtonNum[wc] == bc->ButtonNum[wc - 1])
|
||||||
|
goto gornk;
|
||||||
|
|
||||||
|
bc->NumC++;
|
||||||
|
nstr = MakeButtString(bc);
|
||||||
|
bc->NumC--;
|
||||||
|
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
||||||
|
free(nstr);
|
||||||
|
}
|
||||||
|
else if (NothingPressed() && key)
|
||||||
|
{
|
||||||
|
int wc = bc->NumC;
|
||||||
|
bc->ButtType[wc] = BUTTC_KEYBOARD;
|
||||||
|
bc->DeviceNum[wc] = 0;
|
||||||
|
bc->ButtonNum[wc] = key;
|
||||||
|
|
||||||
|
/* Stop config if the user pushes the same button twice in a row. */
|
||||||
|
if (wc && bc->ButtType[wc] == bc->ButtType[wc - 1] && bc->DeviceNum[wc] == bc->DeviceNum[wc - 1] &&
|
||||||
|
bc->ButtonNum[wc] == bc->ButtonNum[wc - 1])
|
||||||
|
goto gornk;
|
||||||
|
|
||||||
|
bc->NumC++;
|
||||||
|
/* Stop config if we reached our maximum button limit. */
|
||||||
|
if (bc->NumC >= MAXBUTTCONFIG)
|
||||||
|
goto gornk;
|
||||||
|
|
||||||
|
nstr = MakeButtString(bc);
|
||||||
|
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
||||||
|
free(nstr);
|
||||||
|
|
||||||
|
key = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WM_USER + 666:
|
|
||||||
//SetFocus(GetDlgItem(hwndDlg,LBL_DWBDIALOG_TEXT));
|
|
||||||
if(DWBStarted)
|
|
||||||
{
|
|
||||||
char *nstr;
|
|
||||||
ButtConfig *bc = DWBButtons;
|
|
||||||
bc->NumC = 0;
|
|
||||||
DWBStarted = 0;
|
|
||||||
nstr = MakeButtString(bc);
|
|
||||||
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
|
||||||
free(nstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ButtConfig *bc = DWBButtons;
|
|
||||||
int wc = bc->NumC;
|
|
||||||
char *nstr;
|
|
||||||
|
|
||||||
bc->ButtType[wc]=BUTTC_KEYBOARD;
|
|
||||||
bc->DeviceNum[wc]=0;
|
|
||||||
bc->ButtonNum[wc]=lParam&255;
|
|
||||||
|
|
||||||
//Stop config if the user pushes the same button twice in a row.
|
|
||||||
if(wc && bc->ButtType[wc]==bc->ButtType[wc-1] && bc->DeviceNum[wc]==bc->DeviceNum[wc-1] &&
|
|
||||||
bc->ButtonNum[wc]==bc->ButtonNum[wc-1])
|
|
||||||
goto gornk;
|
|
||||||
|
|
||||||
bc->NumC++;
|
|
||||||
//Stop config if we reached our maximum button limit.
|
|
||||||
if(bc->NumC >= MAXBUTTCONFIG)
|
|
||||||
goto gornk;
|
|
||||||
|
|
||||||
nstr = MakeButtString(bc);
|
|
||||||
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
|
||||||
free(nstr);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
key = 0;
|
||||||
|
DWBFirstPress = 1;
|
||||||
|
memset(keyonce, 0, sizeof(keyonce));
|
||||||
|
memcpy(&DWBButtonsBackup, DWBButtons, sizeof(ButtConfig));
|
||||||
SetWindowText(hwndDlg, (char*)DWBText); //mbg merge 7/17/06 added cast
|
SetWindowText(hwndDlg, (char*)DWBText); //mbg merge 7/17/06 added cast
|
||||||
BeginJoyWait(hwndDlg);
|
BeginJoyWait(hwndDlg);
|
||||||
|
KeyboardSetBackgroundAccess(true);
|
||||||
SetTimer(hwndDlg,666,25,0); //Every 25ms.
|
SetTimer(hwndDlg,666,25,0); //Every 25ms.
|
||||||
|
if (DWBButtons->NumC)
|
||||||
{
|
{
|
||||||
char *nstr = MakeButtString(DWBButtons);
|
char *nstr = MakeButtString(DWBButtons);
|
||||||
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
SetDlgItemText(hwndDlg, LBL_DWBDIALOG_TEXT, nstr);
|
||||||
free(nstr);
|
free(nstr);
|
||||||
}
|
}
|
||||||
|
/* workaround for enter and tab keys */
|
||||||
|
SetFocus(NULL);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
case WM_QUIT: goto gornk;
|
case WM_QUIT: goto gornk;
|
||||||
|
|
||||||
|
@ -1078,106 +1300,32 @@ static INT_PTR CALLBACK DWBCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
free(nstr);
|
free(nstr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BTN_CANCEL:
|
||||||
|
memcpy(DWBButtons, &DWBButtonsBackup, sizeof(ButtConfig));
|
||||||
|
goto gornk;
|
||||||
case BTN_CLOSE:
|
case BTN_CLOSE:
|
||||||
gornk:
|
gornk:
|
||||||
KillTimer(hwndDlg,666);
|
KillTimer(hwndDlg,666);
|
||||||
EndJoyWait(hAppWnd);
|
EndJoyWait(hAppWnd);
|
||||||
SetForegroundWindow(GetParent(hwndDlg));
|
KeyboardSetBackgroundAccess(false);
|
||||||
DestroyWindow(hwndDlg);
|
EndDialog(hwndDlg, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DWaitButton(HWND hParent, const uint8 *text, ButtConfig *bc)
|
int DWaitButton(HWND hParent, const char *text, ButtConfig *bc)
|
||||||
{
|
{
|
||||||
DWBText=text;
|
DWBText=text;
|
||||||
DWBButtons = bc;
|
DWBButtons = bc;
|
||||||
DWBStarted = 1;
|
DWBStarted = 1;
|
||||||
|
|
||||||
die = CreateDialog(fceu_hInstance, "DWBDIALOG", hParent, DWBCallB);
|
int nRet = DialogBox(fceu_hInstance, "DWBDIALOG", hParent, DWBCallB);
|
||||||
|
SetFocus(hParent);
|
||||||
EnableWindow(hParent, 0);
|
|
||||||
|
|
||||||
ShowWindow(die, 1);
|
|
||||||
|
|
||||||
while(die)
|
|
||||||
{
|
|
||||||
MSG msg;
|
|
||||||
while(PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE))
|
|
||||||
{
|
|
||||||
if(GetMessage(&msg, 0, 0, 0) > 0)
|
|
||||||
{
|
|
||||||
if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
|
|
||||||
{
|
|
||||||
LPARAM tmpo;
|
|
||||||
|
|
||||||
tmpo = ((msg.lParam >> 16) & 0x7F) | ((msg.lParam >> 17) & 0x80);
|
|
||||||
PostMessage(die,WM_USER+666,0,tmpo);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(msg.message == WM_SYSCOMMAND) continue;
|
|
||||||
if(!IsDialogMessage(die, &msg))
|
|
||||||
{
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableWindow(hParent, 1);
|
|
||||||
return 0; //mbg merge TODO 7/17/06 - had to add this return value--is it right?
|
return 0; //mbg merge TODO 7/17/06 - had to add this return value--is it right?
|
||||||
}
|
}
|
||||||
|
|
||||||
int DWaitSimpleButton(HWND hParent, const uint8 *text)
|
|
||||||
{
|
|
||||||
DWBStarted = 1;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
die = CreateDialog(fceu_hInstance, "DWBDIALOGSIMPLE", hParent, NULL);
|
|
||||||
SetWindowText(die, (char*)text); //mbg merge 7/17/06 added cast
|
|
||||||
EnableWindow(hParent, 0);
|
|
||||||
|
|
||||||
ShowWindow(die, 1);
|
|
||||||
|
|
||||||
while(die)
|
|
||||||
{
|
|
||||||
MSG msg;
|
|
||||||
while(PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE))
|
|
||||||
{
|
|
||||||
if(GetMessage(&msg, 0, 0, 0) > 0)
|
|
||||||
{
|
|
||||||
if(msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
|
|
||||||
{
|
|
||||||
LPARAM tmpo;
|
|
||||||
|
|
||||||
tmpo=((msg.lParam>>16)&0x7F)|((msg.lParam>>17)&0x80);
|
|
||||||
ret = tmpo;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if(msg.message == WM_SYSCOMMAND) continue;
|
|
||||||
if(!IsDialogMessage(die, &msg))
|
|
||||||
{
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Sleep(10);
|
|
||||||
}
|
|
||||||
done:
|
|
||||||
EndDialog(die,0);
|
|
||||||
EnableWindow(hParent, 1);
|
|
||||||
|
|
||||||
if(ret == 1) // convert Esc to nothing (why is it 1 and not VK_ESCAPE?)
|
|
||||||
ret = 0;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static ButtConfig *DoTBButtons=0;
|
static ButtConfig *DoTBButtons=0;
|
||||||
static const char *DoTBTitle=0;
|
static const char *DoTBTitle=0;
|
||||||
static int DoTBMax=0;
|
static int DoTBMax=0;
|
||||||
|
@ -1216,7 +1364,7 @@ static INT_PTR CALLBACK DoTBCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
char btext[128];
|
char btext[128];
|
||||||
btext[0]=0;
|
btext[0]=0;
|
||||||
GetDlgItemText(hwndDlg, b, btext, 128);
|
GetDlgItemText(hwndDlg, b, btext, 128);
|
||||||
DWaitButton(hwndDlg, (uint8*)btext,&DoTBButtons[b - 300]); //mbg merge 7/17/06 added cast
|
DWaitButton(hwndDlg, btext,&DoTBButtons[b - 300]); //mbg merge 7/17/06 added cast
|
||||||
}
|
}
|
||||||
else switch(wParam&0xFFFF)
|
else switch(wParam&0xFFFF)
|
||||||
{
|
{
|
||||||
|
@ -1424,27 +1572,25 @@ INT_PTR CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
);
|
);
|
||||||
|
|
||||||
// Initialize the auto key controls
|
// Initialize the auto key controls
|
||||||
extern int autoHoldKey, autoHoldClearKey;
|
if (autoHoldKeys.NumC)
|
||||||
char btext[128];
|
|
||||||
if (autoHoldKey)
|
|
||||||
{
|
{
|
||||||
if (!GetKeyNameText((autoHoldKey & 0x7F) << 16 | (autoHoldKey & 0x80) << 17, btext, 128))
|
char *nstr = MakeButtString(&autoHoldKeys);
|
||||||
sprintf(btext, "KB: %d", autoHoldKey);
|
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, nstr);
|
||||||
|
free(nstr);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sprintf(btext, "not assigned");
|
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, "not assigned");
|
||||||
}
|
}
|
||||||
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext);
|
|
||||||
|
|
||||||
if (autoHoldClearKey)
|
if (autoHoldClearKeys.NumC)
|
||||||
{
|
{
|
||||||
if (!GetKeyNameText(autoHoldClearKey << 16, btext, 128))
|
char *nstr = MakeButtString(&autoHoldClearKeys);
|
||||||
sprintf(btext, "KB: %d", autoHoldClearKey);
|
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, nstr);
|
||||||
|
free(nstr);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sprintf(btext, "not assigned");
|
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, "not assigned");
|
||||||
}
|
}
|
||||||
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext);
|
|
||||||
|
|
||||||
CenterWindowOnScreen(hwndDlg);
|
CenterWindowOnScreen(hwndDlg);
|
||||||
UpdateFourscoreState(hwndDlg);
|
UpdateFourscoreState(hwndDlg);
|
||||||
|
@ -1609,53 +1755,36 @@ INT_PTR CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
case BTN_AUTO_HOLD: // auto-hold button
|
case BTN_AUTO_HOLD: // auto-hold button
|
||||||
{
|
{
|
||||||
char btext[128] = { 0 };
|
char btext[128] = { 0 };
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg, BTN_AUTO_HOLD, btext, sizeof(btext) );
|
GetDlgItemText(hwndDlg, BTN_AUTO_HOLD, btext, sizeof(btext) );
|
||||||
|
DWaitButton(hwndDlg, btext, &autoHoldKeys);
|
||||||
int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06
|
if (autoHoldKeys.NumC)
|
||||||
|
|
||||||
if(button)
|
|
||||||
{
|
{
|
||||||
if(!GetKeyNameText((button & 0x7F) << 16 | (button & 0x80) << 17, btext, 128))
|
char *nstr = MakeButtString(&autoHoldKeys);
|
||||||
{
|
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, nstr);
|
||||||
sprintf(btext, "KB: %d", button);
|
free(nstr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(btext, "not assigned");
|
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, "not assigned");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int autoHoldKey;
|
|
||||||
autoHoldKey = button;
|
|
||||||
SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTN_CLEAR_AH: // auto-hold clear button
|
case BTN_CLEAR_AH: // auto-hold clear button
|
||||||
{
|
{
|
||||||
char btext[128] = { 0 };
|
char btext[128] = { 0 };
|
||||||
|
|
||||||
GetDlgItemText(hwndDlg, BTN_CLEAR_AH, btext, 128);
|
GetDlgItemText(hwndDlg, BTN_CLEAR_AH, btext, 128);
|
||||||
|
DWaitButton(hwndDlg, btext, &autoHoldClearKeys);
|
||||||
int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06 added cast
|
if (autoHoldClearKeys.NumC)
|
||||||
|
|
||||||
if(button)
|
|
||||||
{
|
{
|
||||||
if( !GetKeyNameText((button & 0x7F) << 16 | (button & 0x80 << 17), btext, sizeof(btext)))
|
char *nstr = MakeButtString(&autoHoldClearKeys);
|
||||||
{
|
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, nstr);
|
||||||
sprintf(btext, "KB: %d", button);
|
free(nstr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(btext, "not assigned");
|
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, "not assigned");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int autoHoldClearKey;
|
|
||||||
autoHoldClearKey = button;
|
|
||||||
|
|
||||||
SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1691,80 +1820,26 @@ void DestroyInput(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FCEUD_CommandMapping[EMUCMD_MAX];
|
//int FCEUD_CommandMapping[EMUCMD_MAX];
|
||||||
|
ButtConfig FCEUD_CommandMapping[EMUCMD_MAX];
|
||||||
|
|
||||||
CFGSTRUCT HotkeyConfig[]={
|
CFGSTRUCT HotkeyConfig[]={
|
||||||
AC(FCEUD_CommandMapping),
|
VAC(FCEUD_CommandMapping, 2),
|
||||||
ENDCFGSTRUCT
|
ENDCFGSTRUCT
|
||||||
};
|
};
|
||||||
|
|
||||||
int FCEUD_TestCommandState(int c)
|
int FCEUD_TestCommandState(int c)
|
||||||
{
|
{
|
||||||
int cmd=FCEUD_CommandMapping[c];
|
|
||||||
int cmdmask=cmd&CMD_KEY_MASK;
|
|
||||||
|
|
||||||
// allow certain commands be affected by key repeat
|
// allow certain commands be affected by key repeat
|
||||||
if(c == EMUCMD_FRAME_ADVANCE/*
|
switch (c)
|
||||||
|| c == EMUCMD_SOUND_VOLUME_UP
|
|
||||||
|| c == EMUCMD_SOUND_VOLUME_DOWN
|
|
||||||
|| c == EMUCMD_SPEED_SLOWER
|
|
||||||
|| c == EMUCMD_SPEED_FASTER*/)
|
|
||||||
{
|
{
|
||||||
keys=GetKeyboard_nr();
|
case EMUCMD_FRAME_ADVANCE:
|
||||||
/* if((cmdmask & CMD_KEY_LALT) == CMD_KEY_LALT
|
case EMUCMD_SPEED_TURBO:
|
||||||
|| (cmdmask & CMD_KEY_RALT) == CMD_KEY_RALT
|
case EMUCMD_TASEDITOR_REWIND:
|
||||||
|| (cmdmask & CMD_KEY_LALT) == CMD_KEY_LALT
|
return DTestButton(&FCEUD_CommandMapping[c], 0);
|
||||||
|| (cmdmask & CMD_KEY_LCTRL) == CMD_KEY_LCTRL
|
default:
|
||||||
|| (cmdmask & CMD_KEY_RCTRL) == CMD_KEY_RCTRL
|
return DTestButton(&FCEUD_CommandMapping[c], 1);
|
||||||
|| (cmdmask & CMD_KEY_LSHIFT) == CMD_KEY_LSHIFT
|
|
||||||
|| (cmdmask & CMD_KEY_RSHIFT) == CMD_KEY_RSHIFT)*/
|
|
||||||
keys_nr=GetKeyboard_nr();
|
|
||||||
// else
|
|
||||||
// keys_nr=GetKeyboard_nr();
|
|
||||||
}
|
}
|
||||||
else if(c != EMUCMD_SPEED_TURBO && c != EMUCMD_TASEDITOR_REWIND) // TODO: this should be made more general by detecting if the command has an "off" function
|
|
||||||
{
|
|
||||||
keys=GetKeyboard_jd();
|
|
||||||
keys_nr=GetKeyboard_nr();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
keys=GetKeyboard_nr();
|
|
||||||
keys_nr=GetKeyboard_nr();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* test CTRL, SHIFT, ALT */
|
|
||||||
if (cmd & CMD_KEY_ALT)
|
|
||||||
{
|
|
||||||
int ctlstate = (cmd & CMD_KEY_LALT) ? keys_nr[SCAN_LEFTALT] : 0;
|
|
||||||
ctlstate |= (cmd & CMD_KEY_RALT) ? keys_nr[SCAN_RIGHTALT] : 0;
|
|
||||||
if (!ctlstate)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if((cmdmask != SCAN_LEFTALT && keys_nr[SCAN_LEFTALT]) || (cmdmask != SCAN_RIGHTALT && keys_nr[SCAN_RIGHTALT]))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (cmd & CMD_KEY_CTRL)
|
|
||||||
{
|
|
||||||
int ctlstate = (cmd & CMD_KEY_LCTRL) ? keys_nr[SCAN_LEFTCONTROL] : 0;
|
|
||||||
ctlstate |= (cmd & CMD_KEY_RCTRL) ? keys_nr[SCAN_RIGHTCONTROL] : 0;
|
|
||||||
if (!ctlstate)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if((cmdmask != SCAN_LEFTCONTROL && keys_nr[SCAN_LEFTCONTROL]) || (cmdmask != SCAN_RIGHTCONTROL && keys_nr[SCAN_RIGHTCONTROL]))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (cmd & CMD_KEY_SHIFT)
|
|
||||||
{
|
|
||||||
int ctlstate = (cmd & CMD_KEY_LSHIFT) ? keys_nr[SCAN_LEFTSHIFT] : 0;
|
|
||||||
ctlstate |= (cmd & CMD_KEY_RSHIFT) ? keys_nr[SCAN_RIGHTSHIFT] : 0;
|
|
||||||
if (!ctlstate)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if((cmdmask != SCAN_LEFTSHIFT && keys_nr[SCAN_LEFTSHIFT]) || (cmdmask != SCAN_RIGHTSHIFT && keys_nr[SCAN_RIGHTSHIFT]))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return keys[cmdmask] ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCEUD_TurboOn (void)
|
void FCEUD_TurboOn (void)
|
||||||
|
|
|
@ -13,13 +13,14 @@
|
||||||
#define CMD_KEY_LALT (1<<20)
|
#define CMD_KEY_LALT (1<<20)
|
||||||
#define CMD_KEY_RALT (1<<21)
|
#define CMD_KEY_RALT (1<<21)
|
||||||
#define CMD_KEY_ALT (CMD_KEY_LALT|CMD_KEY_RALT)
|
#define CMD_KEY_ALT (CMD_KEY_LALT|CMD_KEY_RALT)
|
||||||
|
#define CMD_KEY_LWIN (1<<22)
|
||||||
|
#define CMD_KEY_RWIN (1<<23)
|
||||||
|
#define CMD_KEY_WIN (CMD_KEY_LWIN|CMD_KEY_RWIN)
|
||||||
|
|
||||||
void ConfigInput(HWND hParent);
|
void ConfigInput(HWND hParent);
|
||||||
int InitDInput(void);
|
int InitDInput(void);
|
||||||
void CreateInputStuff(void);
|
|
||||||
void InitInputStuff(void);
|
void InitInputStuff(void);
|
||||||
void DestroyInput(void);
|
void DestroyInput(void);
|
||||||
void InputScreenChanged(int fs);
|
|
||||||
void SetAutoFireDesynch(int DesynchOn);
|
void SetAutoFireDesynch(int DesynchOn);
|
||||||
int GetAutoFireDesynch();
|
int GetAutoFireDesynch();
|
||||||
uint32 GetGamepadPressedImmediate();
|
uint32 GetGamepadPressedImmediate();
|
||||||
|
@ -43,7 +44,7 @@ extern uint8 BWorldData[1 + 13 + 1];
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8 ButtType[MAXBUTTCONFIG];
|
uint8 ButtType[MAXBUTTCONFIG];
|
||||||
uint8 DeviceNum[MAXBUTTCONFIG];
|
uint8 DeviceNum[MAXBUTTCONFIG];
|
||||||
uint16 ButtonNum[MAXBUTTCONFIG];
|
int ButtonNum[MAXBUTTCONFIG];
|
||||||
uint32 NumC;
|
uint32 NumC;
|
||||||
GUID DeviceInstance[MAXBUTTCONFIG];
|
GUID DeviceInstance[MAXBUTTCONFIG];
|
||||||
//uint64 DeviceID[MAXBUTTCONFIG]; /* TODO */
|
//uint64 DeviceID[MAXBUTTCONFIG]; /* TODO */
|
||||||
|
@ -62,13 +63,15 @@ void ParseGIInput(FCEUGI *GameInfo);
|
||||||
#define FCFGD_HYPERSHOT 3
|
#define FCFGD_HYPERSHOT 3
|
||||||
#define FCFGD_QUIZKING 4
|
#define FCFGD_QUIZKING 4
|
||||||
|
|
||||||
void SetEmulationSpeed(int type);
|
|
||||||
int FCEUD_TestCommandState(int c);
|
int FCEUD_TestCommandState(int c);
|
||||||
void FCEUD_UpdateInput();
|
void FCEUD_UpdateInput();
|
||||||
|
int DWaitButton(HWND hParent, const char *text, ButtConfig *bc);
|
||||||
|
int DTestButton(ButtConfig *bc, uint8_t just_down = 0);
|
||||||
|
char *MakeButtString(ButtConfig *bc, int appendKB = 1);
|
||||||
|
|
||||||
extern CFGSTRUCT HotkeyConfig[];
|
extern CFGSTRUCT HotkeyConfig[];
|
||||||
|
|
||||||
extern int FCEUD_CommandMapping[EMUCMD_MAX];
|
extern ButtConfig FCEUD_CommandMapping[EMUCMD_MAX];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,12 @@ typedef struct
|
||||||
LONG MaxY;
|
LONG MaxY;
|
||||||
LONG MinZ;
|
LONG MinZ;
|
||||||
LONG MaxZ;
|
LONG MaxZ;
|
||||||
|
LONG MinRx;
|
||||||
|
LONG MaxRx;
|
||||||
|
LONG MinRy;
|
||||||
|
LONG MaxRy;
|
||||||
|
LONG MinRz;
|
||||||
|
LONG MaxRz;
|
||||||
} POWER_RANGER;
|
} POWER_RANGER;
|
||||||
|
|
||||||
static POWER_RANGER ranges[MAX_JOYSTICKS];
|
static POWER_RANGER ranges[MAX_JOYSTICKS];
|
||||||
|
@ -150,15 +156,36 @@ int DTestButtonJoy(ButtConfig *bc)
|
||||||
|
|
||||||
if(bc->ButtonNum[x]&0x8000) /* Axis "button" */
|
if(bc->ButtonNum[x]&0x8000) /* Axis "button" */
|
||||||
{
|
{
|
||||||
int sa = bc->ButtonNum[x]&3;
|
int sa = bc->ButtonNum[x]&7;
|
||||||
long source;
|
long source;
|
||||||
|
|
||||||
if(sa == 0) source=((int64)StatusSave[n].lX - ranges[n].MinX) * 262144 /
|
switch (sa)
|
||||||
(ranges[n].MaxX - ranges[n].MinX) - 131072;
|
{
|
||||||
else if(sa == 1) source=((int64)StatusSave[n].lY - ranges[n].MinY) * 262144 /
|
case 0:
|
||||||
(ranges[n].MaxY - ranges[n].MinY) - 131072;
|
source = ((int64)StatusSave[n].lX - ranges[n].MinX) * 262144 /
|
||||||
else if(sa == 2) source=((int64)StatusSave[n].lZ - ranges[n].MinZ) * 262144 /
|
(ranges[n].MaxX - ranges[n].MinX) - 131072;
|
||||||
(ranges[n].MaxZ - ranges[n].MinZ) - 131072;
|
break;
|
||||||
|
case 1:
|
||||||
|
source = ((int64)StatusSave[n].lY - ranges[n].MinY) * 262144 /
|
||||||
|
(ranges[n].MaxY - ranges[n].MinY) - 131072;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
source = ((int64)StatusSave[n].lZ - ranges[n].MinZ) * 262144 /
|
||||||
|
(ranges[n].MaxZ - ranges[n].MinZ) - 131072;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
source = ((int64)StatusSave[n].lRx - ranges[n].MinRx) * 262144 /
|
||||||
|
(ranges[n].MaxRx - ranges[n].MinRx) - 131072;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
source = ((int64)StatusSave[n].lRy - ranges[n].MinRy) * 262144 /
|
||||||
|
(ranges[n].MaxRy - ranges[n].MinRy) - 131072;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
source = ((int64)StatusSave[n].lRz - ranges[n].MinRz) * 262144 /
|
||||||
|
(ranges[n].MaxRz - ranges[n].MinRz) - 131072;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now, source is of the range -131072 to 131071. Good enough. */
|
/* Now, source is of the range -131072 to 131071. Good enough. */
|
||||||
if(bc->ButtonNum[x] & 0x4000)
|
if(bc->ButtonNum[x] & 0x4000)
|
||||||
|
@ -191,7 +218,7 @@ int DTestButtonJoy(ButtConfig *bc)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int canax[MAX_JOYSTICKS][3];
|
static int canax[MAX_JOYSTICKS][6];
|
||||||
|
|
||||||
/* Now the fun configuration test begins. */
|
/* Now the fun configuration test begins. */
|
||||||
void BeginJoyWait(HWND hwnd)
|
void BeginJoyWait(HWND hwnd)
|
||||||
|
@ -242,50 +269,67 @@ int DoJoyWaitTest(GUID *guid, uint8 *devicenum, uint16 *buttonnum)
|
||||||
|
|
||||||
memcpy(StatusSave[n].rgbButtons, JoyStatus.rgbButtons, 128);
|
memcpy(StatusSave[n].rgbButtons, JoyStatus.rgbButtons, 128);
|
||||||
|
|
||||||
// lX, lY, lZ
|
|
||||||
long dax, day, daz;
|
|
||||||
long source,psource;
|
long source,psource;
|
||||||
|
|
||||||
dax = ranges[n].MaxX - ranges[n].MinX;
|
for (int axis = 0; axis < 6; axis++)
|
||||||
day = ranges[n].MaxY - ranges[n].MinY;
|
|
||||||
daz = ranges[n].MaxZ - ranges[n].MinZ;
|
|
||||||
|
|
||||||
if(dax)
|
|
||||||
{
|
|
||||||
source=((int64)JoyStatus.lX - ranges[n].MinX) * 262144 / dax - 131072;
|
|
||||||
psource=((int64)StatusSave[n].lX - ranges[n].MinX) * 262144 / dax - 131072;
|
|
||||||
|
|
||||||
if(abs(source) >= 65536 && canax[n][0])
|
|
||||||
{
|
|
||||||
*guid = JoyGUID[n];
|
|
||||||
*devicenum = n;
|
|
||||||
*buttonnum = 0x8000 | (0) | ((source < 0) ? 0x4000 : 0);
|
|
||||||
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
|
||||||
canax[n][0] = 0;
|
|
||||||
return(1);
|
|
||||||
} else if(abs(source) <= 32768) canax[n][0] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(day)
|
|
||||||
{
|
|
||||||
source=((int64)JoyStatus.lY - ranges[n].MinY) * 262144 / day - 131072;
|
|
||||||
psource=((int64)StatusSave[n].lY - ranges[n].MinY) * 262144 / day - 131072;
|
|
||||||
|
|
||||||
if(abs(source) >= 65536 && canax[n][1])
|
|
||||||
{
|
|
||||||
*guid = JoyGUID[n];
|
|
||||||
*devicenum = n;
|
|
||||||
*buttonnum = 0x8000 | (1) | ((source < 0) ? 0x4000 : 0);
|
|
||||||
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
|
||||||
canax[n][1] = 0;
|
|
||||||
return(1);
|
|
||||||
} else if(abs(source) <= 32768) canax[n][1] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(daz)
|
|
||||||
{
|
{
|
||||||
|
long da, jsl, ssl, min;
|
||||||
|
switch (axis)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
da = ranges[n].MaxX - ranges[n].MinX;
|
||||||
|
jsl = JoyStatus.lX;
|
||||||
|
ssl = StatusSave[n].lX;
|
||||||
|
min = ranges[n].MinX;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
da = ranges[n].MaxY - ranges[n].MinY;
|
||||||
|
jsl = JoyStatus.lY;
|
||||||
|
ssl = StatusSave[n].lY;
|
||||||
|
min = ranges[n].MinY;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
da = ranges[n].MaxZ - ranges[n].MinZ;
|
||||||
|
jsl = JoyStatus.lZ;
|
||||||
|
ssl = StatusSave[n].lZ;
|
||||||
|
min = ranges[n].MinZ;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
da = ranges[n].MaxRx - ranges[n].MinRx;
|
||||||
|
jsl = JoyStatus.lRx;
|
||||||
|
ssl = StatusSave[n].lRx;
|
||||||
|
min = ranges[n].MinRx;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
da = ranges[n].MaxRy - ranges[n].MinRy;
|
||||||
|
jsl = JoyStatus.lRy;
|
||||||
|
ssl = StatusSave[n].lRy;
|
||||||
|
min = ranges[n].MinRy;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
da = ranges[n].MaxRz - ranges[n].MinRz;
|
||||||
|
jsl = JoyStatus.lRz;
|
||||||
|
ssl = StatusSave[n].lRz;
|
||||||
|
min = ranges[n].MinRz;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (da)
|
||||||
|
{
|
||||||
|
source = ((int64)jsl - min) * 262144 / da - 131072;
|
||||||
|
psource = ((int64)ssl - min) * 262144 / da - 131072;
|
||||||
|
|
||||||
|
if (abs(source) >= 65536 && canax[n][axis])
|
||||||
|
{
|
||||||
|
*guid = JoyGUID[n];
|
||||||
|
*devicenum = n;
|
||||||
|
*buttonnum = 0x8000 | axis | ((source < 0) ? 0x4000 : 0);
|
||||||
|
memcpy(&StatusSave[n], &JoyStatus, sizeof(DIJOYSTATE2));
|
||||||
|
canax[n][axis] = 0;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
else if (abs(source) <= 32768) canax[n][axis] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(x=0; x<4; x++)
|
for(x=0; x<4; x++)
|
||||||
|
@ -393,6 +437,9 @@ static BOOL CALLBACK JoystickFound(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
||||||
GetARange(Joysticks[n], DIJOFS_X, &ranges[n].MinX, &ranges[n].MaxX);
|
GetARange(Joysticks[n], DIJOFS_X, &ranges[n].MinX, &ranges[n].MaxX);
|
||||||
GetARange(Joysticks[n], DIJOFS_Y, &ranges[n].MinY, &ranges[n].MaxY);
|
GetARange(Joysticks[n], DIJOFS_Y, &ranges[n].MinY, &ranges[n].MaxY);
|
||||||
GetARange(Joysticks[n], DIJOFS_Z, &ranges[n].MinZ, &ranges[n].MaxZ);
|
GetARange(Joysticks[n], DIJOFS_Z, &ranges[n].MinZ, &ranges[n].MaxZ);
|
||||||
|
GetARange(Joysticks[n], DIJOFS_RX, &ranges[n].MinRx, &ranges[n].MaxRx);
|
||||||
|
GetARange(Joysticks[n], DIJOFS_RY, &ranges[n].MinRy, &ranges[n].MaxRy);
|
||||||
|
GetARange(Joysticks[n], DIJOFS_RZ, &ranges[n].MinRz, &ranges[n].MaxRz);
|
||||||
|
|
||||||
JoyGUID[numjoysticks] = lpddi->guidInstance;
|
JoyGUID[numjoysticks] = lpddi->guidInstance;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static unsigned int keys[256] = {0,}; // with repeat
|
||||||
static unsigned int keys_nr[256] = {0,}; // non-repeating
|
static unsigned int keys_nr[256] = {0,}; // non-repeating
|
||||||
static unsigned int keys_jd[256] = {0,}; // just-down
|
static unsigned int keys_jd[256] = {0,}; // just-down
|
||||||
static unsigned int keys_jd_lock[256] = {0,}; // just-down released lock
|
static unsigned int keys_jd_lock[256] = {0,}; // just-down released lock
|
||||||
int autoHoldKey = 0, autoHoldClearKey = 0;
|
extern ButtConfig autoHoldKeys, autoHoldClearKeys;
|
||||||
int ctr=0;
|
int ctr=0;
|
||||||
void KeyboardUpdateState(void)
|
void KeyboardUpdateState(void)
|
||||||
{
|
{
|
||||||
|
@ -115,8 +115,8 @@ void KeyboardUpdateState(void)
|
||||||
keys[i] = 0;
|
keys[i] = 0;
|
||||||
|
|
||||||
extern uint8 autoHoldOn, autoHoldReset;
|
extern uint8 autoHoldOn, autoHoldReset;
|
||||||
autoHoldOn = autoHoldKey && keys[autoHoldKey] != 0;
|
autoHoldOn = DTestButton(&autoHoldKeys); // autoHoldKey && keys[autoHoldKey] != 0;
|
||||||
autoHoldReset = autoHoldClearKey && keys[autoHoldClearKey] != 0;
|
autoHoldReset = DTestButton(&autoHoldClearKeys); //autoHoldClearKey && keys[autoHoldClearKey] != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int *GetKeyboard(void)
|
unsigned int *GetKeyboard(void)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
void KeyboardClose(void);
|
void KeyboardClose(void);
|
||||||
int KeyboardInitialize(void);
|
int KeyboardInitialize(void);
|
||||||
void KeyboardUpdate(void);
|
void KeyboardUpdateState(void);
|
||||||
unsigned int *GetKeyboard(void);
|
unsigned int *GetKeyboard(void);
|
||||||
unsigned int *GetKeyboard_nr(void);
|
unsigned int *GetKeyboard_nr(void);
|
||||||
unsigned int *GetKeyboard_jd(void);
|
unsigned int *GetKeyboard_jd(void);
|
||||||
|
|
|
@ -124,6 +124,9 @@
|
||||||
#define SCAN_F10 0x44
|
#define SCAN_F10 0x44
|
||||||
#define SCAN_F11 0x57
|
#define SCAN_F11 0x57
|
||||||
#define SCAN_F12 0x58
|
#define SCAN_F12 0x58
|
||||||
|
|
||||||
|
#define SCAN_LEFTWIN 0xDB
|
||||||
|
#define SCAN_RIGHTWIN 0xDC
|
||||||
|
|
||||||
#define MKK(k) SCAN_##k
|
#define MKK(k) SCAN_##k
|
||||||
#define MKK_COUNT (256)
|
#define MKK_COUNT (256)
|
||||||
|
|
|
@ -829,17 +829,18 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
CreateMainWindow();
|
CreateMainWindow();
|
||||||
|
|
||||||
if(!InitDInput())
|
if (!InitDInput())
|
||||||
{
|
{
|
||||||
do_exit();
|
do_exit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!DriverInitialize())
|
if (!DriverInitialize())
|
||||||
{
|
{
|
||||||
do_exit();
|
do_exit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
UpdateMenuHotkeys(FCEUMENU_MAIN);
|
||||||
|
|
||||||
debugSystem = new DebugSystem();
|
debugSystem = new DebugSystem();
|
||||||
debugSystem->init();
|
debugSystem->init();
|
||||||
|
|
|
@ -101,326 +101,6 @@ static struct
|
||||||
|
|
||||||
#define NUM_DEFAULT_MAPPINGS (sizeof(DefaultCommandMapping)/sizeof(DefaultCommandMapping[0]))
|
#define NUM_DEFAULT_MAPPINGS (sizeof(DefaultCommandMapping)/sizeof(DefaultCommandMapping[0]))
|
||||||
|
|
||||||
static uint8 keyonce[MKK_COUNT];
|
|
||||||
static unsigned int *keys_nr = 0;
|
|
||||||
|
|
||||||
static const char* ScanNames[256]=
|
|
||||||
{
|
|
||||||
/* 0x00-0x0f */ 0, "Escape", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "Minus", "Equals", "Backspace", "Tab",
|
|
||||||
/* 0x10-0x1f */ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "Enter", "Left Ctrl", "A", "S",
|
|
||||||
/* 0x20-0x2f */ "D", "F", "G", "H", "J", "K", "L", "Semicolon", "Apostrophe", "Tilde", "Left Shift", "Backslash", "Z", "X", "C", "V",
|
|
||||||
/* 0x30-0x3f */ "B", "N", "M", "Comma", "Period", "Slash", "Right Shift", "Numpad *", "Left Alt", "Space", "Caps Lock", "F1", "F2", "F3", "F4", "F5",
|
|
||||||
/* 0x40-0x4f */ "F6", "F7", "F8", "F9", "F10", "NumLock", "ScrollLock", "Numpad 7", "Numpad 8", "Numpad 9", "Numpad Minus", "Numpad 4", "Numpad 5", "Numpad 6", "Numpad Plus", "Numpad 1",
|
|
||||||
/* 0x50-0x5f */ "Numpad 2", "Numpad 3", "Numpad 0", "Numpad Period", 0, 0, "Backslash", "F11", "F12", 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0x60-0x6f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0x70-0x7f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0x80-0x8f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0x90-0x9f */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Numpad Enter", "Right Ctrl", 0, 0,
|
|
||||||
/* 0xa0-0xaf */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0xb0-0xbf */ 0, 0, 0, 0, 0, "Numpad Divide", 0, "PrintScrn", "Right Alt", 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0xc0-0xcf */ 0, 0, 0, 0, 0, "Pause", 0, "Home", "Up Arrow", "PgUp", 0, "Left Arrow", 0, "Right Arrow", 0, "End",
|
|
||||||
/* 0xd0-0xdf */ "Down Arrow", "PgDn", "Ins", "Del", 0, 0, 0, 0, 0, 0, 0, "Left Win", "Right Win", "AppMenu", 0, 0,
|
|
||||||
/* 0xe0-0xef */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
/* 0xf0-0xff */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
int _keyonly(int a)
|
|
||||||
{
|
|
||||||
if(keys_nr[a])
|
|
||||||
{
|
|
||||||
if(!keyonce[a])
|
|
||||||
{
|
|
||||||
keyonce[a] = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
keyonce[a] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetKeyPressed()
|
|
||||||
{
|
|
||||||
int key = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
keys_nr = GetKeyboard_nr();
|
|
||||||
|
|
||||||
for(i = 0; i < 256 && !key; ++i)
|
|
||||||
{
|
|
||||||
if(_keyonly(i))
|
|
||||||
{
|
|
||||||
key = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NothingPressed()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
keys_nr = GetKeyboard_nr();
|
|
||||||
|
|
||||||
for(i = 0; i < 256; ++i)
|
|
||||||
{
|
|
||||||
if(keys_nr[i])
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetKeyMeta(int key)
|
|
||||||
{
|
|
||||||
int meta = key & (~CMD_KEY_MASK);
|
|
||||||
|
|
||||||
switch(key & CMD_KEY_MASK)
|
|
||||||
{
|
|
||||||
case SCAN_LEFTCONTROL:
|
|
||||||
case SCAN_RIGHTCONTROL:
|
|
||||||
return CMD_KEY_CTRL | meta;
|
|
||||||
|
|
||||||
case SCAN_LEFTALT:
|
|
||||||
case SCAN_RIGHTALT:
|
|
||||||
return CMD_KEY_ALT | meta;
|
|
||||||
|
|
||||||
case SCAN_LEFTSHIFT:
|
|
||||||
case SCAN_RIGHTSHIFT:
|
|
||||||
return CMD_KEY_SHIFT | meta;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearExtraMeta(int* key)
|
|
||||||
{
|
|
||||||
switch((*key)&0xff)
|
|
||||||
{
|
|
||||||
case SCAN_LEFTCONTROL:
|
|
||||||
case SCAN_RIGHTCONTROL:
|
|
||||||
*key &= ~(CMD_KEY_CTRL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCAN_LEFTALT:
|
|
||||||
case SCAN_RIGHTALT:
|
|
||||||
*key &= ~(CMD_KEY_ALT);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCAN_LEFTSHIFT:
|
|
||||||
case SCAN_RIGHTSHIFT:
|
|
||||||
*key &= ~(CMD_KEY_SHIFT);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD WINAPI NewInputDialogThread(LPVOID lpvArg)
|
|
||||||
{
|
|
||||||
struct INPUTDLGTHREADARGS* args = (struct INPUTDLGTHREADARGS*)lpvArg;
|
|
||||||
|
|
||||||
while (args->hThreadExit)
|
|
||||||
{
|
|
||||||
if (WaitForSingleObject(args->hThreadExit, 20) == WAIT_OBJECT_0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Poke our owner dialog periodically.
|
|
||||||
PostMessage(args->hwndDlg, WM_USER, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of a single key.
|
|
||||||
*
|
|
||||||
* @param code Keycode
|
|
||||||
*
|
|
||||||
* @return Name of the key
|
|
||||||
*
|
|
||||||
* TODO: Replace return value with parameter.
|
|
||||||
**/
|
|
||||||
const char* GetKeyName(int code)
|
|
||||||
{
|
|
||||||
static char name[16];
|
|
||||||
|
|
||||||
code &= 0xff;
|
|
||||||
|
|
||||||
if(ScanNames[code])
|
|
||||||
{
|
|
||||||
return ScanNames[code];
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(name, "Key 0x%.2x", code);
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the name of a pressed key combination.
|
|
||||||
*
|
|
||||||
* @param c A keycode
|
|
||||||
*
|
|
||||||
* @return The name of the key combination.
|
|
||||||
*
|
|
||||||
* TODO: Replace return value with parameter.
|
|
||||||
**/
|
|
||||||
char* GetKeyComboName(int c)
|
|
||||||
{
|
|
||||||
static char text[80];
|
|
||||||
|
|
||||||
text[0] = '\0';
|
|
||||||
|
|
||||||
if(!c)
|
|
||||||
{
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((c & CMD_KEY_CTRL) == CMD_KEY_CTRL)
|
|
||||||
{
|
|
||||||
strcat(text, "Ctrl + ");
|
|
||||||
}
|
|
||||||
else if ((c & CMD_KEY_CTRL) == CMD_KEY_LCTRL)
|
|
||||||
{
|
|
||||||
strcat(text, "Left Ctrl + ");
|
|
||||||
}
|
|
||||||
else if ((c & CMD_KEY_CTRL) == CMD_KEY_RCTRL)
|
|
||||||
{
|
|
||||||
strcat(text, "Right Ctrl + ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((c & CMD_KEY_ALT) == CMD_KEY_ALT)
|
|
||||||
{
|
|
||||||
strcat(text, "Alt + ");
|
|
||||||
}
|
|
||||||
else if ((c & CMD_KEY_ALT) == CMD_KEY_LALT)
|
|
||||||
{
|
|
||||||
strcat(text, "Left Alt + ");
|
|
||||||
}
|
|
||||||
else if ((c & CMD_KEY_ALT) == CMD_KEY_RALT)
|
|
||||||
{
|
|
||||||
strcat(text, "Right Alt + ");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((c & CMD_KEY_SHIFT) == CMD_KEY_SHIFT)
|
|
||||||
{
|
|
||||||
strcat(text, "Shift + ");
|
|
||||||
}
|
|
||||||
else if ((c & CMD_KEY_SHIFT) == CMD_KEY_LSHIFT)
|
|
||||||
{
|
|
||||||
strcat(text, "Left Shift + ");
|
|
||||||
}
|
|
||||||
else if ((c & CMD_KEY_SHIFT) == CMD_KEY_RSHIFT)
|
|
||||||
{
|
|
||||||
strcat(text, "Right Shift + ");
|
|
||||||
}
|
|
||||||
|
|
||||||
strcat(text, GetKeyName(c & CMD_KEY_MASK));
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Callback function for the dialog where the user can change hotkeys.
|
|
||||||
INT_PTR CALLBACK ChangeInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
static HANDLE hThread = NULL;
|
|
||||||
static DWORD dwThreadId = 0;
|
|
||||||
static struct INPUTDLGTHREADARGS threadargs;
|
|
||||||
static int key = 0;
|
|
||||||
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_INITDIALOG:
|
|
||||||
{
|
|
||||||
// Start the message thread.
|
|
||||||
threadargs.hThreadExit = CreateEvent(NULL, TRUE, FALSE, NULL);
|
|
||||||
threadargs.hwndDlg = hwndDlg;
|
|
||||||
hThread = CreateThread(NULL, 0, NewInputDialogThread, (LPVOID)&threadargs, 0, &dwThreadId);
|
|
||||||
|
|
||||||
key = 0;
|
|
||||||
memset(keyonce, 0, sizeof(keyonce));
|
|
||||||
|
|
||||||
KeyboardSetBackgroundAccess(true);
|
|
||||||
SetFocus(GetDlgItem(hwndDlg, LBL_KEY_COMBO));
|
|
||||||
|
|
||||||
CenterWindowOnScreen(hwndDlg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
case WM_COMMAND:
|
|
||||||
switch(LOWORD(wParam)) // CaH4e3: BN_CLICKED redundant define removed since it always 0, Esc mapping used to be handled as well (I need it too :))
|
|
||||||
{
|
|
||||||
case BTN_OK:
|
|
||||||
// Send quit message.
|
|
||||||
PostMessage(hwndDlg, WM_USER + 99, 0, 0);
|
|
||||||
break;
|
|
||||||
case BTN_CLEAR:
|
|
||||||
key = -1;
|
|
||||||
// Send quit message.
|
|
||||||
PostMessage(hwndDlg, WM_USER + 99, 0, 0);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_USER:
|
|
||||||
{
|
|
||||||
// Our thread sent us a timer signal.
|
|
||||||
int newkey;
|
|
||||||
int meta = GetKeyMeta(key);
|
|
||||||
|
|
||||||
KeyboardUpdateState();
|
|
||||||
|
|
||||||
if((newkey = GetKeyPressed()) != 0)
|
|
||||||
{
|
|
||||||
key = newkey | meta;
|
|
||||||
ClearExtraMeta(&key);
|
|
||||||
SetDlgItemText(hwndDlg, LBL_KEY_COMBO, GetKeyComboName(key));
|
|
||||||
}
|
|
||||||
else if(NothingPressed() && key)
|
|
||||||
{
|
|
||||||
PostMessage(hwndDlg, WM_USER + 99, 0, 0); // Send quit message.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_CLOSE:
|
|
||||||
// exit without changing the key mapping
|
|
||||||
key = 0;
|
|
||||||
case WM_USER + 99:
|
|
||||||
// Done with keyboard.
|
|
||||||
KeyboardSetBackgroundAccess(false);
|
|
||||||
|
|
||||||
// Kill the thread.
|
|
||||||
SetEvent(threadargs.hThreadExit);
|
|
||||||
WaitForSingleObject(hThread, INFINITE);
|
|
||||||
CloseHandle(hThread);
|
|
||||||
CloseHandle(threadargs.hThreadExit);
|
|
||||||
|
|
||||||
// End the dialog.
|
|
||||||
EndDialog(hwndDlg, key);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a key should be shown in the current filter mode.
|
* Checks whether a key should be shown in the current filter mode.
|
||||||
*
|
*
|
||||||
|
@ -443,11 +123,11 @@ bool ShouldDisplayMapping(int mapn, int filter, const int* conflictTable)
|
||||||
}
|
}
|
||||||
else if(filter == EMUCMDTYPE_MAX + 1) /* Assigned */
|
else if(filter == EMUCMDTYPE_MAX + 1) /* Assigned */
|
||||||
{
|
{
|
||||||
return FCEUD_CommandMapping[FCEUI_CommandTable[mapn].cmd] != 0;
|
return FCEUD_CommandMapping[FCEUI_CommandTable[mapn].cmd].NumC != 0;
|
||||||
}
|
}
|
||||||
else if(filter == EMUCMDTYPE_MAX + 2) /* Unassigned */
|
else if(filter == EMUCMDTYPE_MAX + 2) /* Unassigned */
|
||||||
{
|
{
|
||||||
return FCEUD_CommandMapping[FCEUI_CommandTable[mapn].cmd] == 0;
|
return FCEUD_CommandMapping[FCEUI_CommandTable[mapn].cmd].NumC == 0;
|
||||||
}
|
}
|
||||||
else if(filter == EMUCMDTYPE_MAX + 3) /* Conflicts */
|
else if(filter == EMUCMDTYPE_MAX + 3) /* Conflicts */
|
||||||
{
|
{
|
||||||
|
@ -472,10 +152,23 @@ void PopulateConflictTable(int* conflictTable)
|
||||||
{
|
{
|
||||||
for(unsigned int j = i + 1; j < EMUCMD_MAX; ++j)
|
for(unsigned int j = i + 1; j < EMUCMD_MAX; ++j)
|
||||||
{
|
{
|
||||||
if(FCEUD_CommandMapping[i] &&
|
bool hasConflicsts = false;
|
||||||
FCEUD_CommandMapping[i] == FCEUD_CommandMapping[j] &&
|
for (unsigned int x = 0; x < FCEUD_CommandMapping[i].NumC; ++x)
|
||||||
// AnS: added the condition that both commands must have the same EMUCMDFLAG_TASEDITOR, or else they are not considered conflicting
|
{
|
||||||
(FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDITOR) == (FCEUI_CommandTable[j].flags & EMUCMDFLAG_TASEDITOR))
|
for (unsigned int y = 0; y < FCEUD_CommandMapping[j].NumC; ++y)
|
||||||
|
{
|
||||||
|
if ((FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDITOR) == (FCEUI_CommandTable[j].flags & EMUCMDFLAG_TASEDITOR)
|
||||||
|
&& FCEUD_CommandMapping[i].ButtType[x] == FCEUD_CommandMapping[j].ButtType[y]
|
||||||
|
&& FCEUD_CommandMapping[i].DeviceNum[x] == FCEUD_CommandMapping[j].DeviceNum[y]
|
||||||
|
&& FCEUD_CommandMapping[i].ButtonNum[x] == FCEUD_CommandMapping[j].ButtonNum[y])
|
||||||
|
{
|
||||||
|
hasConflicsts = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasConflicsts) break;
|
||||||
|
}
|
||||||
|
if (hasConflicsts)
|
||||||
{
|
{
|
||||||
conflictTable[i] = 1;
|
conflictTable[i] = 1;
|
||||||
conflictTable[j] = 1;
|
conflictTable[j] = 1;
|
||||||
|
@ -551,9 +244,9 @@ void PopulateMappingDisplay(HWND hwndDlg)
|
||||||
lvi.mask = LVIF_TEXT;
|
lvi.mask = LVIF_TEXT;
|
||||||
lvi.iItem = idx;
|
lvi.iItem = idx;
|
||||||
lvi.iSubItem = 2;
|
lvi.iSubItem = 2;
|
||||||
lvi.pszText = GetKeyComboName(FCEUD_CommandMapping[FCEUI_CommandTable[i].cmd]);
|
lvi.pszText = MakeButtString(&FCEUD_CommandMapping[FCEUI_CommandTable[i].cmd], 0);
|
||||||
|
|
||||||
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
|
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
|
||||||
|
free(lvi.pszText);
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
@ -651,7 +344,7 @@ void InitFilterComboBox(HWND hwndDlg)
|
||||||
* Checks what ListView line was selected and shows the dialog
|
* Checks what ListView line was selected and shows the dialog
|
||||||
* that prompts the user to enter a hotkey.
|
* that prompts the user to enter a hotkey.
|
||||||
**/
|
**/
|
||||||
void AskForHotkey(HWND hwndListView)
|
void AskForHotkey(HWND hwndDlg, HWND hwndListView)
|
||||||
{
|
{
|
||||||
int nSel = SendMessage(hwndListView, LVM_GETNEXTITEM, (WPARAM)-1, LVNI_SELECTED);
|
int nSel = SendMessage(hwndListView, LVM_GETNEXTITEM, (WPARAM)-1, LVNI_SELECTED);
|
||||||
|
|
||||||
|
@ -669,20 +362,15 @@ void AskForHotkey(HWND hwndListView)
|
||||||
|
|
||||||
int nCmd = lvi.lParam;
|
int nCmd = lvi.lParam;
|
||||||
|
|
||||||
int nRet = DialogBox(fceu_hInstance, "NEWINPUT", hwndListView, ChangeInputDialogProc);
|
DWaitButton(hwndDlg, FCEUI_CommandTable[nCmd].name, &FCEUD_CommandMapping[nCmd]);
|
||||||
|
|
||||||
if (nRet)
|
memset(&lvi, 0, sizeof(lvi));
|
||||||
{
|
lvi.mask = LVIF_TEXT;
|
||||||
// nRet will be -1 when the user selects "clear".
|
lvi.iItem = nSel;
|
||||||
FCEUD_CommandMapping[nCmd] = ( nRet < 0) ? 0 : nRet;
|
lvi.iSubItem = 2;
|
||||||
|
lvi.pszText = MakeButtString(&FCEUD_CommandMapping[nCmd], 0);
|
||||||
memset(&lvi, 0, sizeof(lvi));
|
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
|
||||||
lvi.mask = LVIF_TEXT;
|
free(lvi.pszText);
|
||||||
lvi.iItem = nSel;
|
|
||||||
lvi.iSubItem = 2;
|
|
||||||
lvi.pszText = GetKeyComboName(FCEUD_CommandMapping[nCmd]);
|
|
||||||
SendMessage(hwndListView, LVM_SETITEM, (WPARAM)0, (LPARAM)&lvi);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +383,10 @@ void ApplyDefaultCommandMapping()
|
||||||
|
|
||||||
for(unsigned i = 0; i < NUM_DEFAULT_MAPPINGS; ++i)
|
for(unsigned i = 0; i < NUM_DEFAULT_MAPPINGS; ++i)
|
||||||
{
|
{
|
||||||
FCEUD_CommandMapping[DefaultCommandMapping[i].cmd] = DefaultCommandMapping[i].key;
|
FCEUD_CommandMapping[DefaultCommandMapping[i].cmd].ButtType[0] = BUTTC_KEYBOARD;
|
||||||
|
FCEUD_CommandMapping[DefaultCommandMapping[i].cmd].DeviceNum[0] = 0;
|
||||||
|
FCEUD_CommandMapping[DefaultCommandMapping[i].cmd].ButtonNum[0] = DefaultCommandMapping[i].key;
|
||||||
|
FCEUD_CommandMapping[DefaultCommandMapping[i].cmd].NumC = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,7 +472,7 @@ INT_PTR CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case LVN_ITEMACTIVATE:
|
case LVN_ITEMACTIVATE:
|
||||||
AskForHotkey(hwndListView);
|
AskForHotkey(hwndDlg, hwndListView);
|
||||||
|
|
||||||
// TODO: Only redraw if Conflicts filter
|
// TODO: Only redraw if Conflicts filter
|
||||||
// is active.
|
// is active.
|
||||||
|
|
|
@ -112,9 +112,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIB
|
||||||
CAPTION "DWB!"
|
CAPTION "DWB!"
|
||||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Text",LBL_DWBDIALOG_TEXT,7,9,237,8
|
LTEXT "Press a key or a button",LBL_DWBDIALOG_TEXT,7,9,237,8
|
||||||
PUSHBUTTON "Clear",BTN_CLEAR,64,32,50,14
|
PUSHBUTTON "Clear",BTN_CLEAR,64,32,50,14
|
||||||
PUSHBUTTON "Close",BTN_CLOSE,188,33,50,14
|
PUSHBUTTON "Cancel",BTN_CANCEL,126,32,50,14
|
||||||
|
PUSHBUTTON "OK",BTN_CLOSE,188,32,50,14
|
||||||
END
|
END
|
||||||
|
|
||||||
FKBDIALOG DIALOGEX 13, 72, 402, 194
|
FKBDIALOG DIALOGEX 13, 72, 402, 194
|
||||||
|
@ -374,16 +375,6 @@ BEGIN
|
||||||
EDITTEXT IDC_NETMOO_PASS,60,182,67,12,ES_PASSWORD
|
EDITTEXT IDC_NETMOO_PASS,60,182,67,12,ES_PASSWORD
|
||||||
END
|
END
|
||||||
|
|
||||||
NEWINPUT DIALOGEX 0, 0, 186, 66
|
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
|
||||||
CAPTION "Enter New Input"
|
|
||||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
|
||||||
BEGIN
|
|
||||||
CTEXT "Press a key",LBL_KEY_COMBO,31,14,122,20
|
|
||||||
PUSHBUTTON "Clear",BTN_CLEAR,95,45,50,14
|
|
||||||
PUSHBUTTON "OK",BTN_OK,40,45,50,14
|
|
||||||
END
|
|
||||||
|
|
||||||
PALCONFIG DIALOGEX 16, 81, 228, 217
|
PALCONFIG DIALOGEX 16, 81, 228, 217
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Palette Configuration"
|
CAPTION "Palette Configuration"
|
||||||
|
@ -684,14 +675,6 @@ BEGIN
|
||||||
DEFPUSHBUTTON "Close",IDC_MOVIE_CLOSE,48,200,49,14,BS_CENTER
|
DEFPUSHBUTTON "Close",IDC_MOVIE_CLOSE,48,200,49,14,BS_CENTER
|
||||||
END
|
END
|
||||||
|
|
||||||
DWBDIALOGSIMPLE DIALOGEX 33, 99, 250, 39
|
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
|
||||||
CAPTION "DWBS!"
|
|
||||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
|
||||||
BEGIN
|
|
||||||
LTEXT "Type a key, or press Escape to disable.",65429,53,14,125,8
|
|
||||||
END
|
|
||||||
|
|
||||||
MEMWATCH DIALOGEX 0, 0, 261, 270
|
MEMWATCH DIALOGEX 0, 0, 261, 270
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
|
@ -1880,10 +1863,6 @@ BEGIN
|
||||||
BOTTOMMARGIN, 201
|
BOTTOMMARGIN, 201
|
||||||
END
|
END
|
||||||
|
|
||||||
"NEWINPUT", DIALOG
|
|
||||||
BEGIN
|
|
||||||
END
|
|
||||||
|
|
||||||
"PALCONFIG", DIALOG
|
"PALCONFIG", DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
LEFTMARGIN, 10
|
LEFTMARGIN, 10
|
||||||
|
@ -1936,10 +1915,6 @@ BEGIN
|
||||||
BOTTOMMARGIN, 217
|
BOTTOMMARGIN, 217
|
||||||
END
|
END
|
||||||
|
|
||||||
"DWBDIALOGSIMPLE", DIALOG
|
|
||||||
BEGIN
|
|
||||||
END
|
|
||||||
|
|
||||||
"MEMWATCH", DIALOG
|
"MEMWATCH", DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
RIGHTMARGIN, 260
|
RIGHTMARGIN, 260
|
||||||
|
@ -2259,11 +2234,6 @@ BEGIN
|
||||||
0
|
0
|
||||||
END
|
END
|
||||||
|
|
||||||
DWBDIALOGSIMPLE AFX_DIALOG_LAYOUT
|
|
||||||
BEGIN
|
|
||||||
0
|
|
||||||
END
|
|
||||||
|
|
||||||
FKBDIALOG AFX_DIALOG_LAYOUT
|
FKBDIALOG AFX_DIALOG_LAYOUT
|
||||||
BEGIN
|
BEGIN
|
||||||
0
|
0
|
||||||
|
@ -2304,11 +2274,6 @@ BEGIN
|
||||||
0
|
0
|
||||||
END
|
END
|
||||||
|
|
||||||
NEWINPUT AFX_DIALOG_LAYOUT
|
|
||||||
BEGIN
|
|
||||||
0
|
|
||||||
END
|
|
||||||
|
|
||||||
PALCONFIG AFX_DIALOG_LAYOUT
|
PALCONFIG AFX_DIALOG_LAYOUT
|
||||||
BEGIN
|
BEGIN
|
||||||
0
|
0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -213,12 +213,14 @@ void TASEDITOR_WINDOW::updateTooltips()
|
||||||
// for other controls we provide hwnd
|
// for other controls we provide hwnd
|
||||||
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
||||||
char tooltipText[TOOLTIP_TEXT_MAX_LEN];
|
char tooltipText[TOOLTIP_TEXT_MAX_LEN];
|
||||||
if (windowItems[i].hotkeyEmuCmd && FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd])
|
if (windowItems[i].hotkeyEmuCmd && FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd].NumC)
|
||||||
{
|
{
|
||||||
// add hotkey mapping if needed
|
// add hotkey mapping if needed
|
||||||
strcpy(tooltipText, windowItems[i].tooltipText);
|
strcpy(tooltipText, windowItems[i].tooltipText);
|
||||||
strcat(tooltipText, " (hotkey: ");
|
strcat(tooltipText, " (hotkey: ");
|
||||||
strcat(tooltipText, GetKeyComboName(FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd]));
|
char *buttName = MakeButtString(&FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd], 0);
|
||||||
|
strcat(tooltipText, buttName);
|
||||||
|
free(buttName);
|
||||||
strcat(tooltipText, ")");
|
strcat(tooltipText, ")");
|
||||||
toolInfo.lpszText = tooltipText;
|
toolInfo.lpszText = tooltipText;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -604,7 +604,9 @@ INT_PTR CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
{
|
{
|
||||||
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
||||||
strcpy(trace_str, "Pause the game (press ");
|
strcpy(trace_str, "Pause the game (press ");
|
||||||
strcat(trace_str, GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]));
|
char *buttName = MakeButtString(&FCEUD_CommandMapping[EMUCMD_PAUSE], 0);
|
||||||
|
strcat(trace_str, buttName);
|
||||||
|
free(buttName);
|
||||||
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
|
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
||||||
}
|
}
|
||||||
|
@ -714,7 +716,9 @@ void BeginLoggingSequence(void)
|
||||||
tracelogbufAddressesLog.resize(tracelogbufsize);
|
tracelogbufAddressesLog.resize(tracelogbufsize);
|
||||||
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
// Assemble the message to pause the game. Uses the current hotkey mapping dynamically
|
||||||
strcat(trace_str, "Pause the game (press ");
|
strcat(trace_str, "Pause the game (press ");
|
||||||
strcat(trace_str, GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]));
|
char *buttName = MakeButtString(&FCEUD_CommandMapping[EMUCMD_PAUSE], 0);
|
||||||
|
strcat(trace_str, buttName);
|
||||||
|
free(buttName);
|
||||||
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
|
strcat(trace_str, " key or snap the Debugger) to update this window.\r\n");
|
||||||
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
SetDlgItemText(hTracer, IDC_TRACER_LOG, trace_str);
|
||||||
tracelogbufpos = tracelogbufusedsize = 0;
|
tracelogbufpos = tracelogbufusedsize = 0;
|
||||||
|
|
|
@ -1269,11 +1269,12 @@ INT_PTR CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||||
CheckDlgButton(hwndDlg,IDC_VIDEOCONFIG_NO8LIM,BST_CHECKED);
|
CheckDlgButton(hwndDlg,IDC_VIDEOCONFIG_NO8LIM,BST_CHECKED);
|
||||||
|
|
||||||
char buf[1024] = "Full Screen";
|
char buf[1024] = "Full Screen";
|
||||||
int c = FCEUD_CommandMapping[EMUCMD_MISC_TOGGLEFULLSCREEN];
|
if (FCEUD_CommandMapping[EMUCMD_MISC_TOGGLEFULLSCREEN].NumC)
|
||||||
if (c)
|
|
||||||
{
|
{
|
||||||
strcat(buf, " (");
|
strcat(buf, " (");
|
||||||
strcat(buf, GetKeyComboName(c));
|
char *buttName = MakeButtString(&FCEUD_CommandMapping[EMUCMD_MISC_TOGGLEFULLSCREEN], 0);
|
||||||
|
strcat(buf, buttName);
|
||||||
|
free(buttName);
|
||||||
if (fullscreenByDoubleclick)
|
if (fullscreenByDoubleclick)
|
||||||
strcat(buf, " or double-click)");
|
strcat(buf, " or double-click)");
|
||||||
else
|
else
|
||||||
|
|
|
@ -2918,7 +2918,7 @@ string HOTKEYMENUINDEX::getQualifiedMenuText(FCEUMENU_INDEX menu_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
string HOTKEYMENUINDEX::getQualifiedMenuText(char* text, int emu_cmd_id) {
|
string HOTKEYMENUINDEX::getQualifiedMenuText(char* text, int emu_cmd_id) {
|
||||||
char* combo = GetKeyComboName(FCEUD_CommandMapping[emu_cmd_id]);
|
char* combo = MakeButtString(&FCEUD_CommandMapping[emu_cmd_id], 0);
|
||||||
char* str = new char[strlen(text) + strlen(combo) + strlen("\t") + 1];
|
char* str = new char[strlen(text) + strlen(combo) + strlen("\t") + 1];
|
||||||
strcpy(str, text);
|
strcpy(str, text);
|
||||||
if (strcmp("", combo))
|
if (strcmp("", combo))
|
||||||
|
@ -2926,6 +2926,7 @@ string HOTKEYMENUINDEX::getQualifiedMenuText(char* text, int emu_cmd_id) {
|
||||||
strcat(str, "\t");
|
strcat(str, "\t");
|
||||||
strcat(str, combo);
|
strcat(str, combo);
|
||||||
}
|
}
|
||||||
|
free(combo);
|
||||||
string menustr = str;
|
string menustr = str;
|
||||||
delete[] str;
|
delete[] str;
|
||||||
return menustr;
|
return menustr;
|
||||||
|
|
|
@ -124,7 +124,6 @@
|
||||||
{0x054bd3e9, 74, -1}, /* Di 4 Ci - Ji Qi Ren Dai Zhan (As) */
|
{0x054bd3e9, 74, -1}, /* Di 4 Ci - Ji Qi Ren Dai Zhan (As) */
|
||||||
{0x496ac8f7, 74, -1}, /* Ji Jia Zhan Shi (As) */
|
{0x496ac8f7, 74, -1}, /* Ji Jia Zhan Shi (As) */
|
||||||
{0xae854cef, 74, -1}, /* Jia A Fung Yun (Chinese) */
|
{0xae854cef, 74, -1}, /* Jia A Fung Yun (Chinese) */
|
||||||
{0xba51ac6f, 78, 2},
|
|
||||||
{0x3d1c3137, 78, 8}, /* Uchuusen - Cosmo Carrier */
|
{0x3d1c3137, 78, 8}, /* Uchuusen - Cosmo Carrier */
|
||||||
{0xa4fbb438, 79, 0},
|
{0xa4fbb438, 79, 0},
|
||||||
{0xd4a76b07, 79, 0}, /* F-15 City Wars*/
|
{0xd4a76b07, 79, 0}, /* F-15 City Wars*/
|
||||||
|
|
Loading…
Reference in New Issue