Cocoa Port: Retrieve both pending and applied NDS inputs post-NDSExec().
- Also do some minor code cleanup on some input-related stuff.
This commit is contained in:
parent
a86539eb1c
commit
f67f959fe3
|
@ -2881,54 +2881,56 @@ static void NDS_applyFinalInput()
|
|||
{
|
||||
const UserInput& input = NDS_getFinalUserInput();
|
||||
|
||||
u16 pad = (0 |
|
||||
((input.buttons.A ? 0 : 0x80) >> 7) |
|
||||
((input.buttons.B ? 0 : 0x80) >> 6) |
|
||||
((input.buttons.T ? 0 : 0x80) >> 5) |
|
||||
((input.buttons.S ? 0 : 0x80) >> 4) |
|
||||
((input.buttons.R ? 0 : 0x80) >> 3) |
|
||||
((input.buttons.L ? 0 : 0x80) >> 2) |
|
||||
((input.buttons.U ? 0 : 0x80) >> 1) |
|
||||
((input.buttons.D ? 0 : 0x80) ) |
|
||||
((input.buttons.E ? 0 : 0x80) << 1) |
|
||||
((input.buttons.W ? 0 : 0x80) << 2)) ;
|
||||
u16 gbaKeys = ((input.buttons.A) ? 0 : (1 << 0)) |
|
||||
((input.buttons.B) ? 0 : (1 << 1)) |
|
||||
((input.buttons.T) ? 0 : (1 << 2)) |
|
||||
((input.buttons.S) ? 0 : (1 << 3)) |
|
||||
((input.buttons.R) ? 0 : (1 << 4)) |
|
||||
((input.buttons.L) ? 0 : (1 << 5)) |
|
||||
((input.buttons.U) ? 0 : (1 << 6)) |
|
||||
((input.buttons.D) ? 0 : (1 << 7)) |
|
||||
((input.buttons.E) ? 0 : (1 << 8)) |
|
||||
((input.buttons.W) ? 0 : (1 << 9));
|
||||
|
||||
gbaKeys = LOCAL_TO_LE_16(gbaKeys);
|
||||
HostWriteWord(MMU.ARM9_REG, 0x130, gbaKeys);
|
||||
HostWriteWord(MMU.ARM7_REG, 0x130, gbaKeys);
|
||||
|
||||
pad = LOCAL_TO_LE_16(pad);
|
||||
((u16 *)MMU.ARM9_REG)[0x130>>1] = (u16)pad;
|
||||
((u16 *)MMU.ARM7_REG)[0x130>>1] = (u16)pad;
|
||||
|
||||
u16 k_cnt = ((u16 *)MMU.ARM9_REG)[0x132>>1];
|
||||
if ( k_cnt & (1<<14))
|
||||
const u16 k_cnt_9 = HostReadWord(MMU.ARM9_REG, 0x132);
|
||||
if (k_cnt_9 & (1 << 14))
|
||||
{
|
||||
//INFO("ARM9: KeyPad IRQ (pad 0x%04X, cnt 0x%04X (condition %s))\n", pad, k_cnt, k_cnt&(1<<15)?"AND":"OR");
|
||||
u16 k_cnt_selected = (k_cnt & 0x3F);
|
||||
if (k_cnt&(1<<15)) // AND
|
||||
//INFO("ARM9: KeyPad IRQ (pad 0x%04X, cnt 0x%04X (condition %s))\n", pad, k_cnt_9, k_cnt_9 & (1<<15) ? "AND" : "OR");
|
||||
const u16 k_cnt_selected = (k_cnt_9 & 0x3F);
|
||||
if (k_cnt_9 & (1 << 15)) // AND
|
||||
{
|
||||
if ((~pad & k_cnt_selected) == k_cnt_selected) NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_KEYPAD);
|
||||
if ((~gbaKeys & k_cnt_selected) == k_cnt_selected)
|
||||
NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_KEYPAD);
|
||||
}
|
||||
else // OR
|
||||
{
|
||||
if (~pad & k_cnt_selected) NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_KEYPAD);
|
||||
if (~gbaKeys & k_cnt_selected)
|
||||
NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_KEYPAD);
|
||||
}
|
||||
}
|
||||
|
||||
k_cnt = ((u16 *)MMU.ARM7_REG)[0x132>>1];
|
||||
if ( k_cnt & (1<<14))
|
||||
const u16 k_cnt_7 = HostReadWord(MMU.ARM7_REG, 0x132);
|
||||
if ( k_cnt_7 & (1 << 14))
|
||||
{
|
||||
//INFO("ARM7: KeyPad IRQ (pad 0x%04X, cnt 0x%04X (condition %s))\n", pad, k_cnt, k_cnt&(1<<15)?"AND":"OR");
|
||||
u16 k_cnt_selected = (k_cnt & 0x3F);
|
||||
if (k_cnt&(1<<15)) // AND
|
||||
//INFO("ARM7: KeyPad IRQ (pad 0x%04X, cnt 0x%04X (condition %s))\n", pad, k_cnt_7, k_cnt_7 & (1<<15) ? "AND" : "OR");
|
||||
const u16 k_cnt_selected = (k_cnt_7 & 0x3F);
|
||||
if (k_cnt_7 & (1 << 15)) // AND
|
||||
{
|
||||
if ((~pad & k_cnt_selected) == k_cnt_selected) NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_KEYPAD);
|
||||
if ((~gbaKeys & k_cnt_selected) == k_cnt_selected)
|
||||
NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_KEYPAD);
|
||||
}
|
||||
else // OR
|
||||
{
|
||||
if (~pad & k_cnt_selected) NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_KEYPAD);
|
||||
if (~gbaKeys & k_cnt_selected)
|
||||
NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_KEYPAD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(input.touch.isTouch)
|
||||
|
||||
if (input.touch.isTouch)
|
||||
{
|
||||
u16 adc_x = NDS_getADCTouchPosX(input.touch.touchX);
|
||||
u16 adc_y = NDS_getADCTouchPosY(input.touch.touchY);
|
||||
|
@ -2964,35 +2966,19 @@ static void NDS_applyFinalInput()
|
|||
if (countLid > 0)
|
||||
countLid--;
|
||||
}
|
||||
|
||||
u16 padExt = (1<<2) | (1<<4) | (1<<5);
|
||||
if (!input.buttons.X) padExt |= 1<<0;
|
||||
if (!input.buttons.Y) padExt |= 1<<1;
|
||||
if (!input.buttons.G) padExt |= 1<<3; //debug button
|
||||
if (!nds.isTouch) padExt |= 1<<6; //~touch
|
||||
if (LidClosed) padExt |= 1<<7;
|
||||
|
||||
((u16 *)MMU.ARM7_REG)[0x136>>1] = LOCAL_TO_LE_16(padExt);
|
||||
|
||||
InputDisplayString=MakeInputDisplayString(padExt, pad);
|
||||
|
||||
//put into the format we want for the movie system
|
||||
//fRLDUTSBAYXWEg
|
||||
//we don't really need nds.pad anymore, but removing it would be a pain
|
||||
|
||||
nds.pad =
|
||||
((input.buttons.R ? 1 : 0) << 12)|
|
||||
((input.buttons.L ? 1 : 0) << 11)|
|
||||
((input.buttons.D ? 1 : 0) << 10)|
|
||||
((input.buttons.U ? 1 : 0) << 9)|
|
||||
((input.buttons.T ? 1 : 0) << 8)|
|
||||
((input.buttons.S ? 1 : 0) << 7)|
|
||||
((input.buttons.B ? 1 : 0) << 6)|
|
||||
((input.buttons.A ? 1 : 0) << 5)|
|
||||
((input.buttons.Y ? 1 : 0) << 4)|
|
||||
((input.buttons.X ? 1 : 0) << 3)|
|
||||
((input.buttons.W ? 1 : 0) << 2)|
|
||||
((input.buttons.E ? 1 : 0) << 1);
|
||||
u16 ndsKeysExt = ((input.buttons.X) ? 0 : (1 << 0)) |
|
||||
((input.buttons.Y) ? 0 : (1 << 1)) |
|
||||
(1 << 2) |
|
||||
((input.buttons.G) ? 0 : (1 << 3)) | // debug button
|
||||
(1 << 4) |
|
||||
(1 << 5) |
|
||||
((nds.isTouch) ? 0 : (1 << 6)) |
|
||||
((!LidClosed) ? 0 : (1 << 7));
|
||||
|
||||
T1WriteWord(MMU.ARM7_REG, 0x136, ndsKeysExt);
|
||||
|
||||
InputDisplayString = MakeInputDisplayString(ndsKeysExt, gbaKeys);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -192,7 +192,6 @@ struct NDSSystem
|
|||
BOOL isFakeBooted;
|
||||
|
||||
BOOL isTouch;
|
||||
u16 pad;
|
||||
|
||||
u16 paddle;
|
||||
|
||||
|
|
|
@ -850,28 +850,48 @@ void ClientExecutionControl::FetchOutputPostNDSExec()
|
|||
this->_ndsFrameInfo.rtcString = tempBuffer;
|
||||
free(tempBuffer);
|
||||
|
||||
const UserInput &ndsInput = NDS_getFinalUserInput();
|
||||
const UserInput &ndsInputsPending = NDS_getRawUserInput();
|
||||
const UserInput &ndsInputsApplied = NDS_getFinalUserInput();
|
||||
|
||||
this->_ndsFrameInfo.inputState.value = 0xFFFFFFFFFFFFFFFFUL;
|
||||
this->_ndsFrameInfo.inputState.A = (ndsInput.buttons.A) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.B = (ndsInput.buttons.B) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Select = (ndsInput.buttons.T) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Start = (ndsInput.buttons.S) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Right = (ndsInput.buttons.R) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Left = (ndsInput.buttons.L) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Up = (ndsInput.buttons.U) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Down = (ndsInput.buttons.D) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.R = (ndsInput.buttons.E) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.L = (ndsInput.buttons.W) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.X = (ndsInput.buttons.X) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Y = (ndsInput.buttons.Y) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Debug = (ndsInput.buttons.G) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Touch = (ndsInput.touch.isTouch) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Lid = (ndsInput.buttons.F) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputState.Microphone = (ndsInput.mic.micButtonPressed != 0) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.value = INPUT_STATES_CLEAR_VALUE;
|
||||
this->_ndsFrameInfo.inputStatesPending.A = (ndsInputsPending.buttons.A) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.B = (ndsInputsPending.buttons.B) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Select = (ndsInputsPending.buttons.T) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Start = (ndsInputsPending.buttons.S) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Right = (ndsInputsPending.buttons.R) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Left = (ndsInputsPending.buttons.L) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Up = (ndsInputsPending.buttons.U) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Down = (ndsInputsPending.buttons.D) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.R = (ndsInputsPending.buttons.E) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.L = (ndsInputsPending.buttons.W) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.X = (ndsInputsPending.buttons.X) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Y = (ndsInputsPending.buttons.Y) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Debug = (ndsInputsPending.buttons.G) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Touch = (ndsInputsPending.touch.isTouch) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Lid = (ndsInputsPending.buttons.F) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesPending.Microphone = (ndsInputsPending.mic.micButtonPressed != 0) ? 0 : 1;
|
||||
this->_ndsFrameInfo.touchLocXPending = ndsInputsPending.touch.touchX >> 4;
|
||||
this->_ndsFrameInfo.touchLocYPending = ndsInputsPending.touch.touchY >> 4;
|
||||
|
||||
this->_ndsFrameInfo.touchLocX = ndsInput.touch.touchX;
|
||||
this->_ndsFrameInfo.touchLocY = ndsInput.touch.touchY;
|
||||
this->_ndsFrameInfo.inputStatesApplied.value = INPUT_STATES_CLEAR_VALUE;
|
||||
this->_ndsFrameInfo.inputStatesApplied.A = (ndsInputsApplied.buttons.A) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.B = (ndsInputsApplied.buttons.B) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Select = (ndsInputsApplied.buttons.T) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Start = (ndsInputsApplied.buttons.S) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Right = (ndsInputsApplied.buttons.R) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Left = (ndsInputsApplied.buttons.L) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Up = (ndsInputsApplied.buttons.U) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Down = (ndsInputsApplied.buttons.D) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.R = (ndsInputsApplied.buttons.E) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.L = (ndsInputsApplied.buttons.W) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.X = (ndsInputsApplied.buttons.X) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Y = (ndsInputsApplied.buttons.Y) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Debug = (ndsInputsApplied.buttons.G) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Touch = (ndsInputsApplied.touch.isTouch) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Lid = (ndsInputsApplied.buttons.F) ? 0 : 1;
|
||||
this->_ndsFrameInfo.inputStatesApplied.Microphone = (ndsInputsApplied.mic.micButtonPressed != 0) ? 0 : 1;
|
||||
this->_ndsFrameInfo.touchLocXApplied = ndsInputsApplied.touch.touchX >> 4;
|
||||
this->_ndsFrameInfo.touchLocYApplied = ndsInputsApplied.touch.touchY >> 4;
|
||||
|
||||
pthread_mutex_unlock(&this->_mutexOutputPostNDSExec);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#define FRAME_SKIP_BIAS 0.1 // May be any real number. This value acts as a vector addition to the frame skip.
|
||||
#define MAX_FRAME_SKIP (DS_FRAMES_PER_SECOND / 2.98)
|
||||
|
||||
#define INPUT_STATES_CLEAR_VALUE 0xFFFFFFFF00FF03FFUL
|
||||
|
||||
enum ExecutionBehavior
|
||||
{
|
||||
ExecutionBehavior_Pause = 0,
|
||||
|
@ -112,11 +114,10 @@ typedef union
|
|||
struct
|
||||
{
|
||||
uint16_t gbaKeys;
|
||||
uint8_t ndsKeysExt;
|
||||
uint8_t guitarGripKeys;
|
||||
uint16_t ndsKeysExt;
|
||||
uint16_t easyPianoKeys;
|
||||
uint8_t guitarGripKeys;
|
||||
uint8_t miscKeys;
|
||||
uint8_t unused;
|
||||
};
|
||||
|
||||
struct
|
||||
|
@ -143,12 +144,7 @@ typedef union
|
|||
uint8_t Touch:1;
|
||||
uint8_t Lid:1;
|
||||
|
||||
uint8_t :3;
|
||||
uint8_t GuitarGripBlue:1;
|
||||
uint8_t GuitarGripYellow:1;
|
||||
uint8_t GuitarGripRed:1;
|
||||
uint8_t GuitarGripGreen:1;
|
||||
uint8_t :1;
|
||||
uint8_t :8;
|
||||
|
||||
uint8_t PianoC:1;
|
||||
uint8_t PianoCSharp:1;
|
||||
|
@ -167,11 +163,17 @@ typedef union
|
|||
uint8_t PianoHighC:1;
|
||||
uint8_t :1;
|
||||
|
||||
uint8_t :3;
|
||||
uint8_t GuitarGripBlue:1;
|
||||
uint8_t GuitarGripYellow:1;
|
||||
uint8_t GuitarGripRed:1;
|
||||
uint8_t GuitarGripGreen:1;
|
||||
uint8_t :1;
|
||||
|
||||
uint8_t Paddle:1;
|
||||
uint8_t Microphone:1;
|
||||
uint8_t :6;
|
||||
|
||||
uint8_t :8;
|
||||
uint8_t Reset:1;
|
||||
uint8_t :5;
|
||||
#else
|
||||
uint8_t Down:1;
|
||||
uint8_t Up:1;
|
||||
|
@ -194,12 +196,7 @@ typedef union
|
|||
uint8_t Y:1;
|
||||
uint8_t X:1;
|
||||
|
||||
uint8_t :1;
|
||||
uint8_t GuitarGripGreen:1;
|
||||
uint8_t GuitarGripRed:1;
|
||||
uint8_t GuitarGripYellow:1;
|
||||
uint8_t GuitarGripBlue:1;
|
||||
uint8_t :3;
|
||||
uint8_t :8;
|
||||
|
||||
uint8_t PianoG:1;
|
||||
uint8_t PianoFSharp:1;
|
||||
|
@ -218,11 +215,17 @@ typedef union
|
|||
uint8_t PianoA:1;
|
||||
uint8_t PianoGSharp:1;
|
||||
|
||||
uint8_t :6;
|
||||
uint8_t :1;
|
||||
uint8_t GuitarGripGreen:1;
|
||||
uint8_t GuitarGripRed:1;
|
||||
uint8_t GuitarGripYellow:1;
|
||||
uint8_t GuitarGripBlue:1;
|
||||
uint8_t :3;
|
||||
|
||||
uint8_t :5;
|
||||
uint8_t Reset:1;
|
||||
uint8_t Microphone:1;
|
||||
uint8_t Paddle:1;
|
||||
|
||||
uint8_t :8;
|
||||
#endif
|
||||
};
|
||||
} NDSInputState; // Each bit represents the Pressed/Released state of a single input. Pressed=0, Released=1
|
||||
|
@ -275,9 +278,13 @@ struct NDSFrameInfo
|
|||
uint32_t cpuLoadAvgARM9;
|
||||
uint32_t cpuLoadAvgARM7;
|
||||
|
||||
NDSInputState inputState;
|
||||
uint16_t touchLocX;
|
||||
uint16_t touchLocY;
|
||||
NDSInputState inputStatesPending;
|
||||
uint8_t touchLocXPending;
|
||||
uint8_t touchLocYPending;
|
||||
|
||||
NDSInputState inputStatesApplied;
|
||||
uint8_t touchLocXApplied;
|
||||
uint8_t touchLocYApplied;
|
||||
|
||||
void clear()
|
||||
{
|
||||
|
@ -289,9 +296,14 @@ struct NDSFrameInfo
|
|||
this->lagFrameCount = 0;
|
||||
this->cpuLoadAvgARM9 = 0;
|
||||
this->cpuLoadAvgARM7 = 0;
|
||||
this->inputState.value = 0xFFFFFFFFFFFFFFFFUL;
|
||||
this->touchLocX = 0;
|
||||
this->touchLocY = 0;
|
||||
|
||||
this->inputStatesPending.value = INPUT_STATES_CLEAR_VALUE;
|
||||
this->touchLocXPending = 0;
|
||||
this->touchLocYPending = 0;
|
||||
|
||||
this->inputStatesApplied.value = INPUT_STATES_CLEAR_VALUE;
|
||||
this->touchLocXApplied = 0;
|
||||
this->touchLocYApplied = 0;
|
||||
}
|
||||
|
||||
void copyFrom(const NDSFrameInfo &fromObject)
|
||||
|
@ -304,9 +316,14 @@ struct NDSFrameInfo
|
|||
this->lagFrameCount = fromObject.lagFrameCount;
|
||||
this->cpuLoadAvgARM9 = fromObject.cpuLoadAvgARM9;
|
||||
this->cpuLoadAvgARM7 = fromObject.cpuLoadAvgARM7;
|
||||
this->inputState = fromObject.inputState;
|
||||
this->touchLocX = fromObject.touchLocX;
|
||||
this->touchLocY = fromObject.touchLocY;
|
||||
|
||||
this->inputStatesPending = fromObject.inputStatesPending;
|
||||
this->touchLocXPending = fromObject.touchLocXPending;
|
||||
this->touchLocYPending = fromObject.touchLocYPending;
|
||||
|
||||
this->inputStatesApplied = fromObject.inputStatesApplied;
|
||||
this->touchLocXApplied = fromObject.touchLocXApplied;
|
||||
this->touchLocYApplied = fromObject.touchLocYApplied;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -728,7 +728,7 @@ void FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, std::stri
|
|||
else
|
||||
{
|
||||
UserInput &input = NDS_getProcessingUserInput();
|
||||
ReplayRecToDesmumeInput(currMovieData.records[currFrameCounter], &input);
|
||||
ReplayRecToDesmumeInput(currMovieData.records[currFrameCounter], input);
|
||||
}
|
||||
|
||||
//if we are on the last frame, then pause the emulator if the player requested it
|
||||
|
@ -763,7 +763,7 @@ void FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, std::stri
|
|||
{
|
||||
MovieRecord mr;
|
||||
const UserInput &input = NDS_getFinalUserInput();
|
||||
DesmumeInputToReplayRec(input, &mr);
|
||||
DesmumeInputToReplayRec(input, mr);
|
||||
|
||||
assert(mr.touch.touch || (!mr.touch.x && !mr.touch.y));
|
||||
//assert(nds.touchX == input.touch.touchX && nds.touchY == input.touch.touchY);
|
||||
|
@ -1210,14 +1210,9 @@ void BinaryDataFromString(std::string &inStringData, std::vector<u8> *outBinaryD
|
|||
}
|
||||
}
|
||||
|
||||
void ReplayRecToDesmumeInput(const MovieRecord &theRecord, UserInput *theInput)
|
||||
void ReplayRecToDesmumeInput(const MovieRecord &inRecord, UserInput &outInput)
|
||||
{
|
||||
if (theInput == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(theRecord.command_reset())
|
||||
if (inRecord.command_reset())
|
||||
{
|
||||
NDS_Reset();
|
||||
return;
|
||||
|
@ -1227,47 +1222,60 @@ void ReplayRecToDesmumeInput(const MovieRecord &theRecord, UserInput *theInput)
|
|||
movie_reset_command = false;
|
||||
}
|
||||
|
||||
const u16 pad = theRecord.pad;
|
||||
theInput->buttons.R = (((pad>>12)&1)!=0);
|
||||
theInput->buttons.L = (((pad>>11)&1)!=0);
|
||||
theInput->buttons.D = (((pad>>10)&1)!=0);
|
||||
theInput->buttons.U = (((pad>>9)&1)!=0);
|
||||
theInput->buttons.T = (((pad>>8)&1)!=0);
|
||||
theInput->buttons.S = (((pad>>7)&1)!=0);
|
||||
theInput->buttons.B = (((pad>>6)&1)!=0);
|
||||
theInput->buttons.A = (((pad>>5)&1)!=0);
|
||||
theInput->buttons.Y = (((pad>>4)&1)!=0);
|
||||
theInput->buttons.X = (((pad>>3)&1)!=0);
|
||||
theInput->buttons.W = (((pad>>2)&1)!=0);
|
||||
theInput->buttons.E = (((pad>>1)&1)!=0);
|
||||
theInput->buttons.G = (((pad>>0)&1)!=0);
|
||||
theInput->buttons.F = theRecord.command_lid();
|
||||
outInput.buttons.R = ((inRecord.pad & (1 << 12)) != 0);
|
||||
outInput.buttons.L = ((inRecord.pad & (1 << 11)) != 0);
|
||||
outInput.buttons.D = ((inRecord.pad & (1 << 10)) != 0);
|
||||
outInput.buttons.U = ((inRecord.pad & (1 << 9)) != 0);
|
||||
outInput.buttons.T = ((inRecord.pad & (1 << 8)) != 0);
|
||||
outInput.buttons.S = ((inRecord.pad & (1 << 7)) != 0);
|
||||
outInput.buttons.B = ((inRecord.pad & (1 << 6)) != 0);
|
||||
outInput.buttons.A = ((inRecord.pad & (1 << 5)) != 0);
|
||||
outInput.buttons.Y = ((inRecord.pad & (1 << 4)) != 0);
|
||||
outInput.buttons.X = ((inRecord.pad & (1 << 3)) != 0);
|
||||
outInput.buttons.W = ((inRecord.pad & (1 << 2)) != 0);
|
||||
outInput.buttons.E = ((inRecord.pad & (1 << 1)) != 0);
|
||||
outInput.buttons.G = ((inRecord.pad & (1 << 0)) != 0);
|
||||
outInput.buttons.F = inRecord.command_lid();
|
||||
|
||||
theInput->touch.touchX = theRecord.touch.x << 4;
|
||||
theInput->touch.touchY = theRecord.touch.y << 4;
|
||||
theInput->touch.isTouch = (theRecord.touch.touch != 0);
|
||||
outInput.touch.isTouch = (inRecord.touch.touch != 0);
|
||||
outInput.touch.touchX = inRecord.touch.x << 4;
|
||||
outInput.touch.touchY = inRecord.touch.y << 4;
|
||||
|
||||
theInput->mic.micButtonPressed = (theRecord.command_microphone()) ? 1 : 0;
|
||||
outInput.mic.micButtonPressed = (inRecord.command_microphone()) ? 1 : 0;
|
||||
}
|
||||
|
||||
void DesmumeInputToReplayRec(const UserInput &theInput, MovieRecord *theRecord)
|
||||
void DesmumeInputToReplayRec(const UserInput &inInput, MovieRecord &outRecord)
|
||||
{
|
||||
theRecord->commands = 0;
|
||||
outRecord.commands = 0;
|
||||
|
||||
if(theInput.mic.micButtonPressed == 1)
|
||||
theRecord->commands = MOVIECMD_MIC;
|
||||
//put into the format we want for the movie system
|
||||
//fRLDUTSBAYXWEg
|
||||
outRecord.pad = ((inInput.buttons.R) ? (1 << 12) : 0) |
|
||||
((inInput.buttons.L) ? (1 << 11) : 0) |
|
||||
((inInput.buttons.D) ? (1 << 10) : 0) |
|
||||
((inInput.buttons.U) ? (1 << 9) : 0) |
|
||||
((inInput.buttons.T) ? (1 << 8) : 0) |
|
||||
((inInput.buttons.S) ? (1 << 7) : 0) |
|
||||
((inInput.buttons.B) ? (1 << 6) : 0) |
|
||||
((inInput.buttons.A) ? (1 << 5) : 0) |
|
||||
((inInput.buttons.Y) ? (1 << 4) : 0) |
|
||||
((inInput.buttons.X) ? (1 << 3) : 0) |
|
||||
((inInput.buttons.W) ? (1 << 2) : 0) |
|
||||
((inInput.buttons.E) ? (1 << 1) : 0);
|
||||
|
||||
theRecord->pad = nds.pad;
|
||||
if (inInput.buttons.F)
|
||||
outRecord.commands = MOVIECMD_LID;
|
||||
|
||||
if(theInput.buttons.F)
|
||||
theRecord->commands = MOVIECMD_LID;
|
||||
|
||||
if(movie_reset_command) {
|
||||
theRecord->commands = MOVIECMD_RESET;
|
||||
if (movie_reset_command)
|
||||
{
|
||||
outRecord.commands = MOVIECMD_RESET;
|
||||
movie_reset_command = false;
|
||||
}
|
||||
|
||||
theRecord->touch.touch = theInput.touch.isTouch ? 1 : 0;
|
||||
theRecord->touch.x = (theInput.touch.isTouch) ? theInput.touch.touchX >> 4 : 0;
|
||||
theRecord->touch.y = (theInput.touch.isTouch) ? theInput.touch.touchY >> 4 : 0;
|
||||
outRecord.touch.touch = (inInput.touch.isTouch) ? 1 : 0;
|
||||
outRecord.touch.x = (inInput.touch.isTouch) ? inInput.touch.touchX >> 4 : 0;
|
||||
outRecord.touch.y = (inInput.touch.isTouch) ? inInput.touch.touchY >> 4 : 0;
|
||||
|
||||
if (inInput.mic.micButtonPressed != 0)
|
||||
outRecord.commands = MOVIECMD_MIC;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ extern bool ShowInputDisplay;
|
|||
void FCEUI_MakeBackupMovie(bool dispMessage);
|
||||
DateTime FCEUI_MovieGetRTCDefault();
|
||||
void BinaryDataFromString(std::string &inStringData, std::vector<u8> *outBinaryData);
|
||||
void ReplayRecToDesmumeInput(const MovieRecord &theRecord, UserInput *theInput);
|
||||
void DesmumeInputToReplayRec(const UserInput &theInput, MovieRecord *theRecord);
|
||||
void ReplayRecToDesmumeInput(const MovieRecord &inRecord, UserInput &outInput);
|
||||
void DesmumeInputToReplayRec(const UserInput &inInput, MovieRecord &outRecord);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue