mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Rerecording and nJoy: Copied the recording functions to nJoy
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2305 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -265,31 +265,9 @@ void Initialize(void *init)
|
||||
if(ReloadDLL()) g_PADInitialize->padNumber = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
{
|
||||
bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads);
|
||||
|
||||
// Warn the user if no gamepads are detected
|
||||
if (_NumGoodPads == 0 && g_EmulatorRunning)
|
||||
{
|
||||
PanicAlert("nJoy: No Gamepad Detected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load PadMapping[] etc
|
||||
g_Config.Load();
|
||||
|
||||
// Update the PadState[].joy handle
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID)
|
||||
if(joyinfo.at(PadMapping[i].ID).Good)
|
||||
PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID);
|
||||
}
|
||||
|
||||
return Success;
|
||||
#ifdef RERECORDING
|
||||
Recording::Initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Shutdown PAD (stop emulation)
|
||||
@ -301,6 +279,14 @@ void Shutdown()
|
||||
{
|
||||
Console::Print("Shutdown: %i\n", SDL_WasInit(0));
|
||||
|
||||
// -------------------------------------------
|
||||
// Play back input instead of accepting any user input
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
Recording::ShutDown();
|
||||
#endif
|
||||
// ----------------------
|
||||
|
||||
// Always change this variable
|
||||
g_EmulatorRunning = false;
|
||||
|
||||
@ -378,7 +364,12 @@ void PAD_Input(u16 _Key, u8 _UpDown)
|
||||
|
||||
// Save state
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void DoState(unsigned char **ptr, int mode) {}
|
||||
void DoState(unsigned char **ptr, int mode)
|
||||
{
|
||||
#ifdef RERECORDING
|
||||
Recording::DoState(ptr, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Set PAD attached pads
|
||||
@ -412,6 +403,18 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
disconnected */
|
||||
if (!PadMapping[_numPAD].enabled || !PadState[_numPAD].joy) return;
|
||||
|
||||
// -------------------------------------------
|
||||
// Play back input instead of accepting any user input
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
if (g_Config.bPlayback)
|
||||
{
|
||||
*_pPADStatus = Recording::Play();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// ----------------------
|
||||
|
||||
// Clear pad status
|
||||
memset(_pPADStatus, 0, sizeof(SPADStatus));
|
||||
|
||||
@ -544,6 +547,15 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
// Use rumble
|
||||
Pad_Use_Rumble(_numPAD, _pPADStatus);
|
||||
|
||||
// -------------------------------------------
|
||||
// Rerecording
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
// Record input
|
||||
if (g_Config.bRecording) Recording::RecordInput(*_pPADStatus);
|
||||
#endif
|
||||
// ----------------------
|
||||
|
||||
// Debugging
|
||||
/*
|
||||
// Show the status of all connected pads
|
||||
@ -575,6 +587,36 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
// Supporting functions
|
||||
//******************************************************************************
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Search for SDL devices
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
{
|
||||
bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads);
|
||||
|
||||
// Warn the user if no gamepads are detected
|
||||
if (_NumGoodPads == 0 && g_EmulatorRunning)
|
||||
{
|
||||
PanicAlert("nJoy: No Gamepad Detected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load PadMapping[] etc
|
||||
g_Config.Load();
|
||||
|
||||
// Update the PadState[].joy handle
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID)
|
||||
if(joyinfo.at(PadMapping[i].ID).Good)
|
||||
PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Check if any of the pads failed to open. In Windows there is a strange "IDirectInputDevice2::
|
||||
SetDataFormat() DirectX error -2147024809" after exactly four SDL_Init() and SDL_Quit() */
|
||||
|
Reference in New Issue
Block a user