forked from PretendoNetwork/Inkay
feat: Move all URL defines into a central location
This commit is contained in:
parent
38f1b1848e
commit
9e376f7839
7 changed files with 92 additions and 41 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,3 +9,4 @@
|
||||||
*.wps
|
*.wps
|
||||||
certs/
|
certs/
|
||||||
*.lst
|
*.lst
|
||||||
|
inkay_config.local.h
|
||||||
|
|
|
||||||
21
common/inkay_config.h
Normal file
21
common/inkay_config.h
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Created by ash on 17/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef INKAY_INKAY_CONFIG_H
|
||||||
|
#define INKAY_INKAY_CONFIG_H
|
||||||
|
|
||||||
|
#ifdef __has_include
|
||||||
|
#if __has_include("inkay_config.local.h")
|
||||||
|
|
||||||
|
#include "inkay_config.local.h"
|
||||||
|
#define INKAY_CUSTOM 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NETWORK_BASEURL
|
||||||
|
#define NETWORK_BASEURL "pretendo.cc"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //INKAY_INKAY_CONFIG_H
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include "olv_urls.h"
|
#include "olv_urls.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "utils/replace_mem.h"
|
#include "utils/replace_mem.h"
|
||||||
|
#include "inkay_config.h"
|
||||||
|
|
||||||
#include <function_patcher/function_patching.h>
|
#include <function_patcher/function_patching.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -36,21 +37,29 @@
|
||||||
#define ACCOUNT_SETTINGS_TID_U 0x000500101004B100
|
#define ACCOUNT_SETTINGS_TID_U 0x000500101004B100
|
||||||
#define ACCOUNT_SETTINGS_TID_E 0x000500101004B200
|
#define ACCOUNT_SETTINGS_TID_E 0x000500101004B200
|
||||||
|
|
||||||
const char whitelist_original[] = {
|
struct account_settings_allowlist {
|
||||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
char scheme[16];
|
||||||
0x00, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x2E,
|
char domain[128];
|
||||||
0x6E, 0x69, 0x6E, 0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x6E, 0x65, 0x74
|
char path[128]; // unverified
|
||||||
|
uint32_t flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
const char whitelist_new[] = {
|
constexpr struct account_settings_allowlist original_entry = {
|
||||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
.scheme = "https",
|
||||||
0x00, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x2E,
|
.domain = "account.nintendo.net",
|
||||||
0x70, 0x72, 0x65, 0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x63, 0x63, 0x00
|
.path = "",
|
||||||
|
.flags = 0x01010101,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char wave_original[] = "saccount.nintendo.net";
|
constexpr struct account_settings_allowlist new_entry = {
|
||||||
|
.scheme = "https",
|
||||||
|
.domain = "account." NETWORK_BASEURL,
|
||||||
|
.path = "",
|
||||||
|
.flags = 0x01010101,
|
||||||
|
};
|
||||||
|
constexpr char wave_original[] = "saccount.nintendo.net";
|
||||||
|
|
||||||
const char wave_new[] = "saccount.pretendo.cc";
|
constexpr char wave_new[] = "saccount." NETWORK_BASEURL;
|
||||||
|
|
||||||
static bool isAccountSettingsTitle() {
|
static bool isAccountSettingsTitle() {
|
||||||
return (OSGetTitleID() != 0 && (
|
return (OSGetTitleID() != 0 && (
|
||||||
|
|
@ -141,12 +150,12 @@ bool hotpatchAccountSettings() {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: hewwo account settings!\n");
|
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: hewwo account settings!\n");
|
||||||
|
|
||||||
if (!replace(0x10000000, 0x10000000, wave_original, sizeof(wave_original), wave_new, sizeof(wave_new))) {
|
if (!replace(0x10000000, 0x10000000, wave_original, sizeof(wave_original), wave_new, sizeof(wave_new))) {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the url /)>~<(\\");
|
DEBUG_FUNCTION_LINE("Inkay: We didn't find the url /)>~<(\\");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!replace(0x10000000, 0x10000000, whitelist_original, sizeof(whitelist_original), whitelist_new, sizeof(whitelist_new))) {
|
if (!replace(0x10000000, 0x10000000, (const char *)&original_entry, sizeof(original_entry), (const char *)&new_entry, sizeof(new_entry))) {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the whitelist /)>~<(\\");
|
DEBUG_FUNCTION_LINE("Inkay: We didn't find the whitelist /)>~<(\\");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,19 @@
|
||||||
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include "inkay_config.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <function_patcher/function_patching.h>
|
#include <function_patcher/function_patching.h>
|
||||||
|
|
||||||
std::vector<PatchedFunctionHandle> dns_patches;
|
std::vector<PatchedFunctionHandle> dns_patches;
|
||||||
|
|
||||||
const std::pair<const char *, const char *> dns_replacements[] = {
|
constexpr std::pair<const char *, const char *> dns_replacements[] = {
|
||||||
// NNCS servers
|
// NNCS servers
|
||||||
{ "nncs1.app.nintendowifi.net", "nncs1.app.pretendo.cc" },
|
{ "nncs1.app.nintendowifi.net", "nncs1.app." NETWORK_BASEURL },
|
||||||
{ "nncs2.app.nintendowifi.net", "nncs2.app.pretendo.cc" },
|
{ "nncs2.app.nintendowifi.net", "nncs2.app." NETWORK_BASEURL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * replace_dns_name(const char *dns_name) {
|
static const char * replace_dns_name(const char *dns_name) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include "olv_urls.h"
|
#include "olv_urls.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "utils/replace_mem.h"
|
#include "utils/replace_mem.h"
|
||||||
|
#include "inkay_config.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <function_patcher/function_patching.h>
|
#include <function_patcher/function_patching.h>
|
||||||
|
|
@ -30,21 +31,28 @@
|
||||||
|
|
||||||
#include "ca_pem.h" // generated at buildtime
|
#include "ca_pem.h" // generated at buildtime
|
||||||
|
|
||||||
const char wave_original[] = "https://ninja.wup.shop.nintendo.net/ninja/wood_index.html?";
|
constexpr char wave_original[] = "https://ninja.wup.shop.nintendo.net/ninja/wood_index.html?";
|
||||||
const char wave_new[] = "http://samurai.wup.shop.pretendo.cc/ninja/wood_index.html?";
|
constexpr char wave_new[] = "http://samurai.wup.shop." NETWORK_BASEURL "/ninja/wood_index.html?";
|
||||||
|
|
||||||
const char whitelist_original[] = {
|
struct eshop_allowlist {
|
||||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
char scheme[16];
|
||||||
0x00, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6D, 0x75, 0x72, 0x61, 0x69, 0x2E,
|
char domain[128];
|
||||||
0x77, 0x75, 0x70, 0x2E, 0x73, 0x68, 0x6F, 0x70, 0x2E, 0x6E, 0x69, 0x6E,
|
char path[128]; // unverified
|
||||||
0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x6E, 0x65, 0x74
|
unsigned char flags[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
const char whitelist_new[] = {
|
constexpr struct eshop_allowlist original_entry = {
|
||||||
0x68, 0x74, 0x74, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
.scheme = "https",
|
||||||
0x00, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6D, 0x75, 0x72, 0x61, 0x69, 0x2E,
|
.domain = "samurai.wup.shop.nintendo.net",
|
||||||
0x77, 0x75, 0x70, 0x2E, 0x73, 0x68, 0x6F, 0x70, 0x2E, 0x70, 0x72, 0x65,
|
.path = "",
|
||||||
0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x63, 0x63, 0x00
|
.flags = {1, 1, 1, 1, 0},
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr struct eshop_allowlist new_entry = {
|
||||||
|
.scheme = "http",
|
||||||
|
.domain = "samurai.wup.shop." NETWORK_BASEURL,
|
||||||
|
.path = "",
|
||||||
|
.flags = {1, 1, 1, 1, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::optional<FSFileHandle> rootca_pem_handle{};
|
static std::optional<FSFileHandle> rootca_pem_handle{};
|
||||||
|
|
@ -68,7 +76,7 @@ DECL_FUNCTION(int, FSOpenFile_eShop, FSClient *client, FSCmdBlock *block, char *
|
||||||
if (!replace(0x10000000, 0x10000000, wave_original, sizeof(wave_original), wave_new, sizeof(wave_new)))
|
if (!replace(0x10000000, 0x10000000, wave_original, sizeof(wave_original), wave_new, sizeof(wave_new)))
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the url /)>~<(\\");
|
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the url /)>~<(\\");
|
||||||
|
|
||||||
if (!replace(0x10000000, 0x10000000, whitelist_original, sizeof(whitelist_original), whitelist_new, sizeof(whitelist_new)))
|
if (!replace(0x10000000, 0x10000000, (const char *)&original_entry, sizeof(original_entry), (const char *)&new_entry, sizeof(new_entry)))
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the whitelist /)>~<(\\");
|
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the whitelist /)>~<(\\");
|
||||||
|
|
||||||
// Check for root CA file and take note of its handle
|
// Check for root CA file and take note of its handle
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,27 @@
|
||||||
|
|
||||||
#include "ca_pem.h" // generated at buildtime
|
#include "ca_pem.h" // generated at buildtime
|
||||||
|
|
||||||
const char wave_original[] = {
|
struct olv_allowlist {
|
||||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
char scheme[16];
|
||||||
0x00, 0x00, 0x00, 0x00, 0x2E, 0x6E, 0x69, 0x6E, 0x74, 0x65, 0x6E, 0x64,
|
char domain[128];
|
||||||
0x6F, 0x2E, 0x6E, 0x65, 0x74
|
char path[128]; // unverified
|
||||||
|
unsigned char flags[5];
|
||||||
};
|
};
|
||||||
const char wave_new[] = {
|
|
||||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
constexpr struct olv_allowlist original_entry = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x2E, 0x70, 0x72, 0x65, 0x74, 0x65, 0x6E, 0x64,
|
.scheme = "https",
|
||||||
0x6F, 0x2E, 0x63, 0x63, 0x00
|
.domain = ".nintendo.net",
|
||||||
|
.path = "",
|
||||||
|
.flags = {1, 1, 1, 1, 1},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr struct olv_allowlist new_entry = {
|
||||||
|
.scheme = "https",
|
||||||
|
.domain = "." NETWORK_BASEURL,
|
||||||
|
.path = "",
|
||||||
|
.flags = {1, 1, 1, 1, 1},
|
||||||
|
};
|
||||||
|
|
||||||
const unsigned char miiverse_green_highlight[] = {
|
const unsigned char miiverse_green_highlight[] = {
|
||||||
0x82, 0xff, 0x05, 0xff, 0x82, 0xff, 0x05, 0xff, 0x1d, 0xff, 0x04, 0xff, 0x1d, 0xff, 0x04, 0xff
|
0x82, 0xff, 0x05, 0xff, 0x82, 0xff, 0x05, 0xff, 0x1d, 0xff, 0x04, 0xff, 0x1d, 0xff, 0x04, 0xff
|
||||||
};
|
};
|
||||||
|
|
@ -87,7 +98,7 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path,
|
||||||
auto olv_ok = setup_olv_libs();
|
auto olv_ok = setup_olv_libs();
|
||||||
// Patch applet binary too
|
// Patch applet binary too
|
||||||
if (olv_ok)
|
if (olv_ok)
|
||||||
replace(0x10000000, 0x10000000, wave_original, sizeof(wave_original), wave_new, sizeof(wave_new));
|
replace(0x10000000, 0x10000000, (const char *)&original_entry, sizeof(original_entry), (const char *)&new_entry, sizeof(new_entry));
|
||||||
// Check for root CA file and take note of its handle
|
// Check for root CA file and take note of its handle
|
||||||
} else if (strcmp("vol/content/browser/rootca.pem", path) == 0) {
|
} else if (strcmp("vol/content/browser/rootca.pem", path) == 0) {
|
||||||
int ret = real_FSOpenFile(client, block, path, mode, handle, error);
|
int ret = real_FSOpenFile(client, block, path, mode, handle, error);
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include "inkay_config.h"
|
||||||
|
|
||||||
const char original_url[] = "discovery.olv.nintendo.net/v1/endpoint";
|
constexpr char original_url[] = "discovery.olv.nintendo.net/v1/endpoint";
|
||||||
const char new_url[] = "discovery.olv.pretendo.cc/v1/endpoint";
|
constexpr char new_url[] = "discovery.olv." NETWORK_BASEURL "/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.");
|
"new_url too long! Must be less than 38chars.");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue