Added emulator detection (#651)

* Added emulator detection

* Fixed missing assignments

* Disable interrupts around the count factor test

* Added more comments to emutest

* Changed PJ64 enum values so the versions work as a bitfield

* Updated README

* Fixed comments

* Updated enum values so you can safely AND and OR all emulator version flags together

* Remove redundant gIsConsole, gIsVC, and gCacheEmulated global variables

* Changed console check to be more future proof against Ares

* Use assembly file instead of casting to a function pointer

* Moved round_double_to_float back to its own compilation unit

* Moved the ParallelN64 check before the Ares check for better future-proofing

* Align pj64_get_count_factor_asm with cache lines... not that it actually matters for pj64

* Adjusted some comments

* Made emulator check thread-safe on emulators that emulate PI timings

* Added gIsConsole macro for backwards compatibility

* Added cen64 to INSTANT_INPUT_BLACKLIST

* Updated comment
This commit is contained in:
Matt Pharoah
2023-08-28 18:03:26 -04:00
committed by GitHub
parent 0138b8ea53
commit febcb71ea3
20 changed files with 278 additions and 92 deletions

View File

@@ -29,6 +29,7 @@
#include "game/puppycam2.h"
#include "game/puppyprint.h"
#include "game/puppylights.h"
#include "game/emutest.h"
#include "config.h"
@@ -740,7 +741,7 @@ static void level_cmd_set_music(void) {
if (sCurrAreaIndex != -1) {
gAreas[sCurrAreaIndex].musicParam = CMD_GET(s16, 2);
#ifdef BETTER_REVERB
if (gIsConsole)
if (gEmulator & EMU_CONSOLE)
gAreas[sCurrAreaIndex].betterReverbPreset = CMD_GET(u8, 4);
else
gAreas[sCurrAreaIndex].betterReverbPreset = CMD_GET(u8, 5);
@@ -753,7 +754,7 @@ static void level_cmd_set_music(void) {
static void level_cmd_set_menu_music(void) {
#ifdef BETTER_REVERB
// Must come before set_background_music()
if (gIsConsole)
if (gEmulator & EMU_CONSOLE)
gBetterReverbPresetValue = CMD_GET(u8, 4);
else
gBetterReverbPresetValue = CMD_GET(u8, 5);
@@ -907,7 +908,7 @@ static void level_cmd_puppylight_node(void) {
static void level_cmd_set_echo(void) {
if (sCurrAreaIndex >= 0 && sCurrAreaIndex < AREA_COUNT) {
gAreaData[sCurrAreaIndex].useEchoOverride = TRUE;
if (gIsConsole)
if (gEmulator & EMU_CONSOLE)
gAreaData[sCurrAreaIndex].echoOverride = CMD_GET(s8, 2);
else
gAreaData[sCurrAreaIndex].echoOverride = CMD_GET(s8, 3);