Merge pull request #9258 from lioncash/core-log

Core: Convert logging over to fmt pt. 1
This commit is contained in:
Léo Lam 2020-11-19 20:32:19 +01:00 committed by GitHub
commit eff566b318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 433 additions and 414 deletions

View File

@ -245,13 +245,13 @@ std::vector<ARCode> LoadCodes(const IniFile& global_ini, const IniFile& local_in
}
else
{
PanicAlertT("Action Replay Error: invalid AR code line: %s", line.c_str());
PanicAlertFmtT("Action Replay Error: invalid AR code line: {0}", line);
if (!success_addr)
PanicAlertT("The address is invalid");
PanicAlertFmtT("The address is invalid");
if (!success_val)
PanicAlertT("The value is invalid");
PanicAlertFmtT("The value is invalid");
}
}
else
@ -316,7 +316,7 @@ static void VLogInfo(std::string_view format, fmt::format_args args)
return;
std::string text = fmt::vformat(format, args);
INFO_LOG(ACTIONREPLAY, "%s", text.c_str());
INFO_LOG_FMT(ACTIONREPLAY, "{}", text);
if (use_internal_log)
{
@ -403,9 +403,9 @@ static bool Subtype_RamWriteAndFill(const ARAddr& addr, const u32 data)
default:
LogInfo("Bad Size");
PanicAlertT("Action Replay Error: Invalid size "
"(%08x : address = %08x) in Ram Write And Fill (%s)",
addr.size, addr.gcaddr, s_current_code->name.c_str());
PanicAlertFmtT("Action Replay Error: Invalid size "
"({0:08x} : address = {1:08x}) in Ram Write And Fill ({2})",
addr.size, addr.gcaddr, s_current_code->name);
return false;
}
@ -463,9 +463,9 @@ static bool Subtype_WriteToPointer(const ARAddr& addr, const u32 data)
default:
LogInfo("Bad Size");
PanicAlertT("Action Replay Error: Invalid size "
"(%08x : address = %08x) in Write To Pointer (%s)",
addr.size, addr.gcaddr, s_current_code->name.c_str());
PanicAlertFmtT("Action Replay Error: Invalid size "
"({0:08x} : address = {1:08x}) in Write To Pointer ({2})",
addr.size, addr.gcaddr, s_current_code->name);
return false;
}
return true;
@ -525,9 +525,9 @@ static bool Subtype_AddCode(const ARAddr& addr, const u32 data)
default:
LogInfo("Bad Size");
PanicAlertT("Action Replay Error: Invalid size "
"(%08x : address = %08x) in Add Code (%s)",
addr.size, addr.gcaddr, s_current_code->name.c_str());
PanicAlertFmtT("Action Replay Error: Invalid size "
"({0:08x} : address = {1:08x}) in Add Code ({2})",
addr.size, addr.gcaddr, s_current_code->name);
return false;
}
return true;
@ -540,9 +540,9 @@ static bool Subtype_MasterCodeAndWriteToCCXXXXXX(const ARAddr& addr, const u32 d
// u8 mcode_type = (data & 0xFF0000) >> 16;
// u8 mcode_count = (data & 0xFF00) >> 8;
// u8 mcode_number = data & 0xFF;
PanicAlertT("Action Replay Error: Master Code and Write To CCXXXXXX not implemented (%s)\n"
PanicAlertFmtT("Action Replay Error: Master Code and Write To CCXXXXXX not implemented ({0})\n"
"Master codes are not needed. Do not use master codes.",
s_current_code->name.c_str());
s_current_code->name);
return false;
}
@ -615,8 +615,9 @@ static bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr& addr, const
default:
LogInfo("Bad Size");
PanicAlertT("Action Replay Error: Invalid size (%08x : address = %08x) in Fill and Slide (%s)",
size, new_addr, s_current_code->name.c_str());
PanicAlertFmtT(
"Action Replay Error: Invalid size ({0:08x} : address = {1:08x}) in Fill and Slide ({2})",
size, new_addr, s_current_code->name);
return false;
}
return true;
@ -670,8 +671,8 @@ static bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr& addr, const u3
else
{
LogInfo("Bad Value");
PanicAlertT("Action Replay Error: Invalid value (%08x) in Memory Copy (%s)", (data & ~0x7FFF),
s_current_code->name.c_str());
PanicAlertFmtT("Action Replay Error: Invalid value ({0:08x}) in Memory Copy ({1})",
(data & ~0x7FFF), s_current_code->name);
return false;
}
return true;
@ -707,8 +708,8 @@ static bool NormalCode(const ARAddr& addr, const u32 data)
default:
LogInfo("Bad Subtype");
PanicAlertT("Action Replay: Normal Code 0: Invalid Subtype %08x (%s)", addr.subtype,
s_current_code->name.c_str());
PanicAlertFmtT("Action Replay: Normal Code 0: Invalid Subtype {0:08x} ({1})", addr.subtype,
s_current_code->name);
return false;
}
@ -749,8 +750,8 @@ static bool CompareValues(const u32 val1, const u32 val2, const int type)
default:
LogInfo("Unknown Compare type");
PanicAlertT("Action Replay: Invalid Normal Code Type %08x (%s)", type,
s_current_code->name.c_str());
PanicAlertFmtT("Action Replay: Invalid Normal Code Type {0:08x} ({1})", type,
s_current_code->name);
return false;
}
}
@ -781,8 +782,8 @@ static bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkip
default:
LogInfo("Bad Size");
PanicAlertT("Action Replay: Conditional Code: Invalid Size %08x (%s)", addr.size,
s_current_code->name.c_str());
PanicAlertFmtT("Action Replay: Conditional Code: Invalid Size {0:08x} ({1})", addr.size,
s_current_code->name);
return false;
}
@ -805,8 +806,8 @@ static bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkip
default:
LogInfo("Bad Subtype");
PanicAlertT("Action Replay: Normal Code %i: Invalid subtype %08x (%s)", 1, addr.subtype,
s_current_code->name.c_str());
PanicAlertFmtT("Action Replay: Normal Code {0}: Invalid subtype {1:08x} ({2})", 1,
addr.subtype, s_current_code->name);
return false;
}
}
@ -889,7 +890,7 @@ static bool RunCodeLocked(const ARCode& arcode)
{
LogInfo(
"This action replay simulator does not support codes that modify Action Replay itself.");
PanicAlertT(
PanicAlertFmtT(
"This action replay simulator does not support codes that modify Action Replay itself.");
return false;
}
@ -923,7 +924,7 @@ static bool RunCodeLocked(const ARCode& arcode)
// Todo: Set register 1BB4 to 1
LogInfo("ZCode: Executes all codes in the same row, Set register 1BB4 to 1 (zcode not "
"supported)");
PanicAlertT("Zero 3 code not supported");
PanicAlertFmtT("Zero 3 code not supported");
return false;
case ZCODE_04: // Fill & Slide or Memory Copy
@ -943,7 +944,7 @@ static bool RunCodeLocked(const ARCode& arcode)
default:
LogInfo("ZCode: Unknown");
PanicAlertT("Zero code unknown to Dolphin: %08x", zcode);
PanicAlertFmtT("Zero code unknown to Dolphin: {0:08x}", zcode);
return false;
}

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <cstdint>
#include <map>
#include <optional>
#include <string>
@ -97,9 +98,9 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume)
const std::optional<u32> entry = volume.ReadSwapped<u32>(offset + 0x10, partition);
const std::optional<u32> size = volume.ReadSwapped<u32>(offset + 0x14, partition);
const std::optional<u32> trailer = volume.ReadSwapped<u32>(offset + 0x18, partition);
if (!entry || !size || !trailer || *entry == (u32)-1 || *size + *trailer == (u32)-1)
if (!entry || !size || !trailer || *entry == UINT32_MAX || *size + *trailer == UINT32_MAX)
{
INFO_LOG(BOOT, "Invalid apploader. Your disc image is probably corrupted.");
INFO_LOG_FMT(BOOT, "Invalid apploader. Your disc image is probably corrupted.");
return false;
}
DVDRead(volume, offset + 0x20, 0x01200000, *size + *trailer, partition);
@ -107,7 +108,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume)
// TODO - Make Apploader(or just RunFunction()) debuggable!!!
// Call iAppLoaderEntry.
DEBUG_LOG(MASTER_LOG, "Call iAppLoaderEntry");
DEBUG_LOG_FMT(MASTER_LOG, "Call iAppLoaderEntry");
const u32 iAppLoaderFuncAddr = is_wii ? 0x80004000 : 0x80003100;
PowerPC::ppcState.gpr[3] = iAppLoaderFuncAddr + 0;
PowerPC::ppcState.gpr[4] = iAppLoaderFuncAddr + 4;
@ -118,7 +119,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume)
const u32 iAppLoaderClose = PowerPC::Read_U32(iAppLoaderFuncAddr + 8);
// iAppLoaderInit
DEBUG_LOG(MASTER_LOG, "Call iAppLoaderInit");
DEBUG_LOG_FMT(MASTER_LOG, "Call iAppLoaderInit");
HLE::Patch(0x81300000, "AppLoaderReport"); // HLE OSReport for Apploader
PowerPC::ppcState.gpr[3] = 0x81300000;
RunFunction(iAppLoaderInit);
@ -126,7 +127,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume)
// iAppLoaderMain - Here we load the apploader, the DOL (the exe) and the FST (filesystem).
// To give you an idea about where the stuff is located on the disc take a look at yagcd
// ch 13.
DEBUG_LOG(MASTER_LOG, "Call iAppLoaderMain");
DEBUG_LOG_FMT(MASTER_LOG, "Call iAppLoaderMain");
PowerPC::ppcState.gpr[3] = 0x81300004;
PowerPC::ppcState.gpr[4] = 0x81300008;
@ -140,13 +141,13 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume)
// iAppLoaderMain returns 0 when there are no more sections to copy.
while (PowerPC::ppcState.gpr[3] != 0x00)
{
u32 iRamAddress = PowerPC::Read_U32(0x81300004);
u32 iLength = PowerPC::Read_U32(0x81300008);
u32 iDVDOffset = PowerPC::Read_U32(0x8130000c) << (is_wii ? 2 : 0);
const u32 ram_address = PowerPC::Read_U32(0x81300004);
const u32 length = PowerPC::Read_U32(0x81300008);
const u32 dvd_offset = PowerPC::Read_U32(0x8130000c) << (is_wii ? 2 : 0);
INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset,
iRamAddress, iLength);
DVDRead(volume, iDVDOffset, iRamAddress, iLength, partition);
INFO_LOG_FMT(MASTER_LOG, "DVDRead: offset: {:08x} memOffset: {:08x} length: {}", dvd_offset,
ram_address, length);
DVDRead(volume, dvd_offset, ram_address, length, partition);
PowerPC::ppcState.gpr[3] = 0x81300004;
PowerPC::ppcState.gpr[4] = 0x81300008;
@ -156,7 +157,7 @@ bool CBoot::RunApploader(bool is_wii, const DiscIO::VolumeDisc& volume)
}
// iAppLoaderClose
DEBUG_LOG(MASTER_LOG, "call iAppLoaderClose");
DEBUG_LOG_FMT(MASTER_LOG, "call iAppLoaderClose");
RunFunction(iAppLoaderClose);
HLE::UnPatch("AppLoaderReport");
@ -205,7 +206,7 @@ void CBoot::SetupGCMemory()
// execute the apploader, function by function, using the above utility.
bool CBoot::EmulatedBS2_GC(const DiscIO::VolumeDisc& volume)
{
INFO_LOG(BOOT, "Faking GC BS2...");
INFO_LOG_FMT(BOOT, "Faking GC BS2...");
SetupMSR();
SetupBAT(/*is_wii*/ false);
@ -330,11 +331,11 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
serno = "123456789";
else
serno = Common::SettingsHandler::GenerateSerialNumber();
INFO_LOG(BOOT, "No previous serial number found, generated one instead: %s", serno.c_str());
INFO_LOG_FMT(BOOT, "No previous serial number found, generated one instead: {}", serno);
}
else
{
INFO_LOG(BOOT, "Using serial number: %s", serno.c_str());
INFO_LOG_FMT(BOOT, "Using serial number: {}", serno);
}
gen.AddSetting("AREA", region_setting.area);
@ -351,14 +352,14 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
settings_file_path, {rw_mode, rw_mode, rw_mode});
if (!settings_file || !settings_file->Write(gen.GetBytes().data(), gen.GetBytes().size()))
{
PanicAlertT("SetupWiiMemory: Can't create setting.txt file");
PanicAlertFmtT("SetupWiiMemory: Can't create setting.txt file");
return false;
}
// Write the 256 byte setting.txt to memory.
Memory::CopyToEmu(0x3800, gen.GetBytes().data(), gen.GetBytes().size());
INFO_LOG(BOOT, "Setup Wii Memory...");
INFO_LOG_FMT(BOOT, "Setup Wii Memory...");
/*
Set hardcoded global variables to Wii memory. These are partly collected from
@ -438,7 +439,7 @@ static void WriteEmptyPlayRecord()
// execute the apploader
bool CBoot::EmulatedBS2_Wii(const DiscIO::VolumeDisc& volume)
{
INFO_LOG(BOOT, "Faking Wii BS2...");
INFO_LOG_FMT(BOOT, "Faking Wii BS2...");
if (volume.GetVolumeType() != DiscIO::Platform::WiiDisc)
return false;

View File

@ -2,7 +2,6 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <cinttypes>
#include <memory>
#include "Common/CommonTypes.h"
@ -29,7 +28,7 @@ bool CBoot::BootNANDTitle(const u64 title_id)
if (ticket.IsValid())
console_type = ticket.GetConsoleType();
else
ERROR_LOG(BOOT, "No ticket was found for %016" PRIx64, title_id);
ERROR_LOG_FMT(BOOT, "No ticket was found for {:016x}", title_id);
SetupWiiMemory(console_type);
return es->LaunchTitle(title_id);
}
@ -38,7 +37,7 @@ bool CBoot::Boot_WiiWAD(const DiscIO::VolumeWAD& wad)
{
if (!WiiUtils::InstallWAD(*IOS::HLE::GetIOS(), wad, WiiUtils::InstallType::Temporary))
{
PanicAlertT("Cannot boot this WAD because it could not be installed to the NAND.");
PanicAlertFmtT("Cannot boot this WAD because it could not be installed to the NAND.");
return false;
}
return BootNANDTitle(wad.GetTMD().GetTitleId());

View File

@ -126,22 +126,22 @@ const char* ElfReader::GetSectionName(int section) const
// This is just a simple elf loader, good enough to load elfs generated by devkitPPC
bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
{
INFO_LOG(MASTER_LOG, "String section: %i", header->e_shstrndx);
INFO_LOG_FMT(MASTER_LOG, "String section: {}", header->e_shstrndx);
if (bRelocate)
{
PanicAlert("Error: Dolphin doesn't know how to load a relocatable elf.");
PanicAlertFmt("Error: Dolphin doesn't know how to load a relocatable elf.");
return false;
}
INFO_LOG(MASTER_LOG, "%i segments:", header->e_phnum);
INFO_LOG_FMT(MASTER_LOG, "{} segments:", header->e_phnum);
// Copy segments into ram.
for (int i = 0; i < header->e_phnum; i++)
{
Elf32_Phdr* p = segments + i;
INFO_LOG(MASTER_LOG, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr,
INFO_LOG_FMT(MASTER_LOG, "Type: {} Vaddr: {:08x} Filesz: {} Memsz: {}", p->p_type, p->p_vaddr,
p->p_filesz, p->p_memsz);
if (p->p_type == PT_LOAD)
@ -158,11 +158,12 @@ bool ElfReader::LoadIntoMemory(bool only_in_mem1) const
if (srcSize < dstSize)
Memory::Memset(writeAddr + srcSize, 0, dstSize - srcSize); // zero out bss
INFO_LOG(MASTER_LOG, "Loadable Segment Copied to %08x, size %08x", writeAddr, p->p_memsz);
INFO_LOG_FMT(MASTER_LOG, "Loadable Segment Copied to {:08x}, size {:08x}", writeAddr,
p->p_memsz);
}
}
INFO_LOG(MASTER_LOG, "Done loading.");
INFO_LOG_FMT(MASTER_LOG, "Done loading.");
return true;
}

View File

@ -223,7 +223,7 @@ static GPUDeterminismMode ParseGPUDeterminismMode(const std::string& mode)
if (mode == "fake-completion")
return GPUDeterminismMode::FakeCompletion;
NOTICE_LOG(BOOT, "Unknown GPU determinism mode %s", mode.c_str());
NOTICE_LOG_FMT(BOOT, "Unknown GPU determinism mode {}", mode);
return GPUDeterminismMode::Auto;
}

View File

@ -75,7 +75,7 @@ void SaveToSYSCONF(Config::LayerType layer)
idle_entry->bytes = std::vector<u8>(2);
else
idle_entry->bytes[0] = 0;
NOTICE_LOG(CORE, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
NOTICE_LOG_FMT(CORE, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
IOS::HLE::RestoreBTInfoSection(&sysconf);
sysconf.Save();
@ -143,8 +143,8 @@ public:
auto ini = inis.find(location.system);
if (ini == inis.end())
{
ERROR_LOG(COMMON, "Config can't map system '%s' to an INI file!",
Config::GetSystemName(location.system).c_str());
ERROR_LOG_FMT(COMMON, "Config can't map system '{}' to an INI file!",
Config::GetSystemName(location.system));
continue;
}

View File

@ -126,7 +126,7 @@ static Location MapINIToRealLocation(const std::string& section, const std::stri
if (!fail && system)
return {*system, config_section, key};
WARN_LOG(CORE, "Unknown game INI option in section %s: %s", section.c_str(), key.c_str());
WARN_LOG_FMT(CORE, "Unknown game INI option in section {}: {}", section, key);
return {Config::System::Main, "", ""};
}
@ -216,7 +216,7 @@ private:
if (!File::Exists(ini_path))
{
// TODO: PanicAlert shouldn't be used for this.
PanicAlertT("Selected controller profile does not exist");
PanicAlertFmtT("Selected controller profile does not exist");
continue;
}

View File

@ -80,7 +80,7 @@ SConfig::~SConfig()
void SConfig::SaveSettings()
{
NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
NOTICE_LOG_FMT(BOOT, "Saving settings to {}", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
@ -343,7 +343,7 @@ void SConfig::LoadSettings()
{
Config::Load();
INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
INFO_LOG_FMT(BOOT, "Loading Settings from {}", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
@ -690,7 +690,7 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
const DiscIO::Language language = GetLanguageAdjustedForRegion(bWii, region);
m_title_name = title_database.GetTitleName(m_gametdb_id, language);
m_title_description = title_database.Describe(m_gametdb_id, language);
NOTICE_LOG(CORE, "Active title: %s", m_title_description.c_str());
NOTICE_LOG_FMT(CORE, "Active title: {}", m_title_description);
Host_TitleChanged();
Config::AddLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
@ -848,12 +848,12 @@ struct SetGameMetadata
{
if (!wad.GetTMD().IsValid())
{
PanicAlertT("This WAD is not valid.");
PanicAlertFmtT("This WAD is not valid.");
return false;
}
if (!IOS::ES::IsChannel(wad.GetTMD().GetTitleId()))
{
PanicAlertT("This WAD is not bootable.");
PanicAlertFmtT("This WAD is not bootable.");
return false;
}
@ -871,7 +871,7 @@ struct SetGameMetadata
const IOS::ES::TMDReader tmd = ios.GetES()->FindInstalledTMD(nand_title.id);
if (!tmd.IsValid() || !IOS::ES::IsChannel(nand_title.id))
{
PanicAlertT("This title cannot be booted.");
PanicAlertFmtT("This title cannot be booted.");
return false;
}

View File

@ -220,7 +220,7 @@ bool Init(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
{
if (IsRunning())
{
PanicAlertT("Emu Thread already running");
PanicAlertFmtT("Emu Thread already running");
return false;
}
@ -233,8 +233,8 @@ bool Init(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
Core::UpdateWantDeterminism(/*initial*/ true);
INFO_LOG(BOOT, "Starting core = %s mode", SConfig::GetInstance().bWii ? "Wii" : "GameCube");
INFO_LOG(BOOT, "CPU Thread separate = %s", SConfig::GetInstance().bCPUThread ? "Yes" : "No");
INFO_LOG_FMT(BOOT, "Starting core = {} mode", SConfig::GetInstance().bWii ? "Wii" : "GameCube");
INFO_LOG_FMT(BOOT, "CPU Thread separate = {}", SConfig::GetInstance().bCPUThread ? "Yes" : "No");
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
@ -278,10 +278,10 @@ void Stop() // - Hammertime!
Fifo::EmulatorState(false);
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
INFO_LOG_FMT(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
// Stop the CPU
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stop CPU").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "Stop CPU"));
CPU::Stop();
if (_CoreParameter.bCPUThread)
@ -289,7 +289,7 @@ void Stop() // - Hammertime!
// Video_EnterLoop() should now exit so that EmuThread()
// will continue concurrently with the rest of the commands
// in this function. We no longer rely on Postmessage.
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "Wait for Video Loop to exit ..."));
g_video_backend->Video_ExitLoop();
}
@ -412,7 +412,7 @@ static void FifoPlayerThread(const std::optional<std::string>& savestate_path,
else
{
// FIFO log does not contain any frames, cannot continue.
PanicAlert("FIFO file is invalid, cannot playback.");
PanicAlertFmt("FIFO file is invalid, cannot playback.");
FifoPlayer::GetInstance().Close();
return;
}
@ -435,7 +435,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
if (s_on_state_changed_callback)
s_on_state_changed_callback(State::Uninitialized);
INFO_LOG(CONSOLE, "Stop\t\t---- Shutdown complete ----");
INFO_LOG_FMT(CONSOLE, "Stop\t\t---- Shutdown complete ----");
}};
Common::SetCurrentThreadName("Emuthread - Starting");
@ -510,9 +510,9 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
Common::ScopeGuard hw_guard{[] {
// We must set up this flag before executing HW::Shutdown()
s_hardware_initialized = false;
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(false, "Shutting down HW"));
HW::Shutdown();
INFO_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(false, "HW shutdown"));
// Clear on screen messages that haven't expired
OSD::ClearMessages();
@ -529,7 +529,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
if (!g_video_backend->Initialize(wsi))
{
PanicAlert("Failed to initialize video backend!");
PanicAlertFmt("Failed to initialize video backend!");
return;
}
Common::ScopeGuard video_guard{[] { g_video_backend->Shutdown(); }};
@ -546,7 +546,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
if (!DSP::GetDSPEmulator()->Initialize(core_parameter.bWii, core_parameter.bDSPThread))
{
PanicAlert("Failed to initialize DSP emulation!");
PanicAlertFmt("Failed to initialize DSP emulation!");
return;
}
@ -615,11 +615,11 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
Fifo::RunGpuLoop();
// We have now exited the Video Loop
INFO_LOG(CONSOLE, "%s", StopMessage(false, "Video Loop Ended").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(false, "Video Loop Ended"));
// Join with the CPU thread.
s_cpu_thread.join();
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "CPU thread stopped."));
}
else // SingleCore mode
{
@ -628,9 +628,9 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
}
#ifdef USE_GDBSTUB
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping GDB ...").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "Stopping GDB ..."));
gdb_deinit();
INFO_LOG(CONSOLE, "%s", StopMessage(true, "GDB stopped.").c_str());
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "GDB stopped."));
#endif
}
@ -656,7 +656,7 @@ void SetState(State state)
Wiimote::Resume();
break;
default:
PanicAlert("Invalid state");
PanicAlertFmt("Invalid state");
break;
}
@ -995,7 +995,7 @@ void UpdateWantDeterminism(bool initial)
bool new_want_determinism = Movie::IsMovieActive() || NetPlay::IsNetPlayRunning();
if (new_want_determinism != s_wants_determinism || initial)
{
NOTICE_LOG(COMMON, "Want determinism <- %s", new_want_determinism ? "true" : "false");
NOTICE_LOG_FMT(COMMON, "Want determinism <- {}", new_want_determinism ? "true" : "false");
RunAsCPUThread([&] {
s_wants_determinism = new_want_determinism;

View File

@ -5,7 +5,6 @@
#include "Core/CoreTiming.h"
#include <algorithm>
#include <cinttypes>
#include <mutex>
#include <string>
#include <unordered_map>
@ -189,9 +188,9 @@ void DoState(PointerWrap& p)
}
else
{
WARN_LOG(POWERPC,
"Lost event from savestate because its type, \"%s\", has not been registered.",
name.c_str());
WARN_LOG_FMT(POWERPC,
"Lost event from savestate because its type, \"{}\", has not been registered.",
name);
ev.type = s_ev_lost;
}
}
@ -260,10 +259,10 @@ void ScheduleEvent(s64 cycles_into_future, EventType* event_type, u64 userdata,
{
if (Core::WantsDeterminism())
{
ERROR_LOG(POWERPC,
"Someone scheduled an off-thread \"%s\" event while netplay or "
ERROR_LOG_FMT(POWERPC,
"Someone scheduled an off-thread \"{}\" event while netplay or "
"movie play/record was active. This is likely to cause a desync.",
event_type->name->c_str());
*event_type->name);
}
std::lock_guard<std::mutex> lk(s_ts_write_lock);
@ -329,8 +328,6 @@ void Advance()
Event evt = std::move(s_event_queue.front());
std::pop_heap(s_event_queue.begin(), s_event_queue.end(), std::greater<Event>());
s_event_queue.pop_back();
// NOTICE_LOG(POWERPC, "[Scheduler] %-20s (%lld, %lld)", evt.type->name->c_str(),
// g.global_timer, evt.time);
evt.type->callback(evt.userdata, g.global_timer - evt.time);
}
@ -358,8 +355,8 @@ void LogPendingEvents()
std::sort(clone.begin(), clone.end());
for (const Event& ev : clone)
{
INFO_LOG(POWERPC, "PENDING: Now: %" PRId64 " Pending: %" PRId64 " Type: %s", g.global_timer,
ev.time, ev.type->name->c_str());
INFO_LOG_FMT(POWERPC, "PENDING: Now: {} Pending: {} Type: {}", g.global_timer, ev.time,
*ev.type->name);
}
}

View File

@ -27,7 +27,7 @@ u16 Accelerator::ReadD3()
m_current_address++;
break;
default:
ERROR_LOG(DSPLLE, "dsp_read_aram_d3() - unknown format 0x%x", m_sample_format);
ERROR_LOG_FMT(DSPLLE, "dsp_read_aram_d3() - unknown format {:#x}", m_sample_format);
break;
}
@ -54,7 +54,7 @@ void Accelerator::WriteD3(u16 value)
m_current_address++;
break;
default:
ERROR_LOG(DSPLLE, "dsp_write_aram_d3() - unknown format 0x%x", m_sample_format);
ERROR_LOG_FMT(DSPLLE, "dsp_write_aram_d3() - unknown format {:#x}", m_sample_format);
break;
}
}
@ -133,7 +133,7 @@ u16 Accelerator::Read(const s16* coefs)
m_current_address += 1;
break;
default:
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", m_sample_format);
ERROR_LOG_FMT(DSPLLE, "dsp_read_accelerator() - unknown format {:#x}", m_sample_format);
step_size_bytes = 2;
m_current_address += 1;
val = 0;

