Skip to content

Commit

Permalink
More libformat fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
z2442 committed Jan 28, 2025
1 parent 08c2b77 commit 2f6c899
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 6 deletions.
8 changes: 8 additions & 0 deletions Source/Core/RSP_HLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ extern "C" {
#if 0
static void RDP_DumpRSPCode(char * name, u32 crc, u32 * mem_base, u32 pc_base, u32 len)
{
#if defined(GCC_OLD)
std::string filename = fmt::format("task_dump_{}_crc_0x{}.txt", name, crc);
#else
std::string filename = std::format("task_dump_{}_crc_0x{}.txt", name, crc);
#endif
// snprintf(filename, sizeof(filename), "task_dump_%s_crc_0x%08x.txt", name, crc);

std::filesystem::path filepath = setBasePath("rsp_dumps");
Expand All @@ -83,7 +87,11 @@ static void RDP_DumpRSPCode(char * name, u32 crc, u32 * mem_base, u32 pc_base, u

char opinfo[400];
SprintRSPOpCodeInfo( opinfo, pc + pc_base, op );
#if defined(GCC_OLD)
fp << fmt::format("0x{:08x}: <0x{:08x}> {}\n", pc + pc_base, op._u32, opinfo);
#else
fp << std::format("0x{:08x}: <0x{:08x}> {}\n", pc + pc_base, op._u32, opinfo);
#endif
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions Source/Debug/Dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ void Dump_DisassembleMIPSRange(std::ofstream& fh, u32 address_offset, const OpCo
#endif

SprintOpCodeInfo( opinfo, address, op );
#if defined(GCC_OLD)
std::string data = fmt::format("0x{}: <0x{}> {}", address, op._u32, opinfo);
#else
std::string data = std::format("0x{}: <0x{}> {}", address, op._u32, opinfo);
#endif
fh << data;
// fprintf(fh, "0x%08x: <0x%08x> %s\n", address, op._u32, opinfo);

Expand Down Expand Up @@ -138,7 +142,12 @@ void Dump_MemoryRange(std::ofstream& fh, u32 address_offset, const u32 * b, cons
const u32 * p( b );
while( p < e )
{
#if defined(GCC_OLD)
std::string output = fmt::format("0x{}x: {} {} {} {} ", address, p[0], p[1], p[2], p[3]);
#else
std::string output = std::format("0x{}x: {} {} {} {} ", address, p[0], p[1], p[2], p[3]);
#endif

fh << output;

const u8 * p8( reinterpret_cast< const u8 * >( p ) );
Expand Down Expand Up @@ -167,7 +176,12 @@ void Dump_DisassembleRSPRange(std::ofstream& fh, u32 address_offset, const OpCod
{
char opinfo[400];
SprintRSPOpCodeInfo( opinfo, address, *p );
#if defined(GCC_OLD)
std::string output = fmt::format("0x{}: <0x{}> {}\n", address, p->_u32, opinfo);
#else
std::string output = std::format("0x{}: <0x{}> {}\n", address, p->_u32, opinfo);
#endif

fh << output;

address += 4;
Expand Down Expand Up @@ -250,7 +264,12 @@ void Dump_Strings( const char * p_file_name )
{
if ( ascii_count >= MIN_LENGTH )
{

#if defined(GCC_OLD)
std::string output = fmt::format("0x{}", ascii_start);
#else
std::string output = std::format("0x{}", ascii_start);
#endif
fp << output;

// fprintf( fp, "0x%08x: ", ascii_start );
Expand Down
4 changes: 4 additions & 0 deletions Source/HLEGraphics/CachedTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,11 @@ void CachedTexture::DumpTexture( const TextureInfo & ti, const std::shared_ptr<C
if( texture != nullptr && texture->HasData() )
{
std::filesystem::path dumpdir = g_ROM.settings.GameName;
#if defined(GCC_OLD)
std::string filename = fmt::format("{}-{}_{}bpp-{}x{}-{}x{}.png", ti.GetLoadAddress(), ti.GetFormatName(), ti.GetSizeInBits(), 0, 0, ti.GetWidth(), ti.GetHeight() );
#else
std::string filename = std::format("{}-{}_{}bpp-{}x{}-{}x{}.png", ti.GetLoadAddress(), ti.GetFormatName(), ti.GetSizeInBits(), 0, 0, ti.GetWidth(), ti.GetHeight() );
#endif
std::filesystem::path filepath;

void * texels;
Expand Down
6 changes: 5 additions & 1 deletion Source/HLEGraphics/DLDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,11 @@ DLDebugOutput * DLDebug_CreateFileOutput()

std::filesystem::path dumpdir = "DisplayLists";
dumpdir /= g_ROM.settings.GameName.c_str();
std::string filepath = fmt::format("dl{}.txt", count++);
#if defined(GCC_OLD)
std::string filepath = fmt::format("dl{}.txt", count++);
#else
std::string filepath = std::format("dl{}.txt", count++);
#endif

dumpdir /= filepath;

Expand Down
23 changes: 20 additions & 3 deletions Source/SysCTR/UI/InGameMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ static void ExecSaveState(int slot)
savePath /= name;
std::filesystem::create_directories(savePath);

std::string filename = fmt::format("saveslot{}.ss", slot);
#if defined(GCC_OLD)
std::string filename = fmt::format("saveslot{}.ss", slot);
#else
std::string filename = std::format("saveslot{}.ss", slot);
#endif

savePath /= filename;

std::cout << "Save Save Slot Path" << savePath << std::endl;
Expand All @@ -63,7 +68,13 @@ static void LoadSaveState(int slot)
savePath /= name;
std::filesystem::create_directories(savePath);

std::string filename = fmt::format("saveslot{}.ss", slot);
#if defined(GCC_OLD)
std::string filename = fmt::format("saveslot{}.ss", slot);
#else
std::string filename = std::format("saveslot{}.ss", slot);
#endif


savePath /= filename;

std::cout << "Load Save Slot Path" << savePath << std::endl;
Expand All @@ -79,7 +90,13 @@ static bool SaveStateExists(int slot)
savePath /= name;
std::filesystem::create_directories(savePath);

std::string filename = fmt::format("saveslot{}.ss", slot);
#if defined(GCC_OLD)
std::string filename = fmt::format("saveslot{}.ss", slot);
#else
std::string filename = std::format("saveslot{}.ss", slot);
#endif


savePath /= filename;

// std::string path = fmt::format("{}/{}{}.ss", "SaveStates", g_ROM.settings.GameName.c_str(), slot);
Expand Down
8 changes: 8 additions & 0 deletions Source/UI/RomSelectorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ void IRomSelectorComponent::RenderPreview()
{
auto p_rominfo = mRomsList[ mCurrentSelection ];

#if defined(GCC_OLD)
std::string rom_size = fmt::format("{} MB", p_rominfo->mRomSize / (1024 * 1024));
#else
std::string rom_size = std::format("{} MB", p_rominfo->mRomSize / (1024 * 1024));
#endif

DrawInfoText( mpContext, y, "Boot:", ROM_GetCicName( p_rominfo->mCicType )); y += line_height;
DrawInfoText( mpContext, y, "Country:", ROM_GetCountryNameFromID( p_rominfo->mRomID.CountryID)); y += line_height;
Expand Down Expand Up @@ -440,7 +444,11 @@ void IRomSelectorComponent::RenderCategoryList()

// char str[ 16 ];
// snprintf( str, sizeof(str), "%c ", GetCategoryLetter( category ) );
#if defined(GCC_OLD)
std::string str = fmt::format("{} ", GetCategoryLetter( category));
#else
std::string str = std::format("{} ", GetCategoryLetter( category));
#endif
x += mpContext->DrawText( x, y, str, colour );
}
}
Expand Down
7 changes: 6 additions & 1 deletion Source/UI/SavestateSelectorComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ namespace
std::filesystem::path full_directory = save_directory / slot_path;
std::filesystem::create_directory(full_directory);

std::string filename_png = fmt::format("saveslot{}.ss.png", slot_idx);
#if defined(GCC_OLD)
std::string filename_png = fmt::format("saveslot{}.ss.png", slot_idx);
std::string filename_ss = fmt::format("saveslot{}.ss", slot_idx);
#else
std::string filename_png = std::format("saveslot{}.ss.png", slot_idx);
std::string filename_ss = std::format("saveslot{}.ss", slot_idx);
#endif

path = full_directory / filename_ss;
png_path = full_directory / filename_png;
Expand Down
7 changes: 6 additions & 1 deletion Source/Utility/Translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ void Translate_Dump(const std::string string, bool dump)

if (fh.is_open())
{
fh << fmt::format("{:08x},{}\n", HashString(string), string);
#if defined(GCC_OLD)
fh << fmt::format("{:08x},{}\n", HashString(string), string);
#else
fh << std::format("{:08x},{}\n", HashString(string), string);
#endif

}
}
}
Expand Down

0 comments on commit 2f6c899

Please sign in to comment.