[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:
parent
c495edd17e
commit
add7ec7b98
|
@ -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++;
|
dd_swapdelay++;
|
||||||
if (dd_swapdelay >= 40)
|
if (dd_swapdelay >= 50)
|
||||||
{
|
{
|
||||||
g_Reg->ASIC_STATUS |= (DD_STATUS_DISK_PRES | DD_STATUS_DISK_CHNG);
|
g_Reg->ASIC_STATUS |= (DD_STATUS_DISK_PRES | DD_STATUS_DISK_CHNG);
|
||||||
dd_swapdelay = 0;
|
dd_swapdelay = 0;
|
||||||
|
|
|
@ -36,6 +36,8 @@ bool CN64Disk::LoadDiskImage(const char * FileLoc)
|
||||||
stdstr ShadowFile = FileLoc;
|
stdstr ShadowFile = FileLoc;
|
||||||
ShadowFile[ShadowFile.length() - 1] = 'r';
|
ShadowFile[ShadowFile.length() - 1] = 'r';
|
||||||
|
|
||||||
|
g_Settings->SaveBool(GameRunning_LoadingInProgress, true);
|
||||||
|
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Attempt to load shadow file.");
|
WriteTrace(TraceN64System, TraceDebug, "Attempt to load shadow file.");
|
||||||
if (!AllocateAndLoadDiskImage(ShadowFile.c_str()))
|
if (!AllocateAndLoadDiskImage(ShadowFile.c_str()))
|
||||||
{
|
{
|
||||||
|
@ -104,9 +106,10 @@ bool CN64Disk::SaveDiskImage()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CN64Disk::SwapDiskImage()
|
void CN64Disk::SwapDiskImage(const char * FileLoc)
|
||||||
{
|
{
|
||||||
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_PRES;
|
g_Reg->ASIC_STATUS &= ~DD_STATUS_DISK_PRES;
|
||||||
|
LoadDiskImage(FileLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CN64Disk::IsValidDiskImage(uint8_t Test[4])
|
bool CN64Disk::IsValidDiskImage(uint8_t Test[4])
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
|
|
||||||
bool LoadDiskImage(const char * FileLoc);
|
bool LoadDiskImage(const char * FileLoc);
|
||||||
bool SaveDiskImage();
|
bool SaveDiskImage();
|
||||||
void SwapDiskImage();
|
void SwapDiskImage(const char * FileLoc);
|
||||||
static bool IsValidDiskImage(uint8_t Test[4]);
|
static bool IsValidDiskImage(uint8_t Test[4]);
|
||||||
uint8_t * GetDiskAddress() { return m_DiskImage; }
|
uint8_t * GetDiskAddress() { return m_DiskImage; }
|
||||||
uint8_t * GetDiskAddressBuffer() { return m_DiskImage + m_DiskBufAddress; }
|
uint8_t * GetDiskAddressBuffer() { return m_DiskImage + m_DiskBufAddress; }
|
||||||
|
|
|
@ -252,8 +252,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
if (GetOpenFileName(&openfilename))
|
if (GetOpenFileName(&openfilename))
|
||||||
{
|
{
|
||||||
g_Disk->SaveDiskImage();
|
g_Disk->SaveDiskImage();
|
||||||
g_Disk->SwapDiskImage();
|
g_Disk->SwapDiskImage(FileName);
|
||||||
g_Disk->LoadDiskImage(FileName);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_SYSTEM_SAVE:
|
case ID_SYSTEM_SAVE:
|
||||||
|
|
Loading…
Reference in New Issue