From 979d9de91ae6ad26916a9a5bcba0f95cf9931007 Mon Sep 17 00:00:00 2001 From: ADev531 Date: Mon, 21 Jul 2025 20:58:20 +0900 Subject: [PATCH 1/3] feat: added korean --- src/lang/ko_KR.lang | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/lang/ko_KR.lang diff --git a/src/lang/ko_KR.lang b/src/lang/ko_KR.lang new file mode 100644 index 0000000..de04939 --- /dev/null +++ b/src/lang/ko_KR.lang @@ -0,0 +1,13 @@ +.plugin_name="Inkay" +,.network_category="네트워크 선택" +,.connect_to_network_setting="Pretendo Network 사용" +,.other_category="기타 설정" +,.reset_wwp_setting="Wara Wara Plaza 초기화" +,.press_a_action="A 버튼을 누르세요" +,.restart_to_apply_action="재시작 후 적용" +,.need_menu_action="Wii U 메뉴에서만" +,.using_nintendo_network="Nintendo Network 사용 중" +,.using_pretendo_network="Pretendo Network 사용 중" +,.multiplayer_port_display="멀티플레이어에 UDP 포트 %hu을(를) 사용합니다" +,.module_not_found="패치를 적용하는 데 실패했습니다. Aroma Updater로 복구해 주세요. (686-1001 모듈 없음)" +,.module_init_not_found="패치를 적용하는 데 실패했습니다. Aroma Updater로 복구해 주세요. (686-1002 모듈 초기화)" From 907de64376d0fde58776b1e819f687dad992c9d3 Mon Sep 17 00:00:00 2001 From: ADev531 Date: Mon, 21 Jul 2025 20:59:55 +0900 Subject: [PATCH 2/3] feat: added language changing --- common/lang.cpp | 24 +++++++++--------- common/lang.h | 22 ++++++++++++++-- plugin/src/config.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++- plugin/src/config.h | 5 ++++ plugin/src/module.cpp | 10 ++++---- src/main.cpp | 14 +++++----- 6 files changed, 107 insertions(+), 27 deletions(-) diff --git a/common/lang.cpp b/common/lang.cpp index 3f32b17..d22c07f 100644 --- a/common/lang.cpp +++ b/common/lang.cpp @@ -4,40 +4,40 @@ #include "lang.h" -config_strings get_config_strings(nn::swkbd::LanguageType language) { +config_strings get_config_strings(inkay_language language) { switch (language) { - case nn::swkbd::LanguageType::English: + case inkay_language::English: default: return { #include "en_US.lang" }; - case nn::swkbd::LanguageType::Spanish: return { + case inkay_language::Spanish: return { #include "es_ES.lang" }; - case nn::swkbd::LanguageType::French: return { + case inkay_language::French: return { #include "fr_FR.lang" }; - case nn::swkbd::LanguageType::Italian: return { + case inkay_language::Italian: return { #include "it_IT.lang" }; - case nn::swkbd::LanguageType::German: return { + case inkay_language::German: return { #include "de_DE.lang" }; - case nn::swkbd::LanguageType::SimplifiedChinese: return { + case inkay_language::SimplifiedChinese: return { #include "zh_CN.lang" }; - case nn::swkbd::LanguageType::TraditionalChinese: return { + case inkay_language::TraditionalChinese: return { #include "zh_Hant.lang" }; - case nn::swkbd::LanguageType::Portuguese: return { + case inkay_language::Portuguese: return { #include "pt_BR.lang" }; - case nn::swkbd::LanguageType::Japanese: return { + case inkay_language::Japanese: return { #include "ja_JP.lang" }; - case nn::swkbd::LanguageType::Dutch: return { + case inkay_language::Dutch: return { #include "nl_NL.lang" }; - case nn::swkbd::LanguageType::Russian: return { + case inkay_language::Russian: return { #include "ru_RU.lang" }; } diff --git a/common/lang.h b/common/lang.h index 6e557fe..7fdbe24 100644 --- a/common/lang.h +++ b/common/lang.h @@ -1,7 +1,25 @@ #pragma once #include -#include + +enum inkay_language { + Japanese = 0, + English, + French, + German, + Italian, + Spanish, + SimplifiedChinese, + Korean, + Dutch, + Portuguese, + Russian, + TraditionalChinese, + Invalid, + // custom ones + System, + EnUwU, +}; struct config_strings { const char *plugin_name; @@ -19,4 +37,4 @@ struct config_strings { std::string_view module_init_not_found; }; -config_strings get_config_strings(nn::swkbd::LanguageType language); +config_strings get_config_strings(inkay_language language); diff --git a/plugin/src/config.cpp b/plugin/src/config.cpp index 98c2323..3079bc8 100644 --- a/plugin/src/config.cpp +++ b/plugin/src/config.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,8 @@ bool Config::connect_to_network = true; bool Config::need_relaunch = false; bool Config::unregister_task_item_pressed = false; bool Config::is_wiiu_menu = false; +uint32_t Config::language = 13; +inkay_language Config::current_language = English; static WUPSConfigAPICallbackStatus report_error(WUPSConfigAPIStatus err) { DEBUG_FUNCTION_LINE_VERBOSE("WUPS config error: %s", WUPSConfigAPI_GetStatusStr(err)); @@ -64,6 +67,21 @@ static void connect_to_network_changed(ConfigItemBoolean* item, bool new_value) if (res != WUPS_STORAGE_ERROR_SUCCESS) return report_storage_error(res); } +static void language_changed(ConfigItemMultipleValues* item, uint32_t new_value) { + DEBUG_FUNCTION_LINE_VERBOSE("language changed to: %d", new_value); + if (new_value != Config::language) { + if (new_value == inkay_language::System) + Config::current_language = (inkay_language)get_system_language(); + else + Config::current_language = (inkay_language)new_value; + } + Config::language = new_value; + + WUPSStorageError res; + res = WUPSStorageAPI::Store("language", Config::language); + if (res != WUPS_STORAGE_ERROR_SUCCESS) return report_storage_error(res); +} + static void unregister_task_item_on_input_cb(void *context, WUPSConfigSimplePadData input) { if (!Config::unregister_task_item_pressed && Config::is_wiiu_menu && ((input.buttons_d & WUPS_CONFIG_BUTTON_A) == WUPS_CONFIG_BUTTON_A)) { @@ -124,7 +142,7 @@ static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHa Config::is_wiiu_menu = (current_title_id == wiiu_menu_tid); // get translation strings - strings = get_config_strings(get_system_language()); + strings = get_config_strings(Config::current_language); // create root config category WUPSConfigCategory root = WUPSConfigCategory(rootHandle); @@ -181,6 +199,29 @@ static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHa err = WUPSConfigAPI_Category_AddItem(other_cat->getHandle(), unregisterTasksItem); if (err != WUPSCONFIG_API_RESULT_SUCCESS) return report_error(err); + constexpr WUPSConfigItemMultipleValues::ValuePair languages[] = { + {0, "Japanese"}, + {1, "English"}, + {2, "French"}, + {3, "German"}, + {4, "Spanish"}, + {5, "Italian"}, + {6, "Simplified Chinese"}, + {7, "Korean"}, + {8, "Dutch"}, + {9, "Portuguese"}, + {10, "Russian"}, + {11, "Traditional Chinese"}, + {13, "System"}, + {14, "English (UwU)"}, + }; + + auto language_item = WUPSConfigItemMultipleValues::CreateFromValue("language", "Language", 13, Config::language, languages, &language_changed, err); + if (!language_item) return report_error(err); + + res = other_cat->add(std::move(*language_item), err); + if (!res) report_error(err); + res = root.add(std::move(*other_cat), err); if (!res) return report_error(err); @@ -228,6 +269,22 @@ void Config::Init() { } else if (res != WUPS_STORAGE_ERROR_SUCCESS) return report_storage_error(res); + res = WUPSStorageAPI::Get("language", Config::language); + if (res == WUPS_STORAGE_ERROR_NOT_FOUND) { + DEBUG_FUNCTION_LINE("Language value not found, attempting to create"); + + // Add the value to the storage. + res = WUPSStorageAPI::Store("language", Config::language); + if (res != WUPS_STORAGE_ERROR_SUCCESS) return report_storage_error(res); + } + else if (res != WUPS_STORAGE_ERROR_SUCCESS) return report_storage_error(res); + + // Set the language that's currently used + if (Config::language == inkay_language::System) + Config::current_language = (inkay_language)get_system_language(); + else + Config::current_language = (inkay_language)Config::language; + // Save storage res = WUPSStorageAPI::SaveStorage(); if (res != WUPS_STORAGE_ERROR_SUCCESS) return report_storage_error(res); diff --git a/plugin/src/config.h b/plugin/src/config.h index 0928d5e..fc84610 100644 --- a/plugin/src/config.h +++ b/plugin/src/config.h @@ -5,12 +5,16 @@ #ifndef INKAY_CONFIG_H #define INKAY_CONFIG_H +#include +#include "lang.h" + class Config { public: static void Init(); // wups config items static bool connect_to_network; + static uint32_t language; // private stuff static bool need_relaunch; @@ -18,6 +22,7 @@ class Config { // private stuff static bool is_wiiu_menu; + static inkay_language current_language; static bool unregister_task_item_pressed; }; diff --git a/plugin/src/module.cpp b/plugin/src/module.cpp index c20d980..586a4c7 100644 --- a/plugin/src/module.cpp +++ b/plugin/src/module.cpp @@ -18,22 +18,22 @@ #include "Notification.h" #include "utils/logger.h" -#include "sysconfig.h" +#include "config.h" #include "lang.h" #include static OSDynLoad_Module module; -static void (*moduleInitialize)(bool) = nullptr; +static void (*moduleInitialize)(bool, inkay_language) = nullptr; static InkayStatus (*moduleGetStatus)() = nullptr; static void (*moduleSetPluginRunning)() = nullptr; static const char *get_module_not_found_message() { - return get_config_strings(get_system_language()).module_not_found.data(); + return get_config_strings(Config::current_language).module_not_found.data(); } static const char *get_module_init_not_found_message() { - return get_config_strings(get_system_language()).module_init_not_found.data(); + return get_config_strings(Config::current_language).module_init_not_found.data(); } void Inkay_Initialize(bool apply_patches) { @@ -54,7 +54,7 @@ void Inkay_Initialize(bool apply_patches) { return; } - moduleInitialize(apply_patches); + moduleInitialize(apply_patches, Config::current_language); } void Inkay_Finalize() { diff --git a/src/main.cpp b/src/main.cpp index 4930ac0..008c976 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -93,18 +93,18 @@ static bool is555(MCPSystemVersion version) { return (version.major == 5) && (version.minor == 5) && (version.patch >= 5); } -static const char *get_nintendo_network_message() { +static const char *get_nintendo_network_message(inkay_language language) { // TL note: "Nintendo Network" is a proper noun - "Network" is part of the name // TL note: "Using" instead of "Connected" is deliberate - we don't know if a successful connection exists, we are // only specifying what we'll *attempt* to connect to - return get_config_strings(get_system_language()).using_nintendo_network.data(); + return get_config_strings(language).using_nintendo_network.data(); } -static const char *get_pretendo_message() { +static const char *get_pretendo_message(inkay_language language) { // TL note: "Pretendo Network" is also a proper noun - though "Pretendo" alone can refer to us as a project // TL note: "Using" instead of "Connected" is deliberate - we don't know if a successful connection exists, we are // only specifying what we'll *attempt* to connect to - return get_config_strings(get_system_language()).using_pretendo_network.data(); + return get_config_strings(language).using_pretendo_network.data(); } static void Inkay_SetPluginRunning() { @@ -122,7 +122,7 @@ static InkayStatus Inkay_GetStatus() { } } -static void Inkay_Initialize(bool apply_patches) { +static void Inkay_Initialize(bool apply_patches, inkay_language language) { if (Config::initialized) return; @@ -150,12 +150,12 @@ static void Inkay_Initialize(bool apply_patches) { DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches applied successfully."); - ShowNotification(get_pretendo_message()); + ShowNotification(get_pretendo_message(language)); Config::initialized = true; } else { DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches skipped."); - ShowNotification(get_nintendo_network_message()); + ShowNotification(get_nintendo_network_message(language)); Config::initialized = true; return; } From 6e1122e1b3a2cfe92a7877512ebad2a961e775ba Mon Sep 17 00:00:00 2001 From: ADev531 Date: Mon, 21 Jul 2025 21:15:09 +0900 Subject: [PATCH 3/3] fix: added Korean and UwU to language changer --- common/lang.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/lang.cpp b/common/lang.cpp index d22c07f..ac39d15 100644 --- a/common/lang.cpp +++ b/common/lang.cpp @@ -40,5 +40,11 @@ config_strings get_config_strings(inkay_language language) { case inkay_language::Russian: return { #include "ru_RU.lang" }; + case inkay_language::Korean: return { +#include "ko_KR.lang" + }; + case inkay_language::EnUwU: return { +#include "en@uwu.lang" + }; } }