Skip to content

Commit

Permalink
fix(config): Switch to snprintf for formatting
Browse files Browse the repository at this point in the history
while vformat is closer to modern string-formatting sensibilities, it added 400KiB to our binaries, whereas snprintf has no noticeable impact. so... suffer, and hope the translators know what's up
  • Loading branch information
ashquarky committed Nov 22, 2024
1 parent 2bf5f8b commit cd1d530
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions plugin/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHa

{
uint16_t port = get_console_peertopeer_port();
std::string multiplayer_port_text = std::vformat(strings.multiplayer_port_display, std::make_format_args(port));
res = network_cat->add(WUPSConfigItemStub::Create(multiplayer_port_text), err);
char buffer[256];
snprintf(buffer, sizeof(buffer), strings.multiplayer_port_display.data(), port);
res = network_cat->add(WUPSConfigItemStub::Create(buffer), err);
if (!res) return report_error(err);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
,.need_menu_action = "From WiiU menu only"
,.using_nintendo_network = "Using Nintendo Network"
,.using_pretendo_network = "Using Pretendo Network"
,.multiplayer_port_display = "Using UDP port {} for multiplayer"
,.multiplayer_port_display = "Using UDP port %hu for multiplayer"
,.module_not_found = "Pretendo patch failed - use Aroma Updater to repair (686-1001 Module missing)"
,.module_init_not_found = "Pretendo patch failed - use Aroma Updater to repair (686-1002 Module init)"

0 comments on commit cd1d530

Please sign in to comment.