forked from PretendoNetwork/Inkay
OLV changes
This commit is contained in:
parent
998abca200
commit
1796ebebb5
3 changed files with 55 additions and 13 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<FSFileHandle> rootca_pem_handle{};
|
||||
static std::optional<FSFileHandle> valid_tld_handle{};
|
||||
std::vector<PatchedFunctionHandle> 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue