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

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 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_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
out = fmt::format_to(out, cc.bias == TevBias::AddHalf ? ".5" : "-.5");
out = fmt::format_to(out, "{}", cc.bias == TevBias::AddHalf ? ".5" : "-.5");
}
else
{
@ -659,9 +659,9 @@ struct fmt::formatter<TevStageCombiner::AlphaCombiner>
if (has_bias)
{
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
out = fmt::format_to(out, ac.bias == TevBias::AddHalf ? ".5" : "-.5");
out = fmt::format_to(out, "{}", ac.bias == TevBias::AddHalf ? ".5" : "-.5");
}
else
{

View File

@ -5,6 +5,7 @@
#include <cmath>
#include <cstdio>
#include <fmt/format.h>
#include "Common/Assert.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)
out.Write("{}", tev_alpha_funcs_table[mode]);
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);

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++)
{
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;
}