From 989ed13d04a28c2cbdfd136f246cb36663d526b6 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:42:27 +0300 Subject: [PATCH] Add a check for missing switch cases. --- PowerRecomp/pch.h | 6 ++++++ PowerRecomp/recompiler.cpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/PowerRecomp/pch.h b/PowerRecomp/pch.h index b1b9b75..572f533 100644 --- a/PowerRecomp/pch.h +++ b/PowerRecomp/pch.h @@ -1,5 +1,11 @@ #pragma once +// Workaround for the intellisense for some reason not seeing C++23 features +#ifdef __INTELLISENSE__ +#undef __cplusplus +#define __cplusplus 202302L +#endif + #include #include #include diff --git a/PowerRecomp/recompiler.cpp b/PowerRecomp/recompiler.cpp index cc3841e..c73eda2 100644 --- a/PowerRecomp/recompiler.cpp +++ b/PowerRecomp/recompiler.cpp @@ -1780,6 +1780,9 @@ bool Recompiler::Recompile(const Function& fn) } else { + if (insn.opcode->id == PPC_INST_BCTR && (*(data - 1) == 0x07008038 || *(data - 1) == 0x00000060) && switchTable == switchTables.end()) + std::println("Found a switch jump table at {:X} with no switch table entry present", base); + if (!Recompile(fn, base, insn, switchTable)) { std::println("Unrecognized instruction at 0x{:X}: {}", base, insn.opcode->name);