Further optimization, now that I know the code functions and have something to fall back to if I mess up.
This commit is contained in:
parent
816da56c87
commit
bd5933dd68
|
@ -170,6 +170,59 @@ int GetAutoFireDesynch()
|
|||
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()
|
||||
{
|
||||
// Get selected joypad buttons, ignoring NES polling
|
||||
// Basically checks for immediate gamepad input.
|
||||
//extern ButtConfig GamePadConfig[4][10];
|
||||
//extern int allowUDLR;
|
||||
|
||||
uint32 JSButtons=0;
|
||||
int x;
|
||||
int wg;
|
||||
|
||||
for(wg=0;wg<4;wg++)
|
||||
{
|
||||
|
||||
for(x=0;x<8;x++)
|
||||
if(DTestButtonImmediate(&GamePadConfig[wg][x]))
|
||||
JSButtons|=(1<<x)<<(wg<<3);
|
||||
|
||||
// Check if U+D/L+R is disabled
|
||||
if(!allowUDLR)
|
||||
{
|
||||
for(x=0;x<32;x+=8)
|
||||
{
|
||||
if((JSButtons & (0xC0<<x) ) == (0xC0<<x) ) JSButtons&=~(0xC0<<x);
|
||||
if((JSButtons & (0x30<<x) ) == (0x30<<x) ) JSButtons&=~(0x30<<x);
|
||||
}
|
||||
}
|
||||
}
|
||||
return JSButtons;
|
||||
}
|
||||
|
||||
int DTestButton(ButtConfig *bc)
|
||||
{
|
||||
uint32 x;//mbg merge 7/17/06 changed to uint
|
||||
|
@ -188,7 +241,6 @@ int DTestButton(ButtConfig *bc)
|
|||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void UpdateGamepad()
|
||||
{
|
||||
if(FCEUMOV_Mode(MOVIEMODE_PLAY))
|
||||
|
|
|
@ -22,6 +22,7 @@ void DestroyInput(void);
|
|||
void InputScreenChanged(int fs);
|
||||
void SetAutoFireDesynch(int DesynchOn);
|
||||
int GetAutoFireDesynch();
|
||||
uint32 GetGamepadPressedImmediate();
|
||||
|
||||
extern LPDIRECTINPUT7 lpDI;
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "input.h"
|
||||
#include "keyboard.h"
|
||||
#include "joystick.h"
|
||||
|
||||
static HRESULT ddrval; //mbg merge 7/17/06 made static
|
||||
static int background = 0;
|
||||
|
@ -41,58 +40,6 @@ static unsigned int keys_jd[256] = {0,}; // just-down
|
|||
static unsigned int keys_jd_lock[256] = {0,}; // just-down released lock
|
||||
int autoHoldKey = 0, autoHoldClearKey = 0;
|
||||
int ctr=0;
|
||||
|
||||
// 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
|
||||
|
||||
for(x=0;x<bc->NumC;x++)
|
||||
{
|
||||
if(bc->ButtType[x]==BUTTC_KEYBOARD)
|
||||
{
|
||||
if(keys_nr[bc->ButtonNum[x]])
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(DTestButtonJoy(bc)) return(1); // Needs joystick.h. Tested with PPJoy mapped with Print Screen
|
||||
return(0);
|
||||
}
|
||||
|
||||
uint32 GetGamepadPressedImmediate()
|
||||
{
|
||||
// Get selected joypad buttons, ignoring NES polling
|
||||
// Basically checks for immediate gamepad input.
|
||||
extern ButtConfig GamePadConfig[4][10];
|
||||
extern int allowUDLR;
|
||||
|
||||
uint32 JSButtons=0;
|
||||
int x;
|
||||
int wg;
|
||||
|
||||
for(wg=0;wg<4;wg++)
|
||||
{
|
||||
|
||||
for(x=0;x<8;x++)
|
||||
if(DTestButtonImmediate(&GamePadConfig[wg][x]))
|
||||
JSButtons|=(1<<x)<<(wg<<3);
|
||||
|
||||
// Check if U+D/L+R is disabled
|
||||
if(!allowUDLR)
|
||||
{
|
||||
for(x=0;x<32;x+=8)
|
||||
{
|
||||
if((JSButtons & (0xC0<<x) ) == (0xC0<<x) ) JSButtons&=~(0xC0<<x);
|
||||
if((JSButtons & (0x30<<x) ) == (0x30<<x) ) JSButtons&=~(0x30<<x);
|
||||
}
|
||||
}
|
||||
}
|
||||
return JSButtons;
|
||||
}
|
||||
|
||||
void KeyboardUpdateState(void)
|
||||
{
|
||||
unsigned char tk[256];
|
||||
|
@ -170,9 +117,6 @@ void KeyboardUpdateState(void)
|
|||
extern uint8 autoHoldOn, autoHoldReset;
|
||||
autoHoldOn = autoHoldKey && keys[autoHoldKey] != 0;
|
||||
autoHoldReset = autoHoldClearKey && keys[autoHoldClearKey] != 0;
|
||||
|
||||
extern uint32 JSImmediate;
|
||||
JSImmediate = GetGamepadPressedImmediate();
|
||||
}
|
||||
|
||||
unsigned int *GetKeyboard(void)
|
||||
|
|
|
@ -82,9 +82,6 @@ bool frameAdvanceLagSkip = false; //If this is true, frame advance will skip ove
|
|||
bool AutoSS = false; //Flagged true when the first auto-savestate is made while a game is loaded, flagged false on game close
|
||||
bool movieSubtitles = true; //Toggle for displaying movie subtitles
|
||||
|
||||
// GetGamepadPressedImmediate() transfer is being a pain to access.
|
||||
uint32 JSImmediate=0;
|
||||
|
||||
FCEUGI::FCEUGI()
|
||||
: filename(0)
|
||||
, archiveFilename(0)
|
||||
|
|
|
@ -50,6 +50,11 @@
|
|||
#include "fceulua.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "drivers/win/common.h" //For DirectX constants
|
||||
#include "drivers/win/input.h"
|
||||
#endif
|
||||
|
||||
#ifdef CREATE_AVI
|
||||
#include "drivers/videolog/nesvideos-piece.h"
|
||||
#endif
|
||||
|
@ -262,11 +267,14 @@ void FCEU_PutImage(void)
|
|||
t[i+j*256] = 0xCF;
|
||||
c = cur_input_display >> (controller * 8);
|
||||
|
||||
extern uint32 JSImmediate;
|
||||
|
||||
// This doesn't work in anything except windows for now.
|
||||
// It doesn't get set anywhere in other ports.
|
||||
ci = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0:JSImmediate >> (controller * 8);
|
||||
#ifdef WIN32
|
||||
ci = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0:GetGamepadPressedImmediate() >> (controller * 8);
|
||||
#else
|
||||
// Put other port info here
|
||||
ci = 0;
|
||||
#endif
|
||||
|
||||
c &= 255;
|
||||
ci &= 255;
|
||||
|
|
Loading…
Reference in New Issue