diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index bf6dee75d..7f52d959c 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -33,7 +33,6 @@ Option Cable("Dreamcast.Cable", 3); // TV Composite Option Region("Dreamcast.Region", 1); // USA Option Broadcast("Dreamcast.Broadcast", 0); // NTSC Option Language("Dreamcast.Language", 1); // English -Option FullMMU("Dreamcast.FullMMU"); Option ForceWindowsCE("Dreamcast.ForceWindowsCE"); Option AutoLoadState("Dreamcast.AutoLoadState"); Option AutoSaveState("Dreamcast.AutoSaveState"); diff --git a/core/cfg/option.h b/core/cfg/option.h index 519c9f8b5..bc45ab8c2 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -365,7 +365,6 @@ extern Option Cable; // 0 -> VGA, 1 -> VGA, 2 -> RGB, 3 -> TV Composite extern Option Region; // 0 -> JP, 1 -> USA, 2 -> EU, 3 -> default extern Option Broadcast; // 0 -> NTSC, 1 -> PAL, 2 -> PAL/M, 3 -> PAL/N, 4 -> default extern Option Language; // 0 -> JP, 1 -> EN, 2 -> DE, 3 -> FR, 4 -> SP, 5 -> IT, 6 -> default -extern Option FullMMU; extern Option ForceWindowsCE; extern Option AutoLoadState; extern Option AutoSaveState; diff --git a/core/emulator.cpp b/core/emulator.cpp index 4425c3b93..8a8f384ef 100644 --- a/core/emulator.cpp +++ b/core/emulator.cpp @@ -53,14 +53,11 @@ static void loadSpecialSettings() if (settings.platform.isConsole()) { - if (ip_meta.isWindowsCE() || config::ForceWindowsCE - || prod_id == "T26702N") // PBA Tour Bowling 2001 + if (ip_meta.isWindowsCE() || prod_id == "T26702N") // PBA Tour Bowling 2001 { - INFO_LOG(BOOT, "Enabling Full MMU and Extra depth scaling for Windows CE game"); + INFO_LOG(BOOT, "Enabling Extra depth scaling for Windows CE game"); config::ExtraDepthScale.override(0.1f); // taxi 2 needs 0.01 for FMV (amd, per-tri) - config::FullMMU.override(true); - if (!config::ForceWindowsCE) - config::ForceWindowsCE.override(true); + config::ForceWindowsCE.override(true); } // Tony Hawk's Pro Skater 2 @@ -731,10 +728,7 @@ void loadGameSpecificSettings() config::Settings::instance().load(true); if (config::ForceWindowsCE) - { config::ExtraDepthScale.override(0.1f); - config::FullMMU.override(true); - } } void Emulator::step() diff --git a/core/hw/sh4/modules/mmu.cpp b/core/hw/sh4/modules/mmu.cpp index f0eb4427d..97704583b 100644 --- a/core/hw/sh4/modules/mmu.cpp +++ b/core/hw/sh4/modules/mmu.cpp @@ -9,6 +9,7 @@ TLB_Entry UTLB[64]; TLB_Entry ITLB[4]; static u32 ITLB_LRU_USE[64]; +bool mmuOn; //SQ fast remap , mainly hackish , assumes 1MB pages //max 64MB can be remapped on SQ @@ -432,8 +433,21 @@ retry_ITLB_Match: void mmu_set_state() { - if (CCN_MMUCR.AT == 1 && config::FullMMU) - NOTICE_LOG(SH4, "Enabling Full MMU support"); + if (CCN_MMUCR.AT == 1) + { + // Detect if we're running Windows CE + static const char magic[] = { 'S', 0, 'H', 0, '-', 0, '4', 0, ' ', 0, 'K', 0, 'e', 0, 'r', 0, 'n', 0, 'e', 0, 'l', 0 }; + if (memcmp(GetMemPtr(0x8c0110a8, 4), magic, sizeof(magic)) == 0 + || memcmp(GetMemPtr(0x8c011118, 4), magic, sizeof(magic)) == 0) + { + mmuOn = true; + NOTICE_LOG(SH4, "Enabling Full MMU support"); + } + } + else + { + mmuOn = false; + } SetMemoryHandlers(); setSqwHandler(); @@ -536,7 +550,7 @@ template void mmu_WriteMem(u32 adr, u64 data); void mmu_TranslateSQW(u32 adr, u32 *out) { - if (!config::FullMMU) + if (!mmuOn) { //This will only work for 1 mb pages .. hopefully nothing else is used //*FIXME* to work for all page sizes ? diff --git a/core/hw/sh4/modules/mmu.h b/core/hw/sh4/modules/mmu.h index a367a8c01..faa299227 100644 --- a/core/hw/sh4/modules/mmu.h +++ b/core/hw/sh4/modules/mmu.h @@ -36,6 +36,7 @@ struct TLB_Entry extern TLB_Entry UTLB[64]; extern TLB_Entry ITLB[4]; extern u32 sq_remap[64]; +extern bool mmuOn; constexpr u32 fast_reg_lut[8] = { @@ -64,7 +65,7 @@ void mmu_flush_table(); static inline bool mmu_enabled() { - return config::FullMMU && CCN_MMUCR.AT == 1; + return mmuOn; } u32 mmu_full_lookup(u32 va, const TLB_Entry **entry, u32& rv); diff --git a/core/hw/sh4/sh4_core.h b/core/hw/sh4/sh4_core.h index 997160b2b..993f7350c 100644 --- a/core/hw/sh4/sh4_core.h +++ b/core/hw/sh4/sh4_core.h @@ -106,8 +106,7 @@ struct SH4ThrownException static inline void RaiseFPUDisableException() { - if (config::FullMMU) - throw SH4ThrownException(next_pc - 2, Sh4Ex_FpuDisabled); + throw SH4ThrownException(next_pc - 2, Sh4Ex_FpuDisabled); } static inline void AdjustDelaySlotException(SH4ThrownException& ex) diff --git a/core/lua/lua.cpp b/core/lua/lua.cpp index d1dc6994c..87ae893ba 100644 --- a/core/lua/lua.cpp +++ b/core/lua/lua.cpp @@ -129,7 +129,6 @@ CONFIG_ACCESSORS(Cable); CONFIG_ACCESSORS(Region); CONFIG_ACCESSORS(Broadcast); CONFIG_ACCESSORS(Language); -CONFIG_ACCESSORS(FullMMU); CONFIG_ACCESSORS(ForceWindowsCE); CONFIG_ACCESSORS(AutoLoadState); CONFIG_ACCESSORS(AutoSaveState); @@ -508,7 +507,6 @@ static void luaRegister(lua_State *L) CONFIG_PROPERTY(UseReios, bool) CONFIG_PROPERTY(FastGDRomLoad, bool) CONFIG_PROPERTY(OpenGlChecks, bool) - CONFIG_PROPERTY(FullMMU, bool) CONFIG_PROPERTY(ForceWindowsCE, bool) .endNamespace() diff --git a/shell/libretro/option.cpp b/shell/libretro/option.cpp index f12de3f02..4ce9ba47d 100644 --- a/shell/libretro/option.cpp +++ b/shell/libretro/option.cpp @@ -32,7 +32,6 @@ Option Cable("", 3); // TV Composite Option Region(CORE_OPTION_NAME "_region", 1); // USA Option Broadcast(CORE_OPTION_NAME "_broadcast", 0); // NTSC Option Language(CORE_OPTION_NAME "_language", 1); // English -Option FullMMU(""); Option ForceWindowsCE(CORE_OPTION_NAME "_force_wince"); Option AutoLoadState(""); Option AutoSaveState("");