Misc: Replace log printf calls with fmt

This commit is contained in:
Stenzek 2024-05-23 20:20:16 +10:00
parent 49b2e76dea
commit b6d019db66
No known key found for this signature in database
117 changed files with 1585 additions and 1615 deletions

View file

@ -43,6 +43,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
BreakAfterAttributes: Leave
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false

View file

@ -283,17 +283,11 @@ public:
#if defined(_WIN32)
// delete the temporary file
if (!DeleteFileW(FileSystem::GetWin32Path(m_temporaryFileName).c_str()))
{
Log_WarningPrintf(
"AtomicUpdatedFileByteStream::~AtomicUpdatedFileByteStream(): Failed to delete temporary file '%s'",
m_temporaryFileName.c_str());
}
Log_WarningFmt("Failed to delete temporary file '{}'", m_temporaryFileName);
#else
// delete the temporary file
if (remove(m_temporaryFileName.c_str()) < 0)
Log_WarningPrintf(
"AtomicUpdatedFileByteStream::~AtomicUpdatedFileByteStream(): Failed to delete temporary file '%s'",
m_temporaryFileName.c_str());
Log_WarningFmt("Failed to delete temporary file '{}'", m_temporaryFileName);
#endif
}
else if (!m_committed)
@ -317,8 +311,7 @@ public:
if (!MoveFileExW(FileSystem::GetWin32Path(m_temporaryFileName).c_str(),
FileSystem::GetWin32Path(m_originalFileName).c_str(), MOVEFILE_REPLACE_EXISTING))
{
Log_WarningPrintf("AtomicUpdatedFileByteStream::Commit(): Failed to rename temporary file '%s' to '%s'",
m_temporaryFileName.c_str(), m_originalFileName.c_str());
Log_WarningFmt("Failed to rename temporary file '{}' to '{}'", m_temporaryFileName, m_originalFileName);
m_discarded = true;
}
else
@ -329,8 +322,7 @@ public:
// move the atomic file name to the original file name
if (rename(m_temporaryFileName.c_str(), m_originalFileName.c_str()) < 0)
{
Log_WarningPrintf("AtomicUpdatedFileByteStream::Commit(): Failed to rename temporary file '%s' to '%s'",
m_temporaryFileName.c_str(), m_originalFileName.c_str());
Log_WarningFmt("Failed to rename temporary file '{}' to '{}'", m_temporaryFileName, m_originalFileName);
m_discarded = true;
}
else

View file

