mirror of
https://github.com/PretendoNetwork/Inkay.git
synced 2026-03-21 17:45:17 -05:00
feat: Move all URL defines into a central location
Some checks failed
Inkay-CI / build-inkay (push) Has been cancelled
Some checks failed
Inkay-CI / build-inkay (push) Has been cancelled
This commit is contained in:
parent
38f1b1848e
commit
9e376f7839
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,3 +9,4 @@
|
|||
*.wps
|
||||
certs/
|
||||
*.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 "utils/logger.h"
|
||||
#include "utils/replace_mem.h"
|
||||
#include "inkay_config.h"
|
||||
|
||||
#include <function_patcher/function_patching.h>
|
||||
#include <vector>
|
||||
|
|
@ -36,21 +37,29 @@
|
|||
#define ACCOUNT_SETTINGS_TID_U 0x000500101004B100
|
||||
#define ACCOUNT_SETTINGS_TID_E 0x000500101004B200
|
||||
|
||||
const char whitelist_original[] = {
|
||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x2E,
|
||||
0x6E, 0x69, 0x6E, 0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x6E, 0x65, 0x74
|
||||
struct account_settings_allowlist {
|
||||
char scheme[16];
|
||||
char domain[128];
|
||||
char path[128]; // unverified
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
const char whitelist_new[] = {
|
||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x2E,
|
||||
0x70, 0x72, 0x65, 0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x63, 0x63, 0x00
|
||||
constexpr struct account_settings_allowlist original_entry = {
|
||||
.scheme = "https",
|
||||
.domain = "account.nintendo.net",
|
||||
.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() {
|
||||
return (OSGetTitleID() != 0 && (
|
||||
|
|
@ -141,12 +150,12 @@ bool hotpatchAccountSettings() {
|
|||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: hewwo account settings!\n");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (!replace(0x10000000, 0x10000000, whitelist_original, sizeof(whitelist_original), whitelist_new, sizeof(whitelist_new))) {
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the whitelist /)>~<(\\");
|
||||
if (!replace(0x10000000, 0x10000000, (const char *)&original_entry, sizeof(original_entry), (const char *)&new_entry, sizeof(new_entry))) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: We didn't find the whitelist /)>~<(\\");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@
|
|||
|
||||
#include <netdb.h>
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "utils/logger.h"
|
||||
#include "inkay_config.h"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <function_patcher/function_patching.h>
|
||||
|
||||
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
|
||||
{ "nncs1.app.nintendowifi.net", "nncs1.app.pretendo.cc" },
|
||||
{ "nncs2.app.nintendowifi.net", "nncs2.app.pretendo.cc" },
|
||||
{ "nncs1.app.nintendowifi.net", "nncs1.app." NETWORK_BASEURL },
|
||||
{ "nncs2.app.nintendowifi.net", "nncs2.app." NETWORK_BASEURL },
|
||||
};
|
||||
|
||||
static const char * replace_dns_name(const char *dns_name) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "olv_urls.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/replace_mem.h"
|
||||
#include "inkay_config.h"
|
||||
|
||||
#include <vector>
|
||||
#include <function_patcher/function_patching.h>
|
||||
|
|
@ -30,21 +31,28 @@
|
|||
|
||||
#include "ca_pem.h" // generated at buildtime
|
||||
|
||||
const 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_original[] = "https://ninja.wup.shop.nintendo.net/ninja/wood_index.html?";
|
||||
constexpr char wave_new[] = "http://samurai.wup.shop." NETWORK_BASEURL "/ninja/wood_index.html?";
|
||||
|
||||
const char whitelist_original[] = {
|
||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6D, 0x75, 0x72, 0x61, 0x69, 0x2E,
|
||||
0x77, 0x75, 0x70, 0x2E, 0x73, 0x68, 0x6F, 0x70, 0x2E, 0x6E, 0x69, 0x6E,
|
||||
0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x6E, 0x65, 0x74
|
||||
struct eshop_allowlist {
|
||||
char scheme[16];
|
||||
char domain[128];
|
||||
char path[128]; // unverified
|
||||
unsigned char flags[5];
|
||||
};
|
||||
|
||||
const char whitelist_new[] = {
|
||||
0x68, 0x74, 0x74, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6D, 0x75, 0x72, 0x61, 0x69, 0x2E,
|
||||
0x77, 0x75, 0x70, 0x2E, 0x73, 0x68, 0x6F, 0x70, 0x2E, 0x70, 0x72, 0x65,
|
||||
0x74, 0x65, 0x6E, 0x64, 0x6F, 0x2E, 0x63, 0x63, 0x00
|
||||
constexpr struct eshop_allowlist original_entry = {
|
||||
.scheme = "https",
|
||||
.domain = "samurai.wup.shop.nintendo.net",
|
||||
.path = "",
|
||||
.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{};
|
||||
|
|
@ -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)))
|
||||
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 /)>~<(\\");
|
||||
|
||||
// Check for root CA file and take note of its handle
|
||||
|
|
|
|||
|
|
@ -30,16 +30,27 @@
|
|||
|
||||
#include "ca_pem.h" // generated at buildtime
|
||||
|
||||
const char wave_original[] = {
|
||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x2E, 0x6E, 0x69, 0x6E, 0x74, 0x65, 0x6E, 0x64,
|
||||
0x6F, 0x2E, 0x6E, 0x65, 0x74
|
||||
struct olv_allowlist {
|
||||
char scheme[16];
|
||||
char domain[128];
|
||||
char path[128]; // unverified
|
||||
unsigned char flags[5];
|
||||
};
|
||||
const char wave_new[] = {
|
||||
0x68, 0x74, 0x74, 0x70, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x2E, 0x70, 0x72, 0x65, 0x74, 0x65, 0x6E, 0x64,
|
||||
0x6F, 0x2E, 0x63, 0x63, 0x00
|
||||
|
||||
constexpr struct olv_allowlist original_entry = {
|
||||
.scheme = "https",
|
||||
.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[] = {
|
||||
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();
|
||||
// Patch applet binary too
|
||||
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
|
||||
} else if (strcmp("vol/content/browser/rootca.pem", path) == 0) {
|
||||
int ret = real_FSOpenFile(client, block, path, mode, handle, error);
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include "inkay_config.h"
|
||||
|
||||
const char original_url[] = "discovery.olv.nintendo.net/v1/endpoint";
|
||||
const char new_url[] = "discovery.olv.pretendo.cc/v1/endpoint";
|
||||
constexpr char original_url[] = "discovery.olv.nintendo.net/v1/endpoint";
|
||||
constexpr char new_url[] = "discovery.olv." NETWORK_BASEURL "/v1/endpoint";
|
||||
|
||||
_Static_assert(sizeof(original_url) > sizeof(new_url),
|
||||
"new_url too long! Must be less than 38chars.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user