View File

@ -144,12 +144,12 @@ void AnalyzeRange(u16 start_addr, u16 end_addr)
}
if (found)
{
INFO_LOG(DSPLLE, "Idle skip location found at %02x (sigNum:%zu)", addr, s + 1);
INFO_LOG_FMT(DSPLLE, "Idle skip location found at {:02x} (sigNum:{})", addr, s + 1);
code_flags[addr] |= CODE_IDLE_SKIP;
}
}
}
INFO_LOG(DSPLLE, "Finished analysis.");
INFO_LOG_FMT(DSPLLE, "Finished analysis.");
}
} // Anonymous namespace

View File

@ -14,6 +14,7 @@
#include "Common/CommonTypes.h"
#include "Common/File.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Common/Swap.h"
@ -66,7 +67,7 @@ bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& t
bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
{
if (code1.size() != code2.size())
printf("Size difference! 1=%zu 2=%zu\n", code1.size(), code2.size());
WARN_LOG_FMT(AUDIO, "Size difference! 1={} 2={}\n", code1.size(), code2.size());
u32 count_equal = 0;
const u16 min_size = static_cast<u16>(std::min(code1.size(), code2.size()));
@ -85,23 +86,23 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
disassembler.DisassembleOpcode(&code1[0], &pc, line1);
pc = i;
disassembler.DisassembleOpcode(&code2[0], &pc, line2);
printf("!! %04x : %04x vs %04x - %s vs %s\n", i, code1[i], code2[i], line1.c_str(),
line2.c_str());
WARN_LOG_FMT(AUDIO, "!! {:04x} : {:04x} vs {:04x} - {} vs {}\n", i, code1[i], code2[i],
line1, line2);
}
}
if (code2.size() != code1.size())
{
printf("Extra code words:\n");
DEBUG_LOG_FMT(AUDIO, "Extra code words:\n");
const std::vector<u16>& longest = code1.size() > code2.size() ? code1 : code2;
for (u16 i = min_size; i < longest.size(); i++)
{
u16 pc = i;
std::string line;
disassembler.DisassembleOpcode(&longest[0], &pc, line);
printf("!! %s\n", line.c_str());
DEBUG_LOG_FMT(AUDIO, "!! {}\n", line);
}
}
printf("Equal instruction words: %i / %i\n", count_equal, min_size);
DEBUG_LOG_FMT(AUDIO, "Equal instruction words: {} / {}\n", count_equal, min_size);
return code1.size() == code2.size() && code1.size() == count_equal;
}
@ -155,7 +156,7 @@ bool DumpDSPCode(const u8* code_be, size_t size_in_bytes, u32 crc)
if (!File::IOFile(binary_file, "wb").WriteBytes(code_be, size_in_bytes))
{
PanicAlert("Can't dump UCode to file '%s'!!", binary_file.c_str());
PanicAlertFmt("Can't dump UCode to file '{}'!!", binary_file);
return false;
}

View File

@ -77,7 +77,7 @@ static bool VerifyRoms()
if (rom_idx < 0)
{
if (AskYesNoT("Your DSP ROMs have incorrect hashes.\n"
if (AskYesNoFmtT("Your DSP ROMs have incorrect hashes.\n"
"Would you like to stop now to fix the problem?\n"
"If you select \"No\", audio might be garbled."))
return false;
@ -254,7 +254,7 @@ void DSPCore_CheckExceptions()
else
{
#if defined(_DEBUG) || defined(DEBUGFAST)
ERROR_LOG(DSPLLE, "Firing exception %d failed", i);
ERROR_LOG_FMT(DSPLLE, "Firing exception {} failed", i);
#endif
}
}

View File

@ -131,7 +131,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1
break;
default:
ERROR_LOG(DSPLLE, "Unknown parameter type: %x", opc.params[j].type);
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}", opc.params[j].type);
break;
}
}

View File

@ -54,11 +54,8 @@ void gdsp_mbox_write_l(Mailbox mbx, u16 val)
g_dsp.mbox[mbx].store(new_value | 0x80000000, std::memory_order_release);
#if defined(_DEBUG) || defined(DEBUGFAST)
if (mbx == MAILBOX_DSP)
DEBUG_LOG(DSP_MAIL, "DSP(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(MAILBOX_DSP),
g_dsp.pc);
else
DEBUG_LOG(DSP_MAIL, "CPU(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(MAILBOX_CPU),
const char* const type = mbx == MAILBOX_DSP ? "DSP" : "CPU";
DEBUG_LOG_FMT(DSP_MAIL, "{}(WM) B:{} M:{:#010x} (pc={:#06x})", type, mbx, gdsp_mbox_peek(mbx),
g_dsp.pc);
#endif
}
@ -86,11 +83,8 @@ u16 gdsp_mbox_read_l(Mailbox mbx)
}
#if defined(_DEBUG) || defined(DEBUGFAST)
if (mbx == MAILBOX_DSP)
DEBUG_LOG(DSP_MAIL, "DSP(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(MAILBOX_DSP),
g_dsp.pc);
else
DEBUG_LOG(DSP_MAIL, "CPU(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(MAILBOX_CPU),
const char* const type = mbx == MAILBOX_DSP ? "DSP" : "CPU";
DEBUG_LOG_FMT(DSP_MAIL, "{}(RM) B:{} M:0x{:#010x} (pc={:#06x})", type, mbx, gdsp_mbox_peek(mbx),
g_dsp.pc);
#endif
@ -104,10 +98,10 @@ void gdsp_ifx_write(u32 addr, u16 val)
switch (addr & 0xff)
{
case DSP_DIRQ:
if (val & 0x1)
if ((val & 1) != 0)
Host::InterruptRequest();
else
WARN_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val);
WARN_LOG_FMT(DSPLLE, "Unknown Interrupt Request pc={:#06x} ({:#06x})", g_dsp.pc, val);
break;
case DSP_DMBH:
@ -130,16 +124,17 @@ void gdsp_ifx_write(u32 addr, u16 val)
if (!g_dsp.ifx_regs[DSP_AMDM])
gdsp_do_dma();
else
NOTICE_LOG(DSPLLE, "Masked DMA skipped");
NOTICE_LOG_FMT(DSPLLE, "Masked DMA skipped");
g_dsp.ifx_regs[DSP_DSCR] &= ~4;
g_dsp.ifx_regs[DSP_DSBL] = 0;
break;
case DSP_GAIN:
if (val)
if (val != 0)
{
DEBUG_LOG(DSPLLE, "Gain Written: 0x%04x", val);
DEBUG_LOG(DSPLLE, "Gain Written: {:#06x}", val);
}
[[fallthrough]];
case DSP_DSPA:
case DSP_DSMAH:
case DSP_DSMAL:
@ -190,18 +185,21 @@ void gdsp_ifx_write(u32 addr, u16 val)
default:
if ((addr & 0xff) >= 0xa0)
{
if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description)
const u32 index = (addr & 0xFF) - 0xa0;
const auto& label = pdlabels[index];
if (label.name && label.description)
{
DEBUG_LOG(DSPLLE, "%04x MW %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, val);
DEBUG_LOG_FMT(DSPLLE, "{:04x} MW {} ({:04x})", g_dsp.pc, label.name, val);
}
else
{
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
ERROR_LOG_FMT(DSPLLE, "{:04x} MW {:04x} ({:04x})", g_dsp.pc, addr, val);
}
}
else
{
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
ERROR_LOG_FMT(DSPLLE, "{:04x} MW {:04x} ({:04x})", g_dsp.pc, addr, val);
}
g_dsp.ifx_regs[addr & 0xFF] = val;
break;
@ -253,23 +251,29 @@ static u16 _gdsp_ifx_read(u16 addr)
return g_dsp.accelerator->ReadD3();
default:
{
const u16 ifx_reg = g_dsp.ifx_regs[addr & 0xFF];
if ((addr & 0xff) >= 0xa0)
{
if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description)
const u32 index = (addr & 0xFF) - 0xa0;
const auto& label = pdlabels[index];
if (label.name && label.description)
{
DEBUG_LOG(DSPLLE, "%04x MR %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name,
g_dsp.ifx_regs[addr & 0xFF]);
DEBUG_LOG_FMT(DSPLLE, "{:04x} MR {} ({:04x})", g_dsp.pc, label.name, ifx_reg);
}
else
{
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
ERROR_LOG_FMT(DSPLLE, "{:04x} MR {:04x} ({:04x})", g_dsp.pc, addr, ifx_reg);
}
}
else
{
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
ERROR_LOG_FMT(DSPLLE, "{:04x} MR {:04x} ({:04x})", g_dsp.pc, addr, ifx_reg);
}
return ifx_reg;
}
return g_dsp.ifx_regs[addr & 0xFF];
}
}
@ -287,16 +291,16 @@ static const u8* gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
Common::WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
Host::CodeLoaded(addr, size);
NOTICE_LOG(DSPLLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)", addr, dsp_addr,
g_dsp.iram_crc);
NOTICE_LOG_FMT(DSPLLE, "*** Copy new UCode from {:#010x} to {:#06x} (crc: {:#08x})", addr,
dsp_addr, g_dsp.iram_crc);
return reinterpret_cast<u8*>(g_dsp.iram) + dsp_addr;
}
static const u8* gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size)
{
ERROR_LOG(DSPLLE, "*** idma_out IRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)", dsp_addr / 2,
addr, size);
ERROR_LOG_FMT(DSPLLE, "*** idma_out IRAM_DSP ({:#06x}) -> RAM ({:#010x}) : size ({:#010x})",
dsp_addr / 2, addr, size);
return nullptr;
}
@ -305,7 +309,7 @@ static const u8* gdsp_idma_out(u16 dsp_addr, u32 addr, u32 size)
static const u8* gdsp_ddma_in(u16 dsp_addr, u32 addr, u32 size)
{
Host::DMAToDSP(g_dsp.dram + dsp_addr / 2, addr, size);
DEBUG_LOG(DSPLLE, "*** ddma_in RAM (0x%08x) -> DRAM_DSP (0x%04x) : size (0x%08x)", addr,
DEBUG_LOG_FMT(DSPLLE, "*** ddma_in RAM ({:#010x}) -> DRAM_DSP ({:#06x}) : size ({:#010x})", addr,
dsp_addr / 2, size);
return reinterpret_cast<u8*>(g_dsp.dram) + dsp_addr;
@ -314,28 +318,30 @@ static const u8* gdsp_ddma_in(u16 dsp_addr, u32 addr, u32 size)
static const u8* gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size)
{
Host::DMAFromDSP(g_dsp.dram + dsp_addr / 2, addr, size);
DEBUG_LOG(DSPLLE, "*** ddma_out DRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)", dsp_addr / 2,
addr, size);
DEBUG_LOG_FMT(DSPLLE, "*** ddma_out DRAM_DSP ({:#06x}) -> RAM ({:#010x}) : size ({:#010x})",
dsp_addr / 2, addr, size);
return reinterpret_cast<const u8*>(g_dsp.dram) + dsp_addr;
}
static void gdsp_do_dma()
{
u32 addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL];
u16 ctl = g_dsp.ifx_regs[DSP_DSCR];
u16 dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2;
u16 len = g_dsp.ifx_regs[DSP_DSBL];
const u32 addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL];
const u16 ctl = g_dsp.ifx_regs[DSP_DSCR];
const u16 dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2;
const u16 len = g_dsp.ifx_regs[DSP_DSBL];
if (len > 0x4000)
{
ERROR_LOG(DSPLLE,
"DMA ERROR: PC: %04x, Control: %04x, Address: %08x, DSP Address: %04x, Size: %04x",
ERROR_LOG_FMT(DSPLLE,
"DMA ERROR: PC: {:04x}, Control: {:04x}, Address: {:08x}, DSP Address: {:04x}, "
"Size: {:04x}",
g_dsp.pc, ctl, addr, dsp_addr, len);
exit(0);
std::exit(0);
}
#if defined(_DEBUG) || defined(DEBUGFAST)
DEBUG_LOG(DSPLLE, "DMA pc: %04x, Control: %04x, Address: %08x, DSP Address: %04x, Size: %04x",
DEBUG_LOG_FMT(
DSPLLE, "DMA pc: {:04x}, Control: {:04x}, Address: {:08x}, DSP Address: {:04x}, Size: {:04x}",
g_dsp.pc, ctl, addr, dsp_addr, len);
#endif

View File

@ -24,7 +24,8 @@ u16 dsp_imem_read(u16 addr)
return g_dsp.irom[addr & DSP_IROM_MASK];
default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Executing from invalid (%04x) memory", g_dsp.pc, addr);
ERROR_LOG_FMT(DSPLLE, "{:04x} DSP ERROR: Executing from invalid ({:04x}) memory", g_dsp.pc,
addr);
return 0;
}
}
@ -37,14 +38,14 @@ u16 dsp_dmem_read(u16 addr)
return g_dsp.dram[addr & DSP_DRAM_MASK];
case 0x1: // 1xxx COEF
DEBUG_LOG(DSPLLE, "%04x : Coefficient Read @ %04x", g_dsp.pc, addr);
DEBUG_LOG_FMT(DSPLLE, "{:04x} : Coefficient Read @ {:04x}", g_dsp.pc, addr);
return g_dsp.coef[addr & DSP_COEF_MASK];
case 0xf: // Fxxx HW regs
return gdsp_ifx_read(addr);
default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory", g_dsp.pc, addr);
ERROR_LOG_FMT(DSPLLE, "{:04x} DSP ERROR: Read from UNKNOWN ({:04x}) memory", g_dsp.pc, addr);
return 0;
}
}
@ -62,7 +63,7 @@ void dsp_dmem_write(u16 addr, u16 val)
break;
default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Write to UNKNOWN (%04x) memory", g_dsp.pc, addr);
ERROR_LOG_FMT(DSPLLE, "{:04x} DSP ERROR: Write to UNKNOWN ({:04x}) memory", g_dsp.pc, addr);
break;
}
}

View File

@ -592,7 +592,7 @@ void InitInstructionTable()
// If the entry already in the table is a strict subset, allow it
if ((s_ext_op_table[i]->opcode_mask | iter->opcode_mask) != s_ext_op_table[i]->opcode_mask)
{
ERROR_LOG(DSPLLE, "opcode ext table place %zu already in use by %s when inserting %s", i,
ERROR_LOG_FMT(DSPLLE, "opcode ext table place {} already in use by {} when inserting {}", i,
s_ext_op_table[i]->name, iter->name);
}
}
@ -610,7 +610,7 @@ void InitInstructionTable()
if (s_op_table[i] == &cw)
s_op_table[i] = &*iter;
else
ERROR_LOG(DSPLLE, "opcode table place %zu already in use for %s", i, iter->name);
ERROR_LOG_FMT(DSPLLE, "opcode table place {} already in use for {}", i, iter->name);
}
writeBackLogIdx.fill(-1);

