Add support for recording bongos.

This commit is contained in:
rog 2012-12-18 23:19:15 -05:00
parent 1bd42b7acc
commit 16ac7803f1
4 changed files with 21 additions and 8 deletions

View File

@ -273,7 +273,7 @@ void Init()
g_Channel[i].m_InLo.Hex = 0;
if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
AddDevice(Movie::IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i);
AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
else
AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
}

View File

@ -71,6 +71,7 @@ std::string g_discChange = "";
std::string author = "";
u64 g_titleID = 0;
unsigned char MD5[16];
u8 bongos;
bool g_bRecordingFromSaveState = false;
bool g_bPolled = false;
@ -109,7 +110,7 @@ std::string GetInputDisplay()
g_numPads = 0;
for (int i = 0; i < 4; i++)
{
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
g_numPads |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
g_numPads |= (1 << (i + 4));
@ -311,6 +312,11 @@ bool IsUsingPad(int controller)
return ((g_numPads & (1 << controller)) != 0);
}
bool IsUsingBongo(int controller)
{
return ((bongos & (1 << controller)) != 0);
}
bool IsUsingWiimote(int wiimote)
{
return ((g_numPads & (1 << (wiimote + 4))) != 0);
@ -368,7 +374,7 @@ void ChangePads(bool instantly)
int controllers = 0;
for (int i = 0; i < 4; i++)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
controllers |= (1 << i);
if (instantly && (g_numPads & 0x0F) == controllers)
@ -376,9 +382,9 @@ void ChangePads(bool instantly)
for (int i = 0; i < 4; i++)
if (instantly) // Changes from savestates need to be instantaneous
SerialInterface::AddDevice(IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i);
SerialInterface::AddDevice(IsUsingPad(i) ? (IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
else
SerialInterface::ChangeDevice(IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i);
SerialInterface::ChangeDevice(IsUsingPad(i) ? (IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
}
void ChangeWiiPads(bool instantly)
@ -412,6 +418,10 @@ bool BeginRecordingInput(int controllers)
g_recordingStartTime = Common::Timer::GetLocalTimeSinceJan1970();
g_rerecords = 0;
for (int i = 0; i < 4; i++)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
bongos |= (1 << i);
if (Core::IsRunning())
{
if(File::Exists(tmpStateFilename))
@ -676,7 +686,7 @@ void ReadHeader()
iCPUCore = tmpHeader.CPUCore;
g_bClearSave = tmpHeader.bClearSave;
bMemcard = tmpHeader.bMemcard;
bongos = tmpHeader.bongos;
}
else
{
@ -1121,6 +1131,7 @@ void SaveRecording(const char *filename)
strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange));
strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author));
memcpy(header.md5,MD5,16);
header.bongos = bongos;
// TODO
header.uniqueID = 0;

View File

@ -118,7 +118,8 @@ struct DTMHeader {
bool bUseRealXFB;
bool bMemcard;
bool bClearSave; // Create a new memory card when playing back a movie if true
u8 reserved[16]; // Padding for any new config options
u8 bongos;
u8 reserved[15]; // Padding for any new config options
u8 discChange[40]; // Name of iso file to switch to, for two disc games.
u8 reserved2[47]; // Make heading 256 bytes, just because we can
};
@ -154,6 +155,7 @@ void GetSettings();
bool IsUsingPad(int controller);
bool IsUsingWiimote(int wiimote);
bool IsUsingBongo(int controller);
void ChangePads(bool instantly = false);
void ChangeWiiPads(bool instantly = false);

View File

@ -745,7 +745,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
}
for (int i = 0; i < 4; i++) {
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
controllers |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)