[Save State] Make sure g_Disk exists
This commit is contained in:
parent
34ec690acc
commit
b2ed47c44f
|
@ -1749,10 +1749,10 @@ bool CN64System::SaveState()
|
||||||
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
zipOpenNewFileInZip(file, SaveFile.GetNameExtension().c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||||
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
|
zipWriteInFileInZip(file, &SaveID_0, sizeof(SaveID_0));
|
||||||
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
|
zipWriteInFileInZip(file, &RdramSize, sizeof(uint32_t));
|
||||||
if (!g_Settings->LoadBool(Setting_EnableDisk))
|
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||||
zipWriteInFileInZip(file, g_Rom->GetRomAddress(), 0x40);
|
|
||||||
else
|
|
||||||
zipWriteInFileInZip(file, g_Disk->GetDiskAddressID(), 0x40);
|
zipWriteInFileInZip(file, g_Disk->GetDiskAddressID(), 0x40);
|
||||||
|
else
|
||||||
|
zipWriteInFileInZip(file, g_Rom->GetRomAddress(), 0x40);
|
||||||
zipWriteInFileInZip(file, &NextViTimer, sizeof(uint32_t));
|
zipWriteInFileInZip(file, &NextViTimer, sizeof(uint32_t));
|
||||||
zipWriteInFileInZip(file, &m_Reg.m_PROGRAM_COUNTER, sizeof(m_Reg.m_PROGRAM_COUNTER));
|
zipWriteInFileInZip(file, &m_Reg.m_PROGRAM_COUNTER, sizeof(m_Reg.m_PROGRAM_COUNTER));
|
||||||
zipWriteInFileInZip(file, m_Reg.m_GPR, sizeof(int64_t) * 32);
|
zipWriteInFileInZip(file, m_Reg.m_GPR, sizeof(int64_t) * 32);
|
||||||
|
@ -1806,10 +1806,10 @@ bool CN64System::SaveState()
|
||||||
hSaveFile.SeekToBegin();
|
hSaveFile.SeekToBegin();
|
||||||
hSaveFile.Write(&SaveID_0, sizeof(uint32_t));
|
hSaveFile.Write(&SaveID_0, sizeof(uint32_t));
|
||||||
hSaveFile.Write(&RdramSize, sizeof(uint32_t));
|
hSaveFile.Write(&RdramSize, sizeof(uint32_t));
|
||||||
if (!g_Settings->LoadBool(Setting_EnableDisk))
|
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||||
hSaveFile.Write(g_Rom->GetRomAddress(), 0x40);
|
|
||||||
else
|
|
||||||
hSaveFile.Write(g_Disk->GetDiskAddressID(), 0x40);
|
hSaveFile.Write(g_Disk->GetDiskAddressID(), 0x40);
|
||||||
|
else
|
||||||
|
hSaveFile.Write(g_Rom->GetRomAddress(), 0x40);
|
||||||
hSaveFile.Write(&NextViTimer, sizeof(uint32_t));
|
hSaveFile.Write(&NextViTimer, sizeof(uint32_t));
|
||||||
hSaveFile.Write(&m_Reg.m_PROGRAM_COUNTER, sizeof(m_Reg.m_PROGRAM_COUNTER));
|
hSaveFile.Write(&m_Reg.m_PROGRAM_COUNTER, sizeof(m_Reg.m_PROGRAM_COUNTER));
|
||||||
hSaveFile.Write(m_Reg.m_GPR, sizeof(int64_t) * 32);
|
hSaveFile.Write(m_Reg.m_GPR, sizeof(int64_t) * 32);
|
||||||
|
@ -1981,9 +1981,9 @@ bool CN64System::LoadState(const char * FileName)
|
||||||
|
|
||||||
uint8_t LoadHeader[64];
|
uint8_t LoadHeader[64];
|
||||||
unzReadCurrentFile(file, LoadHeader, 0x40);
|
unzReadCurrentFile(file, LoadHeader, 0x40);
|
||||||
if (!g_Settings->LoadBool(Setting_EnableDisk))
|
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||||
{
|
{
|
||||||
if (memcmp(LoadHeader, g_Rom->GetRomAddress(), 0x40) != 0 &&
|
if (memcmp(LoadHeader, g_Disk->GetDiskAddressID(), 0x40) != 0 &&
|
||||||
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1991,7 +1991,7 @@ bool CN64System::LoadState(const char * FileName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (memcmp(LoadHeader, g_Disk->GetDiskAddressID(), 0x40) != 0 &&
|
if (memcmp(LoadHeader, g_Rom->GetRomAddress(), 0x40) != 0 &&
|
||||||
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -2060,9 +2060,9 @@ bool CN64System::LoadState(const char * FileName)
|
||||||
//Check header
|
//Check header
|
||||||
uint8_t LoadHeader[64];
|
uint8_t LoadHeader[64];
|
||||||
hSaveFile.Read(LoadHeader, 0x40);
|
hSaveFile.Read(LoadHeader, 0x40);
|
||||||
if (!g_Settings->LoadBool(Setting_EnableDisk))
|
if (g_Settings->LoadBool(Setting_EnableDisk) && g_Disk)
|
||||||
{
|
{
|
||||||
if (memcmp(LoadHeader, g_Rom->GetRomAddress(), 0x40) != 0 &&
|
if (memcmp(LoadHeader, g_Disk->GetDiskAddressID(), 0x40) != 0 &&
|
||||||
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -2070,7 +2070,7 @@ bool CN64System::LoadState(const char * FileName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (memcmp(LoadHeader, g_Disk->GetDiskAddressID(), 0x40) != 0 &&
|
if (memcmp(LoadHeader, g_Rom->GetRomAddress(), 0x40) != 0 &&
|
||||||
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
!g_Notify->AskYesNoQuestion(g_Lang->GetString(MSG_SAVE_STATE_HEADER).c_str()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue