From 7ec7a752dc4735a6ddc73e3d4b11300059ea5f00 Mon Sep 17 00:00:00 2001 From: Nessy Date: Mon, 22 Jan 2024 18:13:59 +0000 Subject: [PATCH] Create locale.txt when generating for console (#26) --- source/patch.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/patch.cpp b/source/patch.cpp index bec1269..a9cbf6c 100644 --- a/source/patch.cpp +++ b/source/patch.cpp @@ -424,6 +424,27 @@ bool WriteAllPatches() { } FSFILE_Close(titleassetsOut); + /*------------------- + | LOCALE EMULATION | + -------------------*/ + + if (Settings::PlayOption == PATCH_CONSOLE) { + Handle localeOut; + const char* localeOutPath = "/luma/titles/0004000000125500/locale.txt"; + FSUSER_DeleteFile(sdmcArchive, fsMakePath(PATH_ASCII, localeOutPath)); + + if (!R_SUCCEEDED(res = FSUSER_OpenFile(&localeOut, sdmcArchive, fsMakePath(PATH_ASCII, localeOutPath), FS_OPEN_WRITE | FS_OPEN_CREATE, 0))) { + return false; + } + + std::vector buffer = { 'U', 'S', 'A', ' ', 'E', 'N' }; + + if (!R_SUCCEEDED(res = FSFILE_Write(localeOut, &bytesWritten, 0, buffer.data(), buffer.size(), FS_WRITE_FLUSH))) { + return false; + } + FSFILE_Close(localeOut); + } + FSUSER_CloseArchive(sdmcArchive); return true;