Future proof console check (closes #663) (#690)

This commit is contained in:
Matt Pharoah
2023-09-22 13:09:32 -04:00
committed by GitHub
parent 544fcaf038
commit c9533d18ff
3 changed files with 14 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ extern void __osPiRelAccess(void);
enum Emulator gEmulator = EMU_CONSOLE;
u32 pj64_get_count_factor_asm(void); // defined in asm/pj64_get_count_factor_asm.s
u32 emux_detect(void); // defined in asm/emux.s
static inline u32 check_count_factor() {
const u32 saved = __osDisableInt();
@@ -86,7 +87,7 @@ static u8 check_cache_emulation() {
void detect_emulator() {
if ((u32)IO_READ(DPC_PIPEBUSY_REG) | (u32)IO_READ(DPC_TMEM_REG) | (u32)IO_READ(DPC_BUFBUSY_REG)) {
gEmulator = EMU_CONSOLE;
gEmulator = emux_detect() ? EMU_ARES : EMU_CONSOLE;
return;
}