From ecd0305a60a47a5550847addbb84b2e7ba0b1b7c Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Sat, 14 Dec 2024 19:43:32 +0100 Subject: [PATCH] fix build without dynarec --- core/build.h | 5 +++++ core/hw/sh4/dyna/blockmanager.h | 20 ++++++++++++++++++-- core/hw/sh4/dyna/decoder_opcodes.h | 4 ++-- core/hw/sh4/dyna/shil.cpp | 7 ++++--- core/hw/sh4/dyna/ssa.cpp | 3 +++ core/linux/common.cpp | 2 +- core/ui/gui.cpp | 2 ++ core/windows/fault_handler.cpp | 2 ++ 8 files changed, 37 insertions(+), 8 deletions(-) diff --git a/core/build.h b/core/build.h index b01192b211..183669cba6 100755 --- a/core/build.h +++ b/core/build.h @@ -42,6 +42,11 @@ #define HOST_CPU CPU_GENERIC #endif +#if defined(TARGET_IPHONE) && !defined(__aarch64__) +// iOS simulator +#define TARGET_NO_REC +#endif + #if defined(TARGET_NO_REC) #define FEAT_SHREC DYNAREC_NONE #define FEAT_AREC DYNAREC_NONE diff --git a/core/hw/sh4/dyna/blockmanager.h b/core/hw/sh4/dyna/blockmanager.h index 255f428039..fd6445f259 100644 --- a/core/hw/sh4/dyna/blockmanager.h +++ b/core/hw/sh4/dyna/blockmanager.h @@ -84,15 +84,31 @@ void bm_Init(); void bm_Term(); void bm_vmem_pagefill(void** ptr,u32 size_bytes); -bool bm_RamWriteAccess(void *p); -void bm_RamWriteAccess(u32 addr); static inline bool bm_IsRamPageProtected(u32 addr) { extern bool unprotected_pages[RAM_SIZE_MAX/PAGE_SIZE]; addr &= RAM_MASK; return !unprotected_pages[addr / PAGE_SIZE]; } + +#if FEAT_SHREC != DYNAREC_NONE + +bool bm_RamWriteAccess(void *p); +void bm_RamWriteAccess(u32 addr); void bm_LockPage(u32 addr, u32 size = PAGE_SIZE); void bm_UnlockPage(u32 addr, u32 size = PAGE_SIZE); u32 bm_getRamOffset(void *p); +#else + +inline static bool bm_RamWriteAccess(void *p) { + return false; +} +inline static void bm_RamWriteAccess(u32 addr) {} +inline static void bm_LockPage(u32 addr, u32 size = PAGE_SIZE) {} +inline static void bm_UnlockPage(u32 addr, u32 size = PAGE_SIZE) {} +inline static u32 bm_getRamOffset(void *p) { + return 0; +} + +#endif diff --git a/core/hw/sh4/dyna/decoder_opcodes.h b/core/hw/sh4/dyna/decoder_opcodes.h index 6eee9fed63..b44c34fc68 100644 --- a/core/hw/sh4/dyna/decoder_opcodes.h +++ b/core/hw/sh4/dyna/decoder_opcodes.h @@ -1,8 +1,10 @@ #pragma once #if FEAT_SHREC != DYNAREC_NONE #define sh4dec(str) void dec_##str (u32 op) +void dec_illegalOp(u32 op); #else #define sh4dec(str) static void dec_##str (u32 op) { } +inline static void dec_illegalOp(u32 op) {} #endif sh4dec(i1000_1011_iiii_iiii); @@ -33,5 +35,3 @@ sh4dec(i0100_nnnn_0110_1010); sh4dec(i0100_nnnn_0110_0110); sh4dec(i0100_nnnn_0001_1011); sh4dec(i0100_nnnn_0000_0011); - -void dec_illegalOp(u32 op); diff --git a/core/hw/sh4/dyna/shil.cpp b/core/hw/sh4/dyna/shil.cpp index 7428f8926d..d5c1617611 100644 --- a/core/hw/sh4/dyna/shil.cpp +++ b/core/hw/sh4/dyna/shil.cpp @@ -1,11 +1,10 @@ -#include - #include "types.h" +#if FEAT_SHREC != DYNAREC_NONE #include "hw/sh4/sh4_mem.h" #include "hw/sh4/sh4_mmr.h" - #include "ngen.h" #include "ssa.h" +#include void AnalyseBlock(RuntimeBlockInfo* blk) { @@ -180,3 +179,5 @@ const char* shil_opcode_name(int op) { return shilop_str[op]; } + +#endif // FEAT_SHREC != DYNAREC_NONE diff --git a/core/hw/sh4/dyna/ssa.cpp b/core/hw/sh4/dyna/ssa.cpp index 11b641bf3e..7838747652 100644 --- a/core/hw/sh4/dyna/ssa.cpp +++ b/core/hw/sh4/dyna/ssa.cpp @@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License along with reicast. If not, see . */ +#include "build.h" +#if FEAT_SHREC != DYNAREC_NONE #include "blockmanager.h" #include "ssa.h" @@ -369,3 +371,4 @@ bool SSAOptimizer::ExecuteConstOp(shil_opcode* op) return false; } } +#endif // FEAT_SHREC != DYNAREC_NONE diff --git a/core/linux/common.cpp b/core/linux/common.cpp index 6e7ac28e86..c1f9d8b77c 100644 --- a/core/linux/common.cpp +++ b/core/linux/common.cpp @@ -51,11 +51,11 @@ void fault_handler(int sn, siginfo_t * si, void *segfault_ctx) // texture protection in VRAM if (VramLockedWrite((u8*)si->si_addr)) return; +#if FEAT_SHREC == DYNAREC_JIT // FPCB jump table protection if (addrspace::bm_lockedWrite((u8*)si->si_addr)) return; -#if FEAT_SHREC == DYNAREC_JIT // fast mem access rewriting host_context_t ctx; context_from_segfault(&ctx, segfault_ctx); diff --git a/core/ui/gui.cpp b/core/ui/gui.cpp index f29ff70ba2..9f68259f28 100644 --- a/core/ui/gui.cpp +++ b/core/ui/gui.cpp @@ -2804,6 +2804,7 @@ static void gui_settings_network() static void gui_settings_advanced() { +#if FEAT_SHREC != DYNAREC_NONE header("CPU Mode"); { ImGui::Columns(2, "cpu_modes", false); @@ -2819,6 +2820,7 @@ static void gui_settings_advanced() "%d MHz"); } ImGui::Spacing(); +#endif header("Other"); { OptionCheckbox("HLE BIOS", config::UseReios, "Force high-level BIOS emulation"); diff --git a/core/windows/fault_handler.cpp b/core/windows/fault_handler.cpp index ac7ce09035..babe160f8f 100644 --- a/core/windows/fault_handler.cpp +++ b/core/windows/fault_handler.cpp @@ -128,9 +128,11 @@ static LONG WINAPI exceptionHandler(EXCEPTION_POINTERS *ep) // texture protection in VRAM if (VramLockedWrite(address)) return EXCEPTION_CONTINUE_EXECUTION; +#if FEAT_SHREC == DYNAREC_JIT // FPCB jump table protection if (addrspace::bm_lockedWrite(address)) return EXCEPTION_CONTINUE_EXECUTION; +#endif host_context_t context; readContext(ep, context);