mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
core config: Expose min/max ranges of integral settings and use it
This commit is contained in:
parent
a6c94a0eaf
commit
6d3fc3a386
@ -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<int_type>(Max, std::max<int_type>(Min, 0)))
|
||||
: _base(type::_int, owner, name)
|
||||
, m_value(def)
|
||||
|
@ -218,7 +218,9 @@ struct lv2_obj
|
||||
template<bool is_usleep = false>
|
||||
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
|
||||
|
@ -66,7 +66,7 @@ namespace vm
|
||||
atomic_t<u32> g_addr_lock = 0;
|
||||
|
||||
// Memory mutex: passive locks
|
||||
std::array<atomic_t<cpu_thread*>, 4> g_locks{};
|
||||
std::array<atomic_t<cpu_thread*>, g_cfg.core.ppu_threads.max> g_locks{};
|
||||
std::array<atomic_t<u64>, 6> g_range_locks{};
|
||||
|
||||
static void _register_lock(cpu_thread* _cpu)
|
||||
|
Loading…
Reference in New Issue
Block a user