forked from ShuriZma/suyu
add static lifetime to constexpr values to force compile time evaluation where possible
Signed-off-by: arades79 <scravers@protonmail.com>
This commit is contained in:
parent
5f5a6e4b2e
commit
45e13b03f3
|
@ -132,7 +132,7 @@ void AudioRenderer::CreateSinkStreams() {
|
|||
}
|
||||
|
||||
void AudioRenderer::ThreadFunc() {
|
||||
constexpr char name[]{"AudioRenderer"};
|
||||
constexpr static char name[]{"AudioRenderer"};
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
|
@ -144,7 +144,7 @@ void AudioRenderer::ThreadFunc() {
|
|||
|
||||
mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK);
|
||||
|
||||
constexpr u64 max_process_time{2'304'000ULL};
|
||||
constexpr static u64 max_process_time{2'304'000ULL};
|
||||
|
||||
while (true) {
|
||||
auto message{mailbox->ADSPWaitMessage()};
|
||||
|
|
|
@ -27,8 +27,8 @@ constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4};
|
|||
template <typename T>
|
||||
static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
||||
const DecodeArg& req) {
|
||||
constexpr s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr s32 max{std::numeric_limits<s16>::max()};
|
||||
constexpr static s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr static s32 max{std::numeric_limits<s16>::max()};
|
||||
|
||||
if (req.buffer == 0 || req.buffer_size == 0) {
|
||||
return 0;
|
||||
|
@ -101,8 +101,8 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
|||
*/
|
||||
static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
||||
const DecodeArg& req) {
|
||||
constexpr u32 SamplesPerFrame{14};
|
||||
constexpr u32 NibblesPerFrame{16};
|
||||
constexpr static u32 SamplesPerFrame{14};
|
||||
constexpr static u32 NibblesPerFrame{16};
|
||||
|
||||
if (req.buffer == 0 || req.buffer_size == 0) {
|
||||
return 0;
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace AudioCore::AudioRenderer {
|
|||
void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input,
|
||||
std::array<s16, 3>& b_, std::array<s16, 2>& a_,
|
||||
VoiceState::BiquadFilterState& state, const u32 sample_count) {
|
||||
constexpr f64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr f64 max{std::numeric_limits<s32>::max()};
|
||||
constexpr static f64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr static f64 max{std::numeric_limits<s32>::max()};
|
||||
std::array<f64, 3> b{Common::FixedPoint<50, 14>::from_base(b_[0]).to_double(),
|
||||
Common::FixedPoint<50, 14>::from_base(b_[1]).to_double(),
|
||||
Common::FixedPoint<50, 14>::from_base(b_[2]).to_double()};
|
||||
|
@ -61,8 +61,8 @@ void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input,
|
|||
static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> input,
|
||||
std::array<s16, 3>& b, std::array<s16, 2>& a,
|
||||
VoiceState::BiquadFilterState& state, const u32 sample_count) {
|
||||
constexpr s64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr s64 max{std::numeric_limits<s32>::max()};
|
||||
constexpr static s64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr static s64 max{std::numeric_limits<s32>::max()};
|
||||
|
||||
for (u32 i = 0; i < sample_count; i++) {
|
||||
const s64 in_sample{input[i]};
|
||||
|
|
|
@ -244,16 +244,16 @@ template <size_t NumChannels>
|
|||
static void ApplyI3dl2ReverbEffect(I3dl2ReverbInfo::State& state,
|
||||
std::span<std::span<const s32>> inputs,
|
||||
std::span<std::span<s32>> outputs, const u32 sample_count) {
|
||||
constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
|
||||
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
|
||||
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
|
||||
0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,
|
||||
};
|
||||
constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
|
||||
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
|
||||
0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3,
|
||||
};
|
||||
constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
|
||||
constexpr static std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
|
||||
2, 0, 0, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 0, 0, 0, 0, 5, 5, 5,
|
||||
};
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p
|
|||
std::vector<std::span<const s32>>& inputs,
|
||||
std::vector<std::span<s32>>& outputs, const u32 sample_count,
|
||||
LightLimiterInfo::StatisticsInternal* statistics) {
|
||||
constexpr s64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr s64 max{std::numeric_limits<s32>::max()};
|
||||
constexpr static s64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr static s64 max{std::numeric_limits<s32>::max()};
|
||||
|
||||
const auto recip_estimate = [](f64 a) -> f64 {
|
||||
s32 q, s;
|
||||
|
|
|
@ -252,16 +252,16 @@ template <size_t NumChannels>
|
|||
static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, ReverbInfo::State& state,
|
||||
std::vector<std::span<const s32>>& inputs,
|
||||
std::vector<std::span<s32>>& outputs, const u32 sample_count) {
|
||||
constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
|
||||
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
|
||||
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
|
||||
0, 0, 1, 1, 0, 1, 0, 0, 1, 1,
|
||||
};
|
||||
constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
|
||||
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
|
||||
0, 0, 1, 1, 0, 1, 2, 2, 3, 3,
|
||||
};
|
||||
constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
|
||||
constexpr static std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
|
||||
0, 0, 1, 1, 2, 2, 4, 4, 5, 5,
|
||||
};
|
||||
|
||||
|
|
|
@ -19,24 +19,24 @@ namespace AudioCore::AudioRenderer {
|
|||
static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input,
|
||||
const u32 target_sample_count, const u32 source_sample_count,
|
||||
UpsamplerState* state) {
|
||||
constexpr u32 WindowSize = 10;
|
||||
constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{
|
||||
constexpr static u32 WindowSize = 10;
|
||||
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{
|
||||
0.95376587f, -0.12872314f, 0.060028076f, -0.032470703f, 0.017669678f,
|
||||
-0.009124756f, 0.004272461f, -0.001739502f, 0.000579834f, -0.000091552734f,
|
||||
};
|
||||
constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{
|
||||
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{
|
||||
0.8230896f, -0.19161987f, 0.093444824f, -0.05090332f, 0.027557373f,
|
||||
-0.014038086f, 0.0064697266f, -0.002532959f, 0.00079345703f, -0.00012207031f,
|
||||
};
|
||||
constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{
|
||||
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{
|
||||
0.6298828f, -0.19274902f, 0.09725952f, -0.05319214f, 0.028625488f,
|
||||
-0.014373779f, 0.006500244f, -0.0024719238f, 0.0007324219f, -0.000091552734f,
|
||||
};
|
||||
constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{
|
||||
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{
|
||||
0.4057312f, -0.1468811f, 0.07601929f, -0.041656494f, 0.022216797f,
|
||||
-0.011016846f, 0.004852295f, -0.0017700195f, 0.00048828125f, -0.000030517578f,
|
||||
};
|
||||
constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{
|
||||
constexpr static std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{
|
||||
0.1854248f, -0.075164795f, 0.03967285f, -0.021728516f, 0.011474609f,
|
||||
-0.005584717f, 0.0024108887f, -0.0008239746f, 0.00021362305f, 0.0f,
|
||||
};
|
||||
|
|
|
@ -21,8 +21,8 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro
|
|||
}
|
||||
|
||||
void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
|
||||
constexpr s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr s32 max{std::numeric_limits<s16>::max()};
|
||||
constexpr static s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr static s32 max{std::numeric_limits<s16>::max()};
|
||||
|
||||
std::vector<s16> output(processor.sample_count);
|
||||
for (u32 channel = 0; channel < input_count; channel++) {
|
||||
|
|
|
@ -20,8 +20,8 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor&
|
|||
}
|
||||
|
||||
void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) {
|
||||
constexpr s32 min = std::numeric_limits<s16>::min();
|
||||
constexpr s32 max = std::numeric_limits<s16>::max();
|
||||
constexpr static s32 min = std::numeric_limits<s16>::min();
|
||||
constexpr static s32 max = std::numeric_limits<s16>::max();
|
||||
|
||||
auto stream{processor.GetOutputSinkStream()};
|
||||
stream->SetSystemChannels(input_count);
|
||||
|
|
|
@ -94,7 +94,7 @@ bool SystemManager::Remove(System& system_) {
|
|||
}
|
||||
|
||||
void SystemManager::ThreadFunc() {
|
||||
constexpr char name[]{"AudioRenderSystemManager"};
|
||||
constexpr static char name[]{"AudioRenderSystemManager"};
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
|
||||
|
|
|
@ -177,7 +177,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
|||
|
||||
switch (sample_format_) {
|
||||
case SampleFormat::PcmInt16: {
|
||||
constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)};
|
||||
constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)};
|
||||
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
||||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
||||
LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!");
|
||||
|
@ -188,7 +188,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
|
|||
} break;
|
||||
|
||||
case SampleFormat::PcmFloat: {
|
||||
constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)};
|
||||
constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)};
|
||||
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
|
||||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
|
||||
LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!");
|
||||
|
|
|
@ -24,8 +24,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr s32 max{std::numeric_limits<s16>::max()};
|
||||
constexpr static s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr static s32 max{std::numeric_limits<s16>::max()};
|
||||
|
||||
auto yuzu_volume{Settings::Volume()};
|
||||
if (yuzu_volume > 1.0f) {
|
||||
|
@ -35,7 +35,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
|
|||
|
||||
if (system_channels == 6 && device_channels == 2) {
|
||||
// We're given 6 channels, but our device only outputs 2, so downmix.
|
||||
constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
|
||||
constexpr static std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
|
||||
|
||||
for (u32 read_index = 0, write_index = 0; read_index < samples.size();
|
||||
read_index += system_channels, write_index += device_channels) {
|
||||
|
@ -106,8 +106,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
|
|||
}
|
||||
|
||||
std::vector<s16> SinkStream::ReleaseBuffer(u64 num_samples) {
|
||||
constexpr s32 min = std::numeric_limits<s16>::min();
|
||||
constexpr s32 max = std::numeric_limits<s16>::max();
|
||||
constexpr static s32 min = std::numeric_limits<s16>::min();
|
||||
constexpr static s32 max = std::numeric_limits<s16>::max();
|
||||
|
||||
auto samples{samples_buffer.Pop(num_samples)};
|
||||
|
||||
|
@ -202,7 +202,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
|
|||
// If we're paused or going to shut down, we don't want to consume buffers as coretiming is
|
||||
// paused and we'll desync, so just play silence.
|
||||
if (system.IsPaused() || system.IsShuttingDown()) {
|
||||
constexpr std::array<s16, 6> silence{};
|
||||
constexpr static std::array<s16, 6> silence{};
|
||||
for (size_t i = frames_written; i < num_frames; i++) {
|
||||
std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ constexpr FixedPoint<I, F> divide(
|
|||
|
||||
using next_type = typename FixedPoint<I, F>::next_type;
|
||||
using base_type = typename FixedPoint<I, F>::base_type;
|
||||
constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits;
|
||||
constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits;
|
||||
|
||||
next_type t(numerator.to_raw());
|
||||
t <<= fractional_bits;
|
||||
|
@ -127,7 +127,7 @@ constexpr FixedPoint<I, F> divide(
|
|||
|
||||
using unsigned_type = typename FixedPoint<I, F>::unsigned_type;
|
||||
|
||||
constexpr int bits = FixedPoint<I, F>::total_bits;
|
||||
constexpr static int bits = FixedPoint<I, F>::total_bits;
|
||||
|
||||
if (denominator == 0) {
|
||||
throw divide_by_zero();
|
||||
|
@ -198,7 +198,7 @@ constexpr FixedPoint<I, F> multiply(
|
|||
using next_type = typename FixedPoint<I, F>::next_type;
|
||||
using base_type = typename FixedPoint<I, F>::base_type;
|
||||
|
||||
constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits;
|
||||
constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits;
|
||||
|
||||
next_type t(static_cast<next_type>(lhs.to_raw()) * static_cast<next_type>(rhs.to_raw()));
|
||||
t >>= fractional_bits;
|
||||
|
@ -216,9 +216,9 @@ constexpr FixedPoint<I, F> multiply(
|
|||
|
||||
using base_type = typename FixedPoint<I, F>::base_type;
|
||||
|
||||
constexpr size_t fractional_bits = FixedPoint<I, F>::fractional_bits;
|
||||
constexpr base_type integer_mask = FixedPoint<I, F>::integer_mask;
|
||||
constexpr base_type fractional_mask = FixedPoint<I, F>::fractional_mask;
|
||||
constexpr static size_t fractional_bits = FixedPoint<I, F>::fractional_bits;
|
||||
constexpr static base_type integer_mask = FixedPoint<I, F>::integer_mask;
|
||||
constexpr static base_type fractional_mask = FixedPoint<I, F>::fractional_mask;
|
||||
|
||||
// more costly but doesn't need a larger type
|
||||
const base_type a_hi = (lhs.to_raw() & integer_mask) >> fractional_bits;
|
||||
|
|
|
@ -47,7 +47,7 @@ template <typename ContiguousContainer>
|
|||
static_assert(std::is_same_v<typename ContiguousContainer::value_type, u8>,
|
||||
"Underlying type within the contiguous container must be u8.");
|
||||
|
||||
constexpr std::size_t pad_width = 2;
|
||||
constexpr static std::size_t pad_width = 2;
|
||||
|
||||
std::string out;
|
||||
out.reserve(std::size(data) * pad_width);
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
|
||||
float GenerateRandomF32() {
|
||||
// Floats have 24 bits of mantissa.
|
||||
constexpr u32 MantissaBits = 24;
|
||||
constexpr static u32 MantissaBits = 24;
|
||||
return static_cast<float>(GenerateRandomU24()) * (1.0f / (1U << MantissaBits));
|
||||
}
|
||||
|
||||
|
@ -234,9 +234,9 @@ public:
|
|||
// Nintendo does not. They use (32 - 5) = 27 bits from the first rnd32()
|
||||
// call, and (32 - 6) bits from the second. We'll do what they do, but
|
||||
// There's not a clear reason why.
|
||||
constexpr u32 MantissaBits = 53;
|
||||
constexpr u32 Shift1st = (64 - MantissaBits) / 2;
|
||||
constexpr u32 Shift2nd = (64 - MantissaBits) - Shift1st;
|
||||
constexpr static u32 MantissaBits = 53;
|
||||
constexpr static u32 Shift1st = (64 - MantissaBits) / 2;
|
||||
constexpr static u32 Shift2nd = (64 - MantissaBits) - Shift1st;
|
||||
|
||||
const u32 first = (this->GenerateRandomU32() >> Shift1st);
|
||||
const u32 second = (this->GenerateRandomU32() >> Shift2nd);
|
||||
|
|
|
@ -361,7 +361,7 @@ struct System::Impl {
|
|||
// Log last frame performance stats if game was loded
|
||||
if (perf_stats) {
|
||||
const auto perf_results = GetAndResetPerfStats();
|
||||
constexpr auto performance = Common::Telemetry::FieldType::Performance;
|
||||
constexpr static auto performance = Common::Telemetry::FieldType::Performance;
|
||||
|
||||
telemetry_session->AddField(performance, "Shutdown_EmulationSpeed",
|
||||
perf_results.emulation_speed * 100.0);
|
||||
|
|
|
@ -45,7 +45,7 @@ CoreTiming::~CoreTiming() {
|
|||
}
|
||||
|
||||
void CoreTiming::ThreadEntry(CoreTiming& instance) {
|
||||
constexpr char name[] = "HostTiming";
|
||||
constexpr static char name[] = "HostTiming";
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
|
|
|
@ -42,7 +42,7 @@ static void PutSIMDRegister(std::array<u32, 64>& simd_regs, size_t offset, const
|
|||
// For sample XML files see the GDB source /gdb/features
|
||||
// This XML defines what the registers are for this specific ARM device
|
||||
std::string GDBStubA64::GetTargetXML() const {
|
||||
constexpr const char* target_xml =
|
||||
constexpr static const char* target_xml =
|
||||
R"(<?xml version="1.0"?>
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target version="1.0">
|
||||
|
@ -271,7 +271,7 @@ u32 GDBStubA64::BreakpointInstruction() const {
|
|||
}
|
||||
|
||||
std::string GDBStubA32::GetTargetXML() const {
|
||||
constexpr const char* target_xml =
|
||||
constexpr static const char* target_xml =
|
||||
R"(<?xml version="1.0"?>
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target version="1.0">
|
||||
|
|
|
@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
|
|||
return IPSFileType::Error;
|
||||
}
|
||||
|
||||
constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
|
||||
constexpr static std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
|
||||
if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) {
|
||||
return IPSFileType::IPS;
|
||||
}
|
||||
|
||||
constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
|
||||
constexpr static std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
|
||||
if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) {
|
||||
return IPSFileType::IPS32;
|
||||
}
|
||||
|
@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
|
|||
}
|
||||
|
||||
static bool IsEOF(IPSFileType type, const std::vector<u8>& data) {
|
||||
constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}};
|
||||
constexpr static std::array<u8, 3> eof{{'E', 'O', 'F'}};
|
||||
if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
|
||||
constexpr static std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
|
||||
return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin());
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) {
|
|||
|
||||
/*static*/ ProgramMetadata ProgramMetadata::GetDefault() {
|
||||
// Allow use of cores 0~3 and thread priorities 1~63.
|
||||
constexpr u32 default_thread_info_capability = 0x30007F7;
|
||||
constexpr static u32 default_thread_info_capability = 0x30007F7;
|
||||
|
||||
ProgramMetadata result;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo
|
|||
}
|
||||
|
||||
static std::string GetCNMTName(TitleType type, u64 title_id) {
|
||||
constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{
|
||||
constexpr static std::array<const char*, 9> TITLE_TYPE_NAMES{
|
||||
"SystemProgram",
|
||||
"SystemData",
|
||||
"SystemUpdate",
|
||||
|
|
|
@ -213,7 +213,7 @@ void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& cal
|
|||
}
|
||||
|
||||
void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) {
|
||||
constexpr std::size_t KEYS_PER_BYTE = 8;
|
||||
constexpr static std::size_t KEYS_PER_BYTE = 8;
|
||||
auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE];
|
||||
const u8 mask = static_cast<u8>(1 << (key_index % KEYS_PER_BYTE));
|
||||
if (status) {
|
||||
|
|
|
@ -114,13 +114,13 @@ size_t KSystemControl::Init::GetAppletPoolSize() {
|
|||
}();
|
||||
|
||||
// Return (possibly) adjusted size.
|
||||
constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
|
||||
constexpr static size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
|
||||
return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize;
|
||||
}
|
||||
|
||||
size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() {
|
||||
// Verify that our minimum is at least as large as Nintendo's.
|
||||
constexpr size_t MinimumSize = RequiredNonSecureSystemMemorySize;
|
||||
constexpr static size_t MinimumSize = RequiredNonSecureSystemMemorySize;
|
||||
static_assert(MinimumSize >= 0x29C8000);
|
||||
|
||||
return MinimumSize;
|
||||
|
|
|
@ -129,7 +129,7 @@ VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAd
|
|||
}
|
||||
|
||||
size_t CalculateSlabHeapGapSize() {
|
||||
constexpr size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB;
|
||||
constexpr static size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB;
|
||||
static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax);
|
||||
return KernelSlabHeapGapSize;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ void KPageBufferSlabHeap::Initialize(Core::System& system) {
|
|||
kernel.GetSystemResourceLimit()->Reserve(LimitableResource::PhysicalMemoryMax, slab_size));
|
||||
|
||||
// Allocate memory for the slab.
|
||||
constexpr auto AllocateOption = KMemoryManager::EncodeOption(
|
||||
constexpr static auto AllocateOption = KMemoryManager::EncodeOption(
|
||||
KMemoryManager::Pool::System, KMemoryManager::Direction::FromFront);
|
||||
const PAddr slab_address =
|
||||
kernel.MemoryManager().AllocateAndOpenContinuous(num_pages, 1, AllocateOption);
|
||||
|
|
|
@ -21,8 +21,8 @@ Result KCapabilities::InitializeForKIP(std::span<const u32> kern_caps, KPageTabl
|
|||
m_program_type = 0;
|
||||
|
||||
// Initial processes may run on all cores.
|
||||
constexpr u64 VirtMask = Core::Hardware::VirtualCoreMask;
|
||||
constexpr u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask);
|
||||
constexpr static u64 VirtMask = Core::Hardware::VirtualCoreMask;
|
||||
constexpr static u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask);
|
||||
|
||||
m_core_mask = VirtMask;
|
||||
m_phys_core_mask = PhysMask;
|
||||
|
@ -170,7 +170,7 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) {
|
|||
template <typename F>
|
||||
Result KCapabilities::ProcessMapRegionCapability(const u32 cap, F f) {
|
||||
// Define the allowed memory regions.
|
||||
constexpr std::array<KMemoryRegionType, 4> MemoryRegions{
|
||||
constexpr static std::array<KMemoryRegionType, 4> MemoryRegions{
|
||||
KMemoryRegionType_None,
|
||||
KMemoryRegionType_KernelTraceBuffer,
|
||||
KMemoryRegionType_OnMemoryBootImage,
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
}
|
||||
|
||||
size_t GetSize(Pool pool) {
|
||||
constexpr Direction GetSizeDirection = Direction::FromFront;
|
||||
constexpr static Direction GetSizeDirection = Direction::FromFront;
|
||||
size_t total = 0;
|
||||
for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr;
|
||||
manager = this->GetNextManager(manager, GetSizeDirection)) {
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
size_t GetFreeSize(Pool pool) {
|
||||
KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]);
|
||||
|
||||
constexpr Direction GetSizeDirection = Direction::FromFront;
|
||||
constexpr static Direction GetSizeDirection = Direction::FromFront;
|
||||
size_t total = 0;
|
||||
for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr;
|
||||
manager = this->GetNextManager(manager, GetSizeDirection)) {
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
void DumpFreeList(Pool pool) {
|
||||
KScopedLightLock lk(m_pool_locks[static_cast<size_t>(pool)]);
|
||||
|
||||
constexpr Direction DumpDirection = Direction::FromFront;
|
||||
constexpr static Direction DumpDirection = Direction::FromFront;
|
||||
for (auto* manager = this->GetFirstManager(pool, DumpDirection); manager != nullptr;
|
||||
manager = this->GetNextManager(manager, DumpDirection)) {
|
||||
manager->DumpFreeList();
|
||||
|
|
|
@ -68,7 +68,7 @@ PAddr KPageHeap::AllocateByRandom(s32 index, size_t num_pages, size_t align_page
|
|||
const size_t align_shift = std::countr_zero(align_size);
|
||||
|
||||
// Decide on a block to allocate from.
|
||||
constexpr size_t MinimumPossibleAlignmentsForRandomAllocation = 4;
|
||||
constexpr static size_t MinimumPossibleAlignmentsForRandomAllocation = 4;
|
||||
{
|
||||
// By default, we'll want to look at all blocks larger than our current one.
|
||||
s32 max_blocks = static_cast<s32>(m_num_blocks);
|
||||
|
|
|
@ -134,7 +134,7 @@ Result KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type
|
|||
}
|
||||
|
||||
// Set code regions and determine remaining
|
||||
constexpr size_t RegionAlignment{2_MiB};
|
||||
constexpr static size_t RegionAlignment{2_MiB};
|
||||
VAddr process_code_start{};
|
||||
VAddr process_code_end{};
|
||||
size_t stack_region_size{};
|
||||
|
@ -2624,7 +2624,7 @@ Result KPageTable::SetMemoryAttribute(VAddr addr, size_t size, u32 mask, u32 att
|
|||
KMemoryPermission old_perm;
|
||||
KMemoryAttribute old_attr;
|
||||
size_t num_allocator_blocks;
|
||||
constexpr auto AttributeTestMask =
|
||||
constexpr static auto AttributeTestMask =
|
||||
~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared);
|
||||
R_TRY(this->CheckMemoryState(
|
||||
std::addressof(old_state), std::addressof(old_perm), std::addressof(old_attr),
|
||||
|
|
|
@ -254,7 +254,7 @@ struct KernelCore::Impl {
|
|||
system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, kernel_size);
|
||||
|
||||
// Reserve secure applet memory, introduced in firmware 5.0.0
|
||||
constexpr u64 secure_applet_memory_size{4_MiB};
|
||||
constexpr static u64 secure_applet_memory_size{4_MiB};
|
||||
ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax,
|
||||
secure_applet_memory_size));
|
||||
}
|
||||
|
@ -477,9 +477,9 @@ struct KernelCore::Impl {
|
|||
const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd;
|
||||
|
||||
// Setup the containing kernel region.
|
||||
constexpr size_t KernelRegionSize = 1_GiB;
|
||||
constexpr size_t KernelRegionAlign = 1_GiB;
|
||||
constexpr VAddr kernel_region_start =
|
||||
constexpr static size_t KernelRegionSize = 1_GiB;
|
||||
constexpr static size_t KernelRegionAlign = 1_GiB;
|
||||
constexpr static VAddr kernel_region_start =
|
||||
Common::AlignDown(code_start_virt_addr, KernelRegionAlign);
|
||||
size_t kernel_region_size = KernelRegionSize;
|
||||
if (!(kernel_region_start + KernelRegionSize - 1 <= KernelVirtualAddressSpaceLast)) {
|
||||
|
@ -489,11 +489,11 @@ struct KernelCore::Impl {
|
|||
kernel_region_start, kernel_region_size, KMemoryRegionType_Kernel));
|
||||
|
||||
// Setup the code region.
|
||||
constexpr size_t CodeRegionAlign = PageSize;
|
||||
constexpr VAddr code_region_start =
|
||||
constexpr static size_t CodeRegionAlign = PageSize;
|
||||
constexpr static VAddr code_region_start =
|
||||
Common::AlignDown(code_start_virt_addr, CodeRegionAlign);
|
||||
constexpr VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign);
|
||||
constexpr size_t code_region_size = code_region_end - code_region_start;
|
||||
constexpr static VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign);
|
||||
constexpr static size_t code_region_size = code_region_end - code_region_start;
|
||||
ASSERT(memory_layout->GetVirtualMemoryRegionTree().Insert(
|
||||
code_region_start, code_region_size, KMemoryRegionType_KernelCode));
|
||||
|
||||
|
@ -524,8 +524,8 @@ struct KernelCore::Impl {
|
|||
}
|
||||
|
||||
// Decide on the actual size for the misc region.
|
||||
constexpr size_t MiscRegionAlign = KernelAslrAlignment;
|
||||
constexpr size_t MiscRegionMinimumSize = 32_MiB;
|
||||
constexpr static size_t MiscRegionAlign = KernelAslrAlignment;
|
||||
constexpr static size_t MiscRegionMinimumSize = 32_MiB;
|
||||
const size_t misc_region_size = Common::AlignUp(
|
||||
std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign);
|
||||
ASSERT(misc_region_size > 0);
|
||||
|
@ -541,8 +541,8 @@ struct KernelCore::Impl {
|
|||
const bool use_extra_resources = KSystemControl::Init::ShouldIncreaseThreadResourceLimit();
|
||||
|
||||
// Setup the stack region.
|
||||
constexpr size_t StackRegionSize = 14_MiB;
|
||||
constexpr size_t StackRegionAlign = KernelAslrAlignment;
|
||||
constexpr static size_t StackRegionSize = 14_MiB;
|
||||
constexpr static size_t StackRegionAlign = KernelAslrAlignment;
|
||||
const VAddr stack_region_start =
|
||||
memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
|
||||
StackRegionSize, StackRegionAlign, KMemoryRegionType_Kernel);
|
||||
|
@ -563,7 +563,7 @@ struct KernelCore::Impl {
|
|||
const PAddr code_end_phys_addr = code_start_phys_addr + code_region_size;
|
||||
const PAddr slab_start_phys_addr = code_end_phys_addr;
|
||||
const PAddr slab_end_phys_addr = slab_start_phys_addr + slab_region_size;
|
||||
constexpr size_t SlabRegionAlign = KernelAslrAlignment;
|
||||
constexpr static size_t SlabRegionAlign = KernelAslrAlignment;
|
||||
const size_t slab_region_needed_size =
|
||||
Common::AlignUp(code_end_phys_addr + slab_region_size, SlabRegionAlign) -
|
||||
Common::AlignDown(code_end_phys_addr, SlabRegionAlign);
|
||||
|
@ -575,8 +575,8 @@ struct KernelCore::Impl {
|
|||
slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab));
|
||||
|
||||
// Setup the temp region.
|
||||
constexpr size_t TempRegionSize = 128_MiB;
|
||||
constexpr size_t TempRegionAlign = KernelAslrAlignment;
|
||||
constexpr static size_t TempRegionSize = 128_MiB;
|
||||
constexpr static size_t TempRegionAlign = KernelAslrAlignment;
|
||||
const VAddr temp_region_start =
|
||||
memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
|
||||
TempRegionSize, TempRegionAlign, KMemoryRegionType_Kernel);
|
||||
|
@ -656,7 +656,7 @@ struct KernelCore::Impl {
|
|||
ASSERT(linear_extents.GetEndAddress() != 0);
|
||||
|
||||
// Setup the linear mapping region.
|
||||
constexpr size_t LinearRegionAlign = 1_GiB;
|
||||
constexpr static size_t LinearRegionAlign = 1_GiB;
|
||||
const PAddr aligned_linear_phys_start =
|
||||
Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign);
|
||||
const size_t linear_region_size =
|
||||
|
@ -737,11 +737,11 @@ struct KernelCore::Impl {
|
|||
void InitializeHackSharedMemory() {
|
||||
// Setup memory regions for emulated processes
|
||||
// TODO(bunnei): These should not be hardcoded regions initialized within the kernel
|
||||
constexpr std::size_t hid_size{0x40000};
|
||||
constexpr std::size_t font_size{0x1100000};
|
||||
constexpr std::size_t irs_size{0x8000};
|
||||
constexpr std::size_t time_size{0x1000};
|
||||
constexpr std::size_t hidbus_size{0x1000};
|
||||
constexpr static std::size_t hid_size{0x40000};
|
||||
constexpr static std::size_t font_size{0x1100000};
|
||||
constexpr static std::size_t irs_size{0x8000};
|
||||
constexpr static std::size_t time_size{0x1000};
|
||||
constexpr static std::size_t hidbus_size{0x1000};
|
||||
|
||||
hid_shared_mem = KSharedMemory::Create(system.Kernel());
|
||||
font_shared_mem = KSharedMemory::Create(system.Kernel());
|
||||
|
|
|
@ -306,7 +306,7 @@ Result ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_tab
|
|||
}
|
||||
|
||||
Result ProcessCapabilities::HandleInterruptFlags(u32 flags) {
|
||||
constexpr u32 interrupt_ignore_value = 0x3FF;
|
||||
constexpr static u32 interrupt_ignore_value = 0x3FF;
|
||||
const u32 interrupt0 = (flags >> 12) & 0x3FF;
|
||||
const u32 interrupt1 = (flags >> 22) & 0x3FF;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle,
|
|||
thread_activity);
|
||||
|
||||
// Validate the activity.
|
||||
constexpr auto IsValidThreadActivity = [](ThreadActivity activity) {
|
||||
constexpr static auto IsValidThreadActivity = [](ThreadActivity activity) {
|
||||
return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused;
|
||||
};
|
||||
R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue);
|
||||
|
|
|
@ -193,7 +193,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
|||
return ResultSuccess;
|
||||
|
||||
case InfoType::ThreadTickCount: {
|
||||
constexpr u64 num_cpus = 4;
|
||||
constexpr static u64 num_cpus = 4;
|
||||
if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) {
|
||||
LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus,
|
||||
info_sub_id);
|
||||
|
|
|
@ -132,7 +132,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas
|
|||
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
|
||||
|
||||
// Validate the attribute and mask.
|
||||
constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached);
|
||||
constexpr static u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached);
|
||||
R_UNLESS((mask | attr) == mask, ResultInvalidCombination);
|
||||
R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination);
|
||||
|
||||
|
|
|
@ -871,7 +871,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont
|
|||
// TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable
|
||||
// way of confirming things like the TID, we're going to assume a non zero value for the time
|
||||
// being.
|
||||
constexpr u64 tid{1};
|
||||
constexpr static u64 tid{1};
|
||||
StoreSaveDataThumbnail(ctx, uuid, tid);
|
||||
}
|
||||
|
||||
|
|
|
@ -1086,7 +1086,7 @@ private:
|
|||
|
||||
// We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is
|
||||
// actually used anywhere
|
||||
constexpr u64 handle = 0xdeadbeef;
|
||||
constexpr static u64 handle = 0xdeadbeef;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
|
@ -1570,7 +1570,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
|
|||
const auto& version = res.first->GetVersionString();
|
||||
std::copy(version.begin(), version.end(), version_string.begin());
|
||||
} else {
|
||||
constexpr char default_version[]{"1.0.0"};
|
||||
constexpr static char default_version[]{"1.0.0"};
|
||||
std::memcpy(version_string.data(), default_version, sizeof(default_version));
|
||||
}
|
||||
|
||||
|
@ -1638,7 +1638,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
|||
void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||
|
||||
constexpr bool gameplay_recording_supported = false;
|
||||
constexpr static bool gameplay_recording_supported = false;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
|
|
@ -1180,7 +1180,7 @@ void SoftwareKeyboard::ReplyChangedStringV2() {
|
|||
.cursor_position{current_cursor_position},
|
||||
};
|
||||
|
||||
constexpr u8 flag = 0;
|
||||
constexpr static u8 flag = 0;
|
||||
|
||||
std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(),
|
||||
current_text.size() * sizeof(char16_t));
|
||||
|
@ -1204,7 +1204,7 @@ void SoftwareKeyboard::ReplyMovedCursorV2() {
|
|||
.cursor_position{current_cursor_position},
|
||||
};
|
||||
|
||||
constexpr u8 flag = 0;
|
||||
constexpr static u8 flag = 0;
|
||||
|
||||
std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(),
|
||||
current_text.size() * sizeof(char16_t));
|
||||
|
@ -1232,7 +1232,7 @@ void SoftwareKeyboard::ReplyChangedStringUtf8V2() {
|
|||
.cursor_position{current_cursor_position},
|
||||
};
|
||||
|
||||
constexpr u8 flag = 0;
|
||||
constexpr static u8 flag = 0;
|
||||
|
||||
std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size());
|
||||
std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &changed_string_arg,
|
||||
|
@ -1257,7 +1257,7 @@ void SoftwareKeyboard::ReplyMovedCursorUtf8V2() {
|
|||
.cursor_position{current_cursor_position},
|
||||
};
|
||||
|
||||
constexpr u8 flag = 0;
|
||||
constexpr static u8 flag = 0;
|
||||
|
||||
std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size());
|
||||
std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &moved_cursor_arg,
|
||||
|
|
|
@ -56,7 +56,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode,
|
|||
}
|
||||
|
||||
void Controller::SetFromCpuBoostMode(CpuBoostMode mode) {
|
||||
constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
|
||||
constexpr static std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
|
||||
PerformanceConfiguration::Config7,
|
||||
PerformanceConfiguration::Config13,
|
||||
PerformanceConfiguration::Config15,
|
||||
|
|
|
@ -77,7 +77,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
// This service function is currently hardcoded on the
|
||||
// actual console to this value (as of 8.0.0).
|
||||
constexpr s32 target_min_volume = 0;
|
||||
constexpr static s32 target_min_volume = 0;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
@ -89,7 +89,7 @@ void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
// This service function is currently hardcoded on the
|
||||
// actual console to this value (as of 8.0.0).
|
||||
constexpr s32 target_max_volume = 15;
|
||||
constexpr static s32 target_max_volume = 15;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
|
|
@ -209,7 +209,7 @@ private:
|
|||
|
||||
std::size_t WorkerBufferSize(u32 channel_count) {
|
||||
ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count");
|
||||
constexpr int num_streams = 1;
|
||||
constexpr static int num_streams = 1;
|
||||
const int num_stereo_streams = channel_count == 2 ? 1 : 0;
|
||||
return opus_multistream_decoder_get_size(num_streams, num_stereo_streams);
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& c
|
|||
|
||||
// TODO: Update this when we implement the album.
|
||||
// Currently we do not have a method of accessing album entries, set this to 0 for now.
|
||||
constexpr u32 total_entries_1{};
|
||||
constexpr u32 total_entries_2{};
|
||||
constexpr static u32 total_entries_1{};
|
||||
constexpr static u32 total_entries_2{};
|
||||
|
||||
LOG_WARNING(
|
||||
Service_Capture,
|
||||
|
|
|
@ -942,7 +942,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
|
|||
|
||||
const auto parameters = rp.PopRaw<Parameters>();
|
||||
// Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData
|
||||
constexpr auto flags = static_cast<u32>(FileSys::SaveDataFlags::None);
|
||||
constexpr static auto flags = static_cast<u32>(FileSys::SaveDataFlags::None);
|
||||
|
||||
LOG_WARNING(Service_FS,
|
||||
"(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n"
|
||||
|
|
|
@ -439,7 +439,7 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
|
|||
using btn = Core::HID::NpadButton;
|
||||
pad_entry.npad_buttons.raw = btn::None;
|
||||
if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) {
|
||||
constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R |
|
||||
constexpr static btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R |
|
||||
btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp |
|
||||
btn::StickRRight | btn::StickRDown;
|
||||
pad_entry.npad_buttons.raw = button_state.raw & right_button_mask;
|
||||
|
@ -447,7 +447,7 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
|
|||
}
|
||||
|
||||
if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) {
|
||||
constexpr btn left_button_mask =
|
||||
constexpr static btn left_button_mask =
|
||||
btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL |
|
||||
btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown;
|
||||
pad_entry.npad_buttons.raw |= button_state.raw & left_button_mask;
|
||||
|
@ -759,7 +759,7 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
|
|||
}
|
||||
|
||||
Result Controller_NPad::SetSupportedNpadIdTypes(std::span<const u8> data) {
|
||||
constexpr std::size_t max_number_npad_ids = 0xa;
|
||||
constexpr static std::size_t max_number_npad_ids = 0xa;
|
||||
const auto length = data.size();
|
||||
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
|
||||
const std::size_t elements = length / sizeof(u32);
|
||||
|
|
|
@ -670,7 +670,7 @@ ResultVal<std::vector<MiiInfoElement>> MiiManager::GetDefault(SourceFlag source_
|
|||
}
|
||||
|
||||
Result MiiManager::GetIndex([[maybe_unused]] const CharInfo& info, u32& index) {
|
||||
constexpr u32 INVALID_INDEX{0xFFFFFFFF};
|
||||
constexpr static u32 INVALID_INDEX{0xFFFFFFFF};
|
||||
|
||||
index = INVALID_INDEX;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ bool IsAmiiboValid(const EncryptedNTAG215File& ntag_file) {
|
|||
LOG_DEBUG(Service_NFP, "tag_CFG1=0x{0:x}", ntag_file.CFG1);
|
||||
|
||||
// Validate UUID
|
||||
constexpr u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3`
|
||||
constexpr static u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3`
|
||||
if ((CT ^ ntag_file.uuid.uid[0] ^ ntag_file.uuid.uid[1] ^ ntag_file.uuid.uid[2]) !=
|
||||
ntag_file.uuid.uid[3]) {
|
||||
return false;
|
||||
|
@ -247,7 +247,7 @@ void Cipher(const DerivedKeys& keys, const NTAG215File& in_data, NTAG215File& ou
|
|||
mbedtls_aes_setkey_enc(&aes, keys.aes_key.data(), aes_key_size);
|
||||
memcpy(nonce_counter.data(), keys.aes_iv.data(), sizeof(keys.aes_iv));
|
||||
|
||||
constexpr std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START;
|
||||
constexpr static std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START;
|
||||
mbedtls_aes_crypt_ctr(&aes, encrypted_data_size, &nc_off, nonce_counter.data(),
|
||||
stream_block.data(),
|
||||
reinterpret_cast<const unsigned char*>(&in_data.settings),
|
||||
|
@ -317,13 +317,13 @@ bool DecodeAmiibo(const EncryptedNTAG215File& encrypted_tag_data, NTAG215File& t
|
|||
Cipher(data_keys, encoded_data, tag_data);
|
||||
|
||||
// Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC!
|
||||
constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
|
||||
constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
|
||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(),
|
||||
sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid),
|
||||
input_length, reinterpret_cast<unsigned char*>(&tag_data.hmac_tag));
|
||||
|
||||
// Regenerate data HMAC
|
||||
constexpr std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START;
|
||||
constexpr static std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START;
|
||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), data_keys.hmac_key.data(),
|
||||
sizeof(HmacKey),
|
||||
reinterpret_cast<const unsigned char*>(&tag_data.write_counter), input_length2,
|
||||
|
@ -357,8 +357,8 @@ bool EncodeAmiibo(const NTAG215File& tag_data, EncryptedNTAG215File& encrypted_t
|
|||
NTAG215File encoded_tag_data{};
|
||||
|
||||
// Generate tag HMAC
|
||||
constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
|
||||
constexpr std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START;
|
||||
constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START;
|
||||
constexpr static std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START;
|
||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(),
|
||||
sizeof(HmacKey), reinterpret_cast<const unsigned char*>(&tag_data.uid),
|
||||
input_length, reinterpret_cast<unsigned char*>(&encoded_tag_data.hmac_tag));
|
||||
|
|
|
@ -512,7 +512,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx
|
|||
};
|
||||
static_assert(sizeof(Output) == 0x3, "Output has incorrect size.");
|
||||
|
||||
constexpr Output out{};
|
||||
constexpr static Output out{};
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
namespace Service::Nvidia::NvCore {
|
||||
|
||||
SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host1x_} {
|
||||
constexpr u32 VBlank0SyncpointId{26};
|
||||
constexpr u32 VBlank1SyncpointId{27};
|
||||
constexpr static u32 VBlank0SyncpointId{26};
|
||||
constexpr static u32 VBlank1SyncpointId{27};
|
||||
|
||||
// Reserve both vblank syncpoints as client managed as they use Continuous Mode
|
||||
// Refer to section 14.3.5.3 of the TRM for more information on Continuous Mode
|
||||
|
|
|
@ -45,7 +45,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
|
|||
|
||||
// If expected_present is specified, we may not want to return a buffer yet.
|
||||
if (expected_present.count() != 0) {
|
||||
constexpr auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second
|
||||
constexpr static auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second
|
||||
|
||||
// The expected_present argument indicates when the buffer is expected to be presented
|
||||
// on-screen.
|
||||
|
|
|
@ -55,7 +55,7 @@ private:
|
|||
LOG_WARNING(Service_OLSC, "(STUBBED) called");
|
||||
|
||||
// backup_setting is set to 0 since real value is unknown
|
||||
constexpr u64 backup_setting = 0;
|
||||
constexpr static u64 backup_setting = 0;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
|
|
|
@ -116,7 +116,7 @@ private:
|
|||
void GetTransmissionStatus(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_PREPO, "(STUBBED) called");
|
||||
|
||||
constexpr s32 status = 0;
|
||||
constexpr static s32 status = 0;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
@ -126,7 +126,7 @@ private:
|
|||
void GetSystemSessionId(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_PREPO, "(STUBBED) called");
|
||||
|
||||
constexpr u64 system_session_id = 0;
|
||||
constexpr static u64 system_session_id = 0;
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(system_session_id);
|
||||
|
|
|
@ -92,7 +92,7 @@ static std::vector<u8> SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co
|
|||
static_assert(sizeof(SerializedResponseHeader) == 0x18,
|
||||
"Response header size must be 0x18 bytes");
|
||||
|
||||
constexpr auto header_size = sizeof(SerializedResponseHeader);
|
||||
constexpr static auto header_size = sizeof(SerializedResponseHeader);
|
||||
const auto addr_size =
|
||||
current->ai_addr && current->ai_addrlen > 0 ? current->ai_addrlen : 4;
|
||||
const auto canonname_size = current->ai_canonname ? strlen(current->ai_canonname) + 1 : 1;
|
||||
|
@ -103,7 +103,7 @@ static std::vector<u8> SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co
|
|||
// Header in network byte order
|
||||
SerializedResponseHeader header{};
|
||||
|
||||
constexpr auto HEADER_MAGIC = 0xBEEFCAFE;
|
||||
constexpr static auto HEADER_MAGIC = 0xBEEFCAFE;
|
||||
header.magic = htonl(HEADER_MAGIC);
|
||||
header.family = htonl(current->ai_family);
|
||||
header.flags = htonl(current->ai_flags);
|
||||
|
|
|
@ -103,7 +103,7 @@ private:
|
|||
const auto certificate_format = rp.PopEnum<CertificateFormat>();
|
||||
[[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0);
|
||||
|
||||
constexpr u64 server_id = 0;
|
||||
constexpr static u64 server_id = 0;
|
||||
|
||||
LOG_WARNING(Service_SSL, "(STUBBED) called, certificate_format={}", certificate_format);
|
||||
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
return std::span<const u8>{};
|
||||
}();
|
||||
|
||||
constexpr u64 client_id = 0;
|
||||
constexpr static u64 client_id = 0;
|
||||
|
||||
LOG_WARNING(Service_SSL, "(STUBBED) called");
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ static constexpr int TransitionTime(int year, Rule rule, int offset) {
|
|||
}
|
||||
|
||||
static bool ParsePosixName(const char* name, TimeZoneRule& rule) {
|
||||
constexpr char default_rule[]{",M4.1.0,M10.5.0"};
|
||||
constexpr static char default_rule[]{",M4.1.0,M10.5.0"};
|
||||
const char* std_name{name};
|
||||
int std_len{};
|
||||
int offset{};
|
||||
|
@ -512,8 +512,8 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi
|
|||
return {};
|
||||
}
|
||||
|
||||
constexpr s32 time_zone_max_leaps{50};
|
||||
constexpr s32 time_zone_max_chars{50};
|
||||
constexpr static s32 time_zone_max_leaps{50};
|
||||
constexpr static s32 time_zone_max_chars{50};
|
||||
if (!(0 <= header.leap_count && header.leap_count < time_zone_max_leaps &&
|
||||
0 < header.type_count && header.type_count < s32(time_zone_rule.ttis.size()) &&
|
||||
0 <= header.time_count && header.time_count < s32(time_zone_rule.ats.size()) &&
|
||||
|
@ -610,7 +610,7 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi
|
|||
if (bytes_read < 0) {
|
||||
return {};
|
||||
}
|
||||
constexpr s32 time_zone_name_max{255};
|
||||
constexpr static s32 time_zone_name_max{255};
|
||||
if (bytes_read > (time_zone_name_max + 1)) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -725,8 +725,8 @@ private:
|
|||
|
||||
// TODO: Figure out what these are
|
||||
|
||||
constexpr s64 unknown_result_1 = 0;
|
||||
constexpr s64 unknown_result_2 = 0;
|
||||
constexpr static s64 unknown_result_1 = 0;
|
||||
constexpr static s64 unknown_result_2 = 0;
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 6};
|
||||
rb.Push(unknown_result_1);
|
||||
|
@ -740,8 +740,8 @@ private:
|
|||
const auto height = rp.Pop<u64>();
|
||||
LOG_DEBUG(Service_VI, "called width={}, height={}", width, height);
|
||||
|
||||
constexpr u64 base_size = 0x20000;
|
||||
constexpr u64 alignment = 0x1000;
|
||||
constexpr static u64 base_size = 0x20000;
|
||||
constexpr static u64 alignment = 0x1000;
|
||||
const auto texture_size = width * height * 4;
|
||||
const auto out_size = (texture_size + base_size - 1) / base_size * base_size;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us
|
|||
double PerfStats::GetLastFrameTimeScale() const {
|
||||
std::scoped_lock lock{object_mutex};
|
||||
|
||||
constexpr double FRAME_LENGTH = 1.0 / 60;
|
||||
constexpr static double FRAME_LENGTH = 1.0 / 60;
|
||||
return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ static u64 GenerateTelemetryId() {
|
|||
mbedtls_entropy_context entropy;
|
||||
mbedtls_entropy_init(&entropy);
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
|
||||
constexpr static std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
|
||||
|
||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||
ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
|
||||
|
@ -225,7 +225,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader,
|
|||
Telemetry::AppendOSInfo(field_collection);
|
||||
|
||||
// Log user configuration information
|
||||
constexpr auto field_type = Telemetry::FieldType::UserConfig;
|
||||
constexpr static auto field_type = Telemetry::FieldType::UserConfig;
|
||||
AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue());
|
||||
AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue());
|
||||
AddField(field_type, "Renderer_Backend",
|
||||
|
|
|
@ -223,8 +223,8 @@ void GCAdapter::AdapterScanThread(std::stop_token stop_token) {
|
|||
}
|
||||
|
||||
bool GCAdapter::Setup() {
|
||||
constexpr u16 nintendo_vid = 0x057e;
|
||||
constexpr u16 gc_adapter_pid = 0x0337;
|
||||
constexpr static u16 nintendo_vid = 0x057e;
|
||||
constexpr static u16 gc_adapter_pid = 0x0337;
|
||||
usb_adapter_handle =
|
||||
std::make_unique<LibUSBDeviceHandle>(libusb_ctx->get(), nintendo_vid, gc_adapter_pid);
|
||||
if (!usb_adapter_handle->get()) {
|
||||
|
@ -346,7 +346,7 @@ void GCAdapter::UpdateVibrations() {
|
|||
// Use 8 states to keep the switching between on/off fast enough for
|
||||
// a human to feel different vibration strenght
|
||||
// More states == more rumble strengths == slower update time
|
||||
constexpr u8 vibration_states = 8;
|
||||
constexpr static u8 vibration_states = 8;
|
||||
|
||||
vibration_counter = (vibration_counter + 1) % vibration_states;
|
||||
|
||||
|
@ -363,7 +363,7 @@ void GCAdapter::SendVibrations() {
|
|||
return;
|
||||
}
|
||||
s32 size{};
|
||||
constexpr u8 rumble_command = 0x11;
|
||||
constexpr static u8 rumble_command = 0x11;
|
||||
const u8 p1 = pads[0].enable_vibration;
|
||||
const u8 p2 = pads[1].enable_vibration;
|
||||
const u8 p3 = pads[2].enable_vibration;
|
||||
|
|
|
@ -77,7 +77,7 @@ void Joycons::Setup() {
|
|||
}
|
||||
|
||||
void Joycons::ScanThread(std::stop_token stop_token) {
|
||||
constexpr u16 nintendo_vendor_id = 0x057e;
|
||||
constexpr static u16 nintendo_vendor_id = 0x057e;
|
||||
Common::SetCurrentThreadName("JoyconScanThread");
|
||||
|
||||
do {
|
||||
|
@ -390,7 +390,7 @@ void Joycons::OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int
|
|||
void Joycons::OnRingConUpdate(f32 ring_data) {
|
||||
// To simplify ring detection it will always be mapped to an empty identifier for all
|
||||
// controllers
|
||||
constexpr PadIdentifier identifier = {
|
||||
constexpr static PadIdentifier identifier = {
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 0,
|
||||
|
|
|
@ -37,7 +37,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_))
|
|||
|
||||
void Mouse::UpdateThread(std::stop_token stop_token) {
|
||||
Common::SetCurrentThreadName("Mouse");
|
||||
constexpr int update_time = 10;
|
||||
constexpr static int update_time = 10;
|
||||
while (!stop_token.stop_requested()) {
|
||||
if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) {
|
||||
// Slow movement by 4%
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
}
|
||||
|
||||
bool UpdateMotion(SDL_ControllerSensorEvent event) {
|
||||
constexpr float gravity_constant = 9.80665f;
|
||||
constexpr static float gravity_constant = 9.80665f;
|
||||
std::scoped_lock lock{mutex};
|
||||
const u64 time_difference = event.timestamp - last_motion_update;
|
||||
last_motion_update = event.timestamp;
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
}
|
||||
|
||||
bool RumblePlay(const Common::Input::VibrationStatus vibration) {
|
||||
constexpr u32 rumble_max_duration_ms = 1000;
|
||||
constexpr static u32 rumble_max_duration_ms = 1000;
|
||||
if (sdl_controller) {
|
||||
return SDL_GameControllerRumble(
|
||||
sdl_controller.get(), static_cast<u16>(vibration.low_amplitude),
|
||||
|
@ -616,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
|
|||
const auto joystick =
|
||||
GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port));
|
||||
|
||||
constexpr Common::Input::VibrationStatus test_vibration{
|
||||
constexpr static Common::Input::VibrationStatus test_vibration{
|
||||
.low_amplitude = 1,
|
||||
.low_frequency = 160.0f,
|
||||
.high_amplitude = 1,
|
||||
|
@ -624,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
|
|||
.type = Common::Input::VibrationAmplificationType::Exponential,
|
||||
};
|
||||
|
||||
constexpr Common::Input::VibrationStatus zero_vibration{
|
||||
constexpr static Common::Input::VibrationStatus zero_vibration{
|
||||
.low_amplitude = 0,
|
||||
.low_frequency = 160.0f,
|
||||
.high_amplitude = 0,
|
||||
|
|
|
@ -599,7 +599,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
|
|||
Status current_status{Status::Initialized};
|
||||
SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {},
|
||||
[&](Response::PadData data) {
|
||||
constexpr u16 CALIBRATION_THRESHOLD = 100;
|
||||
constexpr static u16 CALIBRATION_THRESHOLD = 100;
|
||||
|
||||
if (current_status == Status::Initialized) {
|
||||
// Receiving data means the communication is ready now
|
||||
|
|
|
@ -129,7 +129,7 @@ void JoyconDriver::InputThread(std::stop_token stop_token) {
|
|||
input_thread_running = true;
|
||||
|
||||
// Max update rate is 5ms, ensure we are always able to read a bit faster
|
||||
constexpr int ThreadDelay = 2;
|
||||
constexpr static int ThreadDelay = 2;
|
||||
std::vector<u8> buffer(MaxBufferSize);
|
||||
|
||||
while (!stop_token.stop_requested()) {
|
||||
|
@ -548,7 +548,7 @@ DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info,
|
|||
{0x2007, ControllerType::Right},
|
||||
{0x2009, ControllerType::Pro},
|
||||
};
|
||||
constexpr u16 nintendo_vendor_id = 0x057e;
|
||||
constexpr static u16 nintendo_vendor_id = 0x057e;
|
||||
|
||||
controller_type = ControllerType::None;
|
||||
if (device_info->vendor_id != nintendo_vendor_id) {
|
||||
|
|
|
@ -129,7 +129,7 @@ DriverResult CalibrationProtocol::GetImuCalibration(MotionCalibration& calibrati
|
|||
|
||||
DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration,
|
||||
s16 current_value) {
|
||||
constexpr s16 DefaultRingRange{800};
|
||||
constexpr static s16 DefaultRingRange{800};
|
||||
|
||||
// TODO: Get default calibration form ring itself
|
||||
if (ring_data_max == 0 && ring_data_min == 0) {
|
||||
|
@ -168,8 +168,8 @@ u16 CalibrationProtocol::GetYAxisCalibrationValue(std::span<u8> block) const {
|
|||
}
|
||||
|
||||
void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) {
|
||||
constexpr u16 DefaultStickCenter{0x800};
|
||||
constexpr u16 DefaultStickRange{0x6cc};
|
||||
constexpr static u16 DefaultStickCenter{0x800};
|
||||
constexpr static u16 DefaultStickRange{0x6cc};
|
||||
|
||||
calibration.x.center = ValidateValue(calibration.x.center, DefaultStickCenter);
|
||||
calibration.x.max = ValidateValue(calibration.x.max, DefaultStickRange);
|
||||
|
@ -181,9 +181,9 @@ void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration)
|
|||
}
|
||||
|
||||
void CalibrationProtocol::ValidateCalibration(MotionCalibration& calibration) {
|
||||
constexpr s16 DefaultAccelerometerScale{0x4000};
|
||||
constexpr s16 DefaultGyroScale{0x3be7};
|
||||
constexpr s16 DefaultOffset{0};
|
||||
constexpr static s16 DefaultAccelerometerScale{0x4000};
|
||||
constexpr static s16 DefaultGyroScale{0x3be7};
|
||||
constexpr static s16 DefaultOffset{0};
|
||||
|
||||
for (auto& sensor : calibration.accelerometer) {
|
||||
sensor.scale = ValidateValue(sensor.scale, DefaultAccelerometerScale);
|
||||
|
|
|
@ -72,8 +72,8 @@ DriverResult JoyconCommonProtocol::SendRawData(std::span<const u8> buffer) {
|
|||
|
||||
DriverResult JoyconCommonProtocol::GetSubCommandResponse(SubCommand sc,
|
||||
SubCommandResponse& output) {
|
||||
constexpr int timeout_mili = 66;
|
||||
constexpr int MaxTries = 15;
|
||||
constexpr static int timeout_mili = 66;
|
||||
constexpr static int MaxTries = 15;
|
||||
int tries = 0;
|
||||
|
||||
do {
|
||||
|
@ -157,8 +157,8 @@ DriverResult JoyconCommonProtocol::SendVibrationReport(std::span<const u8> buffe
|
|||
}
|
||||
|
||||
DriverResult JoyconCommonProtocol::ReadRawSPI(SpiAddress addr, std::span<u8> output) {
|
||||
constexpr std::size_t HeaderSize = 5;
|
||||
constexpr std::size_t MaxTries = 10;
|
||||
constexpr static std::size_t HeaderSize = 5;
|
||||
constexpr static std::size_t MaxTries = 10;
|
||||
std::size_t tries = 0;
|
||||
SubCommandResponse response{};
|
||||
std::array<u8, sizeof(ReadSpiPacket)> buffer{};
|
||||
|
@ -216,8 +216,8 @@ DriverResult JoyconCommonProtocol::ConfigureMCU(const MCUConfig& config) {
|
|||
|
||||
DriverResult JoyconCommonProtocol::GetMCUDataResponse(ReportMode report_mode,
|
||||
MCUCommandResponse& output) {
|
||||
constexpr int TimeoutMili = 200;
|
||||
constexpr int MaxTries = 9;
|
||||
constexpr static int TimeoutMili = 200;
|
||||
constexpr static int MaxTries = 9;
|
||||
int tries = 0;
|
||||
|
||||
do {
|
||||
|
@ -265,7 +265,7 @@ DriverResult JoyconCommonProtocol::SendMCUData(ReportMode report_mode, SubComman
|
|||
|
||||
DriverResult JoyconCommonProtocol::WaitSetMCUMode(ReportMode report_mode, MCUMode mode) {
|
||||
MCUCommandResponse output{};
|
||||
constexpr std::size_t MaxTries{8};
|
||||
constexpr static std::size_t MaxTries{8};
|
||||
std::size_t tries{};
|
||||
|
||||
do {
|
||||
|
|
|
@ -131,7 +131,7 @@ DriverResult IrsProtocol::RequestImage(std::span<u8> buffer) {
|
|||
|
||||
DriverResult IrsProtocol::ConfigureIrs() {
|
||||
LOG_DEBUG(Input, "Configure IRS");
|
||||
constexpr std::size_t max_tries = 28;
|
||||
constexpr static std::size_t max_tries = 28;
|
||||
SubCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
@ -166,7 +166,7 @@ DriverResult IrsProtocol::ConfigureIrs() {
|
|||
DriverResult IrsProtocol::WriteRegistersStep1() {
|
||||
LOG_DEBUG(Input, "WriteRegistersStep1");
|
||||
DriverResult result{DriverResult::Success};
|
||||
constexpr std::size_t max_tries = 28;
|
||||
constexpr static std::size_t max_tries = 28;
|
||||
SubCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
@ -226,7 +226,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() {
|
|||
|
||||
DriverResult IrsProtocol::WriteRegistersStep2() {
|
||||
LOG_DEBUG(Input, "WriteRegistersStep2");
|
||||
constexpr std::size_t max_tries = 28;
|
||||
constexpr static std::size_t max_tries = 28;
|
||||
SubCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ bool NfcProtocol::HasAmiibo() {
|
|||
}
|
||||
|
||||
DriverResult NfcProtocol::WaitUntilNfcIsReady() {
|
||||
constexpr std::size_t timeout_limit = 10;
|
||||
constexpr static std::size_t timeout_limit = 10;
|
||||
MCUCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
@ -131,7 +131,7 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() {
|
|||
|
||||
DriverResult NfcProtocol::StartPolling(TagFoundData& data) {
|
||||
LOG_DEBUG(Input, "Start Polling for tag");
|
||||
constexpr std::size_t timeout_limit = 7;
|
||||
constexpr static std::size_t timeout_limit = 7;
|
||||
MCUCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
@ -155,7 +155,7 @@ DriverResult NfcProtocol::StartPolling(TagFoundData& data) {
|
|||
}
|
||||
|
||||
DriverResult NfcProtocol::ReadTag(const TagFoundData& data) {
|
||||
constexpr std::size_t timeout_limit = 10;
|
||||
constexpr static std::size_t timeout_limit = 10;
|
||||
MCUCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
@ -224,7 +224,7 @@ DriverResult NfcProtocol::ReadTag(const TagFoundData& data) {
|
|||
}
|
||||
|
||||
DriverResult NfcProtocol::GetAmiiboData(std::vector<u8>& ntag_data) {
|
||||
constexpr std::size_t timeout_limit = 10;
|
||||
constexpr static std::size_t timeout_limit = 10;
|
||||
MCUCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ DriverResult RingConProtocol::StartRingconPolling() {
|
|||
|
||||
DriverResult RingConProtocol::IsRingConnected(bool& is_connected) {
|
||||
LOG_DEBUG(Input, "IsRingConnected");
|
||||
constexpr std::size_t max_tries = 28;
|
||||
constexpr static std::size_t max_tries = 28;
|
||||
SubCommandResponse output{};
|
||||
std::size_t tries = 0;
|
||||
is_connected = false;
|
||||
|
|
|
@ -39,7 +39,7 @@ void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::strin
|
|||
// which may be overwritten by the result of the addition
|
||||
if (IR::Inst * overflow{inst.GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) {
|
||||
// https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c
|
||||
constexpr u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
|
||||
constexpr static u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
|
||||
const auto sub_a{fmt::format("{}u-{}", s32_max, a)};
|
||||
const auto positive_result{fmt::format("int({})>int({})", b, sub_a)};
|
||||
const auto negative_result{fmt::format("int({})<int({})", b, sub_a)};
|
||||
|
|
|
@ -42,7 +42,7 @@ Id EmitIAdd32(EmitContext& ctx, IR::Inst* inst, Id a, Id b) {
|
|||
SetSignFlag(ctx, inst, result);
|
||||
if (IR::Inst * overflow{inst->GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) {
|
||||
// https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c
|
||||
constexpr u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
|
||||
constexpr static u32 s32_max{static_cast<u32>(std::numeric_limits<s32>::max())};
|
||||
const Id is_positive{ctx.OpSGreaterThanEqual(ctx.U1, a, ctx.u32_zero_value)};
|
||||
const Id sub_a{ctx.OpISub(ctx.U32[1], ctx.Const(s32_max), a)};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void F2F(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a, bool abs) {
|
|||
BitField<8, 2, FloatFormat> dst_size;
|
||||
|
||||
[[nodiscard]] RoundingOp RoundingOperation() const {
|
||||
constexpr u64 rounding_mask = 0x0B;
|
||||
constexpr static u64 rounding_mask = 0x0B;
|
||||
return static_cast<RoundingOp>(rounding_op.Value() & rounding_mask);
|
||||
}
|
||||
} const f2f{insn};
|
||||
|
|
|
@ -176,11 +176,11 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) {
|
|||
(f2i.src_format == SrcFormat::F64) != (f2i.dest_format == DestFormat::I64);
|
||||
if (special_nan_cases) {
|
||||
if (f2i.dest_format == DestFormat::I32) {
|
||||
constexpr u32 nan_value = 0x8000'0000U;
|
||||
constexpr static u32 nan_value = 0x8000'0000U;
|
||||
handled_special_case = true;
|
||||
result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(nan_value), result)};
|
||||
} else if (f2i.dest_format == DestFormat::I64) {
|
||||
constexpr u64 nan_value = 0x8000'0000'0000'0000ULL;
|
||||
constexpr static u64 nan_value = 0x8000'0000'0000'0000ULL;
|
||||
handled_special_case = true;
|
||||
result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(nan_value), result)};
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ enum class Half : u64 {
|
|||
};
|
||||
|
||||
[[nodiscard]] IR::U32 IntegerHalf(IR::IREmitter& ir, const IR::U32& value, Half half) {
|
||||
constexpr bool is_signed{false};
|
||||
constexpr static bool is_signed{false};
|
||||
switch (half) {
|
||||
case Half::All:
|
||||
return value;
|
||||
|
|
|
@ -76,7 +76,7 @@ void TestControl1::ExecuteThread(u32 id) {
|
|||
* doing all the work required.
|
||||
*/
|
||||
TEST_CASE("Fibers::Setup", "[common]") {
|
||||
constexpr std::size_t num_threads = 7;
|
||||
constexpr static std::size_t num_threads = 7;
|
||||
TestControl1 test_control{};
|
||||
test_control.thread_fibers.resize(num_threads);
|
||||
test_control.work_fibers.resize(num_threads);
|
||||
|
|
|
@ -35,8 +35,8 @@ public:
|
|||
}
|
||||
|
||||
void Run(const std::vector<InputCommon::CemuhookUDP::Response::TouchPad> touch_movement_path) {
|
||||
constexpr size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header);
|
||||
constexpr size_t PadDataSize =
|
||||
constexpr static size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header);
|
||||
constexpr static size_t PadDataSize =
|
||||
sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>);
|
||||
|
||||
REQUIRE(touch_movement_path.size() > 0);
|
||||
|
|
|
@ -890,8 +890,8 @@ void BufferCache<P>::CommitAsyncFlushesHigh() {
|
|||
buffer_id,
|
||||
});
|
||||
// Align up to avoid cache conflicts
|
||||
constexpr u64 align = 8ULL;
|
||||
constexpr u64 mask = ~(align - 1ULL);
|
||||
constexpr static u64 align = 8ULL;
|
||||
constexpr static u64 mask = ~(align - 1ULL);
|
||||
total_size_bytes += (new_size + align - 1) & mask;
|
||||
largest_copy = std::max(largest_copy, new_size);
|
||||
};
|
||||
|
@ -1843,8 +1843,8 @@ void BufferCache<P>::DownloadBufferMemory(Buffer& buffer, VAddr cpu_addr, u64 si
|
|||
.size = new_size,
|
||||
});
|
||||
// Align up to avoid cache conflicts
|
||||
constexpr u64 align = 256ULL;
|
||||
constexpr u64 mask = ~(align - 1ULL);
|
||||
constexpr static u64 align = 256ULL;
|
||||
constexpr static u64 mask = ~(align - 1ULL);
|
||||
total_size_bytes += (new_size + align - 1) & mask;
|
||||
largest_copy = std::max(largest_copy, new_size);
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ bool DmaPusher::Step() {
|
|||
|
||||
// Push buffer non-empty, read a word
|
||||
command_headers.resize_destructive(command_list_header.size);
|
||||
constexpr u32 MacroRegistersStart = 0xE00;
|
||||
constexpr static u32 MacroRegistersStart = 0xE00;
|
||||
if (dma_state.method < MacroRegistersStart) {
|
||||
if (Settings::IsGPULevelHigh()) {
|
||||
memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(),
|
||||
|
|
|
@ -72,7 +72,7 @@ void Fermi2D::Blit() {
|
|||
UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled");
|
||||
|
||||
const auto& args = regs.pixels_from_memory;
|
||||
constexpr s64 null_derivate = 1ULL << 32;
|
||||
constexpr static s64 null_derivate = 1ULL << 32;
|
||||
Surface src = regs.src;
|
||||
const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format));
|
||||
const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 &&
|
||||
|
|
|
@ -258,7 +258,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() {
|
|||
size_t Maxwell3D::EstimateIndexBufferSize() {
|
||||
GPUVAddr start_address = regs.index_buffer.StartAddress();
|
||||
GPUVAddr end_address = regs.index_buffer.EndAddress();
|
||||
constexpr std::array<size_t, 4> max_sizes = {
|
||||
constexpr static std::array<size_t, 4> max_sizes = {
|
||||
std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(),
|
||||
std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()};
|
||||
const size_t byte_size = regs.index_buffer.FormatSizeInBytes();
|
||||
|
|
|
@ -694,16 +694,16 @@ private:
|
|||
};
|
||||
const auto force_to_fp16 = [](f32 base_value) {
|
||||
u32 tmp = Common::BitCast<u32>(base_value);
|
||||
constexpr size_t fp32_mantissa_bits = 23;
|
||||
constexpr size_t fp16_mantissa_bits = 10;
|
||||
constexpr size_t mantissa_mask =
|
||||
constexpr static size_t fp32_mantissa_bits = 23;
|
||||
constexpr static size_t fp16_mantissa_bits = 10;
|
||||
constexpr static size_t mantissa_mask =
|
||||
~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL);
|
||||
tmp = tmp & static_cast<u32>(mantissa_mask);
|
||||
// TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM
|
||||
return Common::BitCast<f32>(tmp);
|
||||
};
|
||||
const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) {
|
||||
constexpr size_t fp32_mantissa_bits = 23;
|
||||
constexpr static size_t fp32_mantissa_bits = 23;
|
||||
size_t shift_towards = fp32_mantissa_bits - mantissa;
|
||||
const u32 new_value =
|
||||
static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31));
|
||||
|
@ -770,7 +770,7 @@ private:
|
|||
component_mask[which_component];
|
||||
};
|
||||
const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) {
|
||||
constexpr size_t fp32_mantissa_bits = 23;
|
||||
constexpr static size_t fp32_mantissa_bits = 23;
|
||||
u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f));
|
||||
size_t shift_towards = fp32_mantissa_bits - mantissa;
|
||||
return tmp_value >> shift_towards;
|
||||
|
|
|
@ -194,8 +194,8 @@ struct GPU::Impl {
|
|||
[[nodiscard]] u64 GetTicks() const {
|
||||
// This values were reversed engineered by fincs from NVN
|
||||
// The gpu clock is reported in units of 385/625 nanoseconds
|
||||
constexpr u64 gpu_ticks_num = 384;
|
||||
constexpr u64 gpu_ticks_den = 625;
|
||||
constexpr static u64 gpu_ticks_num = 384;
|
||||
constexpr static u64 gpu_ticks_den = 625;
|
||||
|
||||
u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count();
|
||||
if (Settings::values.use_fast_gpu_time.GetValue()) {
|
||||
|
|
|
@ -283,7 +283,7 @@ void VP9::EncodeTermSubExp(VpxRangeEncoder& writer, s32 value) {
|
|||
} else {
|
||||
value -= 64;
|
||||
|
||||
constexpr s32 size = 8;
|
||||
constexpr static s32 size = 8;
|
||||
|
||||
const s32 mask = (1 << size) - 191;
|
||||
|
||||
|
@ -307,7 +307,7 @@ bool VP9::WriteLessThan(VpxRangeEncoder& writer, s32 value, s32 test) {
|
|||
void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode,
|
||||
const std::array<u8, 1728>& new_prob,
|
||||
const std::array<u8, 1728>& old_prob) {
|
||||
constexpr u32 block_bytes = 2 * 2 * 6 * 6 * 3;
|
||||
constexpr static u32 block_bytes = 2 * 2 * 6 * 6 * 3;
|
||||
|
||||
const auto needs_update = [&](u32 base_index) {
|
||||
return !std::equal(new_prob.begin() + base_index,
|
||||
|
|
|
@ -281,7 +281,7 @@ public:
|
|||
explicit HostCounterBase(std::shared_ptr<HostCounter> dependency_)
|
||||
: dependency{std::move(dependency_)}, depth{dependency ? (dependency->Depth() + 1) : 0} {
|
||||
// Avoid nesting too many dependencies to avoid a stack overflow when these are deleted.
|
||||
constexpr u64 depth_threshold = 96;
|
||||
constexpr static u64 depth_threshold = 96;
|
||||
if (depth > depth_threshold) {
|
||||
depth = 0;
|
||||
base_result = dependency->Query();
|
||||
|
|
|
@ -162,7 +162,8 @@ void ComputePipeline::Configure() {
|
|||
buffer_cache.UnbindComputeTextureBuffers();
|
||||
size_t texbuf_index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -126,9 +126,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
|
|||
const bool is_intel = vendor_name == "Intel";
|
||||
|
||||
#ifdef __unix__
|
||||
constexpr bool is_linux = true;
|
||||
constexpr static bool is_linux = true;
|
||||
#else
|
||||
constexpr bool is_linux = false;
|
||||
constexpr static bool is_linux = false;
|
||||
#endif
|
||||
|
||||
bool disable_fast_buffer_sub_data = false;
|
||||
|
|
|
@ -385,7 +385,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
|||
const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE {
|
||||
size_t index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -237,7 +237,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf
|
|||
screen_info.display_texture = screen_info.texture.resource.handle;
|
||||
|
||||
// TODO(Rodrigo): Read this from HLE
|
||||
constexpr u32 block_height_log2 = 4;
|
||||
constexpr static u32 block_height_log2 = 4;
|
||||
const auto pixel_format{
|
||||
VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)};
|
||||
const u32 bytes_per_pixel{VideoCore::Surface::BytesPerBlock(pixel_format)};
|
||||
|
@ -375,7 +375,7 @@ void RendererOpenGL::AddTelemetryFields() {
|
|||
LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor);
|
||||
LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model);
|
||||
|
||||
constexpr auto user_system = Common::Telemetry::FieldType::UserSystem;
|
||||
constexpr static auto user_system = Common::Telemetry::FieldType::UserSystem;
|
||||
telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor));
|
||||
telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model));
|
||||
telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version));
|
||||
|
|
|
@ -358,8 +358,9 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) {
|
|||
|
||||
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
|
||||
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
|
||||
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
|
||||
constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
|
||||
VK_ACCESS_SHADER_READ_BIT};
|
||||
const VkImageMemoryBarrier barrier{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
.pNext = nullptr,
|
||||
|
|
|
@ -175,7 +175,7 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer,
|
|||
const u8* const host_ptr = cpu_memory.GetPointer(framebuffer_addr);
|
||||
|
||||
// TODO(Rodrigo): Read this from HLE
|
||||
constexpr u32 block_height_log2 = 4;
|
||||
constexpr static u32 block_height_log2 = 4;
|
||||
const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer);
|
||||
const u64 linear_size{GetSizeInBytes(framebuffer)};
|
||||
const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel,
|
||||
|
@ -1482,7 +1482,7 @@ u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer)
|
|||
|
||||
u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer,
|
||||
std::size_t image_index) const {
|
||||
constexpr auto first_image_offset = static_cast<u64>(sizeof(BufferData));
|
||||
constexpr static auto first_image_offset = static_cast<u64>(sizeof(BufferData));
|
||||
return first_image_offset + GetSizeInBytes(framebuffer) * image_index;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,8 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute,
|
|||
buffer_cache.UnbindComputeTextureBuffers();
|
||||
size_t index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -398,7 +398,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
|||
const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE {
|
||||
size_t index{};
|
||||
const auto add_buffer{[&](const auto& desc) {
|
||||
constexpr bool is_image = std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
constexpr static bool is_image =
|
||||
std::is_same_v<decltype(desc), const ImageBufferDescriptor&>;
|
||||
for (u32 i = 0; i < desc.count; ++i) {
|
||||
bool is_written{false};
|
||||
if constexpr (is_image) {
|
||||
|
|
|
@ -1109,9 +1109,9 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re
|
|||
if (!state_tracker.TouchDepthBiasEnable()) {
|
||||
return;
|
||||
}
|
||||
constexpr size_t POINT = 0;
|
||||
constexpr size_t LINE = 1;
|
||||
constexpr size_t POLYGON = 2;
|
||||
constexpr static size_t POINT = 0;
|
||||
constexpr static size_t LINE = 1;
|
||||
constexpr static size_t POLYGON = 2;
|
||||
static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = {
|
||||
POINT, // Points
|
||||
LINE, // Lines
|
||||
|
|
|
@ -55,8 +55,9 @@ std::pair<vk::Image, MemoryCommit> CreateWrappedImage(const Device& device,
|
|||
|
||||
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
|
||||
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
|
||||
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
|
||||
constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
|
||||
VK_ACCESS_SHADER_READ_BIT};
|
||||
const VkImageMemoryBarrier barrier{
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
.pNext = nullptr,
|
||||
|
@ -152,7 +153,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) {
|
|||
.finalLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||
};
|
||||
|
||||
constexpr VkAttachmentReference color_attachment_ref{
|
||||
constexpr static VkAttachmentReference color_attachment_ref{
|
||||
.attachment = 0,
|
||||
.layout = VK_IMAGE_LAYOUT_GENERAL,
|
||||
};
|
||||
|
@ -170,7 +171,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) {
|
|||
.pPreserveAttachments = nullptr,
|
||||
};
|
||||
|
||||
constexpr VkSubpassDependency dependency{
|
||||
constexpr static VkSubpassDependency dependency{
|
||||
.srcSubpass = VK_SUBPASS_EXTERNAL,
|
||||
.dstSubpass = 0,
|
||||
.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
|
@ -328,7 +329,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
},
|
||||
}};
|
||||
|
||||
constexpr VkPipelineVertexInputStateCreateInfo vertex_input_ci{
|
||||
constexpr static VkPipelineVertexInputStateCreateInfo vertex_input_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -338,7 +339,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.pVertexAttributeDescriptions = nullptr,
|
||||
};
|
||||
|
||||
constexpr VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
|
||||
constexpr static VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -346,7 +347,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.primitiveRestartEnable = VK_FALSE,
|
||||
};
|
||||
|
||||
constexpr VkPipelineViewportStateCreateInfo viewport_state_ci{
|
||||
constexpr static VkPipelineViewportStateCreateInfo viewport_state_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -356,7 +357,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.pScissors = nullptr,
|
||||
};
|
||||
|
||||
constexpr VkPipelineRasterizationStateCreateInfo rasterization_ci{
|
||||
constexpr static VkPipelineRasterizationStateCreateInfo rasterization_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -372,7 +373,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.lineWidth = 1.0f,
|
||||
};
|
||||
|
||||
constexpr VkPipelineMultisampleStateCreateInfo multisampling_ci{
|
||||
constexpr static VkPipelineMultisampleStateCreateInfo multisampling_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
|
@ -384,7 +385,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.alphaToOneEnable = VK_FALSE,
|
||||
};
|
||||
|
||||
constexpr VkPipelineColorBlendAttachmentState color_blend_attachment{
|
||||
constexpr static VkPipelineColorBlendAttachmentState color_blend_attachment{
|
||||
.blendEnable = VK_FALSE,
|
||||
.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO,
|
||||
.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO,
|
||||
|
@ -407,7 +408,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp
|
|||
.blendConstants = {0.0f, 0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
|
||||
constexpr std::array dynamic_states{
|
||||
constexpr static std::array dynamic_states{
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
};
|
||||
|
@ -468,7 +469,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo>
|
|||
}
|
||||
|
||||
void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) {
|
||||
constexpr std::array<VkImageSubresourceRange, 1> subresources{{{
|
||||
constexpr static std::array<VkImageSubresourceRange, 1> subresources{{{
|
||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
|
@ -528,8 +529,8 @@ SMAA::SMAA(const Device& device, MemoryAllocator& allocator, size_t image_count,
|
|||
}
|
||||
|
||||
void SMAA::CreateImages() {
|
||||
constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
|
||||
std::tie(m_static_images[Area], m_static_buffer_commits[Area]) =
|
||||
CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM);
|
||||
|
@ -586,12 +587,12 @@ void SMAA::CreateSampler() {
|
|||
|
||||
void SMAA::CreateShaders() {
|
||||
// These match the order of the SMAAStage enum
|
||||
constexpr std::array vert_shader_sources{
|
||||
constexpr static std::array vert_shader_sources{
|
||||
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV),
|
||||
};
|
||||
constexpr std::array frag_shader_sources{
|
||||
constexpr static std::array frag_shader_sources{
|
||||
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV),
|
||||
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV),
|
||||
|
@ -675,8 +676,8 @@ void SMAA::UploadImages(Scheduler& scheduler) {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
|
||||
constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
|
||||
|
||||
UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent,
|
||||
VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes));
|
||||
|
|
|
@ -299,7 +299,7 @@ void StagingBufferPool::ReleaseCache(MemoryUsage usage) {
|
|||
}
|
||||
|
||||
void StagingBufferPool::ReleaseLevel(StagingBuffersCache& cache, size_t log2) {
|
||||
constexpr size_t deletions_per_tick = 16;
|
||||
constexpr static size_t deletions_per_tick = 16;
|
||||
auto& staging = cache[log2];
|
||||
auto& entries = staging.entries;
|
||||
const size_t old_size = entries.size();
|
||||
|
|
|
@ -53,7 +53,7 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) {
|
|||
}
|
||||
|
||||
VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) {
|
||||
constexpr auto undefined_size{std::numeric_limits<u32>::max()};
|
||||
constexpr static auto undefined_size{std::numeric_limits<u32>::max()};
|
||||
if (capabilities.currentExtent.width != undefined_size) {
|
||||
return capabilities.currentExtent;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void TurboMode::Run(std::stop_token stop_token) {
|
|||
auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal);
|
||||
|
||||
// Create the descriptor pool to contain our descriptor.
|
||||
constexpr VkDescriptorPoolSize pool_size{
|
||||
constexpr static VkDescriptorPoolSize pool_size{
|
||||
.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.descriptorCount = 1,
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ void TurboMode::Run(std::stop_token stop_token) {
|
|||
});
|
||||
|
||||
// Create the descriptor set layout from the pool.
|
||||
constexpr VkDescriptorSetLayoutBinding layout_binding{
|
||||
constexpr static VkDescriptorSetLayoutBinding layout_binding{
|
||||
.binding = 0,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
.descriptorCount = 1,
|
||||
|
|
|
@ -371,7 +371,7 @@ std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) {
|
|||
}
|
||||
|
||||
u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) {
|
||||
constexpr u64 RGBA8_PIXEL_SIZE = 4;
|
||||
constexpr static u64 RGBA8_PIXEL_SIZE = 4;
|
||||
const u64 base_block_size = static_cast<u64>(DefaultBlockWidth(format)) *
|
||||
static_cast<u64>(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE;
|
||||
return (base_size * base_block_size) / BytesPerBlock(format);
|
||||
|
|
|
@ -29,7 +29,7 @@ constexpr u32 pdep(u32 value) {
|
|||
|
||||
template <u32 mask, u32 incr_amount>
|
||||
void incrpdep(u32& value) {
|
||||
constexpr u32 swizzled_incr = pdep<mask>(incr_amount);
|
||||
constexpr static u32 swizzled_incr = pdep<mask>(incr_amount);
|
||||
value = ((value | ~mask) + swizzled_incr) & mask;
|
||||
}
|
||||
|
||||
|
|
|
@ -495,9 +495,9 @@ VkResult Free(VkDevice device, VkCommandPool handle, Span<VkCommandBuffer> buffe
|
|||
Instance Instance::Create(u32 version, Span<const char*> layers, Span<const char*> extensions,
|
||||
InstanceDispatch& dispatch) {
|
||||
#ifdef __APPLE__
|
||||
constexpr VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
|
||||
constexpr static VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR};
|
||||
#else
|
||||
constexpr VkFlags ci_flags{};
|
||||
constexpr static VkFlags ci_flags{};
|
||||
#endif
|
||||
|
||||
const VkApplicationInfo application_info{
|
||||
|
|
|
@ -720,7 +720,7 @@ void GRenderWindow::TouchEndEvent() {
|
|||
|
||||
void GRenderWindow::InitializeCamera() {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA
|
||||
constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz)
|
||||
constexpr static auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz)
|
||||
if (!Settings::values.enable_ir_sensor) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -317,9 +317,9 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center)
|
|||
|
||||
// D-pad constants
|
||||
const QPointF dpad_center = center + QPoint(9, 14);
|
||||
constexpr int dpad_distance = 23;
|
||||
constexpr int dpad_radius = 11;
|
||||
constexpr float dpad_arrow_size = 1.2f;
|
||||
constexpr static int dpad_distance = 23;
|
||||
constexpr static int dpad_radius = 11;
|
||||
constexpr static float dpad_arrow_size = 1.2f;
|
||||
|
||||
// D-pad buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -439,9 +439,9 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center
|
|||
|
||||
// Face buttons constants
|
||||
const QPointF face_center = center + QPoint(-9, -73);
|
||||
constexpr int face_distance = 23;
|
||||
constexpr int face_radius = 11;
|
||||
constexpr float text_size = 1.1f;
|
||||
constexpr static int face_distance = 23;
|
||||
constexpr static int face_radius = 11;
|
||||
constexpr static float text_size = 1.1f;
|
||||
|
||||
// Face buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -559,9 +559,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center)
|
|||
|
||||
// Face buttons constants
|
||||
const QPointF face_center = center + QPoint(65, -65);
|
||||
constexpr int face_distance = 20;
|
||||
constexpr int face_radius = 10;
|
||||
constexpr float text_size = 1.0f;
|
||||
constexpr static int face_distance = 20;
|
||||
constexpr static int face_radius = 10;
|
||||
constexpr static float text_size = 1.0f;
|
||||
|
||||
// Face buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -581,9 +581,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center)
|
|||
|
||||
// D-pad constants
|
||||
const QPointF dpad_center = center + QPoint(-65, 12);
|
||||
constexpr int dpad_distance = 20;
|
||||
constexpr int dpad_radius = 10;
|
||||
constexpr float dpad_arrow_size = 1.1f;
|
||||
constexpr static int dpad_distance = 20;
|
||||
constexpr static int dpad_radius = 10;
|
||||
constexpr static float dpad_arrow_size = 1.1f;
|
||||
|
||||
// D-pad buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -651,9 +651,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen
|
|||
|
||||
// Face buttons constants
|
||||
const QPointF face_center = center + QPoint(171, -41);
|
||||
constexpr float face_distance = 12.8f;
|
||||
constexpr float face_radius = 6.4f;
|
||||
constexpr float text_size = 0.6f;
|
||||
constexpr static float face_distance = 12.8f;
|
||||
constexpr static float face_radius = 6.4f;
|
||||
constexpr static float text_size = 0.6f;
|
||||
|
||||
// Face buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -673,9 +673,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen
|
|||
|
||||
// D-pad constants
|
||||
const QPointF dpad_center = center + QPoint(-171, 8);
|
||||
constexpr float dpad_distance = 12.8f;
|
||||
constexpr float dpad_radius = 6.4f;
|
||||
constexpr float dpad_arrow_size = 0.68f;
|
||||
constexpr static float dpad_distance = 12.8f;
|
||||
constexpr static float dpad_radius = 6.4f;
|
||||
constexpr static float dpad_arrow_size = 0.68f;
|
||||
|
||||
// D-pad buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -754,9 +754,9 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center)
|
|||
|
||||
// Face buttons constants
|
||||
const QPointF face_center = center + QPoint(105, -56);
|
||||
constexpr int face_distance = 31;
|
||||
constexpr int face_radius = 15;
|
||||
constexpr float text_size = 1.5f;
|
||||
constexpr static int face_distance = 31;
|
||||
constexpr static int face_radius = 15;
|
||||
constexpr static float text_size = 1.5f;
|
||||
|
||||
// Face buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -846,7 +846,7 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) {
|
|||
using namespace Settings::NativeButton;
|
||||
|
||||
// Face buttons constants
|
||||
constexpr float text_size = 1.1f;
|
||||
constexpr static float text_size = 1.1f;
|
||||
|
||||
// Face buttons
|
||||
p.setPen(colors.outline);
|
||||
|
@ -1497,7 +1497,7 @@ void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) {
|
|||
std::array<QPointF, pro_left_handle.size() / 2> qleft_handle;
|
||||
std::array<QPointF, pro_left_handle.size() / 2> qright_handle;
|
||||
std::array<QPointF, pro_body.size()> qbody;
|
||||
constexpr int radius1 = 32;
|
||||
constexpr static int radius1 = 32;
|
||||
|
||||
for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) {
|
||||
const float left_x = pro_left_handle[point * 2 + 0];
|
||||
|
@ -1539,7 +1539,7 @@ void PlayerControlPreview::DrawGCBody(QPainter& p, const QPointF center) {
|
|||
std::array<QPointF, gc_body.size()> qbody;
|
||||
std::array<QPointF, 8> left_hex;
|
||||
std::array<QPointF, 8> right_hex;
|
||||
constexpr float angle = 2 * 3.1415f / 8;
|
||||
constexpr static float angle = 2 * 3.1415f / 8;
|
||||
|
||||
for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) {
|
||||
const float body_x = gc_left_body[point * 2 + 0];
|
||||
|
@ -1676,9 +1676,9 @@ void PlayerControlPreview::DrawDualBody(QPainter& p, const QPointF center) {
|
|||
std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview;
|
||||
std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview;
|
||||
std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview;
|
||||
constexpr float size = 1.61f;
|
||||
constexpr float size2 = 0.9f;
|
||||
constexpr float offset = 209.3f;
|
||||
constexpr static float size = 1.61f;
|
||||
constexpr static float size2 = 0.9f;
|
||||
constexpr static float offset = 209.3f;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
|
||||
const float body_x = left_joycon_body[point * 2 + 0];
|
||||
|
@ -1767,10 +1767,10 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) {
|
|||
std::array<QPointF, left_joycon_slider.size() / 2> qleft_joycon_slider;
|
||||
std::array<QPointF, left_joycon_slider_topview.size() / 2> qleft_joycon_slider_topview;
|
||||
std::array<QPointF, left_joycon_topview.size() / 2> qleft_joycon_topview;
|
||||
constexpr float size = 1.78f;
|
||||
constexpr float size2 = 1.1115f;
|
||||
constexpr float offset = 312.39f;
|
||||
constexpr float offset2 = 335;
|
||||
constexpr static float size = 1.78f;
|
||||
constexpr static float size2 = 1.1115f;
|
||||
constexpr static float offset = 312.39f;
|
||||
constexpr static float offset2 = 335;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
|
||||
left_joycon[point] = center + QPointF(left_joycon_body[point * 2] * size + offset,
|
||||
|
@ -1867,10 +1867,10 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) {
|
|||
std::array<QPointF, left_joycon_slider.size() / 2> qright_joycon_slider;
|
||||
std::array<QPointF, left_joycon_slider_topview.size() / 2> qright_joycon_slider_topview;
|
||||
std::array<QPointF, left_joycon_topview.size() / 2> qright_joycon_topview;
|
||||
constexpr float size = 1.78f;
|
||||
constexpr float size2 = 1.1115f;
|
||||
constexpr float offset = 312.39f;
|
||||
constexpr float offset2 = 335;
|
||||
constexpr static float size = 1.78f;
|
||||
constexpr static float size2 = 1.1115f;
|
||||
constexpr static float offset = 312.39f;
|
||||
constexpr static float offset2 = 335;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) {
|
||||
right_joycon[point] = center + QPointF(-left_joycon_body[point * 2] * size - offset,
|
||||
|
@ -2068,8 +2068,8 @@ void PlayerControlPreview::DrawDualTriggers(QPainter& p, const QPointF center,
|
|||
const Common::Input::ButtonStatus& right_pressed) {
|
||||
std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger;
|
||||
std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger;
|
||||
constexpr float size = 1.62f;
|
||||
constexpr float offset = 210.6f;
|
||||
constexpr static float size = 1.62f;
|
||||
constexpr static float offset = 210.6f;
|
||||
for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
|
||||
const float left_trigger_x = left_joycon_trigger[point * 2 + 0];
|
||||
const float left_trigger_y = left_joycon_trigger[point * 2 + 1];
|
||||
|
@ -2097,7 +2097,7 @@ void PlayerControlPreview::DrawDualTriggersTopView(
|
|||
const Common::Input::ButtonStatus& right_pressed) {
|
||||
std::array<QPointF, left_joystick_L_topview.size() / 2> qleft_trigger;
|
||||
std::array<QPointF, left_joystick_L_topview.size() / 2> qright_trigger;
|
||||
constexpr float size = 0.9f;
|
||||
constexpr static float size = 0.9f;
|
||||
|
||||
for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) {
|
||||
const float top_view_x = left_joystick_L_topview[point * 2 + 0];
|
||||
|
@ -2134,7 +2134,7 @@ void PlayerControlPreview::DrawDualZTriggersTopView(
|
|||
const Common::Input::ButtonStatus& right_pressed) {
|
||||
std::array<QPointF, left_joystick_ZL_topview.size() / 2> qleft_trigger;
|
||||
std::array<QPointF, left_joystick_ZL_topview.size() / 2> qright_trigger;
|
||||
constexpr float size = 0.9f;
|
||||
constexpr static float size = 0.9f;
|
||||
|
||||
for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) {
|
||||
qleft_trigger[point] =
|
||||
|
@ -2167,8 +2167,8 @@ void PlayerControlPreview::DrawDualZTriggersTopView(
|
|||
void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center,
|
||||
const Common::Input::ButtonStatus& left_pressed) {
|
||||
std::array<QPointF, left_joycon_trigger.size() / 2> qleft_trigger;
|
||||
constexpr float size = 1.78f;
|
||||
constexpr float offset = 311.5f;
|
||||
constexpr static float size = 1.78f;
|
||||
constexpr static float offset = 311.5f;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
|
||||
qleft_trigger[point] = center + QPointF(left_joycon_trigger[point * 2] * size + offset,
|
||||
|
@ -2184,8 +2184,8 @@ void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center,
|
|||
void PlayerControlPreview::DrawLeftZTriggers(QPainter& p, const QPointF center,
|
||||
const Common::Input::ButtonStatus& left_pressed) {
|
||||
std::array<QPointF, left_joycon_sideview_zl.size() / 2> qleft_trigger;
|
||||
constexpr float size = 1.1115f;
|
||||
constexpr float offset2 = 335;
|
||||
constexpr static float size = 1.1115f;
|
||||
constexpr static float offset2 = 335;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) {
|
||||
qleft_trigger[point] = center + QPointF(left_joycon_sideview_zl[point * 2] * size + offset2,
|
||||
|
@ -2241,8 +2241,8 @@ void PlayerControlPreview::DrawLeftZTriggersTopView(
|
|||
void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center,
|
||||
const Common::Input::ButtonStatus& right_pressed) {
|
||||
std::array<QPointF, left_joycon_trigger.size() / 2> qright_trigger;
|
||||
constexpr float size = 1.78f;
|
||||
constexpr float offset = 311.5f;
|
||||
constexpr static float size = 1.78f;
|
||||
constexpr static float offset = 311.5f;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) {
|
||||
qright_trigger[point] = center + QPointF(-left_joycon_trigger[point * 2] * size - offset,
|
||||
|
@ -2258,8 +2258,8 @@ void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center,
|
|||
void PlayerControlPreview::DrawRightZTriggers(QPainter& p, const QPointF center,
|
||||
const Common::Input::ButtonStatus& right_pressed) {
|
||||
std::array<QPointF, left_joycon_sideview_zl.size() / 2> qright_trigger;
|
||||
constexpr float size = 1.1115f;
|
||||
constexpr float offset2 = 335;
|
||||
constexpr static float size = 1.1115f;
|
||||
constexpr static float offset2 = 335;
|
||||
|
||||
for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) {
|
||||
qright_trigger[point] =
|
||||
|
@ -2433,7 +2433,7 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPo
|
|||
|
||||
void PlayerControlPreview::DrawJoystickProperties(
|
||||
QPainter& p, const QPointF center, const Common::Input::AnalogProperties& properties) {
|
||||
constexpr float size = 45.0f;
|
||||
constexpr static float size = 45.0f;
|
||||
const float range = size * properties.range;
|
||||
const float deadzone = size * properties.deadzone;
|
||||
|
||||
|
@ -2453,7 +2453,7 @@ void PlayerControlPreview::DrawJoystickProperties(
|
|||
|
||||
void PlayerControlPreview::DrawJoystickDot(QPainter& p, const QPointF center,
|
||||
const Common::Input::StickStatus& stick, bool raw) {
|
||||
constexpr float size = 45.0f;
|
||||
constexpr static float size = 45.0f;
|
||||
const float range = size * stick.x.properties.range;
|
||||
|
||||
if (raw) {
|
||||
|
|
|
@ -476,8 +476,8 @@ void GameList::DonePopulating(const QStringList& watch_list) {
|
|||
// Workaround: Add the watch paths in chunks to allow the gui to refresh
|
||||
// This prevents the UI from stalling when a large number of watch paths are added
|
||||
// Also artificially caps the watcher to a certain number of directories
|
||||
constexpr int LIMIT_WATCH_DIRECTORIES = 5000;
|
||||
constexpr int SLICE_SIZE = 25;
|
||||
constexpr static int LIMIT_WATCH_DIRECTORIES = 5000;
|
||||
constexpr static int SLICE_SIZE = 25;
|
||||
int len = std::min(static_cast<int>(watch_list.size()), LIMIT_WATCH_DIRECTORIES);
|
||||
for (int i = 0; i < len; i += SLICE_SIZE) {
|
||||
watcher->addPaths(watch_list.mid(i, i + SLICE_SIZE));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue