GC input recording: Record the on/off state and the analogue state of the L/R triggers separately (gets rid of an arbitrary numeric constant of 230 which isn't elsewhere in the code and should solve some issues with Metroid Prime recordings).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7179 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
smelenchuk 2011-02-15 23:38:44 +00:00
parent d19c97dbe1
commit 0cc0618e6d
2 changed files with 12 additions and 8 deletions

View File

@ -246,8 +246,10 @@ void RecordInput(SPADStatus *PadStatus, int controllerID)
g_padState.DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0);
g_padState.DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0);
g_padState.L = PadStatus->triggerLeft;
g_padState.R = PadStatus->triggerRight;
g_padState.L = ((PadStatus->button & PAD_TRIGGER_L) != 0);
g_padState.R = ((PadStatus->button & PAD_TRIGGER_R) != 0);
g_padState.TriggerL = PadStatus->triggerLeft;
g_padState.TriggerR = PadStatus->triggerRight;
g_padState.AnalogStickX = PadStatus->stickX;
g_padState.AnalogStickY = PadStatus->stickY;
@ -413,13 +415,14 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
if(g_padState.DPadRight)
PadStatus->button |= PAD_BUTTON_RIGHT;
PadStatus->triggerLeft = g_padState.L;
if(PadStatus->triggerLeft > 230)
if(g_padState.L)
PadStatus->button |= PAD_TRIGGER_L;
PadStatus->triggerRight = g_padState.R;
if(PadStatus->triggerRight > 230)
if(g_padState.R)
PadStatus->button |= PAD_TRIGGER_R;
PadStatus->triggerLeft = g_padState.TriggerL;
PadStatus->triggerRight = g_padState.TriggerR;
PadStatus->stickX = g_padState.AnalogStickX;
PadStatus->stickY = g_padState.AnalogStickY;

View File

@ -40,9 +40,10 @@ struct ControllerState {
bool Start:1, A:1, B:1, X:1, Y:1, Z:1; // Binary buttons, 6 bits
bool DPadUp:1, DPadDown:1, // Binary D-Pad buttons, 4 bits
DPadLeft:1, DPadRight:1;
bool reserved:6; // Reserved bits used for padding, 6 bits
bool L:1, R:1; // Binary triggers, 2 bits
bool reserved:4; // Reserved bits used for padding, 4 bits
u8 L, R; // Triggers, 16 bits
u8 TriggerL, TriggerR; // Triggers, 16 bits
u8 AnalogStickX, AnalogStickY; // Main Stick, 16 bits
u8 CStickX, CStickY; // Sub-Stick, 16 bits