Misc movie fixes.
Fix setting memory cards on playback. Fix saving revision to header. Herpa derp lets open a file while it's still open in another function, and not even check if it fails to load. Fix an assumption that wii games are using a wiimote.
This commit is contained in:
parent
905d38827e
commit
ed1a9480b0
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "EXI.h"
|
#include "EXI.h"
|
||||||
#include "Sram.h"
|
#include "Sram.h"
|
||||||
|
#include "../Movie.h"
|
||||||
SRAM g_SRAM;
|
SRAM g_SRAM;
|
||||||
|
|
||||||
namespace ExpansionInterface
|
namespace ExpansionInterface
|
||||||
|
@ -44,7 +45,12 @@ void Init()
|
||||||
for (u32 i = 0; i < NUM_CHANNELS; i++)
|
for (u32 i = 0; i < NUM_CHANNELS; i++)
|
||||||
g_Channels[i] = new CEXIChannel(i);
|
g_Channels[i] = new CEXIChannel(i);
|
||||||
|
|
||||||
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
|
if (Movie::IsPlayingInput() && Movie::IsUsingMemcard() && Movie::IsConfigSaved())
|
||||||
|
g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA
|
||||||
|
else if(Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved())
|
||||||
|
g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA
|
||||||
|
else
|
||||||
|
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
|
||||||
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
|
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
|
||||||
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
|
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
|
||||||
g_Channels[1]->AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0); // SlotB
|
g_Channels[1]->AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0); // SlotB
|
||||||
|
|
|
@ -736,16 +736,6 @@ bool PlayInput(const char *filename)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load savestate (and skip to frame data)
|
|
||||||
if(tmpHeader.bFromSaveState)
|
|
||||||
{
|
|
||||||
const std::string stateFilename = std::string(filename) + ".sav";
|
|
||||||
if(File::Exists(stateFilename))
|
|
||||||
Core::SetStateFileName(stateFilename);
|
|
||||||
g_bRecordingFromSaveState = true;
|
|
||||||
Movie::LoadInput(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadHeader();
|
ReadHeader();
|
||||||
g_totalFrames = tmpHeader.frameCount;
|
g_totalFrames = tmpHeader.frameCount;
|
||||||
g_totalLagCount = tmpHeader.lagCount;
|
g_totalLagCount = tmpHeader.lagCount;
|
||||||
|
@ -762,6 +752,16 @@ bool PlayInput(const char *filename)
|
||||||
g_currentByte = 0;
|
g_currentByte = 0;
|
||||||
g_recordfd.Close();
|
g_recordfd.Close();
|
||||||
|
|
||||||
|
// Load savestate (and skip to frame data)
|
||||||
|
if(tmpHeader.bFromSaveState)
|
||||||
|
{
|
||||||
|
const std::string stateFilename = std::string(filename) + ".sav";
|
||||||
|
if(File::Exists(stateFilename))
|
||||||
|
Core::SetStateFileName(stateFilename);
|
||||||
|
g_bRecordingFromSaveState = true;
|
||||||
|
Movie::LoadInput(filename);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -786,7 +786,13 @@ void DoState(PointerWrap &p)
|
||||||
|
|
||||||
void LoadInput(const char *filename)
|
void LoadInput(const char *filename)
|
||||||
{
|
{
|
||||||
File::IOFile t_record(filename, "r+b");
|
File::IOFile t_record;
|
||||||
|
if (!t_record.Open(filename, "r+b"))
|
||||||
|
{
|
||||||
|
PanicAlertT("Failed to read %s", filename);
|
||||||
|
EndPlayInput(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
t_record.ReadArray(&tmpHeader, 1);
|
t_record.ReadArray(&tmpHeader, 1);
|
||||||
|
|
||||||
|
@ -849,7 +855,7 @@ void LoadInput(const char *filename)
|
||||||
{
|
{
|
||||||
// this is a "you did something wrong" alert for the user's benefit.
|
// this is a "you did something wrong" alert for the user's benefit.
|
||||||
// we'll try to say what's going on in excruciating detail, otherwise the user might not believe us.
|
// we'll try to say what's going on in excruciating detail, otherwise the user might not believe us.
|
||||||
if(Core::g_CoreStartupParameter.bWii)
|
if(IsUsingWiimote(1))
|
||||||
{
|
{
|
||||||
// TODO: more detail
|
// TODO: more detail
|
||||||
PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %d (0x%X). You should load another save before continuing, or load this state with read-only mode off. Otherwise you'll probably get a desync.", i+256, i+256);
|
PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %d (0x%X). You should load another save before continuing, or load this state with read-only mode off. Otherwise you'll probably get a desync.", i+256, i+256);
|
||||||
|
@ -925,18 +931,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
|
||||||
if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL)
|
if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_currentFrame == 1)
|
|
||||||
{
|
|
||||||
if (tmpHeader.bMemcard)
|
|
||||||
{
|
|
||||||
ExpansionInterface::ChangeDevice(0, EXIDEVICE_MEMORYCARD, 0);
|
|
||||||
}
|
|
||||||
else if (!tmpHeader.bMemcard)
|
|
||||||
{
|
|
||||||
ExpansionInterface::ChangeDevice(0, EXIDEVICE_NONE, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_currentByte + 8 > g_totalBytes)
|
if (g_currentByte + 8 > g_totalBytes)
|
||||||
{
|
{
|
||||||
PanicAlertT("Premature movie end in PlayController. %u + 8 > %u", (u32)g_currentByte, (u32)g_totalBytes);
|
PanicAlertT("Premature movie end in PlayController. %u + 8 > %u", (u32)g_currentByte, (u32)g_totalBytes);
|
||||||
|
@ -1194,9 +1188,13 @@ void GetSettings()
|
||||||
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
|
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
|
||||||
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
|
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
|
||||||
|
|
||||||
std::stringstream ss;
|
int temp;
|
||||||
ss << std::hex << SCM_REV_STR;
|
|
||||||
ss >> revision;
|
for(int i = 0; i < 4; ++i )
|
||||||
|
{
|
||||||
|
sscanf(SCM_REV_STR + 2 * i, "%2x", &temp );
|
||||||
|
revision[i] = temp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckMD5()
|
void CheckMD5()
|
||||||
|
|
Loading…
Reference in New Issue