View File

@ -42,7 +42,7 @@ void WriteCR(u16 val)
// reset
if (val & 1)
{
INFO_LOG(DSPLLE, "DSP_CONTROL RESET");
INFO_LOG_FMT(DSPLLE, "DSP_CONTROL RESET");
DSPCore_Reset();
val &= ~1;
}
@ -51,7 +51,7 @@ void WriteCR(u16 val)
{
// HAX!
// OSInitAudioSystem ucode should send this mail - not DSP core itself
INFO_LOG(DSPLLE, "DSP_CONTROL INIT");
INFO_LOG_FMT(DSPLLE, "DSP_CONTROL INIT");
g_init_hax = true;
val |= 0x800;
}
@ -233,6 +233,6 @@ void nop(const UDSPInstruction opc)
if (opc == 0)
return;
ERROR_LOG(DSPLLE, "LLE: Unrecognized opcode 0x%04x", opc);
ERROR_LOG_FMT(DSPLLE, "LLE: Unrecognized opcode {:#06x}", opc);
}
} // namespace DSP::Interpreter

View File

@ -173,7 +173,7 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst)
m_gpr.PushRegs();
ABI_CallFunctionC16(interpreter_function, inst);
m_gpr.PopRegs();
INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x", inst);
INFO_LOG_FMT(DSPLLE, "Instruction not JITed(ext part): {:04x}", inst);
ext_is_jit = false;
}
}
@ -187,7 +187,7 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst)
else
{
FallBackToInterpreter(inst);
INFO_LOG(DSPLLE, "Instruction not JITed(main part): %04x", inst);
INFO_LOG_FMT(DSPLLE, "Instruction not JITed(main part): {:04x}", inst);
}
// Backlog
@ -359,7 +359,7 @@ void DSPEmitter::Compile(u16 start_addr)
{
// just a safeguard, should never happen anymore.
// if it does we might get stuck over in RunForCycles.
ERROR_LOG(DSPLLE, "Block at 0x%04x has zero size", start_addr);
ERROR_LOG_FMT(DSPLLE, "Block at {:#06x} has zero size", start_addr);
m_block_size[start_addr] = 1;
}

View File

@ -957,7 +957,7 @@ void DSPJitRegCache::GetXReg(X64Reg reg)
{
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
{
ERROR_LOG(DSPLLE, "Trying to get statically used XReg %d", reg);
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", reg);
return;
}
@ -973,7 +973,7 @@ void DSPJitRegCache::PutXReg(X64Reg reg)
{
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
{
ERROR_LOG(DSPLLE, "Trying to put statically used XReg %d", reg);
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", reg);
return;
}

View File

@ -4,6 +4,7 @@
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Core/DSP/DSPCore.h"
#include "Core/DSP/DSPHWInterface.h"
#include "Core/DSP/Jit/x64/DSPEmitter.h"
@ -554,7 +555,7 @@ void DSPEmitter::dmem_write_imm(u16 address, X64Reg value)
break;
}
default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Write to UNKNOWN (%04x) memory", g_dsp.pc, address);
ERROR_LOG_FMT(DSPLLE, "{:04x} DSP ERROR: Write to UNKNOWN ({:04x}) memory", g_dsp.pc, address);
break;
}
}
@ -642,7 +643,7 @@ void DSPEmitter::dmem_read_imm(u16 address)
break;
}
default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory", g_dsp.pc, address);
ERROR_LOG_FMT(DSPLLE, "{:04x} DSP ERROR: Read from UNKNOWN ({:04x}) memory", g_dsp.pc, address);
}
}

View File

@ -8,6 +8,7 @@
#include <string>
#include <vector>
#include "Common/Logging/Log.h"
#include "Core/DSP/DSPTables.h"
namespace DSP
@ -47,7 +48,7 @@ void LabelMap::RegisterLabel(std::string label, u16 lval, LabelType type)
const std::optional<u16> old_value = GetLabelValue(label);
if (old_value && old_value != lval)
{
printf("WARNING: Redefined label %s to %04x - old value %04x\n", label.c_str(), lval,
WARN_LOG_FMT(AUDIO, "Redefined label {} to {:04x} - old value {:04x}\n", label, lval,
*old_value);
DeleteLabel(label);
}
@ -65,7 +66,7 @@ void LabelMap::DeleteLabel(std::string_view label)
labels.erase(iter);
}
std::optional<u16> LabelMap::GetLabelValue(const std::string& name, LabelType type) const
std::optional<u16> LabelMap::GetLabelValue(std::string_view name, LabelType type) const
{
for (const auto& label : labels)
{
@ -77,7 +78,7 @@ std::optional<u16> LabelMap::GetLabelValue(const std::string& name, LabelType ty
}
else
{
printf("WARNING: Wrong label type requested. %s\n", name.c_str());
WARN_LOG_FMT(AUDIO, "Wrong label type requested. {}\n", name);
}
}
}

View File

@ -30,7 +30,7 @@ public:
void RegisterDefaults();
void RegisterLabel(std::string label, u16 lval, LabelType type = LABEL_VALUE);
void DeleteLabel(std::string_view label);
std::optional<u16> GetLabelValue(const std::string& label, LabelType type = LABEL_ANY) const;
std::optional<u16> GetLabelValue(std::string_view name, LabelType type = LABEL_ANY) const;
void Clear();
private:

View File

@ -100,52 +100,52 @@ bool GetCallstack(std::vector<CallstackEntry>& output)
void PrintCallstack()
{
printf("== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]);
fmt::print("== STACK TRACE - SP = {:08x} ==", PowerPC::ppcState.gpr[1]);
if (LR == 0)
{
printf(" LR = 0 - this is bad");
fmt::print(" LR = 0 - this is bad");
}
if (g_symbolDB.GetDescription(PC) != g_symbolDB.GetDescription(LR))
{
printf(" * %s [ LR = %08x ]", g_symbolDB.GetDescription(LR).c_str(), LR);
fmt::print(" * {} [ LR = {:08x} ]", g_symbolDB.GetDescription(LR), LR);
}
WalkTheStack([](u32 func_addr) {
std::string func_desc = g_symbolDB.GetDescription(func_addr);
if (func_desc.empty() || func_desc == "Invalid")
func_desc = "(unknown)";
printf(" * %s [ addr = %08x ]", func_desc.c_str(), func_addr);
fmt::print(" * {} [ addr = {:08x} ]", func_desc, func_addr);
});
}
void PrintCallstack(Common::Log::LOG_TYPE type, Common::Log::LOG_LEVELS level)
{
GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]);
GENERIC_LOG_FMT(type, level, "== STACK TRACE - SP = {:08x} ==", PowerPC::ppcState.gpr[1]);
if (LR == 0)
{
GENERIC_LOG(type, level, " LR = 0 - this is bad");
GENERIC_LOG_FMT(type, level, " LR = 0 - this is bad");
}
if (g_symbolDB.GetDescription(PC) != g_symbolDB.GetDescription(LR))
{
GENERIC_LOG(type, level, " * %s [ LR = %08x ]", g_symbolDB.GetDescription(LR).c_str(), LR);
GENERIC_LOG_FMT(type, level, " * {} [ LR = {:08x} ]", g_symbolDB.GetDescription(LR), LR);
}
WalkTheStack([type, level](u32 func_addr) {
std::string func_desc = g_symbolDB.GetDescription(func_addr);
if (func_desc.empty() || func_desc == "Invalid")
func_desc = "(unknown)";
GENERIC_LOG(type, level, " * %s [ addr = %08x ]", func_desc.c_str(), func_addr);
GENERIC_LOG_FMT(type, level, " * {} [ addr = {:08x} ]", func_desc, func_addr);
});
}
void PrintDataBuffer(Common::Log::LOG_TYPE type, const u8* data, size_t size,
const std::string& title)
std::string_view title)
{
GENERIC_LOG(type, Common::Log::LDEBUG, "%s", title.c_str());
GENERIC_LOG_FMT(type, Common::Log::LDEBUG, "{}", title);
for (u32 j = 0; j < size;)
{
std::string hex_line;
@ -156,7 +156,7 @@ void PrintDataBuffer(Common::Log::LOG_TYPE type, const u8* data, size_t size,
if (j >= size)
break;
}
GENERIC_LOG(type, Common::Log::LDEBUG, " Data: %s", hex_line.c_str());
GENERIC_LOG_FMT(type, Common::Log::LDEBUG, " Data: {}", hex_line);
}
}

View File

@ -5,6 +5,7 @@
#pragma once
#include <string>
#include <string_view>
#include <vector>
#include "Common/CommonTypes.h"
@ -22,7 +23,7 @@ bool GetCallstack(std::vector<CallstackEntry>& output);
void PrintCallstack();
void PrintCallstack(Common::Log::LOG_TYPE type, Common::Log::LOG_LEVELS level);
void PrintDataBuffer(Common::Log::LOG_TYPE type, const u8* data, size_t size,
const std::string& title);
std::string_view title);
void AddAutoBreakpoints();
} // namespace Dolphin_Debugger

View File

