Skip to content

Commit

Permalink
n64: improve PIF HLE emulation by reducing latency (#1351)
Browse files Browse the repository at this point in the history
When doing PIF HLE emulation, we run the HLE state machine just once per
frame. This is OK in general, but there can be a few situations where
this can cause PIF to miss one command from CPU. For instance, a ROM
might send the PIF boot termination command (0x8) and then shortly after
issue a SI DMA to identify controllers. If the two happen within the
same frame, our HLE emulation would miss the boot termination command.

This commit updates the HLE state machine also after each write to PIF
RAM.
  • Loading branch information
rasky authored Dec 17, 2023
1 parent c4bc588 commit 18c84a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ares/n64/pif/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ auto PIF::readWord(u32 address) -> u32 {

auto PIF::writeWord(u32 address, u32 data) -> void {
writeInt(address, data);
return intA(Write, Size4);
intA(Write, Size4);
mainHLE();
}

auto PIF::dmaRead(u32 address, u32 ramAddress) -> void {
Expand All @@ -40,4 +41,5 @@ auto PIF::dmaWrite(u32 address, u32 ramAddress) -> void {
writeInt(address + offset, data);
}
intA(Write, Size64);
mainHLE();
}

0 comments on commit 18c84a8

Please sign in to comment.