Fix non-constexpr format strings

This commit is contained in:
Pokechu22 2022-01-12 22:26:04 -08:00
parent 18cf8ac767
commit 29d6dd609c
5 changed files with 12 additions and 14 deletions

View File

@ -212,13 +212,12 @@ bool WiimoteDevice::IsConnected() const
void WiimoteDevice::Activate(bool connect) void WiimoteDevice::Activate(bool connect)
{ {
const char* message = nullptr;
if (connect && m_baseband_state == BasebandState::Inactive) if (connect && m_baseband_state == BasebandState::Inactive)
{ {
SetBasebandState(BasebandState::RequestConnection); SetBasebandState(BasebandState::RequestConnection);
message = "Wii Remote {} connected"; Core::DisplayMessage(fmt::format("Wii Remote {} connected", GetNumber() + 1),
CONNECTION_MESSAGE_TIME);
} }
else if (!connect && IsConnected()) else if (!connect && IsConnected())
{ {
@ -228,11 +227,9 @@ void WiimoteDevice::Activate(bool connect)
// Not doing that doesn't seem to break anything. // Not doing that doesn't seem to break anything.
m_host->RemoteDisconnect(GetBD()); m_host->RemoteDisconnect(GetBD());
message = "Wii Remote {} disconnected"; Core::DisplayMessage(fmt::format("Wii Remote {} disconnected", GetNumber() + 1),
CONNECTION_MESSAGE_TIME);
} }
if (message)
Core::DisplayMessage(fmt::format(message, GetNumber() + 1), CONNECTION_MESSAGE_TIME);
} }
bool WiimoteDevice::EventConnectionRequest() bool WiimoteDevice::EventConnectionRequest()

View File

@ -45,7 +45,7 @@ std::string NameForPartitionType(u32 partition_type, bool include_prefix)
return include_prefix ? "P-" + type_as_game_id : type_as_game_id; return include_prefix ? "P-" + type_as_game_id : type_as_game_id;
} }
return fmt::format(include_prefix ? "P{}" : "{}", partition_type); return fmt::format("{}{}", include_prefix ? "P" : "", partition_type);
} }
} }

View File

@ -565,9 +565,9 @@ struct fmt::formatter<TevStageCombiner::ColorCombiner>
if (has_bias) if (has_bias)
{ {
if (has_ac || has_bc || has_d) if (has_ac || has_bc || has_d)
out = fmt::format_to(out, cc.bias == TevBias::AddHalf ? " + .5" : " - .5"); out = fmt::format_to(out, "{}", cc.bias == TevBias::AddHalf ? " + .5" : " - .5");
else else
out = fmt::format_to(out, cc.bias == TevBias::AddHalf ? ".5" : "-.5"); out = fmt::format_to(out, "{}", cc.bias == TevBias::AddHalf ? ".5" : "-.5");
} }
else else
{ {
@ -659,9 +659,9 @@ struct fmt::formatter<TevStageCombiner::AlphaCombiner>
if (has_bias) if (has_bias)
{ {
if (has_ac || has_bc || has_d) if (has_ac || has_bc || has_d)
out = fmt::format_to(out, ac.bias == TevBias::AddHalf ? " + .5" : " - .5"); out = fmt::format_to(out, "{}", ac.bias == TevBias::AddHalf ? " + .5" : " - .5");
else else
out = fmt::format_to(out, ac.bias == TevBias::AddHalf ? ".5" : "-.5"); out = fmt::format_to(out, "{}", ac.bias == TevBias::AddHalf ? ".5" : "-.5");
} }
else else
{ {

View File

@ -5,6 +5,7 @@
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <fmt/format.h>
#include "Common/Assert.h" #include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -1819,7 +1820,7 @@ static void WriteAlphaTest(ShaderCode& out, const pixel_shader_uid_data* uid_dat
if (has_no_arguments) if (has_no_arguments)
out.Write("{}", tev_alpha_funcs_table[mode]); out.Write("{}", tev_alpha_funcs_table[mode]);
else else
out.Write(tev_alpha_funcs_table[mode], ref); out.Write(fmt::runtime(tev_alpha_funcs_table[mode]), ref);
}; };
out.SetConstantsUsed(C_ALPHA, C_ALPHA); out.SetConstantsUsed(C_ALPHA, C_ALPHA);

View File

@ -594,7 +594,7 @@ std::pair<std::string, std::string> GetXFTransferInfo(u16 base_address, u8 trans
for (u32 i = 0; i < xf_mem_transfer_size; i++) for (u32 i = 0; i < xf_mem_transfer_size; i++)
{ {
const auto mem_desc = GetXFMemDescription(xf_mem_base + i, Common::swap32(data)); const auto mem_desc = GetXFMemDescription(xf_mem_base + i, Common::swap32(data));
fmt::format_to(std::back_inserter(desc), i == 0 ? "{}" : "\n{}", mem_desc); fmt::format_to(std::back_inserter(desc), "{}{}", i != 0 ? "\n" : "", mem_desc);
data += 4; data += 4;
} }