@@ -67,7 +67,7 @@ static void PreLoadPrep()
6767static void PostLoadPrep ()
6868{
6969 resetCache ();
70- // WriteCP0Status(cpuRegs.CP0.n.Status.val);
70+ // WriteCP0Status(cpuRegs.CP0.n.Status.val);
7171 for (int i = 0 ; i < 48 ; i++)
7272 {
7373 if (std::memcmp (&s_tlb_backup[i], &tlb[i], sizeof (tlbs)) != 0 )
@@ -77,7 +77,9 @@ static void PostLoadPrep()
7777 }
7878 }
7979
80- if (EmuConfig.Gamefixes .GoemonTlbHack ) GoemonPreloadTlb ();
80+ if (EmuConfig.Gamefixes .GoemonTlbHack )
81+ GoemonPreloadTlb ();
82+
8183 CBreakPoints::SetSkipFirst (BREAKPOINT_EE , 0 );
8284 CBreakPoints::SetSkipFirst (BREAKPOINT_IOP , 0 );
8385
@@ -131,7 +133,7 @@ bool SaveStateBase::FreezeTag(const char* src)
131133
132134 if (std::strcmp (tagspace, src) != 0 )
133135 {
134- Console.Error ( fmt::format ( " Savestate data corruption detected while reading tag: {}" , src) );
136+ Console.ErrorFmt ( " Savestate data corruption detected while reading tag: {}" , src);
135137 m_error = true ;
136138 return false ;
137139 }
@@ -163,8 +165,7 @@ bool SaveStateBase::FreezeBios()
163165 " Current BIOS: %s (crc=0x%08x)\n "
164166 " Savestate BIOS: %s (crc=0x%08x)\n " ,
165167 BiosDescription.c_str (), BiosChecksum,
166- biosdesc, bioscheck
167- );
168+ biosdesc, bioscheck);
168169 }
169170
170171 return IsOkay ();
@@ -184,12 +185,12 @@ bool SaveStateBase::FreezeInternals(Error* error)
184185 if (!FreezeTag (" cpuRegs" ))
185186 return false ;
186187
187- Freeze (cpuRegs); // cpu regs + COP0
188- Freeze (psxRegs); // iop regs
188+ Freeze (cpuRegs); // cpu regs + COP0
189+ Freeze (psxRegs); // iop regs
189190 Freeze (fpuRegs);
190- Freeze (tlb); // tlbs
191- Freeze (cachedTlbs); // cached tlbs
192- Freeze (AllowParams1); // OSDConfig written (Fast Boot)
191+ Freeze (tlb); // tlbs
192+ Freeze (cachedTlbs); // cached tlbs
193+ Freeze (AllowParams1); // OSDConfig written (Fast Boot)
193194 Freeze (AllowParams2);
194195
195196 // Third Block - Cycle Timers and Events
@@ -231,7 +232,7 @@ bool SaveStateBase::FreezeInternals(Error* error)
231232 if (!FreezeTag (" IOP-Subsystems" ))
232233 return false ;
233234
234- FreezeMem (iopMem->Sif , sizeof (iopMem->Sif )); // iop's sif memory (not really needed, but oh well)
235+ FreezeMem (iopMem->Sif , sizeof (iopMem->Sif )); // iop's sif memory (not really needed, but oh well)
235236
236237 okay = okay && psxRcntFreeze ();
237238
@@ -301,7 +302,8 @@ memSavingState::memSavingState(VmStateBuffer& save_to)
301302// Saving of state data
302303void memSavingState::FreezeMem (void * data, int size)
303304{
304- if (!size) return ;
305+ if (!size)
306+ return ;
305307
306308 const int new_size = m_idx + size;
307309 if (static_cast <u32 >(new_size) > m_memory.size ())
@@ -320,7 +322,7 @@ memLoadingState::memLoadingState(const VmStateBuffer& load_from)
320322}
321323
322324// Loading of state data from a memory buffer...
323- void memLoadingState::FreezeMem ( void * data, int size )
325+ void memLoadingState::FreezeMem (void * data, int size)
324326{
325327 if (static_cast <u32 >(m_idx + size) > m_memory.size ())
326328 m_error = true ;
@@ -349,20 +351,20 @@ struct SysState_Component
349351
350352static int SysState_MTGSFreeze (FreezeAction mode, freezeData* fP )
351353{
352- MTGS ::FreezeData sstate = { fP , 0 };
354+ MTGS ::FreezeData sstate = {fP , 0 };
353355 MTGS::Freeze (mode, sstate);
354356 return sstate.retval ;
355357}
356358
357- static constexpr SysState_Component SPU2_ { " SPU2" , SPU2freeze };
358- static constexpr SysState_Component GS { " GS" , SysState_MTGSFreeze };
359+ static constexpr SysState_Component SPU2_ {" SPU2" , SPU2freeze};
360+ static constexpr SysState_Component GS {" GS" , SysState_MTGSFreeze};
359361
360362static bool SysState_ComponentFreezeIn (zip_file_t * zf, SysState_Component comp)
361363{
362364 if (!zf)
363365 return true ;
364366
365- freezeData fP = { 0 , nullptr };
367+ freezeData fP = {0 , nullptr };
366368 if (comp.freeze (FreezeAction::Size, &fP ) != 0 )
367369 fP .size = 0 ;
368370
@@ -376,14 +378,14 @@ static bool SysState_ComponentFreezeIn(zip_file_t* zf, SysState_Component comp)
376378
377379 if (zip_fread (zf, data.get (), fP .size ) != static_cast <zip_int64_t >(fP .size ))
378380 {
379- Console.Error ( fmt::format ( " * {}: Failed to decompress save data" , comp.name ) );
381+ Console.ErrorFmt ( " * {}: Failed to decompress save data" , comp.name );
380382 return false ;
381383 }
382384 }
383385
384386 if (comp.freeze (FreezeAction::Load, &fP ) != 0 )
385387 {
386- Console.Error ( fmt::format ( " * {}: Failed to load freeze data" , comp.name ) );
388+ Console.ErrorFmt ( " * {}: Failed to load freeze data" , comp.name );
387389 return false ;
388390 }
389391
@@ -395,7 +397,7 @@ static bool SysState_ComponentFreezeOut(SaveStateBase& writer, SysState_Componen
395397 freezeData fP = {};
396398 if (comp.freeze (FreezeAction::Size, &fP ) != 0 )
397399 {
398- Console.Error ( fmt::format ( " * {}: Failed to get freeze size" , comp.name ) );
400+ Console.ErrorFmt ( " * {}: Failed to get freeze size" , comp.name );
399401 return false ;
400402 }
401403
@@ -410,15 +412,15 @@ static bool SysState_ComponentFreezeOut(SaveStateBase& writer, SysState_Componen
410412 fP .data = writer.GetBlockPtr ();
411413 if (comp.freeze (FreezeAction::Save, &fP ) != 0 )
412414 {
413- Console.Error ( fmt::format ( " * {}: Failed to save freeze data" , comp.name ) );
415+ Console.ErrorFmt ( " * {}: Failed to save freeze data" , comp.name );
414416 return false ;
415417 }
416418
417419 writer.CommitBlock (size);
418420 return true ;
419421}
420422
421- static bool SysState_ComponentFreezeInNew (zip_file_t * zf, const char * name, bool (*do_state_func)(StateWrapper&))
423+ static bool SysState_ComponentFreezeInNew (zip_file_t * zf, const char * name, bool (*do_state_func)(StateWrapper&))
422424{
423425 // TODO: We could decompress on the fly here for a little bit more speed.
424426 std::vector<u8 > data;
@@ -741,7 +743,7 @@ std::unique_ptr<ArchiveEntryList> SaveState_DownloadState(Error* error)
741743 uint startpos = saveme.GetCurrentPos ();
742744 if (!entry->FreezeOut (saveme))
743745 {
744- Error::SetString (error, fmt::format ( " FreezeOut() failed for {}." , entry->GetFilename () ));
746+ Error::SetStringFmt (error, " FreezeOut() failed for {}." , entry->GetFilename ());
745747 destlist.reset ();
746748 break ;
747749 }
@@ -807,9 +809,8 @@ static bool SaveState_CompressScreenshot(SaveStateScreenshotData* data, zip_t* z
807809 if (setjmp (png_jmpbuf (png_ptr)))
808810 return false ;
809811
810- png_set_write_fn (png_ptr, zs, [](png_structp png_ptr, png_bytep data_ptr, png_size_t size) {
811- zip_source_write (static_cast <zip_source_t *>(png_get_io_ptr (png_ptr)), data_ptr, size);
812- }, [](png_structp png_ptr) {});
812+ png_set_write_fn (
813+ png_ptr, zs, [](png_structp png_ptr, png_bytep data_ptr, png_size_t size) { zip_source_write (static_cast <zip_source_t *>(png_get_io_ptr (png_ptr)), data_ptr, size); }, [](png_structp png_ptr) {});
813814 png_set_compression_level (png_ptr, 5 );
814815 png_set_IHDR (png_ptr, info_ptr, data->width , data->height , 8 , PNG_COLOR_TYPE_RGBA ,
815816 PNG_INTERLACE_NONE , PNG_COMPRESSION_TYPE_DEFAULT , PNG_FILTER_TYPE_DEFAULT );
@@ -1119,11 +1120,13 @@ static bool CheckVersion(const std::string& filename, zip_t* zf, Error* error)
11191120 {
11201121 current_emulator_version = " Unknown" ;
11211122 }
1122- Error::SetString (error, fmt::format (TRANSLATE_FS (" SaveState" ," This save state was created with PCSX2 version {0}. It is no longer compatible "
1123- " with your current PCSX2 version {1}.\n\n "
1124- " If you have any unsaved progress on this save state, you can download the compatible PCSX2 version {0} "
1125- " from pcsx2.net, load the save state, and save your progress to the memory card." ),
1126- version_string, current_emulator_version));
1123+ Error::SetStringFmt (error,
1124+ TRANSLATE_FS (" SaveState" ,
1125+ " This save state was created with PCSX2 version {0}. It is no longer compatible "
1126+ " with your current PCSX2 version {1}.\n\n "
1127+ " If you have any unsaved progress on this save state, you can download the compatible PCSX2 version {0} "
1128+ " from pcsx2.net, load the save state, and save your progress to the memory card." ),
1129+ version_string, current_emulator_version);
11271130 return false ;
11281131 }
11291132
@@ -1165,7 +1168,7 @@ static bool LoadInternalStructuresState(zip_t* zf, s64 index, Error* error)
11651168 memLoadingState state (buffer);
11661169 if (!state.FreezeBios ())
11671170 return false ;
1168-
1171+
11691172 if (!state.FreezeInternals (error))
11701173 return false ;
11711174
@@ -1182,7 +1185,7 @@ bool SaveState_UnzipFromDisk(const std::string& filename, Error* error)
11821185 if (zip_error_code_zip (&ze) == ZIP_ER_NOENT )
11831186 Error::SetString (error, " Savestate file does not exist." );
11841187 else
1185- Error::SetString (error, fmt::format ( " Savestate zip error: {}" , zip_error_strerror (&ze) ));
1188+ Error::SetStringFmt (error, " Savestate zip error: {}" , zip_error_strerror (&ze));
11861189
11871190 return false ;
11881191 }
@@ -1235,7 +1238,7 @@ bool SaveState_UnzipFromDisk(const std::string& filename, Error* error)
12351238 auto zff = zip_fopen_index_managed (zf.get (), entryIndices[i], 0 );
12361239 if (!zff || !SavestateEntries[i]->FreezeIn (zff.get ()))
12371240 {
1238- Error::SetString (error, fmt::format ( " Save state corruption in {}." , SavestateEntries[i]->GetFilename () ));
1241+ Error::SetStringFmt (error, " Save state corruption in {}." , SavestateEntries[i]->GetFilename ());
12391242 VMManager::Reset ();
12401243 return false ;
12411244 }
0 commit comments