[64DD] Make sure new disk is loaded into memory before swap

Fixes hang during swap while recording with OBS Studio
This commit is contained in:
luigiblood 2016-05-30 01:09:52 +02:00
parent c495edd17e
commit add7ec7b98
4 changed files with 8 additions and 6 deletions

View File

@ -166,10 +166,10 @@ void DiskGapSectorCheck()
}
}
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != NULL)
if (!(g_Reg->ASIC_STATUS & DD_STATUS_DISK_PRES) && g_Disk != NULL && g_Settings->LoadBool(GameRunning_LoadingInProgress) == false)
{
dd_swapdelay++;
if (dd_swapdelay >= 40)
if (dd_swapdelay >= 50)
{
g_Reg->ASIC_STATUS |= (DD_STATUS_DISK_PRES | DD_STATUS_DISK_CHNG);
dd_swapdelay = 0;

View File

@ -36,6 +36,8 @@ bool CN64Disk::LoadDiskImage(const char * FileLoc)
stdstr ShadowFile = FileLoc;
ShadowFile[ShadowFile.length() - 1] = 'r';
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
WriteTrace(TraceN64System, TraceDebug, "Attempt to load shadow file.");
if (!AllocateAndLoadDiskImage(ShadowFile.c_str()))
{
@ -104,9 +106,10 @@ bool CN64Disk::SaveDiskImage()
return true;
}
void CN64Disk::SwapDiskImage()
void CN64Disk::SwapDiskImage(const char * FileLoc)
{
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_PRES;
LoadDiskImage(FileLoc);
}
bool CN64Disk::IsValidDiskImage(uint8_t Test[4])

View File

@ -19,7 +19,7 @@ public:
bool LoadDiskImage(const char * FileLoc);
bool SaveDiskImage();
void SwapDiskImage();
void SwapDiskImage(const char * FileLoc);
static bool IsValidDiskImage(uint8_t Test[4]);
uint8_t * GetDiskAddress() { return m_DiskImage; }
uint8_t * GetDiskAddressBuffer() { return m_DiskImage + m_DiskBufAddress; }

View File

@ -252,8 +252,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
if (GetOpenFileName(&openfilename))
{
g_Disk->SaveDiskImage();
g_Disk->SwapDiskImage();
g_Disk->LoadDiskImage(FileName);
g_Disk->SwapDiskImage(FileName);
}
break;
case ID_SYSTEM_SAVE: