Compare commits

...

5 commits

Author SHA1 Message Date
一时 三月
d835146081
Merge f5e94b985b into 349b1f38aa 2024-05-28 02:03:59 -05:00
Ash Logan
349b1f38aa fix(main): Version v2.5.0
Updating the aroma APIs does not demand a major version bump imho
Users are always expected to be on latest aroma anyway, v3 would be saved for like. Stroopwafel
2024-05-28 16:48:10 +10:00
Ash Logan
9a9bf0949d fix(config): Don't use C++ exceptions
they almost certainly don't work in this environment, and just returning is better
2024-05-28 16:47:12 +10:00
Ash Logan
695a077ebd chore: Run code formatter across project
this is the CLion formatter since I haven't set up clang-format for Inkay yet
2024-05-28 16:36:39 +10:00
一时 三月
f5e94b985b
Add files via upload 2024-04-19 16:08:11 +08:00
9 changed files with 166 additions and 141 deletions

View file

@ -91,14 +91,36 @@ constexpr config_strings get_config_strings(nn::swkbd::LanguageType language) {
case nn::swkbd::LanguageType::German: case nn::swkbd::LanguageType::German:
return { return {
.plugin_name = "Inkay", .plugin_name = "Inkay",
.network_category = "Netzwerkauswahl", .network_category = "Netzwerkauswahl",
.connect_to_network_setting = "Verbinde zum Pretendo Network", .connect_to_network_setting = "Verbinde zum Pretendo Network",
.other_category = "Andere Einstellungen", .other_category = "Andere Einstellungen",
.reset_wwp_setting = "Wara Wara Plaza zurücksetzen", .reset_wwp_setting = "Wara Wara Plaza zurücksetzen",
.press_a_action = "Drücke A", .press_a_action = "Drücke A",
.restart_to_apply_action = "Neustarten zum Anwenden", .restart_to_apply_action = "Neustarten zum Anwenden",
.need_menu_action = "Nur vom Wii U-Menü aus", .need_menu_action = "Nur vom Wii U-Menü aus",
};
case nn::swkbd::LanguageType::Simplified_Chinese:
return {
.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 = "仅来自WiiU Menu"
};
case nn::swkbd::LanguageType::traditional_Chinese:
return {
.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 = "僅來自WiiU Menu"
}; };
} }
} }
@ -158,64 +180,60 @@ static int32_t unregister_task_item_get_display_value(void *context, char *out_b
} }
static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle rootHandle) { static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle rootHandle) {
uint64_t current_title_id = OSGetTitleID(); uint64_t current_title_id = OSGetTitleID();
uint64_t wiiu_menu_tid = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_WII_U_MENU); uint64_t wiiu_menu_tid = _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_WII_U_MENU);
Config::is_wiiu_menu = (current_title_id == wiiu_menu_tid); Config::is_wiiu_menu = (current_title_id == wiiu_menu_tid);
// get translation strings // get translation strings
strings = get_config_strings(get_system_language()); strings = get_config_strings(get_system_language());
// create root config category // create root config category
WUPSConfigCategory root = WUPSConfigCategory(rootHandle); WUPSConfigCategory root = WUPSConfigCategory(rootHandle);
try { auto patching_cat = WUPSConfigCategory::Create(strings.network_category);
auto patching_cat = WUPSConfigCategory::Create(strings.network_category);
// config id display name default current value changed callback // config id display name default current value changed callback
patching_cat.add(WUPSConfigItemBoolean::Create("connect_to_network", strings.connect_to_network_setting, true, Config::connect_to_network, &connect_to_network_changed)); patching_cat.add(WUPSConfigItemBoolean::Create("connect_to_network", strings.connect_to_network_setting, true, Config::connect_to_network, &connect_to_network_changed));
root.add(std::move(patching_cat)); root.add(std::move(patching_cat));
auto other_cat = WUPSConfigCategory::Create(strings.other_category); auto other_cat = WUPSConfigCategory::Create(strings.other_category);
WUPSConfigAPIItemCallbacksV2 unregisterTasksItemCallbacks = { WUPSConfigAPIItemCallbacksV2 unregisterTasksItemCallbacks = {
.getCurrentValueDisplay = unregister_task_item_get_display_value, .getCurrentValueDisplay = unregister_task_item_get_display_value,
.getCurrentValueSelectedDisplay = unregister_task_item_get_display_value, .getCurrentValueSelectedDisplay = unregister_task_item_get_display_value,
.onSelected = nullptr, .onSelected = nullptr,
.restoreDefault = nullptr, .restoreDefault = nullptr,
.isMovementAllowed = nullptr, .isMovementAllowed = nullptr,
.onCloseCallback = nullptr, .onCloseCallback = nullptr,
.onInput = unregister_task_item_on_input_cb, .onInput = unregister_task_item_on_input_cb,
.onInputEx = nullptr, .onInputEx = nullptr,
.onDelete = nullptr .onDelete = nullptr
}; };
WUPSConfigAPIItemOptionsV2 unregisterTasksItemOptions = { WUPSConfigAPIItemOptionsV2 unregisterTasksItemOptions = {
.displayName = strings.reset_wwp_setting, .displayName = strings.reset_wwp_setting,
.context = nullptr, .context = nullptr,
.callbacks = unregisterTasksItemCallbacks, .callbacks = unregisterTasksItemCallbacks,
}; };
WUPSConfigItemHandle unregisterTasksItem; WUPSConfigItemHandle unregisterTasksItem;
WUPSConfigAPIStatus err; WUPSConfigAPIStatus err;
if ((err = WUPSConfigAPI_Item_Create(unregisterTasksItemOptions, &unregisterTasksItem)) != WUPSCONFIG_API_RESULT_SUCCESS) { if ((err = WUPSConfigAPI_Item_Create(unregisterTasksItemOptions, &unregisterTasksItem)) != WUPSCONFIG_API_RESULT_SUCCESS) {
throw std::runtime_error(std::string("Failed to create config item: ").append(WUPSConfigAPI_GetStatusStr(err))); DEBUG_FUNCTION_LINE("Creating config menu failed: %s", WUPSConfigAPI_GetStatusStr(err));
}
if ((err = WUPSConfigAPI_Category_AddItem(other_cat.getHandle(), unregisterTasksItem)) != WUPSCONFIG_API_RESULT_SUCCESS) {
throw std::runtime_error(std::string("Failed to add config item: ").append(WUPSConfigAPI_GetStatusStr(err)));
}
root.add(std::move(other_cat));
}
catch (std::exception &e) {
DEBUG_FUNCTION_LINE("Creating config menu failed: %s", e.what());
return WUPSCONFIG_API_CALLBACK_RESULT_ERROR; return WUPSCONFIG_API_CALLBACK_RESULT_ERROR;
} }
if ((err = WUPSConfigAPI_Category_AddItem(other_cat.getHandle(), unregisterTasksItem)) != WUPSCONFIG_API_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE("Creating config menu failed: %s", WUPSConfigAPI_GetStatusStr(err));
return WUPSCONFIG_API_CALLBACK_RESULT_ERROR;
}
root.add(std::move(other_cat));
return WUPSCONFIG_API_CALLBACK_RESULT_SUCCESS; return WUPSCONFIG_API_CALLBACK_RESULT_SUCCESS;
} }
static void ConfigMenuClosedCallback() { static void ConfigMenuClosedCallback() {
// Save all changes // Save all changes
if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("Failed to save storage"); DEBUG_FUNCTION_LINE("Failed to save storage");
} }
@ -229,35 +247,35 @@ static void ConfigMenuClosedCallback() {
} }
void Config::Init() { void Config::Init() {
// Init the config api // Init the config api
WUPSConfigAPIOptionsV1 configOptions = { .name = "Inkay" }; WUPSConfigAPIOptionsV1 configOptions = { .name = "Inkay" };
if (WUPSConfigAPI_Init(configOptions, ConfigMenuOpenedCallback, ConfigMenuClosedCallback) != WUPSCONFIG_API_RESULT_SUCCESS) { if (WUPSConfigAPI_Init(configOptions, ConfigMenuOpenedCallback, ConfigMenuClosedCallback) != WUPSCONFIG_API_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE("Failed to initialize WUPS Config API"); DEBUG_FUNCTION_LINE("Failed to initialize WUPS Config API");
return; return;
} }
WUPSStorageError storageRes; WUPSStorageError storageRes;
// Try to get value from storage // Try to get value from storage
if ((storageRes = WUPSStorageAPI::Get<bool>("connect_to_network", Config::connect_to_network)) == WUPS_STORAGE_ERROR_NOT_FOUND) { if ((storageRes = WUPSStorageAPI::Get<bool>("connect_to_network", Config::connect_to_network)) == WUPS_STORAGE_ERROR_NOT_FOUND) {
DEBUG_FUNCTION_LINE("Connect to network value not found, attempting to migrate/create"); DEBUG_FUNCTION_LINE("Connect to network value not found, attempting to migrate/create");
bool skipPatches = false; bool skipPatches = false;
if (WUPSStorageAPI::Get<bool>("skipPatches", skipPatches) == WUPS_STORAGE_ERROR_SUCCESS) { if (WUPSStorageAPI::Get<bool>("skipPatches", skipPatches) == WUPS_STORAGE_ERROR_SUCCESS) {
// Migrate old config value // Migrate old config value
Config::connect_to_network = !skipPatches; Config::connect_to_network = !skipPatches;
WUPSStorageAPI::DeleteItem("skipPatches"); WUPSStorageAPI::DeleteItem("skipPatches");
} }
// Add the value to the storage if it's missing. // Add the value to the storage if it's missing.
if (WUPSStorageAPI::Store<bool>("connect_to_network", connect_to_network) != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPSStorageAPI::Store<bool>("connect_to_network", connect_to_network) != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("Failed to store bool"); DEBUG_FUNCTION_LINE("Failed to store bool");
} }
} }
else if (storageRes != WUPS_STORAGE_ERROR_SUCCESS) { else if (storageRes != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("Failed to get bool %s (%d)", WUPSStorageAPI_GetStatusStr(storageRes), storageRes); DEBUG_FUNCTION_LINE("Failed to get bool %s (%d)", WUPSStorageAPI_GetStatusStr(storageRes), storageRes);
} }
// Save storage // Save storage
if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("Failed to save storage"); DEBUG_FUNCTION_LINE("Failed to save storage");
} }

