From 78e9bd999660011c74faab93c3cb4eca8669dec9 Mon Sep 17 00:00:00 2001 From: Pk11 Date: Tue, 23 Nov 2021 01:44:49 -0600 Subject: [PATCH] A couple derp fixes - Allocate enough space for byte sizes - Pass size to 'bytes' count - Check lang ini not font path for lang reload - Use 24 hour with 0 instead of space for filename date --- arm9/source/date.cpp | 2 +- arm9/source/driveOperations.cpp | 2 +- arm9/source/fileOperations.cpp | 4 ++-- arm9/source/language.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arm9/source/date.cpp b/arm9/source/date.cpp index c2d3e69..35c7c04 100644 --- a/arm9/source/date.cpp +++ b/arm9/source/date.cpp @@ -33,7 +33,7 @@ std::string RetTimeForFilename() const struct tm *Time = localtime(&raw); char tmp[8]; - strftime(tmp, sizeof(tmp), "%k%M%S", Time); + strftime(tmp, sizeof(tmp), "%H%M%S", Time); return tmp; } diff --git a/arm9/source/driveOperations.cpp b/arm9/source/driveOperations.cpp index 8bbe8e6..34ad274 100644 --- a/arm9/source/driveOperations.cpp +++ b/arm9/source/driveOperations.cpp @@ -64,7 +64,7 @@ static float getTbNumber(u64 bytes) { std::string getDriveBytes(u64 bytes) { - char buffer[12]; + char buffer[32]; if (bytes < (1024 * 1024)) sniprintf(buffer, sizeof(buffer), STR_N_KB.c_str(), (int)bytes >> 10); diff --git a/arm9/source/fileOperations.cpp b/arm9/source/fileOperations.cpp index dcc8801..73631f1 100644 --- a/arm9/source/fileOperations.cpp +++ b/arm9/source/fileOperations.cpp @@ -22,12 +22,12 @@ bool clipboardOn = false; bool clipboardUsed = false; std::string getBytes(int bytes) { - char buffer[11]; + char buffer[32]; if (bytes == 1) sniprintf(buffer, sizeof(buffer), STR_1_BYTE.c_str()); else if (bytes < 1024) - sniprintf(buffer, sizeof(buffer), STR_N_BYTES.c_str()); + sniprintf(buffer, sizeof(buffer), STR_N_BYTES.c_str(), bytes); else if (bytes < (1024 * 1024)) sniprintf(buffer, sizeof(buffer), STR_N_KB.c_str(), bytes >> 10); diff --git a/arm9/source/language.cpp b/arm9/source/language.cpp index b78a250..18a55f2 100644 --- a/arm9/source/language.cpp +++ b/arm9/source/language.cpp @@ -108,7 +108,7 @@ std::string getString(CIniFile &ini, const std::string &item, const std::string */ void langInit(bool reloading) { // If reloading then don't change if ini not found - if(reloading && access(config->fontPath().c_str(), F_OK) != 0) + if(reloading && access(config->languageIniPath().c_str(), F_OK) != 0) return; CIniFile languageini(config->languageIniPath());