@ -1766,11 +1766,9 @@ bool FileSystem::RenamePath(const char* old_path, const char* new_path, Error* e
const std::wstring old_wpath = GetWin32Path(old_path);
const std::wstring new_wpath = GetWin32Path(new_path);
if (!MoveFileExW(old_wpath.c_str(), new_wpath.c_str(), MOVEFILE_REPLACE_EXISTING))
if (!MoveFileExW(old_wpath.c_str(), new_wpath.c_str(), MOVEFILE_REPLACE_EXISTING)) [[unlikely]]
{
const DWORD err = GetLastError();
Error::SetWin32(error, "MoveFileExW() failed: ", err);
Log_ErrorPrintf("MoveFileEx('%s', '%s') failed: %08X", old_path, new_path, err);
Error::SetWin32(error, "MoveFileExW() failed: ", GetLastError());
return false;
}
@ -2289,7 +2287,6 @@ bool FileSystem::RenamePath(const char* old_path, const char* new_path, Error* e
{
const int err = errno;
Error::SetErrno(error, "rename() failed: ", err);
Log_ErrorPrintf("rename('%s', '%s') failed: %d", old_path, new_path, err);
return false;
}
@ -2410,13 +2407,13 @@ static bool SetLock(int fd, bool lock)
const off_t offs = lseek(fd, 0, SEEK_CUR);
if (offs < 0)
{
Log_ErrorPrintf("lseek(%d) failed: %d", fd, errno);
Log_ErrorFmt("lseek({}) failed: {}", fd, errno);
return false;
}
if (offs != 0 && lseek(fd, 0, SEEK_SET) < 0)
{
Log_ErrorPrintf("lseek(%d, 0) failed: %d", fd, errno);
Log_ErrorFmt("lseek({}, 0) failed: {}", fd, errno);
return false;
}
@ -2425,7 +2422,7 @@ static bool SetLock(int fd, bool lock)
Panic("Repositioning file descriptor after lock failed.");
if (!res)
Log_ErrorPrintf("lockf() for %s failed: %d", lock ? "lock" : "unlock", errno);
Log_ErrorFmt("lockf() for {} failed: {}", lock ? "lock" : "unlock", errno);
return res;
}

View file

@ -17,11 +17,11 @@ enum LOGLEVEL
LOGLEVEL_NONE = 0, // Silences all log traffic
LOGLEVEL_ERROR = 1, // "ErrorPrint"
LOGLEVEL_WARNING = 2, // "WarningPrint"
LOGLEVEL_PERF = 3, // "PerfPrint"
LOGLEVEL_PERF = 3, // "PerfPrint" // TODO: Purge
LOGLEVEL_INFO = 4, // "InfoPrint"
LOGLEVEL_VERBOSE = 5, // "VerbosePrint"
LOGLEVEL_DEV = 6, // "DevPrint"
LOGLEVEL_PROFILE = 7, // "ProfilePrint"
LOGLEVEL_PROFILE = 7, // "ProfilePrint" // TODO: Purge
LOGLEVEL_DEBUG = 8, // "DebugPrint"
LOGLEVEL_TRACE = 9, // "TracePrint"
LOGLEVEL_COUNT = 10

View file

@ -36,7 +36,7 @@ bool MemMap::MemProtect(void* baseaddr, size_t size, PageProtect mode)
DWORD old_protect;
if (!VirtualProtect(baseaddr, size, static_cast<DWORD>(mode), &old_protect))
{
Log_ErrorPrintf("VirtualProtect() failed with error %u", GetLastError());
Log_ErrorFmt("VirtualProtect() failed with error {}", GetLastError());
return false;
}
@ -205,7 +205,7 @@ u8* SharedMemoryMappingArea::Map(void* file_handle, size_t file_offset, void* ma
if (!MapViewOfFile3(static_cast<HANDLE>(file_handle), GetCurrentProcess(), map_base, file_offset, map_size,
MEM_REPLACE_PLACEHOLDER, PAGE_READWRITE, nullptr, 0))
{
Log_ErrorPrintf("MapViewOfFile3() failed: %u", GetLastError());
Log_ErrorFmt("MapViewOfFile3() failed: {}", GetLastError());
return nullptr;
}
@ -231,7 +231,7 @@ bool SharedMemoryMappingArea::Unmap(void* map_base, size_t map_size)
// unmap the specified range
if (!UnmapViewOfFile2(GetCurrentProcess(), map_base, MEM_PRESERVE_PLACEHOLDER))
{
Log_ErrorPrintf("UnmapViewOfFile2() failed: %u", GetLastError());
Log_ErrorFmt("UnmapViewOfFile2() failed: {}", GetLastError());
return false;
}
@ -285,9 +285,9 @@ bool MemMap::MemProtect(void* baseaddr, size_t size, PageProtect mode)
DebugAssertMsg((size & (HOST_PAGE_SIZE - 1)) == 0, "Size is page aligned");
const int result = mprotect(baseaddr, size, static_cast<int>(mode));
if (result != 0)
if (result != 0) [[unlikely]]
{
Log_ErrorPrintf("mprotect() for %zu at %p failed", size, baseaddr);
Log_ErrorFmt("mprotect() for {} at {} failed", size, baseaddr);
return false;
}

View file

@ -420,7 +420,7 @@ bool Achievements::Initialize()
std::string api_token = Host::GetBaseStringSettingValue("Cheevos", "Token");
if (!username.empty() && !api_token.empty())
{
Log_InfoPrintf("Attempting login with user '%s'...", username.c_str());
Log_InfoFmt("Attempting login with user '{}'...", username);
s_login_request = rc_client_begin_login_with_token(s_client, username.c_str(), api_token.c_str(),
ClientLoginWithTokenCallback, nullptr);
}
@ -769,7 +769,7 @@ void Achievements::ClientEventHandler(const rc_client_event_t* event, rc_client_
break;
default:
Log_ErrorPrintf("Unhandled event: %u", event->type);
[[unlikely]] Log_ErrorFmt("Unhandled event: {}", event->type);
break;
}
}
@ -793,7 +793,7 @@ void Achievements::UpdateRichPresence(std::unique_lock<std::recursive_mutex>& lo
s_rich_presence_string.assign(sv);
Log_InfoPrintf("Rich presence updated: %s", s_rich_presence_string.c_str());
Log_InfoFmt("Rich presence updated: {}", s_rich_presence_string);
Host::OnAchievementsRefreshed();
#ifdef ENABLE_DISCORD_PRESENCE
@ -828,7 +828,7 @@ void Achievements::IdentifyGame(const std::string& path, CDImage* image)
temp_image = CDImage::Open(path.c_str(), g_settings.cdrom_load_image_patches, nullptr);
image = temp_image.get();
if (!temp_image)
Log_ErrorPrintf("Failed to open temporary CD image '%s'", path.c_str());
Log_ErrorFmt("Failed to open temporary CD image '{}'", path);
}
std::string game_hash;
@ -838,7 +838,7 @@ void Achievements::IdentifyGame(const std::string& path, CDImage* image)
if (s_game_hash == game_hash)
{
// only the path has changed - different format/save state/etc.
Log_InfoPrintf("Detected path change from '%s' to '%s'", s_game_path.c_str(), path.c_str());
Log_InfoFmt("Detected path change from '{}' to '{}'", s_game_path, path);
s_game_path = path;
return;
}
@ -861,7 +861,7 @@ void Achievements::IdentifyGame(const std::string& path, CDImage* image)
// bail out if we're not logged in, just save the hash
if (!IsLoggedInOrLoggingIn())
{
Log_InfoPrintf("Skipping load game because we're not logged in.");
Log_InfoPrint("Skipping load game because we're not logged in.");
DisableHardcoreMode();
return;
}
@ -903,7 +903,7 @@ void Achievements::ClientLoadGameCallback(int result, const char* error_message,
if (result == RC_NO_GAME_LOADED)
{
// Unknown game.
Log_InfoPrintf("Unknown game '%s', disabling achievements.", s_game_hash.c_str());
Log_InfoFmt("Unknown game '%s', disabling achievements.", s_game_hash);
DisableHardcoreMode();
return;
}
@ -1053,7 +1053,7 @@ void Achievements::DisplayHardcoreDeferredMessage()
void Achievements::HandleResetEvent(const rc_client_event_t* event)
{
// We handle system resets ourselves, but still need to reset the client's state.
Log_InfoPrintf("Resetting runtime due to reset event");
Log_InfoPrint("Resetting runtime due to reset event");
rc_client_reset(s_client);
if (HasActiveGame())
@ -1065,7 +1065,7 @@ void Achievements::HandleUnlockEvent(const rc_client_event_t* event)
const rc_client_achievement_t* cheevo = event->achievement;
DebugAssert(cheevo);
Log_InfoPrintf("Achievement %s (%u) for game %u unlocked", cheevo->title, cheevo->id, s_game_id);
Log_InfoFmt("Achievement {} ({}) for game {} unlocked", cheevo->title, cheevo->id, s_game_id);
UpdateGameSummary();
if (g_settings.achievements_notifications && FullscreenUI::Initialize())
@ -1089,7 +1089,7 @@ void Achievements::HandleUnlockEvent(const rc_client_event_t* event)
void Achievements::HandleGameCompleteEvent(const rc_client_event_t* event)
{
Log_InfoPrintf("Game %u complete", s_game_id);
Log_InfoFmt("Game {} complete", s_game_id);
UpdateGameSummary();
if (g_settings.achievements_notifications && FullscreenUI::Initialize())
@ -1108,7 +1108,7 @@ void Achievements::HandleGameCompleteEvent(const rc_client_event_t* event)
void Achievements::HandleLeaderboardStartedEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Leaderboard %u (%s) started", event->leaderboard->id, event->leaderboard->title);
Log_DevFmt("Leaderboard {} ({}) started", event->leaderboard->id, event->leaderboard->title);
if (g_settings.achievements_leaderboard_notifications && FullscreenUI::Initialize())
{
@ -1123,7 +1123,7 @@ void Achievements::HandleLeaderboardStartedEvent(const rc_client_event_t* event)
void Achievements::HandleLeaderboardFailedEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Leaderboard %u (%s) failed", event->leaderboard->id, event->leaderboard->title);
Log_DevFmt("Leaderboard {} ({}) failed", event->leaderboard->id, event->leaderboard->title);
if (g_settings.achievements_leaderboard_notifications && FullscreenUI::Initialize())
{
@ -1138,7 +1138,7 @@ void Achievements::HandleLeaderboardFailedEvent(const rc_client_event_t* event)
void Achievements::HandleLeaderboardSubmittedEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Leaderboard %u (%s) submitted", event->leaderboard->id, event->leaderboard->title);
Log_DevFmt("Leaderboard {} ({}) submitted", event->leaderboard->id, event->leaderboard->title);
if (g_settings.achievements_leaderboard_notifications && FullscreenUI::Initialize())
{
@ -1167,8 +1167,8 @@ void Achievements::HandleLeaderboardSubmittedEvent(const rc_client_event_t* even
void Achievements::HandleLeaderboardScoreboardEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Leaderboard %u scoreboard rank %u of %u", event->leaderboard_scoreboard->leaderboard_id,
event->leaderboard_scoreboard->new_rank, event->leaderboard_scoreboard->num_entries);
Log_DevFmt("Leaderboard {} scoreboard rank {} of {}", event->leaderboard_scoreboard->leaderboard_id,
event->leaderboard_scoreboard->new_rank, event->leaderboard_scoreboard->num_entries);
if (g_settings.achievements_leaderboard_notifications && FullscreenUI::Initialize())
{
@ -1195,8 +1195,8 @@ void Achievements::HandleLeaderboardScoreboardEvent(const rc_client_event_t* eve
void Achievements::HandleLeaderboardTrackerShowEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Showing leaderboard tracker: %u: %s", event->leaderboard_tracker->id,
event->leaderboard_tracker->display);
Log_DevFmt("Showing leaderboard tracker: {}: {}", event->leaderboard_tracker->id,
event->leaderboard_tracker->display);
TinyString width_string;
width_string.append(ICON_FA_STOPWATCH);
@ -1219,7 +1219,7 @@ void Achievements::HandleLeaderboardTrackerHideEvent(const rc_client_event_t* ev
if (it == s_active_leaderboard_trackers.end())
return;
Log_DevPrintf("Hiding leaderboard tracker: %u", id);
Log_DevFmt("Hiding leaderboard tracker: {}", id);
it->active = false;
it->show_hide_time.Reset();
}
@ -1232,8 +1232,8 @@ void Achievements::HandleLeaderboardTrackerUpdateEvent(const rc_client_event_t*
if (it == s_active_leaderboard_trackers.end())
return;
Log_DevPrintf("Updating leaderboard tracker: %u: %s", event->leaderboard_tracker->id,
event->leaderboard_tracker->display);
Log_DevFmt("Updating leaderboard tracker: {}: {}", event->leaderboard_tracker->id,
event->leaderboard_tracker->display);
it->text = event->leaderboard_tracker->display;
it->active = true;
@ -1257,7 +1257,7 @@ void Achievements::HandleAchievementChallengeIndicatorShowEvent(const rc_client_
indicator.active = true;
s_active_challenge_indicators.push_back(std::move(indicator));
Log_DevPrintf("Show challenge indicator for %u (%s)", event->achievement->id, event->achievement->title);
Log_DevFmt("Show challenge indicator for {} ({})", event->achievement->id, event->achievement->title);
}
void Achievements::HandleAchievementChallengeIndicatorHideEvent(const rc_client_event_t* event)
@ -1268,15 +1268,15 @@ void Achievements::HandleAchievementChallengeIndicatorHideEvent(const rc_client_
if (it == s_active_challenge_indicators.end())
return;
Log_DevPrintf("Hide challenge indicator for %u (%s)", event->achievement->id, event->achievement->title);
Log_DevFmt("Hide challenge indicator for {} ({})", event->achievement->id, event->achievement->title);
it->show_hide_time.Reset();
it->active = false;
}
void Achievements::HandleAchievementProgressIndicatorShowEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Showing progress indicator: %u (%s): %s", event->achievement->id, event->achievement->title,
event->achievement->measured_progress);
Log_DevFmt("Showing progress indicator: {} ({}): {}", event->achievement->id, event->achievement->title,
event->achievement->measured_progress);
if (!s_active_progress_indicator.has_value())
s_active_progress_indicator.emplace();
@ -1294,15 +1294,15 @@ void Achievements::HandleAchievementProgressIndicatorHideEvent(const rc_client_e
if (!s_active_progress_indicator.has_value())
return;
Log_DevPrintf("Hiding progress indicator");
Log_DevPrint("Hiding progress indicator");
s_active_progress_indicator->show_hide_time.Reset();
s_active_progress_indicator->active = false;
}
void Achievements::HandleAchievementProgressIndicatorUpdateEvent(const rc_client_event_t* event)
{
Log_DevPrintf("Updating progress indicator: %u (%s): %s", event->achievement->id, event->achievement->title,
event->achievement->measured_progress);
Log_DevFmt("Updating progress indicator: {} ({}): {}", event->achievement->id, event->achievement->title,
event->achievement->measured_progress);
s_active_progress_indicator->achievement = event->achievement;
s_active_progress_indicator->active = true;
}
@ -1319,7 +1319,7 @@ void Achievements::HandleServerErrorEvent(const rc_client_event_t* event)
void Achievements::HandleServerDisconnectedEvent(const rc_client_event_t* event)
{
Log_WarningPrintf("Server disconnected.");
Log_WarningPrint("Server disconnected.");
if (FullscreenUI::Initialize())
{
@ -1333,7 +1333,7 @@ void Achievements::HandleServerDisconnectedEvent(const rc_client_event_t* event)
void Achievements::HandleServerReconnectedEvent(const rc_client_event_t* event)
{
Log_WarningPrintf("Server reconnected.");
Log_WarningPrint("Server reconnected.");
if (FullscreenUI::Initialize())
{
@ -1474,7 +1474,7 @@ bool Achievements::DoState(StateWrapper& sw)
if (data_size == 0)
{
// reset runtime, no data (state might've been created without cheevos)
Log_DevPrintf("State is missing cheevos data, resetting runtime");
Log_DevPrint("State is missing cheevos data, resetting runtime");
#ifdef ENABLE_RAINTEGRATION
if (IsUsingRAIntegration())
RA_OnReset();
@ -1502,7 +1502,7 @@ bool Achievements::DoState(StateWrapper& sw)
const int result = rc_client_deserialize_progress(s_client, data.get());
if (result != RC_OK)
{
Log_WarningPrintf("Failed to deserialize cheevos state (%d), resetting", result);
Log_WarningFmt("Failed to deserialize cheevos state ({}), resetting", result);
rc_client_reset(s_client);
}
}
@ -1543,7 +1543,7 @@ bool Achievements::DoState(StateWrapper& sw)
if (result != RC_OK)
{
// set data to zero, effectively serializing nothing
Log_WarningPrintf("Failed to serialize cheevos state (%d)", result);
Log_WarningFmt("Failed to serialize cheevos state ({})", result);
data_size = 0;
}
}
@ -1679,7 +1679,7 @@ void Achievements::ClientLoginWithPasswordCallback(int result, const char* error
if (result != RC_OK)
{
Log_ErrorPrintf("Login failed: %s: %s", rc_error_str(result), error_message ? error_message : "Unknown");
Log_ErrorFmt("Login failed: {}: {}", rc_error_str(result), error_message ? error_message : "Unknown");
Error::SetString(params->error,
fmt::format("{}: {}", rc_error_str(result), error_message ? error_message : "Unknown"));
params->result = false;
@ -1959,7 +1959,7 @@ void Achievements::DrawGameOverlays()
if (!indicator.active && opacity <= 0.01f)
{
Log_DevPrintf("Remove challenge indicator");
Log_DevPrint("Remove challenge indicator");
it = s_active_challenge_indicators.erase(it);
}
else
@ -2003,7 +2003,7 @@ void Achievements::DrawGameOverlays()
if (!indicator.active && opacity <= 0.01f)
{
Log_DevPrintf("Remove progress indicator");
Log_DevPrint("Remove progress indicator");
s_active_progress_indicator.reset();
}
@ -2046,7 +2046,7 @@ void Achievements::DrawGameOverlays()
if (!indicator.active && opacity <= 0.01f)
{
Log_DevPrintf("Remove tracker indicator");
Log_DevPrint("Remove tracker indicator");
it = s_active_leaderboard_trackers.erase(it);
}
else
@ -2974,7 +2974,7 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
void Achievements::OpenLeaderboard(const rc_client_leaderboard_t* lboard)
{
Log_DevPrintf("Opening leaderboard '%s' (%u)", lboard->title, lboard->id);
Log_DevFmt("Opening leaderboard '{}' ({})", lboard->title, lboard->id);
CloseLeaderboard();
@ -3058,7 +3058,7 @@ void Achievements::FetchNextLeaderboardEntries()
for (rc_client_leaderboard_entry_list_t* list : s_leaderboard_entry_lists)
start += list->num_entries;
Log_DevPrintf("Fetching entries %u to %u", start, start + LEADERBOARD_ALL_FETCH_SIZE);
Log_DevFmt("Fetching entries {} to {}", start, start + LEADERBOARD_ALL_FETCH_SIZE);
if (s_leaderboard_fetch_handle)
rc_client_abort_async(s_client, s_leaderboard_fetch_handle);

View file

@ -296,16 +296,15 @@ void AnalogController::SetAnalogMode(bool enabled, bool show_message)
if (m_analog_mode == enabled)
return;
Log_InfoPrintf("Controller %u switched to %s mode.", m_index + 1u, enabled ? "analog" : "digital");
Log_InfoFmt("Controller {} switched to {} mode.", m_index + 1u, m_analog_mode ? "analog" : "digital");
if (show_message)
{
Host::AddIconOSDMessage(fmt::format("Controller{}AnalogMode", m_index), ICON_FA_GAMEPAD,
fmt::format(enabled ?
TRANSLATE_FS("AnalogController", "Controller {} switched to analog mode.") :
TRANSLATE_FS("AnalogController", "Controller {} switched to digital mode."),
m_index + 1u),
5.0f);
Host::AddIconOSDMessage(
fmt::format("analog_mode_toggle_{}", m_index), ICON_FA_GAMEPAD,
enabled ? fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to analog mode."), m_index + 1u) :
fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to digital mode."), m_index + 1u));
}
m_analog_mode = enabled;
}
@ -433,12 +432,12 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
if (data_in == 0x01)
{
Log_DebugPrintf("ACK controller access");
Log_DebugPrint("ACK controller access");
m_command = Command::Ready;
return true;
}
Log_DevPrintf("Unknown data_in = 0x%02X", data_in);
Log_DevFmt("Unknown data_in = 0x{:02X}", data_in);
return false;
}
break;
@ -509,7 +508,7 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
else
{
if (m_configuration_mode)
Log_ErrorPrintf("Unimplemented config mode command 0x%02X", data_in);
Log_ErrorFmt("Unimplemented config mode command 0x{:02X}", data_in);
*data_out = 0xFF;
return false;
@ -659,7 +658,7 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
m_status_byte = 0x5A;
}
Log_DevPrintf("0x%02x(%s) config mode", m_rx_buffer[2], m_configuration_mode ? "enter" : "leave");
Log_DevFmt("0x{:02x}({}) config mode", m_rx_buffer[2], m_configuration_mode ? "enter" : "leave");
}
}
break;
@ -668,14 +667,14 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
{
if (m_command_step == 2)
{
Log_DevPrintf("analog mode val 0x%02x", data_in);
Log_DevFmt("analog mode val 0x{:02x}", data_in);
if (data_in == 0x00 || data_in == 0x01)
SetAnalogMode((data_in == 0x01), true);
}
else if (m_command_step == 3)
{
Log_DevPrintf("analog mode lock 0x%02x", data_in);
Log_DevFmt("analog mode lock 0x{:02x}", data_in);
if (data_in == 0x02 || data_in == 0x03)
m_analog_locked = (data_in == 0x03);
@ -772,10 +771,10 @@ bool AnalogController::Transfer(const u8 data_in, u8* data_out)
{
m_command = Command::Idle;
Log_DebugPrintf("Rx: %02x %02x %02x %02x %02x %02x %02x %02x", m_rx_buffer[0], m_rx_buffer[1], m_rx_buffer[2],
m_rx_buffer[3], m_rx_buffer[4], m_rx_buffer[5], m_rx_buffer[6], m_rx_buffer[7]);
Log_DebugPrintf("Tx: %02x %02x %02x %02x %02x %02x %02x %02x", m_tx_buffer[0], m_tx_buffer[1], m_tx_buffer[2],
m_tx_buffer[3], m_tx_buffer[4], m_tx_buffer[5], m_tx_buffer[6], m_tx_buffer[7]);
Log_DebugFmt("Rx: {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x}", m_rx_buffer[0], m_rx_buffer[1],
m_rx_buffer[2], m_rx_buffer[3], m_rx_buffer[4], m_rx_buffer[5], m_rx_buffer[6], m_rx_buffer[7]);
Log_DebugFmt("Tx: {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x}", m_tx_buffer[0], m_tx_buffer[1],
m_tx_buffer[2], m_tx_buffer[3], m_tx_buffer[4], m_tx_buffer[5], m_tx_buffer[6], m_tx_buffer[7]);
m_rx_buffer.fill(0x00);
m_tx_buffer.fill(0x00);
@ -873,14 +872,13 @@ static const SettingInfo s_settings[] = {
nullptr, s_invert_settings, 0.0f},
};
const Controller::ControllerInfo AnalogController::INFO = {
ControllerType::AnalogController,
"AnalogController",
TRANSLATE_NOOP("ControllerType", "Analog Controller"),
ICON_PF_GAMEPAD,
s_binding_info,
s_settings,
Controller::VibrationCapabilities::LargeSmallMotors};
const Controller::ControllerInfo AnalogController::INFO = {ControllerType::AnalogController,
"AnalogController",
TRANSLATE_NOOP("ControllerType", "Analog Controller"),
ICON_PF_GAMEPAD,
s_binding_info,
s_settings,
Controller::VibrationCapabilities::LargeSmallMotors};
void AnalogController::LoadSettings(SettingsInterface& si, const char* section)
{

View file

@ -12,6 +12,7 @@
#include "common/log.h"
#include "common/string_util.h"
#include "IconsFontAwesome5.h"
#include "IconsPromptFont.h"
#include <cmath>
@ -65,10 +66,10 @@ bool AnalogJoystick::DoState(StateWrapper& sw, bool apply_input_state)
if (sw.IsReading() && (old_analog_mode != m_analog_mode))
{
Host::AddFormattedOSDMessage(5.0f,
m_analog_mode ? TRANSLATE("AnalogJoystick", "Controller %u switched to analog mode.") :
TRANSLATE("AnalogJoystick", "Controller %u switched to digital mode."),
m_index + 1u);
Host::AddIconOSDMessage(
fmt::format("analog_mode_toggle_{}", m_index), ICON_FA_GAMEPAD,
m_analog_mode ? fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to analog mode."), m_index + 1u) :
fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to digital mode."), m_index + 1u));
}
return true;
}
@ -239,11 +240,11 @@ void AnalogJoystick::ToggleAnalogMode()
{
m_analog_mode = !m_analog_mode;
Log_InfoPrintf("Joystick %u switched to %s mode.", m_index + 1u, m_analog_mode ? "analog" : "digital");
Host::AddFormattedOSDMessage(5.0f,
m_analog_mode ? TRANSLATE("AnalogJoystick", "Controller %u switched to analog mode.") :
TRANSLATE("AnalogJoystick", "Controller %u switched to digital mode."),
m_index + 1u);
Log_InfoFmt("Joystick {} switched to {} mode.", m_index + 1u, m_analog_mode ? "analog" : "digital");
Host::AddIconOSDMessage(
fmt::format("analog_mode_toggle_{}", m_index), ICON_FA_GAMEPAD,
m_analog_mode ? fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to analog mode."), m_index + 1u) :
fmt::format(TRANSLATE_FS("Controller", "Controller {} switched to digital mode."), m_index + 1u));
}
bool AnalogJoystick::Transfer(const u8 data_in, u8* data_out)

View file

@ -223,7 +223,7 @@ const BIOS::ImageInfo* BIOS::GetInfoForImage(const Image& image, const Hash& has
return &ii;
}
Log_WarningPrintf("Unknown BIOS hash: %s", hash.ToString().c_str());
Log_WarningFmt("Unknown BIOS hash: {}", hash.ToString());
return nullptr;
}
@ -246,14 +246,14 @@ void BIOS::PatchBIOS(u8* image, u32 image_size, u32 address, u32 value, u32 mask
SmallString old_disasm, new_disasm;
CPU::DisassembleInstruction(&old_disasm, address, existing_value);
CPU::DisassembleInstruction(&new_disasm, address, new_value);
Log_DevPrintf("BIOS-Patch 0x%08X (+0x%X): 0x%08X %s -> %08X %s", address, offset, existing_value, old_disasm.c_str(),
new_value, new_disasm.c_str());
Log_DevFmt("BIOS-Patch 0x{:08X} (+0x{:X}): 0x{:08X} {} -> {:08X} {}", address, offset, existing_value, old_disasm,
new_value, new_disasm);
}
bool BIOS::PatchBIOSFastBoot(u8* image, u32 image_size)
{
// Replace the shell entry point with a return back to the bootstrap.
Log_InfoPrintf("Patching BIOS to skip intro");
Log_InfoPrint("Patching BIOS to skip intro");
PatchBIOS(image, image_size, 0x1FC18000, 0x3C011F80); // lui at, 1f80
PatchBIOS(image, image_size, 0x1FC18004, 0x3C0A0300); // lui t2, 0300h
PatchBIOS(image, image_size, 0x1FC18008, 0xAC2A1814); // sw zero, 1814h(at) ; turn the display on
@ -308,8 +308,8 @@ bool BIOS::IsValidPSExeHeader(const PSEXEHeader& header, u32 file_size)
if ((header.file_size + sizeof(PSEXEHeader)) > file_size)
{
Log_WarningPrintf("Incorrect file size in PS-EXE header: %u bytes should not be greater than %u bytes",
header.file_size, static_cast<unsigned>(file_size - sizeof(PSEXEHeader)));
Log_WarningFmt("Incorrect file size in PS-EXE header: {} bytes should not be greater than {} bytes",
header.file_size, static_cast<unsigned>(file_size - sizeof(PSEXEHeader)));
}
return true;

View file

@ -234,7 +234,7 @@ bool Bus::AllocateMemory(Error* error)
return false;
}
Log_InfoPrintf("Fastmem base: %p", s_fastmem_arena.BasePointer());
Log_InfoFmt("Fastmem base: {}", static_cast<void*>(s_fastmem_arena.BasePointer()));
#endif
#ifndef __ANDROID__
@ -452,15 +452,15 @@ void Bus::RecalculateMemoryTimings()
std::tie(g_spu_access_time[0], g_spu_access_time[1], g_spu_access_time[2]) =
CalculateMemoryTiming(s_MEMCTRL.spu_delay_size, s_MEMCTRL.common_delay);
Log_TracePrintf("BIOS Memory Timing: %u bit bus, byte=%d, halfword=%d, word=%d",
s_MEMCTRL.bios_delay_size.data_bus_16bit ? 16 : 8, g_bios_access_time[0] + 1,
g_bios_access_time[1] + 1, g_bios_access_time[2] + 1);
Log_TracePrintf("CDROM Memory Timing: %u bit bus, byte=%d, halfword=%d, word=%d",
s_MEMCTRL.cdrom_delay_size.data_bus_16bit ? 16 : 8, g_cdrom_access_time[0] + 1,
g_cdrom_access_time[1] + 1, g_cdrom_access_time[2] + 1);
Log_TracePrintf("SPU Memory Timing: %u bit bus, byte=%d, halfword=%d, word=%d",
s_MEMCTRL.spu_delay_size.data_bus_16bit ? 16 : 8, g_spu_access_time[0] + 1, g_spu_access_time[1] + 1,
g_spu_access_time[2] + 1);
Log_TraceFmt("BIOS Memory Timing: {} bit bus, byte={}, halfword={}, word={}",
s_MEMCTRL.bios_delay_size.data_bus_16bit ? 16 : 8, g_bios_access_time[0] + 1, g_bios_access_time[1] + 1,
g_bios_access_time[2] + 1);
Log_TraceFmt("CDROM Memory Timing: {} bit bus, byte={}, halfword={}, word={}",
s_MEMCTRL.cdrom_delay_size.data_bus_16bit ? 16 : 8, g_cdrom_access_time[0] + 1,
g_cdrom_access_time[1] + 1, g_cdrom_access_time[2] + 1);
Log_TraceFmt("SPU Memory Timing: {} bit bus, byte={}, halfword={}, word={}",
s_MEMCTRL.spu_delay_size.data_bus_16bit ? 16 : 8, g_spu_access_time[0] + 1, g_spu_access_time[1] + 1,
g_spu_access_time[2] + 1);
}
CPUFastmemMode Bus::GetFastmemMode()
@ -504,9 +504,10 @@ void Bus::UpdateFastmemViews(CPUFastmemMode mode)
{
auto MapRAM = [](u32 base_address) {
u8* map_address = s_fastmem_arena.BasePointer() + base_address;
if (!s_fastmem_arena.Map(s_shmem_handle, 0, map_address, g_ram_size, PageProtect::ReadWrite))
if (!s_fastmem_arena.Map(s_shmem_handle, 0, map_address, g_ram_size, PageProtect::ReadWrite)) [[unlikely]]
{
Log_ErrorPrintf("Failed to map RAM at fastmem area %p (offset 0x%08X)", map_address, g_ram_size);
Log_ErrorFmt("Failed to map RAM at fastmem area {} (offset 0x{:08X})", static_cast<void*>(map_address),
g_ram_size);
return;
}
@ -516,9 +517,9 @@ void Bus::UpdateFastmemViews(CPUFastmemMode mode)
if (g_ram_code_bits[i])
{
u8* page_address = map_address + (i * HOST_PAGE_SIZE);
if (!MemMap::MemProtect(page_address, HOST_PAGE_SIZE, PageProtect::ReadOnly))
if (!MemMap::MemProtect(page_address, HOST_PAGE_SIZE, PageProtect::ReadOnly)) [[unlikely]]
{
Log_ErrorPrintf("Failed to write-protect code page at %p", page_address);
Log_ErrorFmt("Failed to write-protect code page at {}", static_cast<void*>(page_address));
s_fastmem_arena.Unmap(map_address, g_ram_size);
return;
}
@ -546,7 +547,7 @@ void Bus::UpdateFastmemViews(CPUFastmemMode mode)
s_fastmem_lut = static_cast<u8**>(std::malloc(sizeof(u8*) * FASTMEM_LUT_SLOTS));
Assert(s_fastmem_lut);
Log_InfoPrintf("Fastmem base (software): %p", s_fastmem_lut);
Log_InfoFmt("Fastmem base (software): {}", static_cast<void*>(s_fastmem_lut));
}
// This assumes the top 4KB of address space is not mapped. It shouldn't be on any sane OSes.
@ -652,8 +653,8 @@ void Bus::SetRAMPageWritable(u32 page_index, bool writable)
u8* page_address = it.first + (page_index * HOST_PAGE_SIZE);
if (!MemMap::MemProtect(page_address, HOST_PAGE_SIZE, protect)) [[unlikely]]
{
Log_ErrorPrintf("Failed to %s code page %u (0x%08X) @ %p", writable ? "unprotect" : "protect", page_index,
page_index * static_cast<u32>(HOST_PAGE_SIZE), page_address);
Log_ErrorFmt("Failed to {} code page {} (0x{:08X}) @ {}", writable ? "unprotect" : "protect", page_index,
page_index * static_cast<u32>(HOST_PAGE_SIZE), static_cast<void*>(page_address));
}
}
@ -676,9 +677,7 @@ void Bus::ClearRAMCodePageFlags()
for (const auto& it : s_fastmem_ram_views)
{
if (!MemMap::MemProtect(it.first, it.second, PageProtect::ReadWrite))
{
Log_ErrorPrintf("Failed to unprotect code pages for fastmem view @ %p", it.first);
}
Log_ErrorFmt("Failed to unprotect code pages for fastmem view @ %p", static_cast<void*>(it.first));
}
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ void CDROMAsyncReader::StartThread(u32 readahead_count)
m_shutdown_flag.store(false);
m_read_thread = std::thread(&CDROMAsyncReader::WorkerThreadEntryPoint, this);
Log_InfoPrintf("Read thread started with readahead of %u sectors", readahead_count);
Log_InfoFmt("Read thread started with readahead of {} sectors", readahead_count);
}
void CDROMAsyncReader::StopThread()
@ -80,9 +80,9 @@ bool CDROMAsyncReader::Precache(ProgressCallback* callback)
if (memory_image)
{
const CDImage::LBA lba = m_media->GetPositionOnDisc();
if (!memory_image->Seek(lba))
if (!memory_image->Seek(lba)) [[unlikely]]
{
Log_ErrorPrintf("Failed to seek to LBA %u in memory image", lba);
Log_ErrorFmt("Failed to seek to LBA {} in memory image", lba);
return false;
}
@ -115,7 +115,7 @@ void CDROMAsyncReader::QueueReadSector(CDImage::LBA lba)
const u32 buffer_front = m_buffer_front.load();
if (m_buffers[buffer_front].lba == lba)
{
Log_DebugPrintf("Skipping re-reading same sector %u", lba);
Log_DebugFmt("Skipping re-reading same sector {}", lba);
return;
}
@ -124,7 +124,7 @@ void CDROMAsyncReader::QueueReadSector(CDImage::LBA lba)
if (m_buffer_count > 1 && m_buffers[next_buffer].lba == lba)
{
// great, don't need a seek, but still kick the thread to start reading ahead again
Log_DebugPrintf("Readahead buffer hit for sector %u", lba);
Log_DebugFmt("Readahead buffer hit for sector {}", lba);
m_buffer_front.store(next_buffer);
m_buffer_count.fetch_sub(1);
m_can_readahead.store(true);
@ -134,7 +134,7 @@ void CDROMAsyncReader::QueueReadSector(CDImage::LBA lba)
}
// we need to toss away our readahead and start fresh
Log_DebugPrintf("Readahead buffer miss, queueing seek to %u", lba);
Log_DebugFmt("Readahead buffer miss, queueing seek to {}", lba);
std::unique_lock<std::mutex> lock(m_mutex);
m_next_position_set.store(true);
m_next_position = lba;
@ -154,9 +154,9 @@ bool CDROMAsyncReader::ReadSectorUncached(CDImage::LBA lba, CDImage::SubChannelQ
// read while the lock is held so it has to wait
const CDImage::LBA prev_lba = m_media->GetPositionOnDisc();
const bool result = InternalReadSectorUncached(lba, subq, data);
if (!m_media->Seek(prev_lba))
if (!m_media->Seek(prev_lba)) [[unlikely]]
{
Log_ErrorPrintf("Failed to re-seek to cached position %u", prev_lba);
Log_ErrorFmt("Failed to re-seek to cached position {}", prev_lba);
m_can_readahead.store(false);
}
@ -165,15 +165,15 @@ bool CDROMAsyncReader::ReadSectorUncached(CDImage::LBA lba, CDImage::SubChannelQ
bool CDROMAsyncReader::InternalReadSectorUncached(CDImage::LBA lba, CDImage::SubChannelQ* subq, SectorBuffer* data)
{
if (m_media->GetPositionOnDisc() != lba && !m_media->Seek(lba))
if (m_media->GetPositionOnDisc() != lba && !m_media->Seek(lba)) [[unlikely]]
{
Log_WarningPrintf("Seek to LBA %u failed", lba);
Log_WarningFmt("Seek to LBA {} failed", lba);
return false;
}
if (!m_media->ReadRawSector(data, subq))
if (!m_media->ReadRawSector(data, subq)) [[unlikely]]
{
Log_WarningPrintf("Read of LBA %u failed", lba);
Log_WarningFmt("Read of LBA {} failed", lba);
return false;
}
@ -185,17 +185,17 @@ bool CDROMAsyncReader::WaitForReadToComplete()
// Safe without locking with memory_order_seq_cst.
if (!m_next_position_set.load() && m_buffer_count.load() > 0)
{
Log_TracePrintf("Returning sector %u", m_buffers[m_buffer_front.load()].lba);
Log_TraceFmt("Returning sector {}", m_buffers[m_buffer_front.load()].lba);
return m_buffers[m_buffer_front.load()].result;
}
Common::Timer wait_timer;
Log_DebugPrintf("Sector read pending, waiting");
Log_DebugPrint("Sector read pending, waiting");
std::unique_lock<std::mutex> lock(m_mutex);
m_notify_read_complete_cv.wait(
lock, [this]() { return (m_buffer_count.load() > 0 || m_seek_error.load()) && !m_next_position_set.load(); });
if (m_seek_error.load())
if (m_seek_error.load()) [[unlikely]]
{
m_seek_error.store(false);
return false;
@ -203,10 +203,10 @@ bool CDROMAsyncReader::WaitForReadToComplete()
const u32 front = m_buffer_front.load();
const double wait_time = wait_timer.GetTimeMilliseconds();
if (wait_time > 1.0f)
Log_WarningPrintf("Had to wait %.2f msec for LBA %u", wait_time, m_buffers[front].lba);
if (wait_time > 1.0f) [[unlikely]]
Log_WarningFmt("Had to wait {:.2f} msec for LBA {}", wait_time, m_buffers[front].lba);
Log_TracePrintf("Returning sector %u after waiting", m_buffers[front].lba);
Log_TraceFmt("Returning sector {} after waiting", m_buffers[front].lba);
return m_buffers[front].result;
}
@ -238,18 +238,18 @@ bool CDROMAsyncReader::ReadSectorIntoBuffer(std::unique_lock<std::mutex>& lock)
m_is_reading.store(true);
lock.unlock();
Log_TracePrintf("Reading LBA %u...", buffer.lba);
Log_TraceFmt("Reading LBA {}...", buffer.lba);
buffer.result = m_media->ReadRawSector(buffer.data.data(), &buffer.subq);
if (buffer.result)
if (buffer.result) [[likely]]
{
const double read_time = timer.GetTimeMilliseconds();
if (read_time > 1.0f)
Log_DevPrintf("Read LBA %u took %.2f msec", buffer.lba, read_time);
if (read_time > 1.0f) [[unlikely]]
Log_DevFmt("Read LBA {} took {:.2f} msec", buffer.lba, read_time);
}
else
{
Log_ErrorPrintf("Read of LBA %u failed", buffer.lba);
Log_ErrorFmt("Read of LBA {} failed", buffer.lba);
}
lock.lock();
@ -269,7 +269,7 @@ void CDROMAsyncReader::ReadSectorNonThreaded(CDImage::LBA lba)
if (m_media->GetPositionOnDisc() != lba && !m_media->Seek(lba))
{
Log_WarningPrintf("Seek to LBA %u failed", lba);
Log_WarningFmt("Seek to LBA {} failed", lba);
m_seek_error.store(true);
return;
}
@ -277,18 +277,18 @@ void CDROMAsyncReader::ReadSectorNonThreaded(CDImage::LBA lba)
BufferSlot& buffer = m_buffers.front();
buffer.lba = m_media->GetPositionOnDisc();
Log_TracePrintf("Reading LBA %u...", buffer.lba);
Log_TraceFmt("Reading LBA {}...", buffer.lba);
buffer.result = m_media->ReadRawSector(buffer.data.data(), &buffer.subq);
if (buffer.result)
if (buffer.result) [[likely]]
{
const double read_time = timer.GetTimeMilliseconds();
if (read_time > 1.0f)
Log_DevPrintf("Read LBA %u took %.2f msec", buffer.lba, read_time);
if (read_time > 1.0f) [[unlikely]]
Log_DevFmt("Read LBA {} took {:.2f} msec", buffer.lba, read_time);
}
else
{
Log_ErrorPrintf("Read of LBA %u failed", buffer.lba);
Log_ErrorFmt("Read of LBA {} failed", buffer.lba);
}
m_buffer_count.fetch_add(1);
@ -296,7 +296,7 @@ void CDROMAsyncReader::ReadSectorNonThreaded(CDImage::LBA lba)
void CDROMAsyncReader::CancelReadahead()
{
Log_DevPrintf("Cancelling readahead");
Log_DevPrint("Cancelling readahead");
std::unique_lock lock(m_mutex);
@ -332,7 +332,7 @@ void CDROMAsyncReader::WorkerThreadEntryPoint()
lock.unlock();
// seek without lock held in case it takes time
Log_DebugPrintf("Seeking to LBA %u...", seek_location);
Log_DebugFmt("Seeking to LBA {}...", seek_location);
const bool seek_result = (m_media->GetPositionOnDisc() == seek_location || m_media->Seek(seek_location));
lock.lock();
@ -343,10 +343,10 @@ void CDROMAsyncReader::WorkerThreadEntryPoint()
continue;
// did we fail the seek?
if (!seek_result)
if (!seek_result) [[unlikely]]
{
// add the error result, and don't try to read ahead
Log_WarningPrintf("Seek to LBA %u failed", seek_location);
Log_WarningFmt("Seek to LBA {} failed", seek_location);
m_seek_error.store(true);
m_notify_read_complete_cv.notify_all();
break;
@ -360,7 +360,7 @@ void CDROMAsyncReader::WorkerThreadEntryPoint()
break;
// readahead time! read as many sectors as we have space for
Log_DebugPrintf("Reading ahead %u sectors...", static_cast<u32>(m_buffers.size()) - m_buffer_count.load());
Log_DebugFmt("Reading ahead {} sectors...", static_cast<u32>(m_buffers.size()) - m_buffer_count.load());
while (m_buffer_count.load() < static_cast<u32>(m_buffers.size()))
{
if (m_next_position_set.load())

View file

@ -311,7 +311,7 @@ bool CheatList::LoadFromPCSXRString(const std::string& str)
m_codes.push_back(std::move(current_code));
}
Log_InfoPrintf("Loaded %zu cheats (PCSXR format)", m_codes.size());
Log_InfoFmt("Loaded {} cheats (PCSXR format)", m_codes.size());
return !m_codes.empty();
}
@ -402,7 +402,7 @@ bool CheatList::LoadFromLibretroString(const std::string& str)
const std::string* enable = FindKey(kvp, TinyString::from_format("cheat{}_enable", i));
if (!desc || !code || !enable)
{
Log_WarningPrintf("Missing desc/code/enable for cheat %u", i);
Log_WarningFmt("Missing desc/code/enable for cheat {}", i);
continue;
}
@ -414,7 +414,7 @@ bool CheatList::LoadFromLibretroString(const std::string& str)
m_codes.push_back(std::move(cc));
}
Log_InfoPrintf("Loaded %zu cheats (libretro format)", m_codes.size());
Log_InfoFmt("Loaded {} cheats (libretro format)", m_codes.size());
return !m_codes.empty();
}
@ -501,7 +501,7 @@ bool CheatList::LoadFromEPSXeString(const std::string& str)
if (current_code.Valid())
m_codes.push_back(std::move(current_code));
Log_InfoPrintf("Loaded %zu cheats (EPSXe format)", m_codes.size());
Log_InfoFmt("Loaded {} cheats (EPSXe format)", m_codes.size());
return !m_codes.empty();
}
@ -523,7 +523,7 @@ bool CheatList::ParseLibretroCheat(CheatCode* cc, const char* line)
{
if (!IsLibretroSeparator(*end_ptr))
{
Log_WarningPrintf("Malformed code '%s'", line);
Log_WarningFmt("Malformed code '{}'", line);
break;
}
@ -536,7 +536,7 @@ bool CheatList::ParseLibretroCheat(CheatCode* cc, const char* line)
{
if (!IsLibretroSeparator(*end_ptr))
{
Log_WarningPrintf("Malformed code '%s'", line);
Log_WarningFmt("Malformed code '{}'", line);
break;
}
@ -791,11 +791,11 @@ bool CheatList::LoadFromPackage(const std::string& serial)
if (current_code.Valid())
m_codes.push_back(std::move(current_code));
Log_InfoPrintf("Loaded %zu codes from package for %s", m_codes.size(), serial.c_str());
Log_InfoFmt("Loaded {} codes from package for {}", m_codes.size(), serial);
return !m_codes.empty();
}
Log_WarningPrintf("No codes found in package for %s", serial.c_str());
Log_WarningFmt("No codes found in package for {}", serial);
return false;
}
@ -1266,7 +1266,7 @@ void CheatCode::Apply() const
if ((index + 4) >= instructions.size())
{
Log_ErrorPrintf("Incomplete find/replace instruction");
Log_ErrorPrint("Incomplete find/replace instruction");
return;
}
const Instruction& inst2 = instructions[index + 1];
@ -1754,7 +1754,7 @@ void CheatCode::Apply() const
break;
}
default:
Log_ErrorPrintf("Incorrect conditional instruction (see chtdb.txt for supported instructions)");
Log_ErrorPrint("Incorrect conditional instruction (see chtdb.txt for supported instructions)");
return;
}
}
@ -1866,14 +1866,14 @@ void CheatCode::Apply() const
break;
}
default:
Log_ErrorPrintf("Incorrect conditional instruction (see chtdb.txt for supported instructions)");
Log_ErrorPrint("Incorrect conditional instruction (see chtdb.txt for supported instructions)");
return;
}
}
}
else
{
Log_ErrorPrintf("Incomplete multi conditional instruction");
Log_ErrorPrint("Incomplete multi conditional instruction");
return;
}
if (conditions_check == true)
@ -2518,7 +2518,7 @@ void CheatCode::Apply() const
{
if ((index + 1) >= instructions.size())
{
Log_ErrorPrintf("Incomplete slide instruction");
Log_ErrorPrint("Incomplete slide instruction");
return;
}
@ -2550,7 +2550,7 @@ void CheatCode::Apply() const
}
else
{
Log_ErrorPrintf("Invalid command in second slide parameter 0x%02X", static_cast<unsigned>(write_type));
Log_ErrorFmt("Invalid command in second slide parameter 0x{:02X}", static_cast<unsigned>(write_type));
}
index += 2;
@ -2561,7 +2561,7 @@ void CheatCode::Apply() const
{
if ((index + 1) >= instructions.size())
{
Log_ErrorPrintf("Incomplete slide instruction");
Log_ErrorPrint("Incomplete slide instruction");
return;
}
@ -2622,7 +2622,7 @@ void CheatCode::Apply() const
}
else
{
Log_ErrorPrintf("Invalid command in second slide parameter 0x%02X", static_cast<unsigned>(write_type));
Log_ErrorFmt("Invalid command in second slide parameter 0x{:02X}", static_cast<unsigned>(write_type));
}
index += 2;
@ -2633,7 +2633,7 @@ void CheatCode::Apply() const
{
if ((index + 1) >= instructions.size())
{
Log_ErrorPrintf("Incomplete memory copy instruction");
Log_ErrorPrint("Incomplete memory copy instruction");
return;
}
@ -2656,8 +2656,8 @@ void CheatCode::Apply() const
default:
{
Log_ErrorPrintf("Unhandled instruction code 0x%02X (%08X %08X)", static_cast<u8>(inst.code.GetValue()),
inst.first, inst.second);
Log_ErrorFmt("Unhandled instruction code 0x{:02X} ({:08X} {:08X})", static_cast<u8>(inst.code.GetValue()),
inst.first, inst.second);