@ -329,33 +329,33 @@ void RSOView::LoadSections()
void RSOView::LoadImports()
{
std::size_t size = m_header.GetImportsSize();
const std::size_t size = m_header.GetImportsSize();
if (size % sizeof(RSOImport) != 0)
WARN_LOG(SYMBOLS, "RSO Imports Table has an incoherent size (%08zx)", size);
WARN_LOG_FMT(SYMBOLS, "RSO Imports Table has an incoherent size ({:08x})", size);
m_imports.Load(m_header.GetImportsOffset(), size / sizeof(RSOImport));
}
void RSOView::LoadExports()
{
std::size_t size = m_header.GetExportsSize();
const std::size_t size = m_header.GetExportsSize();
if (size % sizeof(RSOExport) != 0)
WARN_LOG(SYMBOLS, "RSO Exports Table has an incoherent size (%08zx)", size);
WARN_LOG_FMT(SYMBOLS, "RSO Exports Table has an incoherent size ({:08x})", size);
m_exports.Load(m_header.GetExportsOffset(), size / sizeof(RSOExport));
}
void RSOView::LoadInternals()
{
std::size_t size = m_header.GetInternalsSize();
const std::size_t size = m_header.GetInternalsSize();
if (size % sizeof(RSOInternalsEntry) != 0)
WARN_LOG(SYMBOLS, "RSO Internals Relocation Table has an incoherent size (%08zx)", size);
WARN_LOG_FMT(SYMBOLS, "RSO Internals Relocation Table has an incoherent size ({:08x})", size);
m_imports.Load(m_header.GetInternalsOffset(), size / sizeof(RSOInternalsEntry));
}
void RSOView::LoadExternals()
{
std::size_t size = m_header.GetExternalsSize();
const std::size_t size = m_header.GetExternalsSize();
if (size % sizeof(RSOExternalsEntry) != 0)
WARN_LOG(SYMBOLS, "RSO Externals Relocation Table has an incoherent size (%08zx)", size);
WARN_LOG_FMT(SYMBOLS, "RSO Externals Relocation Table has an incoherent size ({:08x})", size);
m_imports.Load(m_header.GetExternalsOffset(), size / sizeof(RSOExternalsEntry));
}
@ -393,7 +393,7 @@ void RSOView::Apply(PPCSymbolDB* symbol_db) const
}
}
}
DEBUG_LOG(SYMBOLS, "RSO(%s): %zu symbols applied", GetName().c_str(), GetExportsCount());
DEBUG_LOG_FMT(SYMBOLS, "RSO({}): {} symbols applied", GetName(), GetExportsCount());
}
u32 RSOView::GetNextEntry() const
@ -528,11 +528,11 @@ std::string RSOView::GetName(const RSOExport& rso_export) const
u32 RSOView::GetProlog() const
{
u32 section_index = m_header.GetPrologSectionIndex();
const u32 section_index = m_header.GetPrologSectionIndex();
if (section_index == 0)
WARN_LOG(SYMBOLS, "RSO doesn't have a prolog function");
WARN_LOG_FMT(SYMBOLS, "RSO doesn't have a prolog function");
else if (section_index >= m_sections.Count())
WARN_LOG(SYMBOLS, "RSO prolog section index out of bound");
WARN_LOG_FMT(SYMBOLS, "RSO prolog section index out of bound");
else
return GetSection(section_index).offset + m_header.GetPrologSectionOffset();
return 0;
@ -540,11 +540,11 @@ u32 RSOView::GetProlog() const
u32 RSOView::GetEpilog() const
{
u32 section_index = m_header.GetEpilogSectionIndex();
const u32 section_index = m_header.GetEpilogSectionIndex();
if (section_index == 0)
WARN_LOG(SYMBOLS, "RSO doesn't have an epilog function");
WARN_LOG_FMT(SYMBOLS, "RSO doesn't have an epilog function");
else if (section_index >= m_sections.Count())
WARN_LOG(SYMBOLS, "RSO epilog section index out of bound");
WARN_LOG_FMT(SYMBOLS, "RSO epilog section index out of bound");
else
return GetSection(section_index).offset + m_header.GetEpilogSectionOffset();
return 0;
@ -552,11 +552,11 @@ u32 RSOView::GetEpilog() const
u32 RSOView::GetUnresolved() const
{
u32 section_index = m_header.GetUnresolvedSectionIndex();
const u32 section_index = m_header.GetUnresolvedSectionIndex();
if (section_index == 0)
WARN_LOG(SYMBOLS, "RSO doesn't have a unresolved function");
WARN_LOG_FMT(SYMBOLS, "RSO doesn't have a unresolved function");
else if (section_index >= m_sections.Count())
WARN_LOG(SYMBOLS, "RSO unresolved section index out of bound");
WARN_LOG_FMT(SYMBOLS, "RSO unresolved section index out of bound");
else
return GetSection(section_index).offset + m_header.GetUnresolvedSectionOffset();
return 0;
@ -567,7 +567,7 @@ bool RSOChainView::Load(u32 address)
// Load node
RSOView node;
node.LoadHeader(address);
DEBUG_LOG(SYMBOLS, "RSOChain node name: %s", node.GetName().c_str());
DEBUG_LOG_FMT(SYMBOLS, "RSOChain node name: {}", node.GetName());
m_chain.emplace_front(std::move(node));
if (LoadNextChain(m_chain.front()) && LoadPrevChain(m_chain.front()))
@ -613,8 +613,8 @@ bool RSOChainView::LoadNextChain(const RSOView& view)
if (prev_address != next_node.GetPrevEntry())
{
ERROR_LOG(SYMBOLS, "RSOChain has an incoherent previous link %08x != %08x in %s",
prev_address, next_node.GetPrevEntry(), next_node.GetName().c_str());
ERROR_LOG_FMT(SYMBOLS, "RSOChain has an incoherent previous link {:08x} != {:08x} in {}",
prev_address, next_node.GetPrevEntry(), next_node.GetName());
return false;
}
@ -638,8 +638,8 @@ bool RSOChainView::LoadPrevChain(const RSOView& view)
if (next_address != prev_node.GetNextEntry())
{
ERROR_LOG(SYMBOLS, "RSOChain has an incoherent next link %08x != %08x in %s", next_address,
prev_node.GetNextEntry(), prev_node.GetName().c_str());
ERROR_LOG_FMT(SYMBOLS, "RSOChain has an incoherent next link {:08x} != {:08x} in {}",
next_address, prev_node.GetNextEntry(), prev_node.GetName());
return false;
}

View File

@ -121,13 +121,14 @@ static Installation InstallCodeHandlerLocked()
std::string data;
if (!File::ReadFileToString(File::GetSysDirectory() + GECKO_CODE_HANDLER, data))
{
ERROR_LOG(ACTIONREPLAY, "Could not enable cheats because " GECKO_CODE_HANDLER " was missing.");
ERROR_LOG_FMT(ACTIONREPLAY,
"Could not enable cheats because " GECKO_CODE_HANDLER " was missing.");
return Installation::Failed;
}
if (data.size() > INSTALLER_END_ADDRESS - INSTALLER_BASE_ADDRESS - CODE_SIZE)
{
ERROR_LOG(ACTIONREPLAY, GECKO_CODE_HANDLER " is too big. The file may be corrupt.");
ERROR_LOG_FMT(ACTIONREPLAY, GECKO_CODE_HANDLER " is too big. The file may be corrupt.");
return Installation::Failed;
}
@ -147,7 +148,7 @@ static Installation InstallCodeHandlerLocked()
// Patch MMIO address
if (PowerPC::HostRead_U32(INSTALLER_BASE_ADDRESS + h) == (0x3f000000u | ((mmio_addr ^ 1) << 8)))
{
NOTICE_LOG(ACTIONREPLAY, "Patching MMIO access at %08x", INSTALLER_BASE_ADDRESS + h);
NOTICE_LOG_FMT(ACTIONREPLAY, "Patching MMIO access at {:08x}", INSTALLER_BASE_ADDRESS + h);
PowerPC::HostWrite_U32(0x3f000000u | mmio_addr << 8, INSTALLER_BASE_ADDRESS + h);
}
}
@ -175,10 +176,10 @@ static Installation InstallCodeHandlerLocked()
// If the code is not going to fit in the space we have left then we have to skip it
if (next_address + active_code.codes.size() * CODE_SIZE > end_address)
{
NOTICE_LOG(ACTIONREPLAY,
NOTICE_LOG_FMT(ACTIONREPLAY,
"Too many GeckoCodes! Ran out of storage space in Game RAM. Could "
"not write: \"%s\". Need %zu bytes, only %u remain.",
active_code.name.c_str(), active_code.codes.size() * CODE_SIZE,
"not write: \"{}\". Need {} bytes, only {} remain.",
active_code.name, active_code.codes.size() * CODE_SIZE,
end_address - next_address);
continue;
}
@ -191,7 +192,7 @@ static Installation InstallCodeHandlerLocked()
}
}
WARN_LOG(ACTIONREPLAY, "GeckoCodes: Using %u of %u bytes", next_address - start_address,
WARN_LOG_FMT(ACTIONREPLAY, "GeckoCodes: Using {} of {} bytes", next_address - start_address,
end_address - start_address);
// Stop code. Tells the handler that this is the end of the list.
@ -275,9 +276,9 @@ void RunCodeHandler()
PowerPC::HostWrite_U64(rPS(i).PS0AsU64(), SP + 24 + 2 * i * sizeof(u64));
PowerPC::HostWrite_U64(rPS(i).PS1AsU64(), SP + 24 + (2 * i + 1) * sizeof(u64));
}
DEBUG_LOG(ACTIONREPLAY,
DEBUG_LOG_FMT(ACTIONREPLAY,
"GeckoCodes: Initiating phantom branch-and-link. "
"PC = 0x%08X, SP = 0x%08X, SFP = 0x%08X",
"PC = {:#010x}, SP = {:#010x}, SFP = {:#010x}",
PC, SP, SFP);
LR = HLE_TRAMPOLINE_ADDRESS;
PC = NPC = ENTRY_POINT;

View File

@ -104,7 +104,7 @@ static void CheckKR(const char* name, kern_return_t kr)
{
if (kr)
{
PanicAlert("%s failed: kr=%x", name, kr);
PanicAlertFmt("{} failed: kr={:x}", name, kr);
}
}
@ -159,13 +159,13 @@ static void ExceptionThread(mach_port_t port)
if (msg_in.Head.msgh_id != 2406)
{
PanicAlert("unknown message received");
PanicAlertFmt("unknown message received");
return;
}
if (msg_in.flavor != x86_THREAD_STATE64)
{
PanicAlert("unknown flavor %d (expected %d)", msg_in.flavor, x86_THREAD_STATE64);
PanicAlertFmt("unknown flavor {} (expected {})", msg_in.flavor, x86_THREAD_STATE64);
return;
}

View File

@ -28,6 +28,7 @@
#include "Common/File.h"
#include "Common/FileUtil.h"
#include "Common/Hash.h"
#include "Common/MsgHandler.h"
#include "Common/NandPaths.h"
#include "Common/StringUtil.h"
#include "Common/Timer.h"
@ -228,8 +229,8 @@ void Init(const BootParameters& boot)
md5thread.detach();
if (strncmp(tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6))
{
PanicAlertT("The recorded game (%s) is not the same as the selected game (%s)",
tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID().c_str());
PanicAlertFmtT("The recorded game ({0}) is not the same as the selected game ({1})",
tmpHeader.gameID.data(), SConfig::GetInstance().GetGameID());
EndPlayInput(false);
}
}
@ -369,9 +370,9 @@ void SignalDiscChange(const std::string& new_path)
constexpr size_t maximum_length = sizeof(DTMHeader::discChange);
if (filename.length() > maximum_length)
{
PanicAlertT("The disc change to \"%s\" could not be saved in the .dtm file.\n"
PanicAlertFmtT("The disc change to \"{0}\" could not be saved in the .dtm file.\n"
"The filename of the disc image must not be longer than 40 characters.",
filename.c_str());
filename);
}
s_discChange = filename;
s_bDiscChange = true;
@ -884,7 +885,7 @@ bool PlayInput(const std::string& movie_path, std::optional<std::string>* savest
if (!IsMovieHeader(tmpHeader.filetype))
{
PanicAlertT("Invalid recording file");
PanicAlertFmtT("Invalid recording file");
return false;
}
@ -941,7 +942,7 @@ void LoadInput(const std::string& movie_path)
File::IOFile t_record;
if (!t_record.Open(movie_path, "r+b"))
{
PanicAlertT("Failed to read %s", movie_path.c_str());
PanicAlertFmtT("Failed to read {0}", movie_path);
EndPlayInput(false);
return;
}
@ -950,7 +951,7 @@ void LoadInput(const std::string& movie_path)
if (!IsMovieHeader(tmpHeader.filetype))
{
PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", movie_path.c_str());
PanicAlertFmtT("Savestate movie {0} is corrupted, movie recording stopping...", movie_path);
EndPlayInput(false);
return;
}
@ -973,10 +974,10 @@ void LoadInput(const std::string& movie_path)
// This can only happen if the user manually deletes data from the dtm.
if (s_currentByte > totalSavedBytes)
{
PanicAlertT("Warning: You loaded a save whose movie ends before the current frame in the save "
"(byte %u < %u) (frame %u < %u). You should load another save before continuing.",
(u32)totalSavedBytes + 256, (u32)s_currentByte + 256, (u32)tmpHeader.frameCount,
(u32)s_currentFrame);
PanicAlertFmtT(
"Warning: You loaded a save whose movie ends before the current frame in the save "
"(byte {0} < {1}) (frame {2} < {3}). You should load another save before continuing.",
totalSavedBytes + 256, s_currentByte + 256, tmpHeader.frameCount, s_currentFrame);
afterEnd = true;
}
@ -998,11 +999,11 @@ void LoadInput(const std::string& movie_path)
else if (s_currentByte > s_temp_input.size())
{
afterEnd = true;
PanicAlertT("Warning: You loaded a save that's after the end of the current movie. (byte %u "
"> %zu) (input %u > %u). You should load another save before continuing, or load "
PanicAlertFmtT(
"Warning: You loaded a save that's after the end of the current movie. (byte {0} "
"> {1}) (input {2} > {3}). You should load another save before continuing, or load "
"this state with read-only mode off.",
(u32)s_currentByte + 256, s_temp_input.size() + 256, (u32)s_currentInputCount,
(u32)s_totalInputCount);
s_currentByte + 256, s_temp_input.size() + 256, s_currentInputCount, s_totalInputCount);
}
else if (s_currentByte > 0 && !s_temp_input.empty())
{
@ -1024,7 +1025,7 @@ void LoadInput(const std::string& movie_path)
const size_t byte_offset = static_cast<size_t>(mismatch_index) + sizeof(DTMHeader);
// TODO: more detail
PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %zu (0x%zX). "
PanicAlertFmtT("Warning: You loaded a save whose movie mismatches on byte {0} ({1:#x}). "
"You should load another save before continuing, or load this state with "
"read-only mode off. Otherwise you'll probably get a desync.",
byte_offset, byte_offset);
@ -1040,33 +1041,32 @@ void LoadInput(const std::string& movie_path)
ControllerState movPadState;
memcpy(&movPadState, &s_temp_input[frame * sizeof(ControllerState)],
sizeof(ControllerState));
PanicAlertT(
"Warning: You loaded a save whose movie mismatches on frame %td. You should load "
PanicAlertFmtT(
"Warning: You loaded a save whose movie mismatches on frame {0}. You should load "
"another save before continuing, or load this state with read-only mode off. "
"Otherwise you'll probably get a desync.\n\n"
"More information: The current movie is %d frames long and the savestate's movie "
"is %d frames long.\n\n"
"On frame %td, the current movie presses:\n"
"Start=%d, A=%d, B=%d, X=%d, Y=%d, Z=%d, DUp=%d, DDown=%d, DLeft=%d, DRight=%d, "
"L=%d, R=%d, LT=%d, RT=%d, AnalogX=%d, AnalogY=%d, CX=%d, CY=%d, Connected=%d"
"More information: The current movie is {1} frames long and the savestate's movie "
"is {2} frames long.\n\n"
"On frame {3}, the current movie presses:\n"
"Start={4}, A={5}, B={6}, X={7}, Y={8}, Z={9}, DUp={10}, DDown={11}, DLeft={12}, "
"DRight={13}, L={14}, R={15}, LT={16}, RT={17}, AnalogX={18}, AnalogY={19}, CX={20}, "
"CY={21}, Connected={22}"
"\n\n"
"On frame %td, the savestate's movie presses:\n"
"Start=%d, A=%d, B=%d, X=%d, Y=%d, Z=%d, DUp=%d, DDown=%d, DLeft=%d, DRight=%d, "
"L=%d, R=%d, LT=%d, RT=%d, AnalogX=%d, AnalogY=%d, CX=%d, CY=%d, Connected=%d",
frame, (int)s_totalFrames, (int)tmpHeader.frameCount, frame, (int)curPadState.Start,
(int)curPadState.A, (int)curPadState.B, (int)curPadState.X, (int)curPadState.Y,
(int)curPadState.Z, (int)curPadState.DPadUp, (int)curPadState.DPadDown,
(int)curPadState.DPadLeft, (int)curPadState.DPadRight, (int)curPadState.L,
(int)curPadState.R, (int)curPadState.TriggerL, (int)curPadState.TriggerR,
(int)curPadState.AnalogStickX, (int)curPadState.AnalogStickY,
(int)curPadState.CStickX, (int)curPadState.CStickY, (int)curPadState.is_connected,
frame, (int)movPadState.Start, (int)movPadState.A, (int)movPadState.B,
(int)movPadState.X, (int)movPadState.Y, (int)movPadState.Z, (int)movPadState.DPadUp,
(int)movPadState.DPadDown, (int)movPadState.DPadLeft, (int)movPadState.DPadRight,
(int)movPadState.L, (int)movPadState.R, (int)movPadState.TriggerL,
(int)movPadState.TriggerR, (int)movPadState.AnalogStickX,
(int)movPadState.AnalogStickY, (int)movPadState.CStickX, (int)movPadState.CStickY,
(int)curPadState.is_connected);
"On frame {23}, the savestate's movie presses:\n"
"Start={24}, A={25}, B={26}, X={27}, Y={28}, Z={29}, DUp={30}, DDown={31}, "
"DLeft={32}, DRight={33}, L={34}, R={35}, LT={36}, RT={37}, AnalogX={38}, "
"AnalogY={39}, CX={40}, CY={41}, Connected={42}",
frame, s_totalFrames, tmpHeader.frameCount, frame, curPadState.Start, curPadState.A,
curPadState.B, curPadState.X, curPadState.Y, curPadState.Z, curPadState.DPadUp,
curPadState.DPadDown, curPadState.DPadLeft, curPadState.DPadRight, curPadState.L,
curPadState.R, curPadState.TriggerL, curPadState.TriggerR, curPadState.AnalogStickX,
curPadState.AnalogStickY, curPadState.CStickX, curPadState.CStickY,
curPadState.is_connected, frame, movPadState.Start, movPadState.A, movPadState.B,
movPadState.X, movPadState.Y, movPadState.Z, movPadState.DPadUp, movPadState.DPadDown,
movPadState.DPadLeft, movPadState.DPadRight, movPadState.L, movPadState.R,
movPadState.TriggerL, movPadState.TriggerR, movPadState.AnalogStickX,
movPadState.AnalogStickY, movPadState.CStickX, movPadState.CStickY,
curPadState.is_connected);
}
}
}
@ -1122,7 +1122,7 @@ void PlayController(GCPadStatus* PadStatus, int controllerID)
if (s_currentByte + sizeof(ControllerState) > s_temp_input.size())
{
PanicAlertT("Premature movie end in PlayController. %u + %zu > %zu", (u32)s_currentByte,
PanicAlertFmtT("Premature movie end in PlayController. {0} + {1} > {2}", s_currentByte,
sizeof(ControllerState), s_temp_input.size());
EndPlayInput(!s_bReadOnly);
return;
@ -1187,7 +1187,7 @@ void PlayController(GCPadStatus* PadStatus, int controllerID)
if (!DVDInterface::AutoChangeDisc())
{
CPU::Break();
PanicAlertT("Change the disc to %s", s_discChange.c_str());
PanicAlertFmtT("Change the disc to {0}", s_discChange);
}
});
}
@ -1208,7 +1208,7 @@ bool PlayWiimote(int wiimote, WiimoteCommon::DataReportBuilder& rpt, int ext,
if (s_currentByte > s_temp_input.size())
{
PanicAlertT("Premature movie end in PlayWiimote. %u > %zu", (u32)s_currentByte,
PanicAlertFmtT("Premature movie end in PlayWiimote. {0} > {1}", s_currentByte,
s_temp_input.size());
EndPlayInput(!s_bReadOnly);
return false;
@ -1219,10 +1219,10 @@ bool PlayWiimote(int wiimote, WiimoteCommon::DataReportBuilder& rpt, int ext,
if (size != sizeInMovie)
{
PanicAlertT("Fatal desync. Aborting playback. (Error in PlayWiimote: %u != %u, byte %u.)%s",
(u32)sizeInMovie, (u32)size, (u32)s_currentByte,
(s_controllers & 0xF) ?
" Try re-creating the recording with all GameCube controllers "
PanicAlertFmtT(
"Fatal desync. Aborting playback. (Error in PlayWiimote: {0} != {1}, byte {2}.){3}",
sizeInMovie, size, s_currentByte,
(s_controllers & 0xF) ? " Try re-creating the recording with all GameCube controllers "
"disabled (in Configure > GameCube > Device Settings)." :
"");
EndPlayInput(!s_bReadOnly);
@ -1233,7 +1233,7 @@ bool PlayWiimote(int wiimote, WiimoteCommon::DataReportBuilder& rpt, int ext,
if (s_currentByte + size > s_temp_input.size())
{
PanicAlertT("Premature movie end in PlayWiimote. %u + %d > %zu", (u32)s_currentByte, size,
PanicAlertFmtT("Premature movie end in PlayWiimote. {0} + {1} > {2}", s_currentByte, size,
s_temp_input.size());
EndPlayInput(!s_bReadOnly);
return false;

View File

@ -309,7 +309,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
MessageId mid;
packet >> mid;
INFO_LOG(NETPLAY, "Got server message: %x", mid);
INFO_LOG_FMT(NETPLAY, "Got server message: {:x}", mid);
switch (mid)
{
@ -320,8 +320,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> player.name;
packet >> player.revision;
INFO_LOG(NETPLAY, "Player %s (%d) using %s joined", player.name.c_str(), player.pid,
player.revision.c_str());
INFO_LOG_FMT(NETPLAY, "Player {} ({}) using {} joined", player.name, player.pid,
player.revision);
{
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
@ -346,7 +346,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
break;
const auto& player = it->second;
INFO_LOG(NETPLAY, "Player %s (%d) left", player.name.c_str(), pid);
INFO_LOG_FMT(NETPLAY, "Player {} ({}) left", player.name, pid);
m_dialog->OnPlayerDisconnect(player.name);
m_players.erase(m_players.find(pid));
}
@ -365,7 +365,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
// don't need lock to read in this thread
const Player& player = m_players[pid];
INFO_LOG(NETPLAY, "Player %s (%d) wrote: %s", player.name.c_str(), player.pid, msg.c_str());
INFO_LOG_FMT(NETPLAY, "Player {} ({}) wrote: {}", player.name, player.pid, msg);
// add to gui
std::ostringstream ss;
@ -596,7 +596,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> netplay_name;
}
INFO_LOG(NETPLAY, "Game changed to %s", netplay_name.c_str());
INFO_LOG_FMT(NETPLAY, "Game changed to {}", netplay_name);
// update gui
m_dialog->OnMsgChangeGame(m_selected_game, netplay_name);
@ -641,7 +641,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> m_current_game;
packet >> m_net_settings.m_CPUthread;
INFO_LOG(NETPLAY, "Start of game %s", m_selected_game.game_id.c_str());
INFO_LOG_FMT(NETPLAY, "Start of game {}", m_selected_game.game_id);
{
std::underlying_type_t<PowerPC::CPUCore> core;
@ -735,7 +735,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
case NP_MSG_STOP_GAME:
case NP_MSG_DISABLE_GAME:
{
INFO_LOG(NETPLAY, "Game stopped");
INFO_LOG_FMT(NETPLAY, "Game stopped");
StopGame();
m_dialog->OnMsgStopGame();
@ -792,7 +792,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
player = it->second.name;
}
INFO_LOG(NETPLAY, "Player %s (%d) desynced!", player.c_str(), pid_to_blame);
INFO_LOG_FMT(NETPLAY, "Player {} ({}) desynced!", player, pid_to_blame);
m_dialog->OnDesync(frame, player);
}
@ -851,7 +851,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
(is_slot_a ? "A." : "B.") + region + (mc251 ? ".251" : "") + ".raw";
if (File::Exists(path) && !File::Delete(path))
{
PanicAlertT("Failed to delete NetPlay memory card. Verify your write permissions.");
PanicAlertFmtT("Failed to delete NetPlay memory card. Verify your write permissions.");
SyncSaveDataResponse(false);
return 0;
}
@ -876,7 +876,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
if ((File::Exists(path) && !File::DeleteDirRecursively(path + DIR_SEP)) ||
!File::CreateFullPath(path + DIR_SEP))
{
PanicAlertT("Failed to reset NetPlay GCI folder. Verify your write permissions.");
PanicAlertFmtT("Failed to reset NetPlay GCI folder. Verify your write permissions.");
SyncSaveDataResponse(false);
return 0;
}
@ -906,7 +906,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
if (File::Exists(path) && !File::DeleteDirRecursively(path))
{
PanicAlertT("Failed to reset NetPlay NAND folder. Verify your write permissions.");
PanicAlertFmtT("Failed to reset NetPlay NAND folder. Verify your write permissions.");
SyncSaveDataResponse(false);
return 0;
}
@ -932,7 +932,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
if (!buffer || !file || !file->Write(buffer->data(), buffer->size()))
{
PanicAlertT("Failed to write Mii data.");
PanicAlertFmtT("Failed to write Mii data.");
SyncSaveDataResponse(false);
return 0;
}
@ -1013,7 +1013,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
if (!save->WriteHeader(header) || !save->WriteBkHeader(bk_header) ||
!save->WriteFiles(files))
{
PanicAlertT("Failed to write Wii save.");
PanicAlertFmtT("Failed to write Wii save.");
SyncSaveDataResponse(false);
return 0;
}
@ -1025,7 +1025,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
break;
default:
PanicAlertT("Unknown SYNC_SAVE_DATA message received with id: %d", sub_id);
PanicAlertFmtT("Unknown SYNC_SAVE_DATA message received with id: {0}", sub_id);
break;
}
}
@ -1059,7 +1059,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
m_sync_gecko_codes_success_count = 0;
NOTICE_LOG(ACTIONREPLAY, "Receiving %d Gecko codelines", m_sync_gecko_codes_count);
NOTICE_LOG_FMT(ACTIONREPLAY, "Receiving {} Gecko codelines", m_sync_gecko_codes_count);
// Check if no codes to sync, if so return as finished
if (m_sync_gecko_codes_count == 0)
@ -1068,8 +1068,10 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
SyncCodeResponse(true);
}
else
{
m_dialog->AppendChat(Common::GetStringT("Synchronizing Gecko codes..."));
}
}
break;
case SYNC_CODES_DATA_GECKO:
@ -1094,7 +1096,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> new_code.address;
packet >> new_code.data;
NOTICE_LOG(ACTIONREPLAY, "Received %08x %08x", new_code.address, new_code.data);
NOTICE_LOG_FMT(ACTIONREPLAY, "Received {:08x} {:08x}", new_code.address, new_code.data);
gcode.codes.push_back(std::move(new_code));
@ -1128,7 +1130,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
m_sync_ar_codes_success_count = 0;
NOTICE_LOG(ACTIONREPLAY, "Receiving %d AR codelines", m_sync_ar_codes_count);
NOTICE_LOG_FMT(ACTIONREPLAY, "Receiving {} AR codelines", m_sync_ar_codes_count);
// Check if no codes to sync, if so return as finished
if (m_sync_ar_codes_count == 0)
@ -1137,8 +1139,10 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
SyncCodeResponse(true);
}
else
{
m_dialog->AppendChat(Common::GetStringT("Synchronizing AR codes..."));
}
}
break;
case SYNC_CODES_DATA_AR:
@ -1163,7 +1167,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
packet >> new_code.cmd_addr;
packet >> new_code.value;
NOTICE_LOG(ACTIONREPLAY, "Received %08x %08x", new_code.cmd_addr, new_code.value);
NOTICE_LOG_FMT(ACTIONREPLAY, "Received {:08x} {:08x}", new_code.cmd_addr, new_code.value);
arcode.ops.push_back(new_code);
if (++m_sync_ar_codes_success_count >= m_sync_ar_codes_count)
@ -1238,7 +1242,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
break;
default:
PanicAlertT("Unknown message received with id : %d", mid);
PanicAlertFmtT("Unknown message received with id : {0}", mid);
break;
}
@ -1500,7 +1504,7 @@ bool NetPlayClient::StartGame(const std::string& path)
if (m_is_running.IsSet())
{
PanicAlertT("Game is already running!");
PanicAlertFmtT("Game is already running!");
return false;
}
@ -1609,7 +1613,7 @@ bool NetPlayClient::DecompressPacketIntoFile(sf::Packet& packet, const std::stri
File::IOFile file(file_path, "wb");
if (!file)
{
PanicAlertT("Failed to open file \"%s\". Verify your write permissions.", file_path.c_str());
PanicAlertFmtT("Failed to open file \"{0}\". Verify your write permissions.", file_path);
return false;
}
@ -1633,13 +1637,13 @@ bool NetPlayClient::DecompressPacketIntoFile(sf::Packet& packet, const std::stri
if (lzo1x_decompress(in_buffer.data(), cur_len, out_buffer.data(), &new_len, nullptr) !=
LZO_E_OK)
{
PanicAlertT("Internal LZO Error - decompression failed");
PanicAlertFmtT("Internal LZO Error - decompression failed");
return false;
}
if (!file.WriteBytes(out_buffer.data(), new_len))
{
PanicAlertT("Error writing file: %s", file_path.c_str());
PanicAlertFmtT("Error writing file: {0}", file_path);
return false;
}
}
@ -1675,7 +1679,7 @@ std::optional<std::vector<u8>> NetPlayClient::DecompressPacketIntoBuffer(sf::Pac
if (lzo1x_decompress(in_buffer.data(), cur_len, &out_buffer[i], &new_len, nullptr) != LZO_E_OK)
{
PanicAlertT("Internal LZO Error - decompression failed");
PanicAlertFmtT("Internal LZO Error - decompression failed");
return {};
}
@ -1782,16 +1786,16 @@ void NetPlayClient::OnConnectFailed(u8 reason)
switch (reason)
{
case TraversalConnectFailedClientDidntRespond:
PanicAlertT("Traversal server timed out connecting to the host");
PanicAlertFmtT("Traversal server timed out connecting to the host");
break;
case TraversalConnectFailedClientFailure:
PanicAlertT("Server rejected traversal attempt");
PanicAlertFmtT("Server rejected traversal attempt");
break;
case TraversalConnectFailedNoSuchClient:
PanicAlertT("Invalid host");
PanicAlertFmtT("Invalid host");
break;
default:
PanicAlertT("Unknown error %x", reason);
PanicAlertFmtT("Unknown error {0:x}", reason);
break;
}
}
@ -2006,7 +2010,7 @@ bool NetPlayClient::WiimoteUpdate(int _number, u8* data, const std::size_t size,
// If it still mismatches, it surely desynced
if (nw.report_id != reporting_mode)
{
PanicAlertT("Netplay has desynced. There is no way to recover from this.");
PanicAlertFmtT("Netplay has desynced. There is no way to recover from this.");
return false;
}
}
@ -2504,7 +2508,7 @@ bool Wiimote::NetPlay_GetButtonPress(int wiimote, bool pressed)
{
return data[0];
}
PanicAlertT("Netplay has desynced in NetPlay_GetButtonPress()");
PanicAlertFmtT("Netplay has desynced in NetPlay_GetButtonPress()");
return false;
}

View File

@ -109,7 +109,7 @@ NetPlayServer::NetPlayServer(const u16 port, const bool forward_port, NetPlayUI*
//--use server time
if (enet_initialize() != 0)
{
PanicAlertT("Enet Didn't Initialize");
PanicAlertFmtT("Enet Didn't Initialize");
}
m_pad_map.fill(0);
@ -275,7 +275,7 @@ void NetPlayServer::ThreadFunc()
{
// Actual client initialization is deferred to the receive event, so here
// we'll just log the new connection.
INFO_LOG(NETPLAY, "Peer connected from: %x:%u", netEvent.peer->address.host,
INFO_LOG_FMT(NETPLAY, "Peer connected from: {:x}:{}", netEvent.peer->address.host,
netEvent.peer->address.port);
}
break;
@ -678,7 +678,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
MessageId mid;
packet >> mid;
INFO_LOG(NETPLAY, "Got client message: %x", mid);
INFO_LOG_FMT(NETPLAY, "Got client message: {:x}", mid);
// don't need lock because this is the only thread that modifies the players
// only need locks for writes to m_players in this thread
@ -1121,8 +1121,8 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
break;
default:
PanicAlertT(
"Unknown SYNC_GECKO_CODES message with id:%d received from player:%d Kicking player!",
PanicAlertFmtT(
"Unknown SYNC_GECKO_CODES message with id:{0} received from player:{1} Kicking player!",
sub_id, player.pid);
return 1;
}
@ -1130,7 +1130,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
break;
default:
PanicAlertT("Unknown message with id:%d received from player:%d Kicking player!", mid,
PanicAlertFmtT("Unknown message with id:{0} received from player:{1} Kicking player!", mid,
player.pid);
// unknown message, kick the client
return 1;
@ -1232,7 +1232,7 @@ bool NetPlayServer::RequestStartGame()
m_start_pending = true;
if (!SyncSaveData())
{
PanicAlertT("Error synchronizing save data!");
PanicAlertFmtT("Error synchronizing save data!");
m_start_pending = false;
return false;
}
@ -1245,7 +1245,7 @@ bool NetPlayServer::RequestStartGame()
m_start_pending = true;
if (!SyncCodes())
{
PanicAlertT("Error synchronizing cheat codes!");
PanicAlertFmtT("Error synchronizing cheat codes!");
m_start_pending = false;
return false;
}
@ -1638,7 +1638,7 @@ bool NetPlayServer::SyncCodes()
const auto game = m_dialog->FindGameFile(m_selected_game_identifier);
if (game == nullptr)
{
PanicAlertT("Selected game doesn't exist in game list!");
PanicAlertFmtT("Selected game doesn't exist in game list!");
return false;
}
@ -1672,16 +1672,16 @@ bool NetPlayServer::SyncCodes()
u16 codelines = 0;
for (const Gecko::GeckoCode& active_code : s_active_codes)
{
NOTICE_LOG(ACTIONREPLAY, "Indexing %s", active_code.name.c_str());
NOTICE_LOG_FMT(ACTIONREPLAY, "Indexing {}", active_code.name);
for (const Gecko::GeckoCode::Code& code : active_code.codes)
{
NOTICE_LOG(ACTIONREPLAY, "%08x %08x", code.address, code.data);
NOTICE_LOG_FMT(ACTIONREPLAY, "{:08x} {:08x}", code.address, code.data);
codelines++;
}
}
// Output codelines to send
NOTICE_LOG(ACTIONREPLAY, "Sending %d Gecko codelines", codelines);
NOTICE_LOG_FMT(ACTIONREPLAY, "Sending {} Gecko codelines", codelines);
// Send initial packet. Notify of the sync operation and total number of lines being sent.
{
@ -1700,10 +1700,10 @@ bool NetPlayServer::SyncCodes()
// Iterate through the active code vector and send each codeline
for (const Gecko::GeckoCode& active_code : s_active_codes)
{
NOTICE_LOG(ACTIONREPLAY, "Sending %s", active_code.name.c_str());
NOTICE_LOG_FMT(ACTIONREPLAY, "Sending {}", active_code.name);
for (const Gecko::GeckoCode::Code& code : active_code.codes)
{
NOTICE_LOG(ACTIONREPLAY, "%08x %08x", code.address, code.data);
NOTICE_LOG_FMT(ACTIONREPLAY, "{:08x} {:08x}", code.address, code.data);
pac << code.address;
pac << code.data;
}
@ -1722,16 +1722,16 @@ bool NetPlayServer::SyncCodes()
u16 codelines = 0;
for (const ActionReplay::ARCode& active_code : s_active_codes)
{
NOTICE_LOG(ACTIONREPLAY, "Indexing %s", active_code.name.c_str());
NOTICE_LOG_FMT(ACTIONREPLAY, "Indexing {}", active_code.name);
for (const ActionReplay::AREntry& op : active_code.ops)
{
NOTICE_LOG(ACTIONREPLAY, "%08x %08x", op.cmd_addr, op.value);
NOTICE_LOG_FMT(ACTIONREPLAY, "{:08x} {:08x}", op.cmd_addr, op.value);
codelines++;
}
}
// Output codelines to send
NOTICE_LOG(ACTIONREPLAY, "Sending %d AR codelines", codelines);
NOTICE_LOG_FMT(ACTIONREPLAY, "Sending {} AR codelines", codelines);
// Send initial packet. Notify of the sync operation and total number of lines being sent.
{
@ -1750,10 +1750,10 @@ bool NetPlayServer::SyncCodes()
// Iterate through the active code vector and send each codeline
for (const ActionReplay::ARCode& active_code : s_active_codes)
{
NOTICE_LOG(ACTIONREPLAY, "Sending %s", active_code.name.c_str());
NOTICE_LOG_FMT(ACTIONREPLAY, "Sending {}", active_code.name);
for (const ActionReplay::AREntry& op : active_code.ops)
{
NOTICE_LOG(ACTIONREPLAY, "%08x %08x", op.cmd_addr, op.value);
NOTICE_LOG_FMT(ACTIONREPLAY, "{:08x} {:08x}", op.cmd_addr, op.value);
pac << op.cmd_addr;
pac << op.value;
}
@ -1778,7 +1778,7 @@ bool NetPlayServer::CompressFileIntoPacket(const std::string& file_path, sf::Pac
File::IOFile file(file_path, "rb");
if (!file)
{
PanicAlertT("Failed to open file \"%s\".", file_path.c_str());
PanicAlertFmtT("Failed to open file \"{0}\".", file_path);
return false;
}
@ -1812,14 +1812,14 @@ bool NetPlayServer::CompressFileIntoPacket(const std::string& file_path, sf::Pac
if (!file.ReadBytes(in_buffer.data(), cur_len))
{
PanicAlertT("Error reading file: %s", file_path.c_str());
PanicAlertFmtT("Error reading file: {0}", file_path.c_str());
return false;
}
if (lzo1x_1_compress(in_buffer.data(), cur_len, out_buffer.data(), &out_len, wrkmem.data()) !=
LZO_E_OK)
{
PanicAlertT("Internal LZO Error - compression failed");
PanicAlertFmtT("Internal LZO Error - compression failed");
return false;
}
@ -1874,7 +1874,7 @@ bool NetPlayServer::CompressBufferIntoPacket(const std::vector<u8>& in_buffer, s
if (lzo1x_1_compress(&in_buffer[i], cur_len, out_buffer.data(), &out_len, wrkmem.data()) !=
LZO_E_OK)
{
PanicAlertT("Internal LZO Error - compression failed");
PanicAlertFmtT("Internal LZO Error - compression failed");
return false;
}

View File

@ -243,9 +243,9 @@ bool ApplyFramePatches()
// where we can try again after the CPU hopefully returns back to the normal instruction flow.
if (!MSR.DR || !MSR.IR || !IsStackSane())
{
DEBUG_LOG(
ACTIONREPLAY,
"Need to retry later. CPU configuration is currently incorrect. PC = 0x%08X, MSR = 0x%08X",
DEBUG_LOG_FMT(ACTIONREPLAY,
"Need to retry later. CPU configuration is currently incorrect. PC = {:#010x}, "
"MSR = {:#010x}",
PC, MSR.Hex);
return false;
}

View File

@ -381,7 +381,7 @@ static void CompressAndDumpState(CompressAndDumpState_args save_args)
}
if (lzo1x_1_compress(buffer_data + i, cur_len, out, &out_len, wrkmem) != LZO_E_OK)
PanicAlertT("Internal LZO Error - compression failed");
PanicAlertFmtT("Internal LZO Error - compression failed");
// The size of the data to write is 'out_len'
f.WriteArray((lzo_uint32*)&out_len, 1);
@ -532,7 +532,7 @@ static void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_
if (res != LZO_E_OK)
{
// This doesn't seem to happen anymore.
PanicAlertT("Internal LZO Error - decompression failed (%d) (%li, %li) \n"
PanicAlertFmtT("Internal LZO Error - decompression failed ({0}) ({1}, {2}) \n"
"Try loading the state again",
res, i, new_len);
return;
@ -543,12 +543,12 @@ static void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_
}
else // uncompressed
{
const size_t size = (size_t)(f.GetSize() - sizeof(StateHeader));
const auto size = static_cast<size_t>(f.GetSize() - sizeof(StateHeader));
buffer.resize(size);
if (!f.ReadBytes(&buffer[0], size))
{
PanicAlert("wtf? reading bytes: %zu", size);
PanicAlertFmt("Error reading bytes: {0}", size);
return;
}
}
@ -638,7 +638,7 @@ void SetOnAfterLoadCallback(AfterLoadCallbackFunc callback)
void Init()
{
if (lzo_init() != LZO_E_OK)
PanicAlertT("Internal LZO Error - lzo_init() failed");
PanicAlertFmtT("Internal LZO Error - lzo_init() failed");
}
void Shutdown()
@ -727,12 +727,12 @@ void UndoLoadState()
}
else
{
PanicAlertT("No undo.dtm found, aborting undo load state to prevent movie desyncs");
PanicAlertFmtT("No undo.dtm found, aborting undo load state to prevent movie desyncs");
}
}
else
{
PanicAlertT("There is nothing to undo!");
PanicAlertFmtT("There is nothing to undo!");
}
}

View File

@ -60,7 +60,7 @@ void SysConf::Load()
"/shared2/sys/SYSCONF", IOS::HLE::FS::Mode::Read);
if (!file || file->GetStatus()->size != SYSCONF_SIZE || !LoadFromFile(*file))
{
WARN_LOG(CORE, "No valid SYSCONF detected. Creating a new one.");
WARN_LOG_FMT(CORE, "No valid SYSCONF detected. Creating a new one.");
InsertDefaultEntries();
}
}
@ -118,8 +118,8 @@ bool SysConf::LoadFromFile(const IOS::HLE::FS::FileHandle& file)
data.resize(GetNonArrayEntrySize(type));
break;
default:
ERROR_LOG(CORE, "Unknown entry type %d in SYSCONF for %s (offset %u)", static_cast<u8>(type),
name.c_str(), offset);
ERROR_LOG_FMT(CORE, "Unknown entry type {} in SYSCONF for {} (offset {})",
static_cast<u8>(type), name, offset);
return false;
}

View File

@ -141,7 +141,7 @@ static void InitializeDeterministicWiiSaves(FS::FileSystem* session_fs)
if (!CopyNandFile(sync_fs, Common::GetMiiDatabasePath(), session_fs,
Common::GetMiiDatabasePath()))
{
WARN_LOG(CORE, "Failed to copy Mii database to the NAND");
WARN_LOG_FMT(CORE, "Failed to copy Mii database to the NAND");
}
}
else
@ -162,7 +162,7 @@ static void InitializeDeterministicWiiSaves(FS::FileSystem* session_fs)
if (!CopyNandFile(configured_fs.get(), Common::GetMiiDatabasePath(), session_fs,
Common::GetMiiDatabasePath()))
{
WARN_LOG(CORE, "Failed to copy Mii database to the NAND");
WARN_LOG_FMT(CORE, "Failed to copy Mii database to the NAND");
}
}
}
@ -173,19 +173,19 @@ void InitializeWiiRoot(bool use_temporary)
if (use_temporary)
{
s_temp_wii_root = File::GetUserPath(D_USER_IDX) + "WiiSession" DIR_SEP;
WARN_LOG(IOS_FS, "Using temporary directory %s for minimal Wii FS", s_temp_wii_root.c_str());
WARN_LOG_FMT(IOS_FS, "Using temporary directory {} for minimal Wii FS", s_temp_wii_root);
// If directory exists, make a backup
if (File::Exists(s_temp_wii_root))
{
const std::string backup_path =
s_temp_wii_root.substr(0, s_temp_wii_root.size() - 1) + ".backup" DIR_SEP;
WARN_LOG(IOS_FS, "Temporary Wii FS directory exists, moving to backup...");
WARN_LOG_FMT(IOS_FS, "Temporary Wii FS directory exists, moving to backup...");
// If backup exists, delete it as we don't want a mess
if (File::Exists(backup_path))
{
WARN_LOG(IOS_FS, "Temporary Wii FS backup directory exists, deleting...");
WARN_LOG_FMT(IOS_FS, "Temporary Wii FS backup directory exists, deleting...");
File::DeleteDirRecursively(backup_path);
}
@ -280,7 +280,7 @@ void InitializeWiiFileSystemContents()
// Because we do not require the system menu to be run, WiiConnect24 files must be copied
// to the NAND manually.
if (!CopySysmenuFilesToFS(fs.get(), File::GetSysDirectory() + WII_USER_DIR, ""))
WARN_LOG(CORE, "Failed to copy initial System Menu files to the NAND");
WARN_LOG_FMT(CORE, "Failed to copy initial System Menu files to the NAND");
if (s_temp_wii_root.empty())
return;
@ -307,7 +307,7 @@ void CleanUpWiiFileSystemContents()
if (!CopyNandFile(ios->GetFS().get(), Common::GetMiiDatabasePath(), configured_fs.get(),
Common::GetMiiDatabasePath()))
{
WARN_LOG(CORE, "Failed to copy Mii database to the NAND");
WARN_LOG_FMT(CORE, "Failed to copy Mii database to the NAND");
}
for (const u64 title_id : ios->GetES()->GetInstalledTitles())

View File

@ -6,7 +6,6 @@
#include <algorithm>
#include <bitset>
#include <cinttypes>
#include <cstddef>
#include <map>
#include <memory>
@ -52,7 +51,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
{
if (!wad.GetTicket().IsValid() || !wad.GetTMD().IsValid())
{
PanicAlertT("WAD installation failed: The selected file is not a valid WAD.");
PanicAlertFmtT("WAD installation failed: The selected file is not a valid WAD.");
return false;
}
@ -73,7 +72,10 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
verify_signature)) < 0)
{
if (ret != IOS::HLE::IOSC_FAIL_CHECKVALUE)
PanicAlertT("WAD installation failed: Could not initialise title import (error %d).", ret);
{
PanicAlertFmtT("WAD installation failed: Could not initialise title import (error {0}).",
ret);
}
return false;
}
@ -87,7 +89,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
es->ImportContentData(context, 0, data.data(), static_cast<u32>(data.size())) < 0 ||
es->ImportContentEnd(context, 0) < 0)
{
PanicAlertT("WAD installation failed: Could not import content %08x.", content.id);
PanicAlertFmtT("WAD installation failed: Could not import content {0:08x}.", content.id);
return false;
}
}
@ -97,7 +99,7 @@ static bool ImportWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad,
if ((contents_imported && es->ImportTitleDone(context) < 0) ||
(!contents_imported && es->ImportTitleCancel(context) < 0))
{
PanicAlertT("WAD installation failed: Could not finalise title import.");
PanicAlertFmtT("WAD installation failed: Could not finalise title import.");
return false;
}
@ -163,8 +165,8 @@ bool InstallWAD(IOS::HLE::Kernel& ios, const DiscIO::VolumeWAD& wad, InstallType
const bool has_another_version =
installed_tmd.IsValid() && installed_tmd.GetTitleVersion() != wad.GetTMD().GetTitleVersion();
if (has_another_version &&
!AskYesNoT("A different version of this title is already installed on the NAND.\n\n"
"Installed version: %u\nWAD version: %u\n\n"
!AskYesNoFmtT("A different version of this title is already installed on the NAND.\n\n"
"Installed version: {0}\nWAD version: {1}\n\n"
"Installing this WAD will replace it irreversibly. Continue?",
installed_tmd.GetTitleVersion(), wad.GetTMD().GetTitleVersion()))
{
@ -309,7 +311,7 @@ OnlineSystemUpdater::ParseTitlesResponse(const std::vector<u8>& response) const
pugi::xml_parse_result result = doc.load_buffer(response.data(), response.size());
if (!result)
{
ERROR_LOG(CORE, "ParseTitlesResponse: Could not parse response");
ERROR_LOG_FMT(CORE, "ParseTitlesResponse: Could not parse response");
return {};
}
@ -317,14 +319,14 @@ OnlineSystemUpdater::ParseTitlesResponse(const std::vector<u8>& response) const
const pugi::xml_node node = doc.select_node("//GetSystemUpdateResponse").node();
if (!node)
{
ERROR_LOG(CORE, "ParseTitlesResponse: Could not find response node");
ERROR_LOG_FMT(CORE, "ParseTitlesResponse: Could not find response node");
return {};
}
const int code = node.child("ErrorCode").text().as_int();
if (code != 0)
{
ERROR_LOG(CORE, "ParseTitlesResponse: Non-zero error code (%d)", code);
ERROR_LOG_FMT(CORE, "ParseTitlesResponse: Non-zero error code ({})", code);
return {};
}
@ -336,7 +338,7 @@ OnlineSystemUpdater::ParseTitlesResponse(const std::vector<u8>& response) const
info.content_prefix_url = ReplaceAll(info.content_prefix_url, "https://", "http://");
if (info.content_prefix_url.empty())
{
ERROR_LOG(CORE, "ParseTitlesResponse: Empty content prefix URL");
ERROR_LOG_FMT(CORE, "ParseTitlesResponse: Empty content prefix URL");
return {};
}
@ -427,7 +429,7 @@ UpdateResult OnlineSystemUpdater::DoOnlineUpdate()
const UpdateResult res = InstallTitleFromNUS(info.content_prefix_url, title, &updated_titles);
if (res != UpdateResult::Succeeded)
{
ERROR_LOG(CORE, "Failed to update %016" PRIx64 " -- aborting update", title.id);
ERROR_LOG_FMT(CORE, "Failed to update {:016x} -- aborting update", title.id);
return res;
}
@ -436,10 +438,10 @@ UpdateResult OnlineSystemUpdater::DoOnlineUpdate()
if (updated_titles.empty())
{
NOTICE_LOG(CORE, "Update finished - Already up-to-date");
NOTICE_LOG_FMT(CORE, "Update finished - Already up-to-date");
return UpdateResult::AlreadyUpToDate;
}
NOTICE_LOG(CORE, "Update finished - %zu updates installed", updated_titles.size());
NOTICE_LOG_FMT(CORE, "Update finished - {} updates installed", updated_titles.size());
return UpdateResult::Succeeded;
}
@ -454,13 +456,13 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
if (!ShouldInstallTitle(title) || updated_titles->find(title.id) != updated_titles->end())
return UpdateResult::Succeeded;
NOTICE_LOG(CORE, "Updating title %016" PRIx64, title.id);
NOTICE_LOG_FMT(CORE, "Updating title {:016x}", title.id);
// Download the ticket and certificates.
const auto ticket = DownloadTicket(prefix_url, title);
if (ticket.first.empty() || ticket.second.empty())
{
ERROR_LOG(CORE, "Failed to download ticket and certs");
ERROR_LOG_FMT(CORE, "Failed to download ticket and certs");
return UpdateResult::DownloadFailed;
}
@ -469,7 +471,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
const auto es = m_ios.GetES();
if ((ret = es->ImportTicket(ticket.first, ticket.second)) < 0)
{
ERROR_LOG(CORE, "Failed to import ticket: error %d", ret);
ERROR_LOG_FMT(CORE, "Failed to import ticket: error {}", ret);
return UpdateResult::ImportFailed;
}
@ -477,7 +479,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
const auto tmd = DownloadTMD(prefix_url, title);
if (!tmd.first.IsValid())
{
ERROR_LOG(CORE, "Failed to download TMD");
ERROR_LOG_FMT(CORE, "Failed to download TMD");
return UpdateResult::DownloadFailed;
}
@ -487,11 +489,11 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
{
if (!es->FindInstalledTMD(ios_id).IsValid())
{
WARN_LOG(CORE, "Importing required system title %016" PRIx64 " first", ios_id);
WARN_LOG_FMT(CORE, "Importing required system title {:016x} first", ios_id);
const UpdateResult res = InstallTitleFromNUS(prefix_url, {ios_id, 0}, updated_titles);
if (res != UpdateResult::Succeeded)
{
ERROR_LOG(CORE, "Failed to import required system title %016" PRIx64, ios_id);
ERROR_LOG_FMT(CORE, "Failed to import required system title {:016x}", ios_id);
return res;
}
}
@ -501,7 +503,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
IOS::HLE::Device::ES::Context context;
if ((ret = es->ImportTitleInit(context, tmd.first.GetBytes(), tmd.second)) < 0)
{
ERROR_LOG(CORE, "Failed to initialise title import: error %d", ret);
ERROR_LOG_FMT(CORE, "Failed to initialise title import: error {}", ret);
return UpdateResult::ImportFailed;
}
@ -521,21 +523,22 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
if ((ret = es->ImportContentBegin(context, title.id, content.id)) < 0)
{
ERROR_LOG(CORE, "Failed to initialise import for content %08x: error %d", content.id, ret);
ERROR_LOG_FMT(CORE, "Failed to initialise import for content {:08x}: error {}", content.id,
ret);
return UpdateResult::ImportFailed;
}
const std::optional<std::vector<u8>> data = DownloadContent(prefix_url, title, content.id);
if (!data)
{
ERROR_LOG(CORE, "Failed to download content %08x", content.id);
ERROR_LOG_FMT(CORE, "Failed to download content {:08x}", content.id);
return UpdateResult::DownloadFailed;
}
if (es->ImportContentData(context, 0, data->data(), static_cast<u32>(data->size())) < 0 ||
es->ImportContentEnd(context, 0) < 0)
{
ERROR_LOG(CORE, "Failed to import content %08x", content.id);
ERROR_LOG_FMT(CORE, "Failed to import content {:08x}", content.id);
return UpdateResult::ImportFailed;
}
}
@ -546,7 +549,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_
if ((all_contents_imported && (ret = es->ImportTitleDone(context)) < 0) ||
(!all_contents_imported && (ret = es->ImportTitleCancel(context)) < 0))
{
ERROR_LOG(CORE, "Failed to finalise title import: error %d", ret);
ERROR_LOG_FMT(CORE, "Failed to finalise title import: error {}", ret);
return UpdateResult::ImportFailed;
}
@ -674,7 +677,7 @@ UpdateResult DiscSystemUpdater::DoDiscUpdate()
if (update_partition == partitions.cend())
{
ERROR_LOG(CORE, "Could not find any update partition");
ERROR_LOG_FMT(CORE, "Could not find any update partition");
return UpdateResult::MissingUpdatePartition;
}
@ -688,7 +691,7 @@ UpdateResult DiscSystemUpdater::UpdateFromManifest(std::string_view manifest_nam
const DiscIO::FileSystem* disc_fs = m_volume->GetFileSystem(m_partition);
if (!disc_fs)
{
ERROR_LOG(CORE, "Could not read the update partition file system");
ERROR_LOG_FMT(CORE, "Could not read the update partition file system");
return UpdateResult::DiscReadFailed;
}
@ -696,7 +699,7 @@ UpdateResult DiscSystemUpdater::UpdateFromManifest(std::string_view manifest_nam
if (!update_manifest ||
(update_manifest->GetSize() - sizeof(ManifestHeader)) % sizeof(Entry) != 0)
{
ERROR_LOG(CORE, "Invalid or missing update manifest");
ERROR_LOG_FMT(CORE, "Invalid or missing update manifest");
return UpdateResult::DiscReadFailed;
}
@ -712,7 +715,7 @@ UpdateResult DiscSystemUpdater::UpdateFromManifest(std::string_view manifest_nam
if (entry.size() != DiscIO::ReadFile(*m_volume, m_partition, update_manifest.get(),
entry.data(), entry.size(), offset))
{
ERROR_LOG(CORE, "Failed to read update information from update manifest");
ERROR_LOG_FMT(CORE, "Failed to read update information from update manifest");
return UpdateResult::DiscReadFailed;
}
@ -729,7 +732,7 @@ UpdateResult DiscSystemUpdater::UpdateFromManifest(std::string_view manifest_nam
const UpdateResult res = ProcessEntry(type, attrs, {title_id, title_version}, path);
if (res != UpdateResult::Succeeded && res != UpdateResult::AlreadyUpToDate)
{
ERROR_LOG(CORE, "Failed to update %016" PRIx64 " -- aborting update", title_id);
ERROR_LOG_FMT(CORE, "Failed to update {:016x} -- aborting update", title_id);
return res;
}
@ -762,7 +765,7 @@ UpdateResult DiscSystemUpdater::ProcessEntry(u32 type, std::bitset<32> attrs,
auto blob = DiscIO::VolumeFileBlobReader::Create(*m_volume, m_partition, path);
if (!blob)
{
ERROR_LOG(CORE, "Could not find %s", std::string(path).c_str());
ERROR_LOG_FMT(CORE, "Could not find {}", path);
return UpdateResult::DiscReadFailed;
}
const DiscIO::VolumeWAD wad{std::move(blob)};
@ -792,7 +795,8 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
Common::RootUserPath(Common::FROM_CONFIGURED_ROOT) + "/sys/replace";
if (File::Exists(sys_replace_path))
{
ERROR_LOG(CORE, "CheckNAND: NAND was used with old versions, so it is likely to be damaged");
ERROR_LOG_FMT(CORE,
"CheckNAND: NAND was used with old versions, so it is likely to be damaged");
if (repair)
File::Delete(sys_replace_path);
else
@ -804,7 +808,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
const File::FileInfo rfl_db(rfl_db_path);
if (rfl_db.Exists() && rfl_db.GetSize() == 0)
{
ERROR_LOG(CORE, "CheckNAND: RFL_DB.dat exists but is empty");
ERROR_LOG_FMT(CORE, "CheckNAND: RFL_DB.dat exists but is empty");
if (repair)
File::Delete(rfl_db_path);
else
@ -823,7 +827,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
if (File::IsDirectory(dir))
continue;
ERROR_LOG(CORE, "CheckNAND: Missing dir %s for title %016" PRIx64, dir.c_str(), title_id);
ERROR_LOG_FMT(CORE, "CheckNAND: Missing dir {} for title {:016x}", dir, title_id);
if (repair)
File::CreateDir(dir);
else
@ -834,7 +838,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
const auto ticket = es->FindSignedTicket(title_id);
if (!IOS::ES::IsDiscTitle(title_id) && !ticket.IsValid())
{
ERROR_LOG(CORE, "CheckNAND: Missing ticket for title %016" PRIx64, title_id);
ERROR_LOG_FMT(CORE, "CheckNAND: Missing ticket for title {:016x}", title_id);
result.titles_to_remove.insert(title_id);
if (repair)
File::DeleteDirRecursively(title_dir);
@ -847,11 +851,11 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
{
if (File::ScanDirectoryTree(content_dir, false).children.empty())
{
WARN_LOG(CORE, "CheckNAND: Missing TMD for title %016" PRIx64, title_id);
WARN_LOG_FMT(CORE, "CheckNAND: Missing TMD for title {:016x}", title_id);
}
else
{
ERROR_LOG(CORE, "CheckNAND: Missing TMD for title %016" PRIx64, title_id);
ERROR_LOG_FMT(CORE, "CheckNAND: Missing TMD for title {:016x}", title_id);
result.titles_to_remove.insert(title_id);
if (repair)
File::DeleteDirRecursively(title_dir);
@ -869,7 +873,7 @@ static NANDCheckResult CheckNAND(IOS::HLE::Kernel& ios, bool repair)
if (is_installed && installed_contents != tmd.GetContents() &&
(tmd.GetTitleFlags() & IOS::ES::TitleFlags::TITLE_TYPE_DATA) == 0)
{
ERROR_LOG(CORE, "CheckNAND: Missing contents for title %016" PRIx64, title_id);
ERROR_LOG_FMT(CORE, "CheckNAND: Missing contents for title {:016x}", title_id);
result.titles_to_remove.insert(title_id);
if (repair)
File::DeleteDirRecursively(title_dir);