From 1796ebebb5322c87cfbe951a582ed23d7fbce83a Mon Sep 17 00:00:00 2001 From: red binder Date: Sat, 18 Jul 2026 00:50:36 +0200 Subject: [PATCH] OLV changes --- plugin/src/main.cpp | 2 +- src/patches/olv_applet.cpp | 62 ++++++++++++++++++++++++++++++++------ src/patches/olv_urls.h | 4 +-- 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/plugin/src/main.cpp b/plugin/src/main.cpp index 57ba9d1..516146d 100644 --- a/plugin/src/main.cpp +++ b/plugin/src/main.cpp @@ -91,7 +91,7 @@ void splatoon_patcher(){ auto str_loc = (char*)(0x000009ac + (uint32_t)game_data_region); - strcpy(str_loc, "https://s-res.spfn.net/post"); + strcpy(str_loc, "https://splatpost.spbr.net/post"); } } } diff --git a/src/patches/olv_applet.cpp b/src/patches/olv_applet.cpp index 8f97a79..2860027 100644 --- a/src/patches/olv_applet.cpp +++ b/src/patches/olv_applet.cpp @@ -46,7 +46,7 @@ constexpr struct olv_allowlist original_entry = { constexpr struct olv_allowlist new_entry = { .scheme = "https", - .domain = "." NETWORK_BASEURL, + .domain = ".projectrose.cafe", .path = "", .flags = {1, 1, 1, 1, 1}, }; @@ -77,6 +77,7 @@ const replacement replacements[] = { }; static std::optional rootca_pem_handle{}; +static std::optional valid_tld_handle{}; std::vector olv_patches; DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path, const char *mode, uint32_t *handle, @@ -106,33 +107,74 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path, DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Found Miiverse CA, replacing..."); return ret; } + else if (strcmp("vol/content/browser/effective_tld_names.dat", path) == 0) + { + // we patch the TLD because .cafe isnt on the list (projectrose.cafe) + int ret = real_FSOpenFile(client, block, path, mode, handle, error); + valid_tld_handle = *handle; + DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Found Miiverse TLD List, patching..."); + return ret; + } return real_FSOpenFile(client, block, path, mode, handle, error); } DECL_FUNCTION(FSStatus, FSReadFile, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, - FSFileHandle handle, uint32_t unk1, uint32_t flags) { - if (size != 1) { - DEBUG_FUNCTION_LINE("Inkay: Miiverse CA replacement failed!"); + FSFileHandle handle, uint32_t unk1, uint32_t flags) +{ + if (size != 1) + { + DEBUG_FUNCTION_LINE("Inkay: Miiverse CA/LTD replacement failed!"); } - if (rootca_pem_handle && *rootca_pem_handle == handle) { - strlcpy((char *) buffer, (const char *) ca_pem, size * count); + if (rootca_pem_handle && *rootca_pem_handle == handle) + { + strlcpy((char *)buffer, (const char *)ca_pem, size * count); - //this can't be done above (in the FSOpenFile hook) since it's not loaded yet. - //the hardcoded offsets suck but they really are at Random Places In The Heap - replaceBulk(0x11000000, 0x02000000, replacements); - return (FSStatus) count; + // this can't be done above (in the FSOpenFile hook) since it's not loaded yet. + // the hardcoded offsets suck but they really are at Random Places In The Heap + return (FSStatus)count; + } + else if (valid_tld_handle && *valid_tld_handle == handle) + { + // we patch the tld "aero"... + FSStatus ret = real_FSReadFile( + client, block, buffer, size, count, handle, unk1, flags); + + if (ret > 0) + { + uint32_t totalSize = size * count; + char *buf = (char *)buffer; + + for (uint32_t i = 0; i + 4 <= totalSize; i++) + { + if (memcmp(&buf[i], "aero", 4) == 0) + { + memcpy(&buf[i], "cafe", 4); + + DEBUG_FUNCTION_LINE_VERBOSE( + "Inkay: patched TLD aero -> cafe"); + } + } + } + + return ret; } return real_FSReadFile(client, block, buffer, size, count, handle, unk1, flags); } + DECL_FUNCTION(FSStatus, FSCloseFile, FSClient *client, FSCmdBlock *block, FSFileHandle handle, FSErrorFlag errorMask) { if (handle == rootca_pem_handle) { rootca_pem_handle.reset(); } + if (handle == valid_tld_handle) + { + valid_tld_handle.reset(); + } + return real_FSCloseFile(client, block, handle, errorMask); } diff --git a/src/patches/olv_urls.h b/src/patches/olv_urls.h index 323498f..aa055fc 100644 --- a/src/patches/olv_urls.h +++ b/src/patches/olv_urls.h @@ -18,9 +18,9 @@ #include "inkay_config.h" constexpr char original_url[] = "discovery.olv.nintendo.net/v1/endpoint"; -constexpr char new_url[] = "discovery.olv." NETWORK_BASEURL "/v1/endpoint"; +constexpr char new_url[] = "disco.olv.projectrose.cafe/v1/endpoint"; -_Static_assert(sizeof(original_url) > sizeof(new_url), +_Static_assert(sizeof(original_url) >= sizeof(new_url), "new_url too long! Must be less than 38chars."); bool setup_olv_libs();