View file

@ -22,14 +22,14 @@ public:
}; };
struct config_strings { struct config_strings {
const char* plugin_name; const char *plugin_name;
const char* network_category; const char *network_category;
const char* connect_to_network_setting; const char *connect_to_network_setting;
const char* other_category; const char *other_category;
const char* reset_wwp_setting; const char *reset_wwp_setting;
const char* press_a_action; const char *press_a_action;
const char* restart_to_apply_action; const char *restart_to_apply_action;
const char* need_menu_action; const char *need_menu_action;
}; };
#endif //INKAY_CONFIG_H #endif //INKAY_CONFIG_H

View file

@ -1,8 +1,7 @@
#ifndef _PATCHER_H #ifndef _PATCHER_H
#define _PATCHER_H #define _PATCHER_H
typedef struct URL_Patch typedef struct URL_Patch {
{
unsigned int address; unsigned int address;
char url[80]; char url[80];
} URL_Patch; } URL_Patch;
@ -36,7 +35,7 @@ static const URL_Patch url_patches[] = {
{0xE22B3FFC, "https://nus.c.shop.pretendo.cc/nus/services/NetUpdateSOAP"}, {0xE22B3FFC, "https://nus.c.shop.pretendo.cc/nus/services/NetUpdateSOAP"},
{0xE229DE0C, "n.app.pretendo.cc"}, {0xE229DE0C, "n.app.pretendo.cc"},
//nim-boss .bss //nim-boss .bss
{0xE24B8A24, "https://nppl.app.pretendo.cc/p01/policylist/1/1/UNK"}, {0xE24B8A24, "https://nppl.app.pretendo.cc/p01/policylist/1/1/UNK"},
{0xE31930D4, "https://%s%saccount.pretendo.cc/v%u/api/"} {0xE31930D4, "https://%s%saccount.pretendo.cc/v%u/api/"}
}; };

