From ac4aeb23a81e72c7aeb08f5bb0c695a18e5381de Mon Sep 17 00:00:00 2001 From: pifopi Date: Sun, 21 Dec 2025 17:29:02 +0100 Subject: [PATCH] Use std::format instead of custom string formatting --- Common/Cpp/Options/FloatingPointOption.cpp | 6 +- Common/Cpp/Options/TimeDurationOption.cpp | 2 +- Common/Cpp/Options/TimeExpressionOption.cpp | 14 ++-- Common/Cpp/PrettyPrint.cpp | 66 ++----------------- Common/Cpp/PrettyPrint.h | 8 +-- .../AudioPipeline/AudioInfo.cpp | 2 +- .../AudioPipeline/IO/AudioSink.cpp | 2 +- .../AudioPipeline/IO/AudioSource.cpp | 2 +- .../Environment/HardwareValidation_x86.tpp | 6 +- .../ErrorReports/ErrorReports.cpp | 19 +++--- .../ProgramStats/StatsTracking.cpp | 4 +- .../CommonFramework/Tools/StatAccumulator.cpp | 13 ++-- .../Backends/CameraImplementations.cpp | 10 --- .../Backends/MediaServicesQt6.cpp | 4 +- .../Stats/MemoryUtilizationStats.cpp | 4 +- .../VideoPipeline/UI/VideoDisplayWidget.cpp | 6 +- .../VideoPipeline/VideoOverlayTypes.cpp | 2 +- .../Audio/AudioPerSpectrumDetectorBase.cpp | 4 +- .../CommonTools/OCR/OCR_StringMatchResult.cpp | 4 +- .../CommonTools/OCR/OCR_TrainingTools.cpp | 25 +++---- .../Options/QtWidgets/StringSelectWidget.cpp | 2 +- .../Connection/MessageLogger.cpp | 2 +- .../SerialPABotBase_StatusThread.h | 2 +- .../Source/Integrations/DiscordWebhook.cpp | 9 +-- .../Source/ML/Inference/ML_YOLOv5Detector.cpp | 2 +- .../Joycon/NintendoSwitch_JoyconState.cpp | 22 +++---- ...NintendoSwitch_ControllerWithScheduler.cpp | 21 +++--- .../NintendoSwitch_ProControllerState.cpp | 14 ++-- .../Pokemon/Pokemon_CollectedPokemonInfo.cpp | 5 +- .../Source/Pokemon/Pokemon_EncounterStats.cpp | 5 +- .../Source/Pokemon/Pokemon_Notification.cpp | 14 ++-- .../Pokemon/Resources/Pokemon_EggSteps.cpp | 3 +- .../PokemonBDSP_ShinyEncounterDetector.cpp | 16 ++--- .../PokemonBDSP_ShinySparkleSet.cpp | 8 +-- .../ShinyHunting/PokemonLA_BurmyFinder.cpp | 2 +- .../Programs/PokemonLZA_BasicNavigation.cpp | 4 +- .../Programs/PokemonLZA_BoxSorter.cpp | 9 ++- .../ShinyHunting/PokemonLZA_ShuttleRun.cpp | 2 +- .../ShinyHunting/PokemonLZA_WildZoneCafe.cpp | 4 +- .../PokemonLZA_WildZoneEntrance.cpp | 10 +-- .../Tera/PokemonSV_TeraCardDetector.cpp | 23 ++----- .../AutoStory/PokemonSV_AutoStoryTools.cpp | 10 ++- .../Farming/PokemonSV_ESPTraining.cpp | 2 +- .../PokemonSV_GimmighoulChestFarmer.cpp | 2 +- .../PokemonSV_GimmighoulRoamingFarmer.cpp | 2 +- .../Farming/PokemonSV_MaterialFarmerTools.cpp | 4 +- .../ItemPrinter/PokemonSV_ItemPrinterRNG.cpp | 2 +- .../PokemonSV_AreaZeroPlatform.cpp | 4 +- .../ShinyHunting/PokemonSV_LetsGoTools.cpp | 6 +- .../PokemonSV_ShinyHunt-AreaZeroPlatform.cpp | 15 +++-- .../PokemonSV_ShinyHunt-Scatterbug.cpp | 2 +- .../TeraRaids/PokemonSV_JoinTracker.cpp | 2 +- .../PokemonSwSh_BattleDialogTracker.cpp | 6 +- .../Inference/Dens/PokemonSwSh_BeamSetter.cpp | 16 +++-- .../Dens/PokemonSwSh_RaidLobbyReader.cpp | 18 ++--- .../PokemonSwSh_ShinyEncounterDetector.cpp | 7 +- .../PokemonSwSh_MaxLair_Detect_BattleMenu.cpp | 2 +- .../PokemonSwSh_MaxLair_StrongBoss.cpp | 4 +- .../PokemonSwSh_DateSpam-BerryFarmer.cpp | 2 +- .../PokemonSwSh_DateSpam-BerryFarmer2.cpp | 4 +- ...emonSwSh_DateSpam-DailyHighlightFarmer.cpp | 2 +- .../PokemonSwSh_DateSpam-LotoFarmer.cpp | 2 +- .../PokemonSwSh_DateSpam-PokeJobsFarmer.cpp | 4 +- .../PokemonSwSh_DateSpam-StowOnSideFarmer.cpp | 2 +- .../PokemonSwSh_DateSpam-WattFarmer.cpp | 2 +- .../DenHunting/PokemonSwSh_DaySkipperEU.cpp | 1 - .../PokemonSwSh_DaySkipperJPN-7.8k.cpp | 1 - .../DenHunting/PokemonSwSh_DaySkipperJPN.cpp | 1 - .../DenHunting/PokemonSwSh_DaySkipperStats.h | 8 ++- .../DenHunting/PokemonSwSh_DaySkipperUS.cpp | 1 - .../EggPrograms/PokemonSwSh_EggFetcher2.cpp | 4 +- .../PokemonSwSh_EggFetcherMultiple.cpp | 4 +- .../PokemonSwSh_GodEggDuplication.cpp | 4 +- .../PokemonSwSh_GodEggItemDupe.cpp | 4 +- .../PokemonSwSh_AutoHost-MultiGame.cpp | 2 +- .../Hosting/PokemonSwSh_AutoHost-Rolling.cpp | 2 +- .../PokemonSwSh_OverworldTargetTracker.cpp | 11 ++-- ...emonSwSh_ShinyHuntAutonomous-Overworld.cpp | 27 ++++---- .../PokemonSwSh_RaidItemFarmerOKHO.cpp | 2 +- ...monSwSh_ShinyHuntAutonomous-Regigigas2.cpp | 2 +- ...onSwSh_ShinyHuntAutonomous-StrongSpawn.cpp | 2 +- ...Sh_ShinyHuntAutonomous-SwordsOfJustice.cpp | 2 +- .../PokemonSwSh_ShinyHunt-Regi.cpp | 10 +-- ...kemonSwSh_ShinyHuntUnattended-IoATrade.cpp | 2 +- ...monSwSh_ShinyHuntUnattended-Regigigas2.cpp | 2 +- ...onSwSh_ShinyHuntUnattended-StrongSpawn.cpp | 2 +- ...Sh_ShinyHuntUnattended-SwordsOfJustice.cpp | 2 +- .../Programs/ZeldaTotK_BowItemDuper.cpp | 2 +- .../Programs/ZeldaTotK_MineruItemDuper.cpp | 2 +- .../Programs/ZeldaTotK_ParaglideItemDuper.cpp | 2 +- .../Programs/ZeldaTotK_SurfItemDuper.cpp | 2 +- .../Programs/ZeldaTotK_WeaponDuper.cpp | 2 +- 92 files changed, 250 insertions(+), 360 deletions(-) diff --git a/Common/Cpp/Options/FloatingPointOption.cpp b/Common/Cpp/Options/FloatingPointOption.cpp index d1e3801fd7..b63bf631b8 100644 --- a/Common/Cpp/Options/FloatingPointOption.cpp +++ b/Common/Cpp/Options/FloatingPointOption.cpp @@ -121,12 +121,10 @@ JsonValue FloatingPointCell::to_json() const{ std::string FloatingPointCell::check_validity(double x) const{ const Data& data = *m_data; if (x < data.m_min_value){ - std::ostringstream ss; - return "Value too small: min = " + tostr_default(data.m_min_value) + ", value = " + tostr_default(x); + return std::format("Value too small: min = {}, value = {}", data.m_min_value, x); } if (x > data.m_max_value){ - std::ostringstream ss; - return "Value too large: max = " + tostr_default(data.m_max_value) + ", value = " + tostr_default(x); + return std::format("Value too large: max = {}, value = {}", data.m_max_value, x); } if (std::isnan(x)){ return "Value is NaN."; diff --git a/Common/Cpp/Options/TimeDurationOption.cpp b/Common/Cpp/Options/TimeDurationOption.cpp index dc585c00bc..7b614205e3 100644 --- a/Common/Cpp/Options/TimeDurationOption.cpp +++ b/Common/Cpp/Options/TimeDurationOption.cpp @@ -259,7 +259,7 @@ std::string TimeDurationCell::time_string(const std::string& text) const{ if constexpr (self >= milliseconds){ return duration_to_string(std::chrono::duration_cast(value)); }else{ - return tostr_u_commas(value.count()) + " " + m_data->m_units; + return std::format("{:L} {}", value.count(), m_data->m_units); } } diff --git a/Common/Cpp/Options/TimeExpressionOption.cpp b/Common/Cpp/Options/TimeExpressionOption.cpp index e698bb63c8..895d6bf728 100644 --- a/Common/Cpp/Options/TimeExpressionOption.cpp +++ b/Common/Cpp/Options/TimeExpressionOption.cpp @@ -25,7 +25,7 @@ std::string ticks_to_time(double ticks_per_second, int64_t ticks){ const double DAY = HOUR * 24; std::string str; - str += tostr_u_commas(ticks); + str += std::format("{:L}", ticks); str += " tick"; // Compute absolute value of the ticks: uint64_t abs_ticks = 0; @@ -44,17 +44,13 @@ std::string ticks_to_time(double ticks_per_second, int64_t ticks){ str += "-"; } if (abs_ticks < MINUTE * 2){ - str += tostr_fixed((double)abs_ticks / SECOND, 3); - str += " seconds"; + str += std::format("{:.3f} seconds", (double)abs_ticks / SECOND); }else if (abs_ticks < HOUR * 2){ - str += tostr_fixed((double)abs_ticks / MINUTE, 3); - str += " minutes"; + str += std::format("{:.3f} minutes", (double)abs_ticks / MINUTE); }else if (abs_ticks < DAY * 2){ - str += tostr_fixed((double)abs_ticks / HOUR, 3); - str += " hours"; + str += std::format("{:.3f} hours", (double)abs_ticks / HOUR); }else{ - str += tostr_fixed((double)abs_ticks / DAY, 3); - str += " days"; + str += std::format("{:.3f} days", (double)abs_ticks / DAY); } str += ")"; return str; diff --git a/Common/Cpp/PrettyPrint.cpp b/Common/Cpp/PrettyPrint.cpp index 1f2cbae375..cee8fe1de3 100644 --- a/Common/Cpp/PrettyPrint.cpp +++ b/Common/Cpp/PrettyPrint.cpp @@ -22,33 +22,6 @@ std::string tostr_padded(size_t digits, uint64_t x){ } return std::string(digits - str.size(), '0') + str; } -std::string tostr_u_commas(int64_t x){ - // Prints out x with comma separators. - - std::string str = std::to_string(x); - std::string out; - - const char* ptr = str.c_str(); - // len: how many digits, don't count "-" in the negative numbers - size_t len = str.size() - (x < 0); - - size_t commas = (len + 2) / 3 - 1; - size_t shift = len - commas * 3 + (x < 0); - - while (true){ - char ch = *ptr++; - if (ch == '\0') - break; - if (shift == 0){ - out += ','; - shift = 3; - } - out += ch; - shift--; - } - - return out; -} inline std::string byte_prefix(size_t index){ @@ -164,22 +137,6 @@ std::string tostr_bytes(uint64_t bytes){ return tostr_ui_bytes(bytes); } - - -std::string tostr_default(double x){ - std::ostringstream ss; - ss << x; - return ss.str(); -} -std::string tostr_fixed(double x, int precision){ - std::ostringstream out; - out << std::setprecision(precision); - out << std::fixed; - out << x; - return out.str(); -} - - std::string now_to_filestring(){ #if _WIN32 && _MSC_VER #pragma warning(disable:4996) @@ -244,30 +201,21 @@ std::string duration_to_string(std::chrono::milliseconds milliseconds){ uint64_t ticks = milliseconds.count(); - std::string str; if (ticks < MINUTE * 2){ - str += tostr_fixed((double)ticks / SECOND, 3); - str += " seconds"; + return std::format("{:.3f} seconds", (double)ticks / SECOND); }else if (ticks < HOUR * 2){ - str += tostr_fixed((double)ticks / MINUTE, 3); - str += " minutes"; + return std::format("{:.3f} minutes", (double)ticks / MINUTE); }else if (ticks < DAY * 2){ - str += tostr_fixed((double)ticks / HOUR, 3); - str += " hours"; + return std::format("{:.3f} hours", (double)ticks / HOUR); }else if (ticks < WEEK * 2){ - str += tostr_fixed((double)ticks / DAY, 3); - str += " days"; + return std::format("{:.3f} days", (double)ticks / DAY); }else if (ticks < YEARS * 2){ - str += tostr_fixed((double)ticks / WEEK, 3); - str += " weeks"; + return std::format("{:.3f} weeks", (double)ticks / WEEK); }else if (ticks < MILLION_YEARS){ - str += tostr_fixed((double)ticks / YEARS, 3); - str += " years"; + return std::format("{:.3f} years", (double)ticks / YEARS); }else{ - str += tostr_fixed((double)ticks / MILLION_YEARS, 3); - str += " million years"; + return std::format("{:.3f} million years", (double)ticks / MILLION_YEARS); } - return str; } diff --git a/Common/Cpp/PrettyPrint.h b/Common/Cpp/PrettyPrint.h index 8681e50d4b..4db05cf370 100644 --- a/Common/Cpp/PrettyPrint.h +++ b/Common/Cpp/PrettyPrint.h @@ -10,19 +10,13 @@ #include #include #include +#include namespace PokemonAutomation{ std::string tostr_padded(size_t digits, uint64_t x); -std::string tostr_u_commas(int64_t x); std::string tostr_bytes(uint64_t bytes); -// Convert double to string using the default precision on ostream. -std::string tostr_default(double x); -// Convert double to string with fixed precision. -// The precision specifies the number of digits after the decimal point. -std::string tostr_fixed(double x, int precision); - // Format current time to a string to be used as filenames. // e.g. "20220320-044444408355" std::string now_to_filestring(); diff --git a/SerialPrograms/Source/CommonFramework/AudioPipeline/AudioInfo.cpp b/SerialPrograms/Source/CommonFramework/AudioPipeline/AudioInfo.cpp index 71bc015170..060af0d288 100644 --- a/SerialPrograms/Source/CommonFramework/AudioPipeline/AudioInfo.cpp +++ b/SerialPrograms/Source/CommonFramework/AudioPipeline/AudioInfo.cpp @@ -370,7 +370,7 @@ std::vector AudioDeviceInfo::all_input_devices(){ WallClock end = current_time(); double seconds = std::chrono::duration_cast(end - start).count() / 1000.; - global_logger_tagged().log("Done querying audio inputs... " + tostr_fixed(seconds, 3) + " seconds", COLOR_CYAN); + global_logger_tagged().log(std::format("Done querying audio inputs... {:.3f} seconds", seconds), COLOR_CYAN); bool show_all_devices = GlobalSettings::instance().AUDIO_PIPELINE->SHOW_ALL_DEVICES; if (show_all_devices){ diff --git a/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSink.cpp b/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSink.cpp index 40b9cfd5f8..ca99d85df8 100644 --- a/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSink.cpp +++ b/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSink.cpp @@ -73,7 +73,7 @@ class AudioOutputDevice : public AudioFloatToStream, private ObjectStreamListene void set_volume(double volume){ auto scope_check = m_sanitizer.check_scope(); double absolute = convertAudioVolumeFromSlider(volume); - m_logger.log("Volume set to: Slider = " + tostr_default(volume) + " -> Absolute = " + tostr_default(absolute)); + m_logger.log(std::format("Volume set to: Slider = {} -> Absolute = {}", volume, absolute)); m_sink.setVolume(absolute); } diff --git a/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSource.cpp b/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSource.cpp index 8174979055..3c4ca72588 100644 --- a/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSource.cpp +++ b/SerialPrograms/Source/CommonFramework/AudioPipeline/IO/AudioSource.cpp @@ -76,7 +76,7 @@ class AudioInputDevice final : public QIODevice{ m_source->start(this); WallClock end = current_time(); double seconds = std::chrono::duration_cast(end - start).count() / 1000.; - logger.log("Done starting audio... " + tostr_fixed(seconds, 3) + " seconds", COLOR_CYAN); + logger.log(std::format("Done starting audio... {:.3f} seconds", seconds), COLOR_CYAN); } ~AudioInputDevice(){ if (m_source){ diff --git a/SerialPrograms/Source/CommonFramework/Environment/HardwareValidation_x86.tpp b/SerialPrograms/Source/CommonFramework/Environment/HardwareValidation_x86.tpp index 56de85da12..cebe840404 100644 --- a/SerialPrograms/Source/CommonFramework/Environment/HardwareValidation_x86.tpp +++ b/SerialPrograms/Source/CommonFramework/Environment/HardwareValidation_x86.tpp @@ -60,7 +60,7 @@ bool check_hardware(){ str += "You can continue, but the program may not work correctly.
"; str += "(i.e. Increased error rate. Fail to reliably detect shinies, etc...)

"; str += "(Reason: Base frequency measured at "; - str += QString::fromStdString(tostr_fixed(specs.base_frequency / 1000000000., 3)); + str += QString::fromStdString(std::format("{:.3f}", specs.base_frequency / 1e9)); str += " GHz which is very slow.)

"; str += "Recommendation: Use a more powerful computer."; box.warning(nullptr, "Warning", str); @@ -82,10 +82,10 @@ bool check_hardware(){ str += "Threads: " + QString::number(specs.threads) + "
"; str += "Sockets: " + QString::number(specs.sockets) + "
"; str += "Numa Nodes: " + QString::number(specs.numa_nodes) + "
"; - str += "Base Frequency: " + QString::fromStdString(tostr_fixed(specs.base_frequency / 1000000000., 3)) + " GHz
"; + str += QString::fromStdString(std::format("Base Frequency: {:.3f} GHz
", specs.base_frequency / 1e9)); str += "
"; str += "(p-cores + 0.2 * v-cores) * base-frequency = "; - str += QString::fromStdString(tostr_fixed(efreq / 1000000000., 3)); + str += QString::fromStdString(std::format("{:.3f}", efreq / 1e9)); str += " GHz

"; str += "Recommendation: Use a more powerful computer."; box.warning(nullptr, "Warning", str); diff --git a/SerialPrograms/Source/CommonFramework/ErrorReports/ErrorReports.cpp b/SerialPrograms/Source/CommonFramework/ErrorReports/ErrorReports.cpp index 38f8c11e0e..588dfde182 100644 --- a/SerialPrograms/Source/CommonFramework/ErrorReports/ErrorReports.cpp +++ b/SerialPrograms/Source/CommonFramework/ErrorReports/ErrorReports.cpp @@ -365,16 +365,15 @@ std::unique_ptr send_all_unsent_reports(Logger& logger, bool allow_pr QMessageBox::StandardButton button = box.information( nullptr, "Error Reporting", - QString::fromStdString( - (reports.size() == 1 - ? "There is " + tostr_u_commas(reports.size()) + " error report.

" - "Would you like to help make this program better by sending it to the developers?

" - : "There are " + tostr_u_commas(reports.size()) + " error reports.

" - "Would you like to help make this program better by sending them to the developers?

" - ) + - make_text_url(ERROR_PATH_UNSENT, "View unsent error reports.")// + "

" -// "(You can change )" - ), + QString::fromStdString(std::format( + "There {} {:L} error report{}.

" + "Would you like to help make this program better by sending {} to the developers?

{}", + (reports.size() == 1 ? "is" : "are"), + reports.size(), + (reports.size() == 1 ? "" : "s"), + (reports.size() == 1 ? "it" : "them"), + make_text_url(ERROR_PATH_UNSENT, "View unsent error reports.") + )), QMessageBox::Yes | QMessageBox::No, QMessageBox::StandardButton::Yes ); diff --git a/SerialPrograms/Source/CommonFramework/ProgramStats/StatsTracking.cpp b/SerialPrograms/Source/CommonFramework/ProgramStats/StatsTracking.cpp index 6f3a0114e7..eb0cdd8c2d 100644 --- a/SerialPrograms/Source/CommonFramework/ProgramStats/StatsTracking.cpp +++ b/SerialPrograms/Source/CommonFramework/ProgramStats/StatsTracking.cpp @@ -69,9 +69,7 @@ std::string StatsTracker::to_str(PrintMode mode) const{ if (!str.empty()){ str += " - "; } - str += stat.label; - str += ": "; - str += tostr_u_commas(count); + str += std::format("{}: {:L}", stat.label, count); } return str; } diff --git a/SerialPrograms/Source/CommonFramework/Tools/StatAccumulator.cpp b/SerialPrograms/Source/CommonFramework/Tools/StatAccumulator.cpp index 90ba86d3d9..1bdc8f3cd1 100644 --- a/SerialPrograms/Source/CommonFramework/Tools/StatAccumulator.cpp +++ b/SerialPrograms/Source/CommonFramework/Tools/StatAccumulator.cpp @@ -40,13 +40,12 @@ double StatAccumulatorI32::stddev() const{ std::string StatAccumulatorI32::dump(const char* units, double divider) const{ divider = 1. / divider; - std::string str; - str += "Count = " + tostr_u_commas(m_count); - str += ", Mean = " + tostr_default(mean() * divider) + units; - str += ", Stddev = " + tostr_default(stddev() * divider) + units; - str += ", Min = " + tostr_default(min() * divider) + units; - str += ", Max = " + tostr_default(max() * divider) + units; - return str; + return std::format("Count = {:L}, Mean = {}{}, Stddev = {}{}, Min = {}{}, Max = {}{}", + m_count, + mean() * divider, units, + stddev() * divider, units, + min() * divider, units, + max() * divider, units); } void StatAccumulatorI32::log(Logger& logger, const std::string& label, const char* units, double divider) const{ logger.log(label + ": " + dump(units, divider), COLOR_MAGENTA); diff --git a/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/CameraImplementations.cpp b/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/CameraImplementations.cpp index 446a722af3..4ebf266385 100644 --- a/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/CameraImplementations.cpp +++ b/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/CameraImplementations.cpp @@ -105,22 +105,12 @@ const CameraBackend& get_camera_backend(){ std::vector get_all_cameras(){ const CameraBackend& backend = get_camera_backend(); -// global_logger_tagged().log("Start loading camera list..."); -// WallClock start = current_time(); std::vector ret = backend.get_all_cameras(); -// WallClock end = current_time(); -// double seconds = std::chrono::duration_cast(end - start).count() / 1000.; -// global_logger_tagged().log("Done loading camera list... " + tostr_fixed(seconds, 3) + " seconds"); return ret; } std::string get_camera_name(const CameraInfo& info){ const CameraBackend& backend = get_camera_backend(); -// global_logger_tagged().log("Start reading camera name..."); -// WallClock start = current_time(); std::string ret = backend.get_camera_name(info); -// WallClock end = current_time(); -// double seconds = std::chrono::duration_cast(end - start).count() / 1000.; -// global_logger_tagged().log("Done reading camera name... " + tostr_fixed(seconds, 3) + " seconds"); return ret; } diff --git a/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.cpp b/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.cpp index dad25df275..1508f86e85 100644 --- a/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.cpp +++ b/SerialPrograms/Source/CommonFramework/VideoPipeline/Backends/MediaServicesQt6.cpp @@ -74,10 +74,10 @@ void GlobalMediaServices::refresh_cameras(){ WallClock end = current_time(); double seconds = std::chrono::duration_cast(end - start).count() / 1000.; - global_logger_tagged().log("Done refreshing camera list... " + tostr_fixed(seconds, 3) + " seconds", COLOR_CYAN); + global_logger_tagged().log(std::format("Done refreshing camera list... {:.3f} seconds", seconds), COLOR_CYAN); }catch (std::exception& e){ global_logger_tagged().log( - std::string("Refreshing camera list returned exception: ") + e.what(), + std::format("Refreshing camera list returned exception: {}", e.what()), COLOR_RED ); } diff --git a/SerialPrograms/Source/CommonFramework/VideoPipeline/Stats/MemoryUtilizationStats.cpp b/SerialPrograms/Source/CommonFramework/VideoPipeline/Stats/MemoryUtilizationStats.cpp index 77c96fc662..04bc656ac5 100644 --- a/SerialPrograms/Source/CommonFramework/VideoPipeline/Stats/MemoryUtilizationStats.cpp +++ b/SerialPrograms/Source/CommonFramework/VideoPipeline/Stats/MemoryUtilizationStats.cpp @@ -84,9 +84,7 @@ bool MemoryUtilizationStats::get_stat( if (current != 0 && total != 0){ usage = (double)current / total; - stat_text += " ("; - stat_text += tostr_fixed(usage * 100, 1); - stat_text += "%)"; + stat_text += std::format(" ({:.1f}%)", usage * 100); return true; } diff --git a/SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoDisplayWidget.cpp b/SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoDisplayWidget.cpp index 010fe324de..fbc5d16b19 100644 --- a/SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoDisplayWidget.cpp +++ b/SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoDisplayWidget.cpp @@ -264,15 +264,15 @@ void VideoDisplayWidget::on_key_release(QKeyEvent* event){ OverlayStatSnapshot VideoSourceFPS::get_current(){ double fps = m_parent.m_video_session.fps_source(); return OverlayStatSnapshot{ - "Video Source FPS: " + tostr_fixed(fps, 2), + std::format("Video Source FPS: {:.2f}", fps), fps < 20 ? COLOR_RED : COLOR_WHITE }; } OverlayStatSnapshot VideoDisplayFPS::get_current(){ double fps = m_parent.m_video_session.fps_display(); return OverlayStatSnapshot{ - "Video Display FPS: " + (fps < 0 ? "???" : tostr_fixed(fps, 2)), - fps >= 0 && fps < 20 ? COLOR_RED : COLOR_WHITE + fps < 0 ? "Video Display FPS: ???" : std::format("Video Display FPS: {:.2f}", fps), + (fps >= 0 && fps < 20) ? COLOR_RED : COLOR_WHITE }; } diff --git a/SerialPrograms/Source/CommonFramework/VideoPipeline/VideoOverlayTypes.cpp b/SerialPrograms/Source/CommonFramework/VideoPipeline/VideoOverlayTypes.cpp index 94efba1d53..3a55f5fd85 100644 --- a/SerialPrograms/Source/CommonFramework/VideoPipeline/VideoOverlayTypes.cpp +++ b/SerialPrograms/Source/CommonFramework/VideoPipeline/VideoOverlayTypes.cpp @@ -65,7 +65,7 @@ OverlayStatSnapshot OverlayStatUtilizationPrinter::get_snapshot(const std::strin color = COLOR_YELLOW; } return OverlayStatSnapshot{ - label + " " + tostr_fixed(utilization * 100, 2) + " %", + std::format("{} {:.2f} %", label, utilization * 100), color }; } diff --git a/SerialPrograms/Source/CommonTools/Audio/AudioPerSpectrumDetectorBase.cpp b/SerialPrograms/Source/CommonTools/Audio/AudioPerSpectrumDetectorBase.cpp index 5810dcb6eb..420a9834fd 100644 --- a/SerialPrograms/Source/CommonTools/Audio/AudioPerSpectrumDetectorBase.cpp +++ b/SerialPrograms/Source/CommonTools/Audio/AudioPerSpectrumDetectorBase.cpp @@ -61,9 +61,9 @@ void AudioPerSpectrumDetectorBase::throw_if_no_sound(std::chrono::milliseconds m void AudioPerSpectrumDetectorBase::log_results(){ if (m_last_timestamp != WallClock::min()){ - m_logger.log(m_audio_name + " detected! Error Coefficient = " + tostr_default(m_lowest_error), COLOR_BLUE); + m_logger.log(std::format("{} detected! Error Coefficient = {}", m_audio_name, m_lowest_error), COLOR_BLUE); }else{ - m_logger.log(m_audio_name + " not detected. Error Coefficient = " + tostr_default(m_lowest_error), COLOR_PURPLE); + m_logger.log(std::format("{} not detected. Error Coefficient = {}", m_audio_name, m_lowest_error), COLOR_PURPLE); } #if 0 diff --git a/SerialPrograms/Source/CommonTools/OCR/OCR_StringMatchResult.cpp b/SerialPrograms/Source/CommonTools/OCR/OCR_StringMatchResult.cpp index e1936376b1..7d7bc79cd6 100644 --- a/SerialPrograms/Source/CommonTools/OCR/OCR_StringMatchResult.cpp +++ b/SerialPrograms/Source/CommonTools/OCR/OCR_StringMatchResult.cpp @@ -53,7 +53,7 @@ void StringMatchResult::log(Logger& logger, double max_log10p, const std::string if (results.size() == 1){ auto iter = results.begin(); str += iter->second.to_str(); - str += " (log10p = " + tostr_default(iter->first) +")"; + str += std::format(" (log10p = {})", iter->first); }else{ str += "Multiple Candidates =>\n"; size_t printed = 0; @@ -62,7 +62,7 @@ void StringMatchResult::log(Logger& logger, double max_log10p, const std::string str += " (" + std::to_string(results.size() - 10) + " more...)\n"; break; } - str += " " + tostr_default(item.first) + " : " + item.second.to_str() + "\n"; + str += std::format(" {} : {}\n", item.first, item.second.to_str()); printed++; } } diff --git a/SerialPrograms/Source/CommonTools/OCR/OCR_TrainingTools.cpp b/SerialPrograms/Source/CommonTools/OCR/OCR_TrainingTools.cpp index d6fb1e32d8..3a8cff7343 100644 --- a/SerialPrograms/Source/CommonTools/OCR/OCR_TrainingTools.cpp +++ b/SerialPrograms/Source/CommonTools/OCR/OCR_TrainingTools.cpp @@ -90,10 +90,11 @@ TrainingSession::TrainingSession( scope.throw_if_cancelled(); } - logger.log( - "Parsing Complete: Languages = " + tostr_u_commas(m_samples.size()) + - ", Samples = " + tostr_u_commas(m_total_samples) - ); + logger.log(std::format( + "Parsing Complete: Languages = {:L}, Samples = {:L}", + m_samples.size(), + m_total_samples + )); } @@ -176,10 +177,10 @@ void TrainingSession::generate_small_dictionary( m_scope.throw_if_cancelled(); } - m_logger.log("Languages: " + tostr_u_commas(m_samples.size())); - m_logger.log("Samples: " + tostr_u_commas(m_total_samples)); - m_logger.log("Matched: " + tostr_u_commas(matched)); - m_logger.log("Missed: " + tostr_u_commas(failed)); + m_logger.log(std::format("Languages: {:L}", m_samples.size())); + m_logger.log(std::format("Samples: {:L}", m_total_samples)); + m_logger.log(std::format("Matched: {:L}", matched.load())); + m_logger.log(std::format("Missed: {:L}", failed.load())); trained.save(output_json_file); } @@ -265,10 +266,10 @@ void TrainingSession::generate_large_dictionary( m_scope.throw_if_cancelled(); } - m_logger.log("Languages: " + tostr_u_commas(m_samples.size())); - m_logger.log("Samples: " + tostr_u_commas(m_total_samples)); - m_logger.log("Matched: " + tostr_u_commas(matched)); - m_logger.log("Missed: " + tostr_u_commas(failed)); + m_logger.log(std::format("Languages: {:L}", m_samples.size())); + m_logger.log(std::format("Samples: {:L}", m_total_samples)); + m_logger.log(std::format("Matched: {:L}", matched.load())); + m_logger.log(std::format("Missed: {:L}", failed.load())); } diff --git a/SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp b/SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp index 01a4385768..828a14a954 100644 --- a/SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp +++ b/SerialPrograms/Source/CommonTools/Options/QtWidgets/StringSelectWidget.cpp @@ -77,7 +77,7 @@ void StringSelectCellWidget::load_options(){ // cout << "load_options()" << endl; const std::vector& cases = m_value.database().case_list(); if (this->count() <= 1){ - global_logger_tagged().log("Loading dropdown with " + tostr_u_commas(cases.size()) + " elements."); + global_logger_tagged().log(std::format("Loading dropdown with {:L} elements.", cases.size())); this->clear(); for (const StringSelectEntry& item : cases){ QPixmap pixmap = QPixmap::fromImage(item.icon.to_QImage_ref()); diff --git a/SerialPrograms/Source/Controllers/SerialPABotBase/Connection/MessageLogger.cpp b/SerialPrograms/Source/Controllers/SerialPABotBase/Connection/MessageLogger.cpp index 6edc164d21..777b92c6a1 100644 --- a/SerialPrograms/Source/Controllers/SerialPABotBase/Connection/MessageLogger.cpp +++ b/SerialPrograms/Source/Controllers/SerialPABotBase/Connection/MessageLogger.cpp @@ -41,7 +41,7 @@ bool SerialLogger::ok_to_log(){ } if (m_messages_dropped != 0){ - m_logger.log("Dropped " + tostr_u_commas(m_messages_dropped) + " message(s) due to logging rate limit.", COLOR_RED); + m_logger.log(std::format("Dropped {:L} message(s) due to logging rate limit.", m_messages_dropped), COLOR_RED); m_messages_dropped = 0; } diff --git a/SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_StatusThread.h b/SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_StatusThread.h index 9e8a784ca6..1127e2660a 100644 --- a/SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_StatusThread.h +++ b/SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_StatusThread.h @@ -76,7 +76,7 @@ class ControllerStatusThread{ auto last = current_time() - last_ack.load(std::memory_order_relaxed); std::chrono::duration seconds = last; if (last > 2 * PERIOD){ - std::string text = "Last Ack: " + tostr_fixed(seconds.count(), 3) + " seconds ago"; + std::string text = std::format("Last Ack: {:.3f} seconds ago", seconds.count()); m_connection.set_status_line1(text, COLOR_RED); // m_logger.log("Connection issue detected. Turning on all logging..."); // settings.log_everything.store(true, std::memory_order_release); diff --git a/SerialPrograms/Source/Integrations/DiscordWebhook.cpp b/SerialPrograms/Source/Integrations/DiscordWebhook.cpp index 89a8c77cae..b36e1815f1 100644 --- a/SerialPrograms/Source/Integrations/DiscordWebhook.cpp +++ b/SerialPrograms/Source/Integrations/DiscordWebhook.cpp @@ -65,8 +65,7 @@ void DiscordWebhookSender::send( ){ cleanup_stuck_requests(); std::shared_ptr json(new JsonValue(obj.clone())); -// cout << "Scheduling Webhook Message... (queue = " + tostr_u_commas(m_queue.size()) + ")" << endl; - logger.log("Scheduling Webhook Message... (queue = " + tostr_u_commas(m_queue.size()) + ")", COLOR_PURPLE); + logger.log(std::format("Scheduling Webhook Message... (queue = {:L})", m_queue.size()), COLOR_PURPLE); m_queue.add_event( delay, [ @@ -98,8 +97,7 @@ void DiscordWebhookSender::send( ){ cleanup_stuck_requests(); std::shared_ptr json(new JsonValue(obj.clone())); -// cout << "Scheduling Webhook Message... (queue = " + tostr_u_commas(m_queue.size()) + ")" << endl; - logger.log("Scheduling Webhook Message... (queue = " + tostr_u_commas(m_queue.size()) + ")", COLOR_PURPLE); + logger.log(std::format("Scheduling Webhook Message... (queue = {:L})", m_queue.size()), COLOR_PURPLE); m_queue.add_event( delay, [ @@ -234,8 +232,7 @@ void DiscordWebhookSender::internal_send( QNetworkRequest request(url); QNetworkAccessManager manager; m_event_loop->connect(&manager, SIGNAL(finished(QNetworkReply*)), SLOT(quit())); -// cout << "Sending Webhook Message... (queue = " + tostr_u_commas(m_queue.size()) + ")" << endl; - m_logger.log("Sending Webhook Message... (queue = " + tostr_u_commas(m_queue.size()) + ")", COLOR_BLUE); + m_logger.log(std::format("Sending Webhook Message... (queue = {:L})", m_queue.size()), COLOR_BLUE); std::unique_ptr reply(manager.post(request, &multiPart)); if (!m_stopping.load(std::memory_order_acquire)){ diff --git a/SerialPrograms/Source/ML/Inference/ML_YOLOv5Detector.cpp b/SerialPrograms/Source/ML/Inference/ML_YOLOv5Detector.cpp index 9f7ee55db4..3bed5bfb5c 100644 --- a/SerialPrograms/Source/ML/Inference/ML_YOLOv5Detector.cpp +++ b/SerialPrograms/Source/ML/Inference/ML_YOLOv5Detector.cpp @@ -139,7 +139,7 @@ bool YOLOv5Watcher::process_frame(const ImageViewRGB32& frame, WallClock timesta m_overlay_set.clear(); for(const auto& box : m_detector.detected_boxes()){ - std::string text = m_detector.session()->label_name(box.label_idx) + ": " + tostr_fixed(box.score, 2); + std::string text = std::format("{}: {:.2f}", m_detector.session()->label_name(box.label_idx), box.score); m_overlay_set.add(COLOR_RED, box.box, text); } return false; diff --git a/SerialPrograms/Source/NintendoSwitch/Controllers/Joycon/NintendoSwitch_JoyconState.cpp b/SerialPrograms/Source/NintendoSwitch/Controllers/Joycon/NintendoSwitch_JoyconState.cpp index 7f51a25bdf..95a2011792 100644 --- a/SerialPrograms/Source/NintendoSwitch/Controllers/Joycon/NintendoSwitch_JoyconState.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Controllers/Joycon/NintendoSwitch_JoyconState.cpp @@ -120,11 +120,13 @@ std::string JoyconState::to_cpp(Milliseconds hold, Milliseconds release) const{ std::string release_str = std::to_string(release.count()) + "ms"; if (non_neutral_fields > 1){ - std::string ret; - ret += "pbf_controller_state(context, " - + button_to_code_string(buttons) + ", " - + tostr_fixed(joystick.x, 3) + ", " + tostr_fixed(joystick.y, 3) + ", " - + hold_str +");\n"; + std::string ret = std::format( + "pbf_controller_state(context, {}, {:.3f}, {:.3f}, {});\n", + button_to_code_string(buttons), + joystick.x, + joystick.y, + hold_str + ); if (release != Milliseconds(0)){ ret += "pbf_wait(context, " + release_str + ");\n"; } @@ -132,13 +134,11 @@ std::string JoyconState::to_cpp(Milliseconds hold, Milliseconds release) const{ } switch (non_neutral_field){ case 0: - return "pbf_press_button(context, " - + button_to_code_string(buttons) + ", " - + hold_str + ", " + release_str + ");\n"; + return std::format("pbf_press_button(context, {}, {}, {});\n", + button_to_code_string(buttons), hold_str, release_str); case 1: - return "pbf_move_joystick(context, " - + tostr_fixed(joystick.x, 3) + ", " + tostr_fixed(joystick.y, 3) + ", " - + hold_str + ", " + release_str + ");\n"; + return std::format("pbf_move_joystick(context, {:.3f}, {:.3f}, {}, {});\n", + joystick.x, joystick.y, hold_str, release_str); } throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Impossible state."); } diff --git a/SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ControllerWithScheduler.cpp b/SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ControllerWithScheduler.cpp index d39965c92d..f783ed7e27 100644 --- a/SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ControllerWithScheduler.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ControllerWithScheduler.cpp @@ -141,10 +141,10 @@ void ControllerWithScheduler::issue_right_joystick( execute_schedule(cancellable, schedule); if (m_logging_throttler){ m_logger.log( - "issue_right_joystick(): (" + tostr_fixed(position.x, 3) + "," + tostr_fixed(position.y, 3) + ")" + - ", delay = " + std::to_string(delay.count()) + "ms" + - ", hold = " + std::to_string(hold.count()) + "ms" + - ", cooldown = " + std::to_string(cooldown.count()) + "ms", + std::format( + "issue_right_joystick(): ({:.3f}, {:.3f}), delay = {}ms, hold = {}ms, cooldown = {}ms", + position.x, position.y, delay.count(), hold.count(), cooldown.count() + ), COLOR_DARKGREEN ); } @@ -248,11 +248,14 @@ void ControllerWithScheduler::issue_full_controller_state( // (people entering passwords) if (enable_logging){ m_logger.log( - "issue_controller_state(): (" + button_to_string(button) + - "), dpad(" + dpad_to_string(dpad) + - "), LJ(" + tostr_fixed(left_joystick.x, 3) + "," + tostr_fixed(left_joystick.y, 3) + - "), RJ(" + tostr_fixed(right_joystick.x, 3) + "," + tostr_fixed(right_joystick.y, 3) + - "), hold = " + std::to_string(hold.count()) + "ms", + std::format( + "issue_controller_state(): ({}), dpad({}), LJ({:.3f}, {:.3f}), RJ({:.3f}, {:.3f}), hold = {}ms", + button_to_string(button), + dpad_to_string(dpad), + left_joystick.x, left_joystick.y, + right_joystick.x, right_joystick.y, + hold.count() + ), COLOR_DARKGREEN ); }else{ diff --git a/SerialPrograms/Source/NintendoSwitch/Controllers/Procon/NintendoSwitch_ProControllerState.cpp b/SerialPrograms/Source/NintendoSwitch/Controllers/Procon/NintendoSwitch_ProControllerState.cpp index cffc2c6c14..0b75bdd963 100644 --- a/SerialPrograms/Source/NintendoSwitch/Controllers/Procon/NintendoSwitch_ProControllerState.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Controllers/Procon/NintendoSwitch_ProControllerState.cpp @@ -164,13 +164,13 @@ std::string ProControllerState::to_cpp(Milliseconds hold, Milliseconds release) std::string release_str = std::to_string(release.count()) + "ms"; if (non_neutral_fields > 1){ - std::string ret; - ret += "pbf_controller_state(context, " - + button_to_code_string(buttons) + ", " - + dpad_to_code_string(dpad) + ", {" - + tostr_fixed(left_joystick.x, 3) + ", " + tostr_fixed(left_joystick.y, 3) + "}, {" - + tostr_fixed(right_joystick.x, 3) + ", " + tostr_fixed(right_joystick.y, 3) + "}, " - + hold_str +");\n"; + std::string ret = std::format( + "pbf_controller_state(context, {}, {}, {{{:.3f}, {:.3f}}}, {{{:.3f}, {:.3f}}}, {});\n", + button_to_code_string(buttons), + dpad_to_code_string(dpad), + left_joystick.x, left_joystick.y, + right_joystick.x, right_joystick.y, + hold_str); if (release != Milliseconds(0)){ ret += "pbf_wait(context, " + release_str + ");\n"; } diff --git a/SerialPrograms/Source/Pokemon/Pokemon_CollectedPokemonInfo.cpp b/SerialPrograms/Source/Pokemon/Pokemon_CollectedPokemonInfo.cpp index a7fd926038..0d05a71d14 100644 --- a/SerialPrograms/Source/Pokemon/Pokemon_CollectedPokemonInfo.cpp +++ b/SerialPrograms/Source/Pokemon/Pokemon_CollectedPokemonInfo.cpp @@ -4,6 +4,7 @@ * */ +#include #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/Json/JsonValue.h" #include "Common/Cpp/Json/JsonArray.h" @@ -103,9 +104,7 @@ std::ostream& operator<<(std::ostream& os, const std::optionaldump(); - str += "\n"; + str += std::format("{:L} : {}\n", item.first, item.second->dump()); } return str; } diff --git a/SerialPrograms/Source/Pokemon/Pokemon_Notification.cpp b/SerialPrograms/Source/Pokemon/Pokemon_Notification.cpp index 31e8c7ccb8..4e657a2053 100644 --- a/SerialPrograms/Source/Pokemon/Pokemon_Notification.cpp +++ b/SerialPrograms/Source/Pokemon/Pokemon_Notification.cpp @@ -115,13 +115,13 @@ void send_encounter_notification( shinies = "Maybe Shiny"; break; case ShinyType::UNKNOWN_SHINY: - shinies = symbol + std::string(" Shiny ") + symbol; + shinies = std::format("{} Shiny {}", symbol, symbol); break; case ShinyType::STAR_SHINY: - shinies = symbol + std::string(" Star Shiny ") + symbol; + shinies = std::format("{} Star Shiny {}", symbol, symbol); break; case ShinyType::SQUARE_SHINY: - shinies = symbol + std::string(" Square Shiny ") + symbol; + shinies = std::format("{} Square Shiny {}", symbol, symbol); break; } }else if (!results.empty()){ @@ -130,16 +130,16 @@ void send_encounter_notification( case 0: if (shiny_detected){ symbol = shiny_symbol(ShinyType::UNKNOWN_SHINY); - shinies = symbol + " Found Shiny! " + symbol + " (Unable to determine which.)"; + shinies = std::format("{} Found Shiny! {} (Unable to determine which.)", symbol, symbol); }else{ shinies = "No Shinies"; } break; case 1: - shinies = symbol + " Found Shiny! " + symbol; + shinies = std::format("{} Found Shiny! {}", symbol, symbol); break; default: - shinies += symbol + std::string(" Multiple Shinies! ") + symbol; + shinies += std::format("{} Multiple Shinies! {}", symbol, symbol); break; } } @@ -150,7 +150,7 @@ void send_encounter_notification( } if (!shinies.empty()){ if (!std::isnan(alpha)){ - shinies += "\n(Detection Alpha = " + tostr_default(alpha) + ")"; + shinies += std::format("\n(Detection Alpha = {})", alpha); } embeds.emplace_back("Shininess:", std::move(shinies)); } diff --git a/SerialPrograms/Source/Pokemon/Resources/Pokemon_EggSteps.cpp b/SerialPrograms/Source/Pokemon/Resources/Pokemon_EggSteps.cpp index cd56149e49..3e966c07ab 100644 --- a/SerialPrograms/Source/Pokemon/Resources/Pokemon_EggSteps.cpp +++ b/SerialPrograms/Source/Pokemon/Resources/Pokemon_EggSteps.cpp @@ -49,8 +49,7 @@ EggStepDatabase::EggStepDatabase(const char* resource_path, const SpriteDatabase for (const auto& item : nat_id_to_steps){ const std::string& slug = item.second.first; - std::string display_name = Pokemon::get_pokemon_name(slug).display_name(); - display_name += " (" + tostr_u_commas(item.second.second) + " steps)"; + std::string display_name = std::format("{} ({:L} steps)", Pokemon::get_pokemon_name(slug).display_name(), item.second.second); const SpriteDatabase::Sprite* sprite = sprites == nullptr ? nullptr diff --git a/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.cpp b/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.cpp index fd22b3f29e..02189d1c14 100644 --- a/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.cpp @@ -213,13 +213,10 @@ void determine_shiny_status( alpha_own += DIALOG_ALPHA; } } - env.log( - "ShinyDetector: Wild Alpha = " + tostr_default(alpha_wild_overall) + - (wild_shiny_sound_detected ? " (shiny sound detected)" : "") + - ", Left Alpha = " + tostr_default(alpha_wild_left) + - ", Right Alpha = " + tostr_default(alpha_wild_right) + - ", Your Alpha = " + tostr_default(alpha_own) + - (own_shiny_sound_detected ? " (shiny sound detected)" : ""), + env.log(std::format("ShinyDetector: Wild Alpha = {}{}, Left Alpha = {}, Right Alpha = {}, Your Alpha = {}{}", + alpha_wild_overall, wild_shiny_sound_detected ? " (shiny sound detected)" : "", + alpha_wild_left, alpha_wild_right, + alpha_own, own_shiny_sound_detected ? " (shiny sound detected)" : ""), COLOR_PURPLE ); @@ -240,10 +237,7 @@ void determine_shiny_status( if (DIALOG_ALPHA <= alpha_wild_overall && alpha_wild_overall < DIALOG_ALPHA + 1.5){ dump_image(env.logger(), env.program_info(), "LowShinyAlpha", wild_result.get_best_screenshot()); - std::string str; - str += "Low alpha shiny (alpha = "; - str += tostr_default(alpha_wild_overall); - str += ").\nPlease report this image to the " + PROGRAM_NAME + " server."; + std::string str = std::format("Low alpha shiny (alpha = {}).\nPlease report this image to the {} server.", alpha_wild_overall, PROGRAM_NAME); send_program_recoverable_error_notification( env, settings, str, diff --git a/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinySparkleSet.cpp b/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinySparkleSet.cpp index 1799517c8e..98b30127b7 100644 --- a/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinySparkleSet.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinySparkleSet.cpp @@ -55,14 +55,14 @@ std::string ShinySparkleSetBDSP::to_str() const{ if (m_alpha_overall < 3.0){ return str; } - str += "SparkleDetector"; + str = "SparkleDetector"; if (!balls.empty()){ - str += " - Balls: " + std::to_string(balls.size()); + str += std::format(" - Balls: {}", balls.size()); } if (!stars.empty()){ - str += " - Stars: " + std::to_string(stars.size()); + str += std::format(" - Stars: {}", stars.size()); } - str += " - (alpha = " + tostr_default(m_alpha_overall) + ")"; + str += std::format(" - (alpha = {})", m_alpha_overall); return str; } void ShinySparkleSetBDSP::draw_boxes( diff --git a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp index 7ca159d970..e24b27282c 100644 --- a/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp +++ b/SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_BurmyFinder.cpp @@ -150,7 +150,7 @@ struct BurmyFinder::TreeCounter{ if (i != 0){ oss << " - "; } - oss << "Tree " << i << ": " << tostr_u_commas(tree[i]); + oss << std::format("Tree {}: {:L}", i, tree[i]); } logger.log(oss.str()); } diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp index 4a9ca9ac50..31ab57cb28 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp @@ -486,8 +486,8 @@ double get_facing_direction( ); } double angle = arrow_watcher.detected_angle_deg(); - console.log("Direction arrow detected! Angle: " + tostr_fixed(angle, 0) + " degrees"); - console.overlay().add_log("Minimap Arrow: " + tostr_fixed(angle, 0) + " deg", COLOR_YELLOW); + console.log(std::format("Direction arrow detected! Angle: {:.0f} degrees", angle)); + console.overlay().add_log(std::format("Minimap Arrow: {:.0f} deg", angle), COLOR_YELLOW); return angle; } diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp index 32e94d5da0..864dc8ecbe 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "Common/Cpp/Exceptions.h" #include "CommonFramework/Exceptions/OperationFailedException.h" #include "CommonFramework/ImageTools/ImageBoxes.h" @@ -148,12 +149,10 @@ void print_boxes_data(const std::vector>& bo std::string create_overlay_info(const CollectedPokemonInfo& pokemon, const BoxDexNumberDetector& dex_number_detector){ const std::string& display_name = get_pokemon_name(pokemon.name_slug).display_name(); - + std::string overlay_log = dex_number_detector.dex_type() == DexType::HYPERSPACE ? "H" : "L"; - - char dex_str[6]; - snprintf(dex_str, sizeof(dex_str), "%03d", dex_number_detector.dex_number()); - overlay_log += std::string(dex_str) + " " + display_name; + + overlay_log += std::format("{:03} {}", dex_number_detector.dex_number(), display_name); if(pokemon.gender == StatsHuntGenderFilter::Male){ overlay_log += " " + UNICODE_MALE; } else if (pokemon.gender == StatsHuntGenderFilter::Female){ diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp index ed7ea1700a..d3e063e55b 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp @@ -153,7 +153,7 @@ void route_wild_zone_3_tower(SingleSwitchProgramEnvironment& env, ProControllerC } else{ OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, - "route_wild_zone_3_tower: unexpected facing direction: " + PokemonAutomation::tostr_fixed(direction, 0) + " deg", + std::format("route_wild_zone_3_tower: unexpected facing direction: {:.0f} deg", direction), env.console ); } diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp index 68ac42fcbc..8d61eb0496 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneCafe.cpp @@ -186,8 +186,8 @@ void do_one_cafe_trip( { const double cur_direction = get_facing_direction(env.console, context); const double direction_change = get_angle_between_facing_directions(starting_direction, cur_direction); - env.log("Facing direction difference after day/night change: " + tostr_fixed(direction_change, 0) + " deg, from " - + tostr_fixed(starting_direction, 0) + " to " + tostr_fixed(cur_direction, 0) + " deg"); + env.log(std::format("Facing direction difference after day/night change: {:.0f} deg, from {:.0f} to {:.0f} deg", + direction_change, starting_direction, cur_direction)); if (direction_change > 30){ // we are already facing the gate diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp index f1c0c41e56..ec086e9343 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_WildZoneEntrance.cpp @@ -329,9 +329,11 @@ void leave_zone_and_reset_spawns( { const double cur_direction = get_facing_direction(env.console, context); const double direction_change = get_angle_between_facing_directions(starting_direction, cur_direction); - env.log("Facing direction difference after day/night change: " + tostr_fixed(direction_change, 0) + " deg, from " - + tostr_fixed(starting_direction, 0) + " to " + tostr_fixed(cur_direction, 0) + " deg"); - + env.log(std::format( + "Facing direction difference after day/night change: {:.0f} deg, from {:.0f} to {:.0f} deg", + direction_change, starting_direction, cur_direction + )); + uint8_t joystick_y = 0; if (direction_change > 150.0){ // we are facing towards the gate @@ -346,7 +348,7 @@ void leave_zone_and_reset_spawns( }else{ OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, - "leave_zone_and_reset_spawns(): Facing direction after day/night change is wrong: " + tostr_fixed(direction_change, 0) + " deg", + std::format("leave_zone_and_reset_spawns(): Facing direction after day/night change is wrong: {:.0f} deg", direction_change), env.console ); } diff --git a/SerialPrograms/Source/PokemonSV/Inference/Tera/PokemonSV_TeraCardDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/Tera/PokemonSV_TeraCardDetector.cpp index 0521e8adcb..ec864e5c78 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Tera/PokemonSV_TeraCardDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/Tera/PokemonSV_TeraCardDetector.cpp @@ -247,22 +247,13 @@ std::set TeraCardReader::pokemon_slug( -std::string TeraLobbyNameMatchResult::to_str() const{ - std::string ret; - ret += "\"" + raw_ocr; - if (ret.back() == '\n'){ - ret.pop_back(); - } -// ret += "\" -> \"" + normalized_ocr + "\" == \""; - ret += "\" -> \""; - ret += entry.name; - ret += "\" ("; - if (exact_match){ - ret += "exact match, "; - }else{ - ret += "partial match, "; - } - ret += "log10p = " + tostr_default(log10p) + ")"; +std::string TeraLobbyNameMatchResult::to_str() const { + std::string ret = std::format("\"{}\"", raw_ocr.ends_with('\n') ? raw_ocr.substr(0, raw_ocr.size() - 1) : raw_ocr); + ret += std::format(" -> \"{}\" ({} match, log10p = {})", + entry.name, + exact_match ? "exact" : "partial", + log10p + ); return ret; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 5c9695953f..343c23a469 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -1514,7 +1514,7 @@ ImageFloatBox get_yolo_box( ImageFloatBox box = detected_box.box; std::string label = yolo_detector.session()->label_name(detected_box.label_idx); double score = detected_box.score; - std::string label_score = label + ": " + tostr_fixed(score, 2); + std::string label_score = std::format("{}: {:.2f}", label, score); if (target_label == label){ overlays.add(COLOR_RED, box, label_score); @@ -1528,8 +1528,12 @@ ImageFloatBox get_yolo_box( } - env.console.log(std::string(target_label) + ": {" + std::to_string(target_box.x) + ", " + std::to_string(target_box.y) + ", " + std::to_string(target_box.width) + ", " + std::to_string(target_box.height) + "}"); - env.console.log("center-y: " + std::to_string(target_box.y + target_box.height/2) + " center-x: " + std::to_string(target_box.x + target_box.width/2)); + env.console.log(std::format("{}: {{ {}, {}, {}, {} }}", + target_label, target_box.x, target_box.y, target_box.width, target_box.height)); + + env.console.log(std::format("center-y: {} center-x: {}", + target_box.y + target_box.height / 2, + target_box.x + target_box.width / 2)); return target_box; } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ESPTraining.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ESPTraining.cpp index 1d6ca0baac..04feee954d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ESPTraining.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_ESPTraining.cpp @@ -66,7 +66,7 @@ void ESPTraining::program(SingleSwitchProgramEnvironment& env, ProControllerCont ESPTrainingStats& stats = env.current_stats(); for (uint32_t c = 0; c < ROUNDS; c++){ - env.log("Round: " + tostr_u_commas(c)); + env.log(std::format("Round: {:L}", c)); //Initiate dialog with Dendra //Dendra needs time to turn and face the player diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp index 3b6fcc4de4..2e42a70b73 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulChestFarmer.cpp @@ -165,7 +165,7 @@ void GimmighoulChestFarmer::program(SingleSwitchProgramEnvironment& env, ProCont uint32_t c = 0; while(c < PP){ // Press A to enter battle, assuming there is a chest - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); pbf_mash_button(context, BUTTON_A, 125); pbf_wait(context, 125); //Wait extra to make sure the overworld map vanishes context.wait_for_all_requests(); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulRoamingFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulRoamingFarmer.cpp index e6b45c95ab..6e7cbbb8b0 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulRoamingFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_GimmighoulRoamingFarmer.cpp @@ -67,7 +67,7 @@ void GimmighoulRoamingFarmer::program(SingleSwitchProgramEnvironment& env, ProCo uint8_t year = MAX_YEAR; for (uint32_t c = 0; c < SKIPS; c++){ // Grab coin assuming there is one - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); pbf_mash_button(context, BUTTON_A, 90); pbf_wait(context, 2 * TICKS_PER_SECOND); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp index 7a50b7c745..2e0add02df 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.cpp @@ -262,7 +262,7 @@ void run_material_farmer( // heal before starting Let's go console.log("Heal before starting Let's go", COLOR_PURPLE); - console.log("Heal threshold: " + tostr_default(options.AUTO_HEAL_PERCENT), COLOR_PURPLE); + console.log(std::format("Heal threshold: {}", options.AUTO_HEAL_PERCENT.operator double()), COLOR_PURPLE); check_hp(env, console, context, options, hp_watcher, stats); /* @@ -335,7 +335,7 @@ void check_hp( ){ double hp = hp_watcher.last_known_value() * 100; if (0 < hp){ - stream.log("Last Known HP: " + tostr_default(hp) + "%", COLOR_BLUE); + stream.log(std::format("Last Known HP: {}%", hp), COLOR_BLUE); }else{ stream.log("Last Known HP: ?", COLOR_RED); } diff --git a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp index c944e551c5..d688e78966 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ItemPrinter/PokemonSV_ItemPrinterRNG.cpp @@ -400,7 +400,7 @@ ItemPrinterPrizeResult ItemPrinterRNG::run_print_at_date( // Commit the date and start the timer. pbf_press_button(context, BUTTON_A, 20, 30); WallClock trigger_time = std::chrono::system_clock::now() + trigger_delay; - env.log("Will commit in " + tostr_u_commas(trigger_delay.count()) + " milliseconds."); + env.log(std::format("Will commit in {:L} milliseconds.", trigger_delay.count())); // Re-enter the game. pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_AreaZeroPlatform.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_AreaZeroPlatform.cpp index 579d481401..15db27fc30 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_AreaZeroPlatform.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_AreaZeroPlatform.cpp @@ -439,7 +439,7 @@ void choose_path( double diff_x = platform_x - 0.62; double diff_y = platform_y - 0.71; - logger.log("Move Direction: x = " + tostr_default(diff_x) + ", y = " + tostr_default(diff_y), COLOR_BLUE); + logger.log(std::format("Move Direction: x = {}, y = {}", diff_x, diff_y), COLOR_BLUE); direction_to_stick(x, y, diff_x, diff_y); duration = (uint16_t)std::min(std::sqrt(diff_x*diff_x + diff_y*diff_y) * 125 * 12, 400); @@ -480,7 +480,7 @@ void area_zero_platform_run_path2( stream.log("Unable to find center of platform.", COLOR_RED); return; } - stream.log("Platform center at: x = " + tostr_default(platform_x) + ", y = " + tostr_default(platform_y), COLOR_BLUE); + stream.log(std::format("Platform center at: x = {}, y = {}", platform_x, platform_y), COLOR_BLUE); choose_path(stream.logger(), move_x, move_y, duration, platform_x, platform_y); diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp index 97917a3dbe..6c9fd65262 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_LetsGoTools.cpp @@ -227,11 +227,7 @@ bool use_lets_go_to_clear_in_front( last_kill = WallDuration::max(); }else{ last_kill = now - last_kill_time; - stream.log( - "Last Kill: " + - tostr_fixed(std::chrono::duration_cast(last_kill).count() / 1000., 3) + - " seconds ago" - ); + stream.log(std::format("Last Kill: {:.3f} seconds ago", last_kill.count() / 1000.0)); } if (last_kill > timeout){ diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp index 5d0cd7bb68..c3241b9e8d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.cpp @@ -210,7 +210,7 @@ bool ShinyHuntAreaZeroPlatform::run_traversal(ProControllerContext& context){ double hp = m_sensors->lets_go_hp.last_known_value() * 100; if (0 < hp){ - stream.log("Last Known HP: " + tostr_default(hp) + "%", COLOR_BLUE); + stream.log(std::format("Last Known HP: {}%", hp), COLOR_BLUE); }else{ stream.log("Last Known HP: ?", COLOR_RED); } @@ -246,12 +246,13 @@ bool ShinyHuntAreaZeroPlatform::run_traversal(ProControllerContext& context){ kills, encounters, window_seconds ); } - stream.log( - "Starting Traversal Iteration: " + tostr_u_commas(m_iterations) + - "\n Time Window (Seconds): " + std::to_string(window_seconds.count()) + - "\n Kills: " + std::to_string(kills) + - "\n Encounters: " + std::to_string(encounters) - ); + stream.log(std::format( + "Starting Traversal Iteration: {:L}\n" + " Time Window (Seconds): {}\n" + " Kills: {}\n" + " Encounters: {}", + m_iterations, window_seconds.count(), kills, encounters + )); // Check we want to do a platform reset first: do{ diff --git a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp index 85c8a252bd..cb8c3dc18f 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.cpp @@ -370,7 +370,7 @@ void ShinyHuntScatterbug::run_one_sandwich_iteration( double hp = hp_watcher.last_known_value() * 100; if (0 < hp){ - env.console.log("Last Known HP: " + tostr_default(hp) + "%", COLOR_BLUE); + env.console.log(std::format("Last Known HP: {}%", hp), COLOR_BLUE); }else{ env.console.log("Last Known HP: ?", COLOR_RED); } diff --git a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.cpp b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.cpp index 3f4260b5b6..3bdacf460f 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/TeraRaids/PokemonSV_JoinTracker.cpp @@ -85,7 +85,7 @@ bool check_ban_for_name( double w_log10p = std::log10(w_probability); if (w_log10p <= entry.log10p){ if (PreloadSettings::instance().DEVELOPER_MODE){ - logger.log("Cannot ban whitelisted user: " + name + " (log10p = " + tostr_default(w_log10p) + ")", COLOR_RED); + logger.log(std::format("Cannot ban whitelisted user: {} (log10p = {})", name, w_log10p), COLOR_RED); } return false; } diff --git a/SerialPrograms/Source/PokemonSwSh/Inference/Battles/PokemonSwSh_BattleDialogTracker.cpp b/SerialPrograms/Source/PokemonSwSh/Inference/Battles/PokemonSwSh_BattleDialogTracker.cpp index fc794dff15..71c94508fe 100644 --- a/SerialPrograms/Source/PokemonSwSh/Inference/Battles/PokemonSwSh_BattleDialogTracker.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Inference/Battles/PokemonSwSh_BattleDialogTracker.cpp @@ -50,8 +50,7 @@ bool EncounterDialogTracker::process_frame(const ImageViewRGB32& screen, WallClo std::chrono::milliseconds gap_duration = std::chrono::duration_cast(timestamp - m_end_dialog); m_logger.log( - "DialogTracker: Dialog off -> on. " + - tostr_default(gap_duration.count() / 1000.) + " seconds", + std::format("DialogTracker: Dialog off -> on. {} seconds", gap_duration.count() / 1000.0), COLOR_PURPLE ); @@ -83,8 +82,7 @@ bool EncounterDialogTracker::process_frame(const ImageViewRGB32& screen, WallClo void EncounterDialogTracker::push_end(WallClock timestamp){ std::chrono::milliseconds gap_duration = std::chrono::duration_cast(timestamp - m_end_dialog); m_logger.log( - "DialogTracker: End " + - tostr_default(gap_duration.count() / 1000.) + " seconds", + std::format("DialogTracker: End {} seconds", gap_duration.count() / 1000.0), COLOR_PURPLE ); EncounterState state = m_state.load(std::memory_order_relaxed); diff --git a/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_BeamSetter.cpp b/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_BeamSetter.cpp index 17fe63be10..e6b0fd22ad 100644 --- a/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_BeamSetter.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_BeamSetter.cpp @@ -157,13 +157,15 @@ BeamSetter::Detection BeamSetter::run( } } - std::string str = "BeamReader: column = " + std::to_string(best_index); - - str += ", stddev = " + tostr_default(best_stddev); - str += ", brightness = " + tostr_default(best_brightness); - str += ", euclidean = " + tostr_default(best_euclidean); - str += ", delta = " + tostr_default(best_delta); - str += ", sigma = " + tostr_default(best_sigma); + std::string str = std::format( + "BeamReader: column = {}, stddev = {}, brightness = {}, euclidean = {}, delta = {}, sigma = {}", + best_index, + best_stddev, + best_brightness, + best_euclidean, + best_delta, + best_sigma + ); if (purple){ m_stream.log(str, COLOR_BLUE); diff --git a/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_RaidLobbyReader.cpp b/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_RaidLobbyReader.cpp index 632029452b..b1b3e21bd7 100644 --- a/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_RaidLobbyReader.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Inference/Dens/PokemonSwSh_RaidLobbyReader.cpp @@ -40,8 +40,6 @@ RaidLobbyState RaidLobbyReader::read(const ImageViewRGB32& screen){ return RaidLobbyState(); } - std::string str; - FloatPixel average0 = image_average(extract_box_reference(screen, m_checkbox0)); FloatPixel average1 = image_average(extract_box_reference(screen, m_checkbox1)); FloatPixel average2 = image_average(extract_box_reference(screen, m_checkbox2)); @@ -49,21 +47,17 @@ RaidLobbyState RaidLobbyReader::read(const ImageViewRGB32& screen){ double distance1 = euclidean_distance(average0, average1); double distance2 = euclidean_distance(average0, average2); double distance3 = euclidean_distance(average0, average3); - str += "Ready = {"; - str += tostr_default(0) + ", "; - str += tostr_default(distance1) + ", "; - str += tostr_default(distance2) + ", "; - str += tostr_default(distance3) + "}"; double stddev0 = image_stddev(extract_box_reference(screen, m_spritebox0)).sum(); double stddev1 = image_stddev(extract_box_reference(screen, m_spritebox1)).sum(); double stddev2 = image_stddev(extract_box_reference(screen, m_spritebox2)).sum(); double stddev3 = image_stddev(extract_box_reference(screen, m_spritebox3)).sum(); - str += ", Sprites = {"; - str += tostr_default(stddev0) + ", "; - str += tostr_default(stddev1) + ", "; - str += tostr_default(stddev2) + ", "; - str += tostr_default(stddev3) + "}"; + + std::string str = std::format( + "Ready = {{0, {}, {}, {}}}, Sprites = {{{}, {}, {}, {}}}", + distance1, distance2, distance3, + stddev0, stddev1, stddev2, stddev3 + ); m_logger.log("RaidLobbyReader(): " + str, COLOR_PURPLE); diff --git a/SerialPrograms/Source/PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_ShinyEncounterDetector.cpp b/SerialPrograms/Source/PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_ShinyEncounterDetector.cpp index 6f4140c79f..0a3a31ffaf 100644 --- a/SerialPrograms/Source/PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_ShinyEncounterDetector.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Inference/ShinyDetection/PokemonSwSh_ShinyEncounterDetector.cpp @@ -103,9 +103,10 @@ ShinyType determine_shiny_status( double best_square = sparkles.best_square(); logger.log( - "ShinyDetector: Overall Alpha = " + tostr_default(alpha) + - ", Star Alpha = " + tostr_default(best_star) + - ", Square Alpha = " + tostr_default(best_square), + std::format("ShinyDetector: Overall Alpha = {}, Star Alpha = {}, Square Alpha = {}", + alpha, + best_star, + best_square), COLOR_PURPLE ); diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.cpp index e7813ecce3..0b9820e941 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.cpp @@ -267,7 +267,7 @@ std::set BattleMenuReader::read_opponent_in_summary(Logger& logger, std::string type_str = "Type Read Result:\n"; for (const auto& item : candidates){ - type_str += " " + POKEMON_TYPE_SLUGS().get_string(item.second.first) + " : " + tostr_default(item.first ) + "\n"; + type_str += std::format(" {} : {}\n", POKEMON_TYPE_SLUGS().get_string(item.second.first), item.first); } logger.log(type_str); diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp index 3ef7d32ee1..0f231c4515 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp @@ -208,10 +208,10 @@ class EndBattleDecider_StrongBoss : public EndBattleDecider{ } double win_ratio = path_stats.win_ratio(); if (win_ratio >= m_min_win_ratio){ - m_logger.log("Win Ratio = " + tostr_default(win_ratio) + ": Resetting to keep path.", COLOR_BLUE); + m_logger.log(std::format("Win Ratio = {}: Resetting to keep path.", win_ratio), COLOR_BLUE); return CaughtScreenAction::RESET; }else{ - m_logger.log("Win Ratio = " + tostr_default(win_ratio) + ": Continuing to get new path.", COLOR_BLUE); + m_logger.log(std::format("Win Ratio = {}: Continuing to get new path.", win_ratio), COLOR_BLUE); return CaughtScreenAction::TAKE_NON_BOSS_SHINY_AND_CONTINUE; } } diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer.cpp index 97d7b04a50..3a8aefe4f7 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer.cpp @@ -66,7 +66,7 @@ void BerryFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCont uint8_t year = MAX_YEAR; uint16_t save_count = 0; for (uint32_t c = 0; c < SKIPS; c++){ - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); home_roll_date_enter_game_autorollback(env.console, context, year); if (context->performance_class() == ControllerPerformanceClass::SysbotBase){ diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer2.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer2.cpp index 7039c21306..3233535724 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer2.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-BerryFarmer2.cpp @@ -298,8 +298,8 @@ void BerryFarmer2::program(SingleSwitchProgramEnvironment& env, ProControllerCon while (c < FETCH_ATTEMPTS){ env.update_stats(); uint16_t iteration_attempts = 1; - env.log("Fetch Attempts: " + tostr_u_commas(c)); - + env.log(std::format("Fetch Attempts: {:L}", c)); + home_roll_date_enter_game_autorollback(env.console, context, year); stats.days++; // Interact with the tree diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-DailyHighlightFarmer.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-DailyHighlightFarmer.cpp index 5ec192d82b..00e84e02de 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-DailyHighlightFarmer.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-DailyHighlightFarmer.cpp @@ -66,7 +66,7 @@ void DailyHighlightFarmer::program(SingleSwitchProgramEnvironment& env, ProContr uint8_t year = MAX_YEAR; uint16_t save_count = 0; for (uint32_t c = 0; c < SKIPS; c++){ - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); home_roll_date_enter_game_autorollback(env.console, context, year); if (context->performance_class() == ControllerPerformanceClass::SysbotBase){ pbf_wait(context, 90); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-LotoFarmer.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-LotoFarmer.cpp index 9798d0d1b3..5d6c7ebde8 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-LotoFarmer.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-LotoFarmer.cpp @@ -66,7 +66,7 @@ void LotoFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerConte uint8_t year = MAX_YEAR; for (uint32_t c = 0; c < SKIPS; c++){ - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); home_roll_date_enter_game_autorollback(env.console, context, year); if (context->performance_class() == ControllerPerformanceClass::SysbotBase){ pbf_wait(context, 90); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-PokeJobsFarmer.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-PokeJobsFarmer.cpp index b51bc7c646..b83f87b6ec 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-PokeJobsFarmer.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-PokeJobsFarmer.cpp @@ -103,7 +103,7 @@ void PokeJobsFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC // Start new jobs for (uint16_t j = 1; j <= CONCURRENCY; j++){ - env.log("Starting job #" + tostr_u_commas(j) + " in year " + tostr_u_commas(2000 + year)); + env.log(std::format("Starting job #{:L} in year {:L}", j, 2000 + year)); // Enter Poke Jobs enter_jobs(context, MENU_INDEX); @@ -145,7 +145,7 @@ void PokeJobsFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerC // Complete jobs for (uint16_t j = 1; j <= CONCURRENCY; j++){ - env.log("Completing job #" + tostr_u_commas(j) + " in year " + tostr_u_commas(2000 + year)); + env.log(std::format("Completing job #{:L} in year {:L}", j, 2000 + year)); // Enter Poke Jobs enter_jobs(context, MENU_INDEX); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-StowOnSideFarmer.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-StowOnSideFarmer.cpp index c7fb045105..98902a24e5 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-StowOnSideFarmer.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-StowOnSideFarmer.cpp @@ -66,7 +66,7 @@ void StowOnSideFarmer::program(SingleSwitchProgramEnvironment& env, ProControlle uint8_t year = MAX_YEAR; uint16_t save_count = 0; for (uint32_t c = 0; c < SKIPS; c++){ - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); home_roll_date_enter_game_autorollback(env.console, context, year); if (context->performance_class() == ControllerPerformanceClass::SysbotBase){ pbf_wait(context, 90); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-WattFarmer.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-WattFarmer.cpp index d5ca1fa380..9bd046ca32 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-WattFarmer.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DateSpamFarmers/PokemonSwSh_DateSpam-WattFarmer.cpp @@ -82,7 +82,7 @@ void WattFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerConte uint8_t year = MAX_YEAR; uint16_t save_count = 0; for (uint32_t c = 0; c < SKIPS; c++){ - env.log("Fetch Attempts: " + tostr_u_commas(c)); + env.log(std::format("Fetch Attempts: {:L}", c)); home_roll_date_enter_game_autorollback(env.console, context, year); if (context->performance_class() == ControllerPerformanceClass::SysbotBase){ diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperEU.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperEU.cpp index 319281bc31..8bc02a025e 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperEU.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperEU.cpp @@ -128,7 +128,6 @@ void DaySkipperEU::run_switch1(SingleSwitchProgramEnvironment& env, ProControlle year++; remaining_skips--; stats.issued++; -// env.log("Skips Remaining: " + tostr_u_commas(remaining_skips)); env.update_stats(); if (year >= 60){ diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN-7.8k.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN-7.8k.cpp index a26df04abf..52d8ed4d85 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN-7.8k.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN-7.8k.cpp @@ -198,7 +198,6 @@ void DaySkipperJPN7p8k::program(SingleSwitchProgramEnvironment& env, ProControll remaining_skips--; stats.issued++; env.log("Expected Date: " + std::to_string(date.year + 2000) + "/" + std::to_string(date.month) + "/" + std::to_string(date.day)); -// env.log("Skips Remaining: " + tostr_u_commas(remaining_skips)); env.update_stats(); } if (CORRECTION_SKIPS != 0 && correct_count == CORRECTION_SKIPS){ diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN.cpp index cf616edd56..64438045aa 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN.cpp @@ -116,7 +116,6 @@ void DaySkipperJPN::run_switch1(SingleSwitchProgramEnvironment& env, ProControll day++; remaining_skips--; stats.issued++; -// env.log("Skips Remaining: " + tostr_u_commas(remaining_skips)); env.update_stats(); } if (CORRECTION_SKIPS != 0 && correct_count == CORRECTION_SKIPS){ diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperStats.h b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperStats.h index 6ae26c2b1c..17fb37e976 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperStats.h +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperStats.h @@ -29,9 +29,11 @@ class SkipperStats : public StatsTracker{ if (total_skips == 0){ return StatsTracker::to_str(mode); }else{ - return - "Skips Issued: " + tostr_u_commas(issued) + - " - Skips Remaining: " + tostr_u_commas(total_skips - issued.load(std::memory_order_relaxed)); + return std::format( + "Skips Issued: {:L} - Skips Remaining: {:L}", + issued.load(std::memory_order_relaxed), + total_skips - issued.load(std::memory_order_relaxed) + ); } } diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperUS.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperUS.cpp index bf8bf244d3..e351291d83 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperUS.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperUS.cpp @@ -126,7 +126,6 @@ void DaySkipperUS::run_switch1(SingleSwitchProgramEnvironment& env, ProControlle year++; remaining_skips--; stats.issued++; -// env.log("Skips Remaining: " + tostr_u_commas(remaining_skips)); env.update_stats(); if (year >= 60){ diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcher2.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcher2.cpp index 80456cf49d..643fec7336 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcher2.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcher2.cpp @@ -62,7 +62,7 @@ void EggFetcher2::run_eggfetcher( // 1st Fetch: Get into position. { - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); fly_home_collect_egg(context, true); collect_egg_mash_out(context, deposit_automatically); @@ -74,7 +74,7 @@ void EggFetcher2::run_eggfetcher( // Now we are in steady state. for (; c < attempts; c++){ - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); eggfetcher_loop(context); collect_egg(context); collect_egg_mash_out(context, deposit_automatically); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcherMultiple.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcherMultiple.cpp index 2b6872dea8..2313f82dbc 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcherMultiple.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_EggFetcherMultiple.cpp @@ -79,7 +79,7 @@ void EggFetcherMultiple::run_eggfetcher( // 1st Fetch: Get into position. { - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); fly_home_collect_egg(context, true); collect_egg_mash_out(context, deposit_automatically); @@ -91,7 +91,7 @@ void EggFetcherMultiple::run_eggfetcher( // Now we are in steady state. for (; c < attempts; c++){ - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); eggfetcher_loop(context); collect_egg(context); collect_egg_mash_out(context, deposit_automatically); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggDuplication.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggDuplication.cpp index b1f90f128a..3c86b8ecf2 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggDuplication.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggDuplication.cpp @@ -91,7 +91,7 @@ void GodEggDuplication::run_program(Logger& logger, ProControllerContext& contex // 1st Fetch: Get into position. { - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); fly_home_collect_egg(context, true); collect_godegg(context, party_slot++); if (party_slot >= items){ @@ -106,7 +106,7 @@ void GodEggDuplication::run_program(Logger& logger, ProControllerContext& contex // Now we are in steady state. for (; c < attempts; c++){ - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); eggfetcher_loop(context); collect_egg(context); collect_godegg(context, party_slot++); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggItemDupe.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggItemDupe.cpp index 8daf5dc020..807285cd72 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggItemDupe.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/EggPrograms/PokemonSwSh_GodEggItemDupe.cpp @@ -143,7 +143,7 @@ void GodEggItemDupe::run_program(Logger& logger, ProControllerContext& context, // 1st Fetch: Get into position. { - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); fly_home_collect_egg(context, true); collect_godegg(context, party_slot++, true, false); if (party_slot >= items){ @@ -158,7 +158,7 @@ void GodEggItemDupe::run_program(Logger& logger, ProControllerContext& context, // Now we are in steady state. for (; c < attempts; c++){ - logger.log("Fetch Attempts: " + tostr_u_commas(c)); + logger.log(std::format("Fetch Attempts: {:L}", c)); eggfetcher_loop(context); collect_egg(context); collect_godegg(context, party_slot++, false, false); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-MultiGame.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-MultiGame.cpp index 27739715fa..30e4f1c867 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-MultiGame.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-MultiGame.cpp @@ -160,7 +160,7 @@ void AutoHostMultiGame::program(SingleSwitchProgramEnvironment& env, ProControll // break; // } - env.log("Raids Attempted: " + tostr_u_commas(raids++)); + env.log(std::format("Raids Attempted: {:L}", raids++)); // Start game. rollback_date_from_home(env.console, context, game.skips); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-Rolling.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-Rolling.cpp index 7031378d44..e210470194 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-Rolling.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost-Rolling.cpp @@ -176,7 +176,7 @@ void AutoHostRolling::program(SingleSwitchProgramEnvironment& env, ProController } for (uint32_t raids = 0;; raids++){ - env.log("Raids Attempted: " + tostr_u_commas(raids)); + env.log(std::format("Raids Attempted: {:L}", raids)); env.update_stats(); run_autohost( diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_OverworldTargetTracker.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_OverworldTargetTracker.cpp index d5009736ea..a5fdb9117d 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_OverworldTargetTracker.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_OverworldTargetTracker.cpp @@ -135,12 +135,11 @@ void OverworldTargetTracker::populate_targets( bool OverworldTargetTracker::save_target(std::multimap::iterator target){ #if 1 m_logger.log( - std::string("Best Target: ") + - (target->second.mark == OverworldMark::EXCLAMATION_MARK ? "Exclamation" : "Question") + - " at [" + - tostr_default(target->second.delta_x) + " , " + - tostr_default(-target->second.delta_y) + "], alpha = " + - tostr_default(target->first), + std::format("Best Target: {} at [{}, {}], alpha = {}", + (target->second.mark == OverworldMark::EXCLAMATION_MARK ? "Exclamation" : "Question"), + target->second.delta_x, + -target->second.delta_y, + target->first), COLOR_ORANGE ); #endif diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_ShinyHuntAutonomous-Overworld.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_ShinyHuntAutonomous-Overworld.cpp index 8f36c4ef71..79dbece2fe 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_ShinyHuntAutonomous-Overworld.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/OverworldBot/PokemonSwSh_ShinyHuntAutonomous-Overworld.cpp @@ -264,12 +264,11 @@ bool ShinyHuntAutonomousOverworld::find_encounter( } if (target.first > MAX_TARGET_ALPHA){ stream.log( - std::string("Target too Weak: ") + - (target.second.mark == OverworldMark::EXCLAMATION_MARK ? "Exclamation" : "Question") + - " at [" + - tostr_default(target.second.delta_x) + " , " + - tostr_default(-target.second.delta_y) + "], alpha = " + - tostr_default(target.first), + std::format("Target too Weak: {} at [{} , {}], alpha = {}", + (target.second.mark == OverworldMark::EXCLAMATION_MARK ? "Exclamation" : "Question"), + target.second.delta_x, + -target.second.delta_y, + target.first), COLOR_ORANGE ); continue; @@ -288,12 +287,11 @@ bool ShinyHuntAutonomousOverworld::charge_at_target( ) const{ OverlayBoxScope target_box(stream.overlay(), target.second.box, COLOR_YELLOW); stream.log( - std::string("Best Target: ") + - (target.second.mark == OverworldMark::EXCLAMATION_MARK ? "Exclamation" : "Question") + - " at [" + - tostr_default(target.second.delta_x) + " , " + - tostr_default(-target.second.delta_y) + "], alpha = " + - tostr_default(target.first), + std::format("Best Target: {} at [{} , {}], alpha = {}", + (target.second.mark == OverworldMark::EXCLAMATION_MARK ? "Exclamation" : "Question"), + target.second.delta_x, + -target.second.delta_y, + target.first), COLOR_PURPLE ); @@ -302,10 +300,7 @@ bool ShinyHuntAutonomousOverworld::charge_at_target( (double)trajectory.joystick_y - 128, (double)trajectory.joystick_x - 128 ) * 57.295779513082320877; - stream.log( - "Trajectory: Distance = " + std::to_string(trajectory.distance_in_ticks) + - ", Direction = " + tostr_default(-angle) + " degrees" - ); + stream.log(std::format("Trajectory: Distance = {}, Direction = {} degrees", trajectory.distance_in_ticks, -angle)); Milliseconds duration = (trajectory.distance_in_ticks + 16) * 8ms; duration = std::min(duration, MAX_MOVE_DURATION0); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_RaidItemFarmerOKHO.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_RaidItemFarmerOKHO.cpp index 33f8226fb1..86722c6ce5 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_RaidItemFarmerOKHO.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_RaidItemFarmerOKHO.cpp @@ -129,7 +129,7 @@ void RaidItemFarmerOHKO::program(MultiSwitchProgramEnvironment& env, Cancellable for (uint32_t raids = 0;; raids++){ - env.log("Raids Completed: " + tostr_u_commas(raids)); + env.log(std::format("Raids Completed: {:L}", raids)); host.wait_for_all_requests(); env.run_in_parallel( diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-Regigigas2.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-Regigigas2.cpp index 606766d420..7d850a048a 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-Regigigas2.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-Regigigas2.cpp @@ -125,7 +125,7 @@ void ShinyHuntAutonomousRegigigas2::program(SingleSwitchProgramEnvironment& env, while (true){ for (uint8_t pp = REVERSAL_PP; pp > 0; pp--){ - env.log("Starting Regigigas Encounter: " + tostr_u_commas(stats.encounters() + 1)); + env.log(std::format("Starting Regigigas Encounter: {:L}", stats.encounters() + 1)); pbf_mash_button(context, BUTTON_A, 5s); context.wait_for_all_requests(); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-StrongSpawn.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-StrongSpawn.cpp index f51072ea41..f6fb7c3fb5 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-StrongSpawn.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-StrongSpawn.cpp @@ -108,7 +108,7 @@ void ShinyHuntAutonomousStrongSpawn::program(SingleSwitchProgramEnvironment& env env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST ); - env.log("Starting Encounter: " + tostr_u_commas(stats.encounters() + 1)); + env.log(std::format("Starting Encounter: {:L}", stats.encounters() + 1)); context.wait_for_all_requests(); // Detect shiny. diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-SwordsOfJustice.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-SwordsOfJustice.cpp index 8cde41fe1d..6b4a6eccff 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-SwordsOfJustice.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntAutonomous/PokemonSwSh_ShinyHuntAutonomous-SwordsOfJustice.cpp @@ -135,7 +135,7 @@ void ShinyHuntAutonomousSwordsOfJustice::program(SingleSwitchProgramEnvironment& } pbf_press_button(context, BUTTON_X, 20, 50); pbf_press_dpad(context, DPAD_LEFT, 20, 20); - env.log("Starting Encounter: " + tostr_u_commas(stats.encounters() + 1)); + env.log(std::format("Starting Encounter: {:L}", stats.encounters() + 1)); pbf_press_button(context, BUTTON_A, 20, 0); context.wait_for_all_requests(); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHunt-Regi.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHunt-Regi.cpp index 5765d475be..9e2b8fb2f4 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHunt-Regi.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHunt-Regi.cpp @@ -98,23 +98,23 @@ void run_regi_light_puzzle( switch (regi){ case RegiGolem::Regirock: regirock(context); - logger.log("Starting Regirock Encounter: " + tostr_u_commas(encounter + 1)); + logger.log(std::format("Starting Regirock Encounter: {:L}", encounter + 1)); break; case RegiGolem::Regice: regice(context); - logger.log("Starting Regice Encounter: " + tostr_u_commas(encounter + 1)); + logger.log(std::format("Starting Regice Encounter: {:L}", encounter + 1)); break; case RegiGolem::Registeel: registeel(context); - logger.log("Starting Registeel Encounter: " + tostr_u_commas(encounter + 1)); + logger.log(std::format("Starting Registeel Encounter: {:L}", encounter + 1)); break; case RegiGolem::Regieleki: regieleki(context); - logger.log("Starting Regieleki Encounter: " + tostr_u_commas(encounter + 1)); + logger.log(std::format("Starting Regieleki Encounter: {:L}", encounter + 1)); break; case RegiGolem::Regidrago: regidrago(context); - logger.log("Starting Regidrago Encounter: " + tostr_u_commas(encounter + 1)); + logger.log(std::format("Starting Regidrago Encounter: {:L}", encounter + 1)); break; } } diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-IoATrade.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-IoATrade.cpp index ffec7798a4..edb3f82d78 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-IoATrade.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-IoATrade.cpp @@ -82,7 +82,7 @@ void ShinyHuntUnattendedIoATrade::program(SingleSwitchProgramEnvironment& env, P } for (uint32_t c = 0; ; c++){ - env.log("Starting Trade: " + tostr_u_commas(c + 1)); + env.log(std::format("Starting Trade: {:L}", c + 1)); pbf_press_button(context, BUTTON_A, 10, 100); pbf_press_button(context, BUTTON_A, 10, 60); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-Regigigas2.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-Regigigas2.cpp index fe2aaa1621..1fecef2544 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-Regigigas2.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-Regigigas2.cpp @@ -83,7 +83,7 @@ void ShinyHuntUnattendedRegigigas2::program(SingleSwitchProgramEnvironment& env, uint32_t encounter = 0; while (true){ for (uint8_t pp = REVERSAL_PP; pp > 0; pp--){ - env.log("Starting Regigigas Encounter: " + tostr_u_commas(++encounter)); + env.log(std::format("Starting Regigigas Encounter: {:L}", ++encounter)); pbf_press_button(context, BUTTON_A, 10, 3 * TICKS_PER_SECOND); pbf_press_button(context, BUTTON_A, 10, TICKS_PER_SECOND); diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-StrongSpawn.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-StrongSpawn.cpp index 6f4669726d..64cc367a7d 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-StrongSpawn.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-StrongSpawn.cpp @@ -93,7 +93,7 @@ void ShinyHuntUnattendedStrongSpawn::program(SingleSwitchProgramEnvironment& env pbf_wait(context, START_GAME_WAIT_DELAY0); // Enter game. - env.log("Starting Encounter: " + tostr_u_commas(c + 1)); + env.log(std::format("Starting Encounter: {:L}", c + 1)); pbf_press_button(context, BUTTON_A, 80ms, ENTER_GAME_TO_RUN_DELAY0); // Run away. diff --git a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-SwordsOfJustice.cpp b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-SwordsOfJustice.cpp index 88ad176f46..fc6efb33b7 100644 --- a/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-SwordsOfJustice.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Programs/ShinyHuntUnattended/PokemonSwSh_ShinyHuntUnattended-SwordsOfJustice.cpp @@ -96,7 +96,7 @@ void ShinyHuntUnattendedSwordsOfJustice::program(SingleSwitchProgramEnvironment& } pbf_press_button(context, BUTTON_X, 10, 50); pbf_press_dpad(context, DPAD_LEFT, 10, 10); - env.log("Starting Encounter: " + tostr_u_commas(c + 1)); + env.log(std::format("Starting Encounter: {:L}", c + 1)); pbf_press_button(context, BUTTON_A, 80ms, EXIT_CAMP_TO_RUN_DELAY0); // Run away if not shiny. diff --git a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_BowItemDuper.cpp b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_BowItemDuper.cpp index 7a408d2dd3..396592575a 100644 --- a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_BowItemDuper.cpp +++ b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_BowItemDuper.cpp @@ -81,7 +81,7 @@ void BowItemDuper::program(SingleSwitchProgramEnvironment& env, ProControllerCon while (c < ATTEMPTS){ - env.log("Current Attempts: " + tostr_u_commas(c)); + env.log(std::format("Current Attempts: {:L}", c)); // this routine is thanks to koboldtime#2248 on the PA discord server // it has been adjusted and modified by denvoros#0001 diff --git a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_MineruItemDuper.cpp b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_MineruItemDuper.cpp index 919ef2673d..640ef4c8f5 100644 --- a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_MineruItemDuper.cpp +++ b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_MineruItemDuper.cpp @@ -93,7 +93,7 @@ void MineruItemDuper::program(SingleSwitchProgramEnvironment& env, ProController uint32_t ITEMS_PER_ATTEMPT = IS_ZONAI_DEVICE ? 10 : 5; uint32_t c = 0; while (c < AMOUNT){ - env.log("Current Amount: " + tostr_u_commas(c)); + env.log(std::format("Current Amount: {:L}", c)); // Open menu pbf_press_button(context, BUTTON_PLUS, 20, 100); diff --git a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_ParaglideItemDuper.cpp b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_ParaglideItemDuper.cpp index 992f65301c..8adb75cec0 100644 --- a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_ParaglideItemDuper.cpp +++ b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_ParaglideItemDuper.cpp @@ -104,7 +104,7 @@ void ParaglideItemDuper::program(SingleSwitchProgramEnvironment& env, ProControl uint32_t c = 0; while (c < ATTEMPTS){ - env.log("Current Attempts: " + tostr_u_commas(c)); + env.log(std::format("Current Attempts: {:L}", c)); //Walk forward from teleportation point pbf_move_left_joystick(context, 128, 0, 10, 5); diff --git a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_SurfItemDuper.cpp b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_SurfItemDuper.cpp index 2b6a664f29..cf5c53d00f 100644 --- a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_SurfItemDuper.cpp +++ b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_SurfItemDuper.cpp @@ -90,7 +90,7 @@ void SurfItemDuper::program(SingleSwitchProgramEnvironment& env, ProControllerCo uint32_t c = 0; while (c < ATTEMPTS){ - env.log("Current Attempts: " + tostr_u_commas(c)); + env.log(std::format("Current Attempts: {:L}", c)); //Initiate Shield Surf ssf_press_button(context, BUTTON_ZL, 0ms, 640ms); diff --git a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_WeaponDuper.cpp b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_WeaponDuper.cpp index fc8b816e22..046bf9f3a9 100644 --- a/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_WeaponDuper.cpp +++ b/SerialPrograms/Source/ZeldaTotK/Programs/ZeldaTotK_WeaponDuper.cpp @@ -85,7 +85,7 @@ void WeaponDuper::program(SingleSwitchProgramEnvironment& env, ProControllerCont uint32_t c = 0; while (c < ATTEMPTS){ - env.log("Current Attempts: " + tostr_u_commas(c)); + env.log(std::format("Current Attempts: {:L}", c)); env.log("Open menu"); pbf_press_button(context, BUTTON_PLUS, 10, 30);