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 authored and GitHub committed 2023-08-28 18:03:26 -04:00
1 parent 0138b8ea53
commit febcb71ea3
20 files changed
+278 -92

No files matched your search

+4 -3
View File
@@ -17,6 +17,7 @@
#include "behavior_data.h"
#include "string.h"
#include "color_presets.h"
#include "emutest.h"
#include "config.h"
#include "config/config_world.h"
@@ -314,7 +315,7 @@ void switch_ucode(s32 ucode) {
break;
case GRAPH_NODE_UCODE_REJ:
// Use .rej Microcode, skip sub-pixel processing on console
if (gIsConsole) {
if (gEmulator & EMU_CONSOLE) {
gSPLoadUcodeL(gDisplayListHead++, gspF3DLX2_Rej_fifo); // F3DLX2_Rej
} else {
gSPLoadUcodeL(gDisplayListHead++, gspF3DEX2_Rej_fifo); // F3DEX2_Rej
@@ -583,7 +584,7 @@ void geo_process_perspective(struct GraphNodePerspective *node) {
// If an emulator is detected, use a large value for the half fov
// horizontal value to account for viewport widescreen hacks.
if(!gIsConsole){
if(!(gEmulator & EMU_CONSOLE)){
node->halfFovHorizontal = 9999.0f;
}
#endif
@@ -614,7 +615,7 @@ static f32 get_dist_from_camera(Vec3f pos) {
*/
void geo_process_level_of_detail(struct GraphNodeLevelOfDetail *node) {
#ifdef AUTO_LOD
f32 distanceFromCam = gIsConsole ? get_dist_from_camera(gMatStack[gMatStackIndex][3]) : 50.0f;
f32 distanceFromCam = (gEmulator & EMU_CONSOLE) ? get_dist_from_camera(gMatStack[gMatStackIndex][3]) : 50.0f;
#else
f32 distanceFromCam = get_dist_from_camera(gMatStack[gMatStackIndex][3]);
#endif