View file

@ -49,7 +49,7 @@
#include <gx2/surface.h> #include <gx2/surface.h>
#define INKAY_VERSION "v3.0" #define INKAY_VERSION "v2.5.0"
/** /**
Mandatory plugin information. Mandatory plugin information.
@ -62,6 +62,7 @@ WUPS_PLUGIN_AUTHOR("Pretendo contributors");
WUPS_PLUGIN_LICENSE("ISC"); WUPS_PLUGIN_LICENSE("ISC");
WUPS_USE_STORAGE("inkay"); WUPS_USE_STORAGE("inkay");
WUPS_USE_WUT_DEVOPTAB(); WUPS_USE_WUT_DEVOPTAB();
#include <kernel/kernel.h> #include <kernel/kernel.h>
@ -71,25 +72,24 @@ WUPS_USE_WUT_DEVOPTAB();
#include "utils/sysconfig.h" #include "utils/sysconfig.h"
//thanks @Gary#4139 :p //thanks @Gary#4139 :p
static void write_string(uint32_t addr, const char* str) static void write_string(uint32_t addr, const char *str) {
{
int len = strlen(str) + 1; int len = strlen(str) + 1;
int remaining = len % 4; int remaining = len % 4;
int num = len - remaining; int num = len - remaining;
for (int i = 0; i < (num / 4); i++) { for (int i = 0; i < (num / 4); i++) {
Mocha_IOSUKernelWrite32(addr + i * 4, *(uint32_t*)(str + i * 4)); Mocha_IOSUKernelWrite32(addr + i * 4, *(uint32_t * )(str + i * 4));
} }
if (remaining > 0) { if (remaining > 0) {
uint8_t buf[4]; uint8_t buf[4];
Mocha_IOSUKernelRead32(addr + num, (uint32_t*)&buf); Mocha_IOSUKernelRead32(addr + num, (uint32_t * ) & buf);
for (int i = 0; i < remaining; i++) { for (int i = 0; i < remaining; i++) {
buf[i] = *(str + num + i); buf[i] = *(str + num + i);
} }
Mocha_IOSUKernelWrite32(addr + num, *(uint32_t*)&buf); Mocha_IOSUKernelWrite32(addr + num, *(uint32_t * ) & buf);
} }
} }
@ -97,7 +97,7 @@ static bool is555(MCPSystemVersion version) {
return (version.major == 5) && (version.minor == 5) && (version.patch >= 5); return (version.major == 5) && (version.minor == 5) && (version.patch >= 5);
} }
static const char * get_nintendo_network_message() { static const char *get_nintendo_network_message() {
// TL note: "Nintendo Network" is a proper noun - "Network" is part of the name // 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 // 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 // only specifying what we'll *attempt* to connect to
@ -109,13 +109,18 @@ static const char * get_nintendo_network_message() {
return "Usando Nintendo Network"; return "Usando Nintendo Network";
case nn::swkbd::LanguageType::French: case nn::swkbd::LanguageType::French:
return "Sur Nintendo Network"; return "Sur Nintendo Network";
case nn::swkbd::LanguageType::Italian: case nn::swkbd::LanguageType::Italian:
return "Usando Nintendo Network"; return "Usando Nintendo Network";
case nn::swkbd::LanguageType::German: case nn::swkbd::LanguageType::German:
return "Nutze Nintendo Network"; return "Nutze Nintendo Network";
case nn::swkbd::LanguageType::Simplified_Chinese:
return "使用 Nintendo Network";
case nn::swkbd::LanguageType::traditional_Chinese:
return "使用 Nintendo Network";
} }
} }
static const char * get_pretendo_message() {
static const char *get_pretendo_message() {
// TL note: "Pretendo Network" is also a proper noun - though "Pretendo" alone can refer to us as a project // 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 // 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 // only specifying what we'll *attempt* to connect to
@ -131,11 +136,15 @@ static const char * get_pretendo_message() {
return "Usando Pretendo Network"; return "Usando Pretendo Network";
case nn::swkbd::LanguageType::German: case nn::swkbd::LanguageType::German:
return "Nutze Pretendo Network"; return "Nutze Pretendo Network";
case nn::swkbd::LanguageType::Simplified_Chinese:
return "使用 Pretendo Network";
case nn::swkbd::LanguageType::traditional_Chinese:
return "使用 Pretendo Network";
} }
} }
INITIALIZE_PLUGIN() { INITIALIZE_PLUGIN() {
WHBLogCafeInit(); WHBLogCafeInit();
WHBLogUdpInit(); WHBLogUdpInit();
Config::Init(); Config::Init();
@ -162,29 +171,27 @@ INITIALIZE_PLUGIN() {
}; };
} }
DEBUG_FUNCTION_LINE_VERBOSE("Running on %d.%d.%d%c", DEBUG_FUNCTION_LINE_VERBOSE("Running on %d.%d.%d%c",
os_version.major, os_version.minor, os_version.patch, os_version.region os_version.major, os_version.minor, os_version.patch, os_version.region
); );
// if using pretendo then (try to) apply the ssl patches // if using pretendo then (try to) apply the ssl patches
if (Config::connect_to_network) { if (Config::connect_to_network) {
if (is555(os_version)) { if (is555(os_version)) {
Mocha_IOSUKernelWrite32(0xE1019F78, 0xE3A00001); // mov r0, #1 Mocha_IOSUKernelWrite32(0xE1019F78, 0xE3A00001); // mov r0, #1
} } else {
else {
Mocha_IOSUKernelWrite32(0xE1019E84, 0xE3A00001); // mov r0, #1 Mocha_IOSUKernelWrite32(0xE1019E84, 0xE3A00001); // mov r0, #1
} }
for (const auto& patch : url_patches) { for (const auto &patch: url_patches) {
write_string(patch.address, patch.url); write_string(patch.address, patch.url);
} }
DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches applied successfully."); DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches applied successfully.");
ShowNotification(get_pretendo_message()); ShowNotification(get_pretendo_message());
} } else {
else {
DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches skipped."); DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches skipped.");
ShowNotification(get_nintendo_network_message()); ShowNotification(get_nintendo_network_message());
} }
MCP_Close(mcp); MCP_Close(mcp);
@ -201,7 +208,7 @@ DEINITIALIZE_PLUGIN() {
NotificationModule_DeInitLibrary(); NotificationModule_DeInitLibrary();
FunctionPatcher_DeInitLibrary(); FunctionPatcher_DeInitLibrary();
WHBLogCafeDeinit(); WHBLogCafeDeinit();
WHBLogUdpDeinit(); WHBLogUdpDeinit();
} }
@ -214,6 +221,5 @@ ON_APPLICATION_START() {
} }
ON_APPLICATION_ENDS() { ON_APPLICATION_ENDS() {
// commented because it doesnt really unload inkay
//DEBUG_FUNCTION_LINE_VERBOSE("Unloading Inkay...\n");
} }

View file

@ -23,13 +23,14 @@
#include <coreinit/memorymap.h> #include <coreinit/memorymap.h>
#include <algorithm> #include <algorithm>
bool replace(uint32_t start, uint32_t size, const char* original_val, size_t original_val_sz, const char* new_val, size_t new_val_sz) { bool replace(uint32_t start, uint32_t size, const char *original_val, size_t original_val_sz, const char *new_val,
size_t new_val_sz) {
for (uint32_t addr = start; addr < start + size - original_val_sz; addr++) { for (uint32_t addr = start; addr < start + size - original_val_sz; addr++) {
int ret = memcmp(original_val, (void*)addr, original_val_sz); int ret = memcmp(original_val, (void *) addr, original_val_sz);
if (ret == 0) { if (ret == 0) {
DEBUG_FUNCTION_LINE_VERBOSE("found str @%08x: %s", addr, (const char*)addr); DEBUG_FUNCTION_LINE_VERBOSE("found str @%08x: %s", addr, (const char *) addr);
KernelCopyData(OSEffectiveToPhysical(addr), OSEffectiveToPhysical((uint32_t)new_val), new_val_sz); KernelCopyData(OSEffectiveToPhysical(addr), OSEffectiveToPhysical((uint32_t) new_val), new_val_sz);
DEBUG_FUNCTION_LINE_VERBOSE("new str @%08x: %s", addr, (const char*)addr); DEBUG_FUNCTION_LINE_VERBOSE("new str @%08x: %s", addr, (const char *) addr);
return true; return true;
} }
} }
@ -39,24 +40,24 @@ bool replace(uint32_t start, uint32_t size, const char* original_val, size_t ori
void replaceBulk(uint32_t start, uint32_t size, std::span<const replacement> replacements) { void replaceBulk(uint32_t start, uint32_t size, std::span<const replacement> replacements) {
// work out the biggest input replacement // work out the biggest input replacement
auto max_sz = std::max_element(replacements.begin(), replacements.end(), [](auto& a, auto& b) { auto max_sz = std::max_element(replacements.begin(), replacements.end(), [](auto &a, auto &b) {
return a.orig.size_bytes() < b.orig.size_bytes(); return a.orig.size_bytes() < b.orig.size_bytes();
})->orig.size_bytes(); })->orig.size_bytes();
int counts[replacements.size()]; int counts[replacements.size()];
for (auto& c : counts) { for (auto &c: counts) {
c = 0; c = 0;
} }
for (uint32_t addr = start; addr < start + size - max_sz; addr++) { for (uint32_t addr = start; addr < start + size - max_sz; addr++) {
for (int i = 0; i < (int)replacements.size(); i++) { for (int i = 0; i < (int) replacements.size(); i++) {
const auto& replacement = replacements[i]; const auto &replacement = replacements[i];
int ret = memcmp((void*)addr, replacement.orig.data(), replacement.orig.size_bytes()); int ret = memcmp((void *) addr, replacement.orig.data(), replacement.orig.size_bytes());
if (ret == 0) { if (ret == 0) {
KernelCopyData( KernelCopyData(
OSEffectiveToPhysical(addr), OSEffectiveToPhysical(addr),
OSEffectiveToPhysical((uint32_t)replacement.repl.data()), OSEffectiveToPhysical((uint32_t) replacement.repl.data()),
replacement.repl.size_bytes() replacement.repl.size_bytes()
); );
counts[i]++; counts[i]++;
@ -64,7 +65,7 @@ void replaceBulk(uint32_t start, uint32_t size, std::span<const replacement> rep
} }
} }
} }
for (auto c : counts) { for (auto c: counts) {
DEBUG_FUNCTION_LINE("replaced %d times", c); DEBUG_FUNCTION_LINE("replaced %d times", c);
} }
} }

View file

@ -18,7 +18,8 @@
#include <cstddef> #include <cstddef>
#include <span> #include <span>
bool replace(uint32_t start, uint32_t size, const char* original_val, size_t original_val_sz, const char* new_val, size_t new_val_sz); bool replace(uint32_t start, uint32_t size, const char *original_val, size_t original_val_sz, const char *new_val,
size_t new_val_sz);
struct replacement { struct replacement {
std::span<const uint8_t> orig; std::span<const uint8_t> orig;

View file

@ -24,7 +24,7 @@
#include <optional> #include <optional>
nn::swkbd::LanguageType get_system_language() { nn::swkbd::LanguageType get_system_language() {
static std::optional<nn::swkbd::LanguageType> cached_language{}; static std::optional <nn::swkbd::LanguageType> cached_language{};
if (cached_language) return *cached_language; if (cached_language) return *cached_language;
UCHandle handle = UCOpen(); UCHandle handle = UCOpen();

View file

@ -11,13 +11,13 @@ extern "C" {
namespace nn::boss { namespace nn::boss {
class Task { class Task {
public: public:
nn::act::PersistentId persistentId; nn::act::PersistentId persistentId;
uint32_t unk1; uint32_t unk1;
char task_name[8]; char task_name[8];
uint64_t title_id; uint64_t title_id;
uint32_t unk2; uint32_t unk2;
uint32_t unk3; uint32_t unk3;
}; };
static_assert(sizeof(Task) == 32, "nn::boss::Task must be 32 bytes."); static_assert(sizeof(Task) == 32, "nn::boss::Task must be 32 bytes.");
@ -26,15 +26,15 @@ namespace nn::boss {
extern "C" uint32_t Initialize__Q2_2nn4bossFv(); extern "C" uint32_t Initialize__Q2_2nn4bossFv();
extern "C" uint32_t Finalize__Q2_2nn4bossFv(); extern "C" uint32_t Finalize__Q2_2nn4bossFv();
extern "C" void __ct__Q3_2nn4boss4TaskFv(nn::boss::Task* task); extern "C" void __ct__Q3_2nn4boss4TaskFv(nn::boss::Task *task);
extern "C" uint32_t Initialize__Q3_2nn4boss4TaskFPCcUi(nn::boss::Task* task, char const *, unsigned int); extern "C" uint32_t Initialize__Q3_2nn4boss4TaskFPCcUi(nn::boss::Task *task, char const *, unsigned int);
extern "C" uint32_t Unregister__Q3_2nn4boss4TaskFv(nn::boss::Task* task); extern "C" uint32_t Unregister__Q3_2nn4boss4TaskFv(nn::boss::Task *task);
extern "C" void __dt__Q3_2nn4boss4TaskFv(nn::boss::Task* task); extern "C" void __dt__Q3_2nn4boss4TaskFv(nn::boss::Task *task);
extern "C" uint32_t StartScheduling__Q3_2nn4boss4TaskFb(nn::boss::Task* task, bool queueTaskOnCall); extern "C" uint32_t StartScheduling__Q3_2nn4boss4TaskFb(nn::boss::Task *task, bool queueTaskOnCall);
extern "C" uint32_t GetState__Q3_2nn4boss4TaskCFPUi(nn::boss::Task* task, uint32_t *outExecCount); extern "C" uint32_t GetState__Q3_2nn4boss4TaskCFPUi(nn::boss::Task *task, uint32_t *outExecCount);
extern "C" uint32_t Run__Q3_2nn4boss4TaskFb(nn::boss::Task* task, bool unk); extern "C" uint32_t Run__Q3_2nn4boss4TaskFb(nn::boss::Task *task, bool unk);
extern "C" uint32_t UpdateIntervalSec__Q3_2nn4boss4TaskFUi(nn::boss::Task* task, uint32_t seconds); extern "C" uint32_t UpdateIntervalSec__Q3_2nn4boss4TaskFUi(nn::boss::Task *task, uint32_t seconds);
extern "C" bool IsRegistered__Q3_2nn4boss4TaskCFv(nn::boss::Task* task); extern "C" bool IsRegistered__Q3_2nn4boss4TaskCFv(nn::boss::Task *task);
#ifdef __cplusplus #ifdef __cplusplus
} }