diff --git a/Utilities/Config.h b/Utilities/Config.h index 586d3de27f..1997fd1b3a 100644 --- a/Utilities/Config.h +++ b/Utilities/Config.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Utilities/types.h" #include "Utilities/StrFmt.h" @@ -235,6 +235,10 @@ namespace cfg public: int_type def; + // Expose range + static const s64 max = Max; + static const s64 min = Min; + _int(node* owner, const std::string& name, int_type def = std::min(Max, std::max(Min, 0))) : _base(type::_int, owner, name) , m_value(def) diff --git a/rpcs3/Emu/Cell/lv2/sys_sync.h b/rpcs3/Emu/Cell/lv2/sys_sync.h index a4d28f4d25..301edcdea5 100644 --- a/rpcs3/Emu/Cell/lv2/sys_sync.h +++ b/rpcs3/Emu/Cell/lv2/sys_sync.h @@ -218,7 +218,9 @@ struct lv2_obj template static bool wait_timeout(u64 usec, cpu_thread* const cpu = nullptr) { - // Clamp to max timeout accepted (also solves potential oveflows when scaling) + static_assert(UINT64_MAX / cond_variable::max_timeout >= g_cfg.core.clocks_scale.max, "timeout may overflow during scaling"); + + // Clamp to max timeout accepted if (usec > cond_variable::max_timeout) usec = cond_variable::max_timeout; // Now scale the result diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index 1347779fb3..4402dea37f 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -66,7 +66,7 @@ namespace vm atomic_t g_addr_lock = 0; // Memory mutex: passive locks - std::array, 4> g_locks{}; + std::array, g_cfg.core.ppu_threads.max> g_locks{}; std::array, 6> g_range_locks{}; static void _register_lock(cpu_thread* _cpu)