mirror of
https://github.com/PretendoNetwork/Inkay.git
synced 2026-08-18 11:37:02 +02:00
chore: Tighten up logspam and binary size
Remove some old stuff to Make Small Inkay
This commit is contained in:
parent
04d723137b
commit
1a85a45ce3
8 changed files with 26 additions and 45 deletions
6
Makefile
6
Makefile
|
|
@ -29,19 +29,19 @@ INCLUDES := src src/ext/inih
|
|||
#-------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#-------------------------------------------------------------------------------
|
||||
CFLAGS := -g -Wall -O2 -ffunction-sections \
|
||||
CFLAGS := -Wall -O2 -ffunction-sections -fdata-sections \
|
||||
$(MACHDEP)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ -D__WUPS__
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
CFLAGS += -DDEBUG
|
||||
CFLAGS += -DDEBUG -g
|
||||
endif
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -std=c++20
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map)
|
||||
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Wl,-gc-sections
|
||||
|
||||
LDFLAGS += -T$(WUMS_ROOT)/share/libkernel.ld $(WUPSSPECS)
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ constexpr config_strings get_config_strings(nn::swkbd::LanguageType language) {
|
|||
}
|
||||
|
||||
static void connect_to_network_changed(ConfigItemBoolean* item, bool new_value) {
|
||||
DEBUG_FUNCTION_LINE("connect_to_network changed to: %d", new_value);
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("connect_to_network changed to: %d", new_value);
|
||||
if (new_value != Config::connect_to_network) {
|
||||
Config::need_relaunch = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ DECL_FUNCTION(int, FSOpenFile_accSettings, FSClient *client, FSCmdBlock *block,
|
|||
}
|
||||
|
||||
if (!Config::connect_to_network) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: account settings patches skipped.");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: account settings patches skipped.");
|
||||
return real_FSOpenFile_accSettings(client, block, path, mode, handle, error);
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ DECL_FUNCTION(int, FSOpenFile_accSettings, FSClient *client, FSCmdBlock *block,
|
|||
if (strcmp("vol/content/browser/rootca.pem", path) == 0) {
|
||||
int ret = real_FSOpenFile_accSettings(client, block, path, mode, handle, error);
|
||||
rootca_pem_handle = *handle;
|
||||
DEBUG_FUNCTION_LINE("Inkay: Found account settings CA, replacing...");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Found account settings CA, replacing...");
|
||||
return ret;
|
||||
}
|
||||
return real_FSOpenFile_accSettings(client, block, path, mode, handle, error);
|
||||
|
|
@ -116,19 +116,19 @@ bool patchAccountSettings() {
|
|||
}
|
||||
|
||||
if (!Config::connect_to_network) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: account settings patches skipped.");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: account settings patches skipped.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("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))) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: We didn't find the url /)>~<(\\");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("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("Inkay: We didn't find the whitelist /)>~<(\\");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: We didn't find the whitelist /)>~<(\\");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ DECL_FUNCTION(int, FSOpenFile_eShop, FSClient *client, FSCmdBlock *block, char *
|
|||
const char *initialOma = "vol/content/initial.oma";
|
||||
|
||||
if (!Config::connect_to_network) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: eShop patches skipped.");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: eShop patches skipped.");
|
||||
return real_FSOpenFile_eShop(client, block, path, mode, handle, error);
|
||||
}
|
||||
|
||||
|
|
@ -61,19 +61,19 @@ DECL_FUNCTION(int, FSOpenFile_eShop, FSClient *client, FSCmdBlock *block, char *
|
|||
//below is a hacky (yet functional!) way to get Inkay to redirect URLs from the Miiverse applet
|
||||
//we do it when loading this file since it should only load once, preventing massive lag spikes as it searches all of MEM2 xD
|
||||
|
||||
DEBUG_FUNCTION_LINE("Inkay: hewwo eShop!\n");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: hewwo eShop!\n");
|
||||
|
||||
if (!replace(0x10000000, 0x10000000, wave_original, sizeof(wave_original), wave_new, sizeof(wave_new)))
|
||||
DEBUG_FUNCTION_LINE("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)))
|
||||
DEBUG_FUNCTION_LINE("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
|
||||
} else if (strcmp("vol/content/browser/rootca.pem", path) == 0) {
|
||||
int ret = real_FSOpenFile_eShop(client, block, path, mode, handle, error);
|
||||
rootca_pem_handle = *handle;
|
||||
DEBUG_FUNCTION_LINE("Inkay: Found eShop CA, replacing...");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Found eShop CA, replacing...");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ static int handler(void *user, const char *section, const char *name, const char
|
|||
static void check_modpack() {
|
||||
modpack mod;
|
||||
if (ini_parse("fs:/vol/content/pretendo.ini", handler, &mod)) {
|
||||
DEBUG_FUNCTION_LINE("Inkay/MK8: Doesn't look like a modpack");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay/MK8: Doesn't look like a modpack");
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("Inkay/MK8: Playing %s (%08x)", mod.name.c_str(), mod.dlc_id);
|
||||
|
|
@ -72,7 +72,7 @@ DECL_FUNCTION(void, mk8_MatchmakeSessionSearchCriteria_SetAttribute, void *_this
|
|||
|
||||
const int dlc_id = dlc_modpack->dlc_id;
|
||||
if (dlc_id != -1) {
|
||||
DEBUG_FUNCTION_LINE("Inkay/MK8: Searching for %s session (%08x)", dlc_modpack->name.c_str(), dlc_id);
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay/MK8: Searching for %s session (%08x)", dlc_modpack->name.c_str(), dlc_id);
|
||||
attributeValue = dlc_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ DECL_FUNCTION(void, mk8_MatchmakeSession_SetAttribute, void *_this, uint32_t att
|
|||
|
||||
const int dlc_id = dlc_modpack->dlc_id;
|
||||
if (dlc_id != -1) {
|
||||
DEBUG_FUNCTION_LINE("Inkay/MK8: Creating %s session (%08x)", dlc_modpack->name.c_str(), dlc_id);
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay/MK8: Creating %s session (%08x)", dlc_modpack->name.c_str(), dlc_id);
|
||||
attributeValue = dlc_id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path,
|
|||
const char *initialOma = "vol/content/initial.oma";
|
||||
|
||||
if (!Config::connect_to_network) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: Miiverse patches skipped.");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Miiverse patches skipped.");
|
||||
return real_FSOpenFile(client, block, path, mode, handle, error);
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path,
|
|||
//we do it when loading this file since it should only load once, preventing massive lag spikes as it searches all of MEM2 xD
|
||||
//WHBLogUdpInit();
|
||||
|
||||
DEBUG_FUNCTION_LINE("Inkay: hewwo!\n");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: hewwo!\n");
|
||||
|
||||
auto olv_ok = setup_olv_libs();
|
||||
// Patch applet binary too
|
||||
|
|
@ -90,7 +90,7 @@ DECL_FUNCTION(int, FSOpenFile, FSClient *client, FSCmdBlock *block, char *path,
|
|||
} else if (strcmp("vol/content/browser/rootca.pem", path) == 0) {
|
||||
int ret = real_FSOpenFile(client, block, path, mode, handle, error);
|
||||
rootca_pem_handle = *handle;
|
||||
DEBUG_FUNCTION_LINE("Inkay: Found Miiverse CA, replacing...");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Found Miiverse CA, replacing...");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -123,27 +123,6 @@ DECL_FUNCTION(FSStatus, FSCloseFile, FSClient *client, FSCmdBlock *block, FSFile
|
|||
return real_FSCloseFile(client, block, handle, errorMask);
|
||||
}
|
||||
|
||||
DECL_FUNCTION(uint32_t, NSSLExportInternalServerCertificate, NSSLServerCertId cert, int unk, void *unk2, void *unk3) {
|
||||
if (cert == NSSL_SERVER_CERT_THAWTE_PREMIUM_SERVER_CA) { // Martini patches
|
||||
OSFatal("[598-0069] Please uninstall Martini patches to continue.\n" \
|
||||
"See pretendo.network/docs/search for more info.\n\n" \
|
||||
"Hold the POWER button for 4 seconds to shut down.\n\n"
|
||||
" .\n"
|
||||
".---------.'---.\n"
|
||||
"'. : .'\n"
|
||||
" '. .::: .'\n"
|
||||
" '.'::'.'\n"
|
||||
" '||'\n"
|
||||
" ||\n"
|
||||
" ||\n"
|
||||
"mrz ||\n"
|
||||
" ---====---");
|
||||
}
|
||||
return real_NSSLExportInternalServerCertificate(cert, unk, unk2, unk3);
|
||||
}
|
||||
|
||||
WUPS_MUST_REPLACE_FOR_PROCESS(FSOpenFile, WUPS_LOADER_LIBRARY_COREINIT, FSOpenFile, WUPS_FP_TARGET_PROCESS_MIIVERSE);
|
||||
WUPS_MUST_REPLACE_FOR_PROCESS(FSReadFile, WUPS_LOADER_LIBRARY_COREINIT, FSReadFile, WUPS_FP_TARGET_PROCESS_MIIVERSE);
|
||||
WUPS_MUST_REPLACE_FOR_PROCESS(FSCloseFile, WUPS_LOADER_LIBRARY_COREINIT, FSCloseFile, WUPS_FP_TARGET_PROCESS_MIIVERSE);
|
||||
WUPS_MUST_REPLACE_FOR_PROCESS(NSSLExportInternalServerCertificate, WUPS_LOADER_LIBRARY_NSYSNET,
|
||||
NSSLExportInternalServerCertificate, WUPS_FP_TARGET_PROCESS_MIIVERSE);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ bool path_is_olv(const char* path) {
|
|||
|
||||
void new_rpl_loaded(OSDynLoad_Module module, void* ctx, OSDynLoad_NotifyReason reason, OSDynLoad_NotifyData* rpl) {
|
||||
if (!Config::connect_to_network) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: Miiverse patches skipped.");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Miiverse patches skipped.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ void new_rpl_loaded(OSDynLoad_Module module, void* ctx, OSDynLoad_NotifyReason r
|
|||
|
||||
bool setup_olv_libs() {
|
||||
if (!Config::connect_to_network) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: Miiverse patches skipped.");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Miiverse patches skipped.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ bool setup_olv_libs() {
|
|||
|
||||
auto olvLoaded = check_olv_libs();
|
||||
if (!olvLoaded) {
|
||||
DEBUG_FUNCTION_LINE("Inkay: no olv, quitting for now\n");
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: no olv, quitting for now\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ void replaceBulk(uint32_t start, uint32_t size, std::span<const replacement> rep
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
for (auto c: counts) {
|
||||
DEBUG_FUNCTION_LINE("replaced %d times", c);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue