Skip to content

Commit

Permalink
PCE: Fixed emulator crash when running large block transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
SourMesen committed May 13, 2024
1 parent c61297c commit 6cc490e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Core/PCE/PceConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ void PceConsole::RunFrame()
_psg->PlayQueuedAudio();
}

void PceConsole::ProcessEndOfFrame()
{
//Run the PSG at least once per frame to prevent issues when a very
//large block transfer (TIA, etc.) is running across multiple frames
//(RunFrame above can run more than one frame in this scenario, which can cause issues)
_psg->Run();
_psg->PlayQueuedAudio();
}

void PceConsole::SaveBattery()
{
if(_cdrom) {
Expand Down
2 changes: 2 additions & 0 deletions Core/PCE/PceConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class PceConsole final: public IConsole

void RunFrame() override;

void ProcessEndOfFrame();

void SaveBattery() override;

BaseControlManager* GetControlManager() override;
Expand Down
1 change: 1 addition & 0 deletions Core/PCE/PceVpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ void PceVpc::SendFrame(PceVdc* vdc)
}
}

_console->ProcessEndOfFrame();
_emu->ProcessEndOfFrame();

_console->GetControlManager()->UpdateInputState();
Expand Down

0 comments on commit 6cc490e

Please sign in to comment.