2024-10-19 19:10:08 +01:00
|
|
|
/* Copyright 2022 Pretendo Network contributors <pretendo.network>
|
|
|
|
|
Copyright 2022 Ash Logan <ash@heyquark.com>
|
|
|
|
|
Copyright 2019 Maschell
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <wups.h>
|
2024-11-21 13:19:06 +11:00
|
|
|
|
2024-10-19 19:10:08 +01:00
|
|
|
#include <notifications/notifications.h>
|
|
|
|
|
#include <utils/logger.h>
|
|
|
|
|
#include "config.h"
|
2026-05-16 22:18:39 +02:00
|
|
|
#include<coreinit/title.h>
|
|
|
|
|
#include<coreinit/dynload.h>
|
|
|
|
|
#include<vector>
|
2024-10-19 19:10:08 +01:00
|
|
|
#include "module.h"
|
|
|
|
|
|
2025-02-15 21:09:10 +00:00
|
|
|
#define INKAY_VERSION "v3.0.0"
|
2024-10-19 19:10:08 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Mandatory plugin information.
|
|
|
|
|
If not set correctly, the loader will refuse to use the plugin.
|
|
|
|
|
**/
|
2026-05-16 22:18:39 +02:00
|
|
|
WUPS_PLUGIN_NAME("Inkay(SPFN)");
|
|
|
|
|
WUPS_PLUGIN_DESCRIPTION("SPFN Network Patcher");
|
2024-10-19 19:10:08 +01:00
|
|
|
WUPS_PLUGIN_VERSION(INKAY_VERSION);
|
2026-05-16 22:18:39 +02:00
|
|
|
WUPS_PLUGIN_AUTHOR("Pretendo contributors and RusticMaple");
|
2024-10-19 19:10:08 +01:00
|
|
|
WUPS_PLUGIN_LICENSE("GPLv3");
|
|
|
|
|
|
|
|
|
|
WUPS_USE_STORAGE("inkay");
|
|
|
|
|
|
|
|
|
|
WUPS_USE_WUT_DEVOPTAB();
|
|
|
|
|
|
2026-05-16 22:18:39 +02:00
|
|
|
bool is_current_game_splatoon(){
|
|
|
|
|
auto current_game = OSGetTitleID();
|
|
|
|
|
|
|
|
|
|
if(
|
|
|
|
|
current_game == 0x0005000010162B00 ||
|
|
|
|
|
current_game == 0x0005000010176900 ||
|
|
|
|
|
current_game == 0x0005000010176A00
|
|
|
|
|
){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void splatoon_patcher(){
|
2026-07-19 19:53:42 -04:00
|
|
|
if (!Config::connect_to_network) {
|
|
|
|
|
DEBUG_FUNCTION_LINE_VERBOSE("Inkay: Splatoon patches skipped");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-05-16 22:18:39 +02:00
|
|
|
if(is_current_game_splatoon()){
|
|
|
|
|
NotificationModule_AddInfoNotification("Splatoon Detected, applying patch");
|
|
|
|
|
|
|
|
|
|
auto rpl_count = OSDynLoad_GetNumberOfRPLs();
|
|
|
|
|
|
|
|
|
|
std::vector<OSDynLoad_NotifyData> rpls(rpl_count);
|
|
|
|
|
|
|
|
|
|
if(!OSDynLoad_GetRPLInfo(0, rpl_count, rpls.data())){
|
|
|
|
|
NotificationModule_AddInfoNotification("failed to get rpls");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(auto rpl: rpls){
|
|
|
|
|
if(rpl.name != 0){
|
|
|
|
|
if(strstr(rpl.name, "Gambit") != NULL){
|
|
|
|
|
NotificationModule_AddInfoNotification(rpl.name);
|
|
|
|
|
auto text_color = NMColor();
|
|
|
|
|
text_color.r = 255;
|
|
|
|
|
text_color.g = 255;
|
|
|
|
|
text_color.b = 255;
|
|
|
|
|
text_color.a = 255;
|
|
|
|
|
|
|
|
|
|
auto bg_color = NMColor();
|
|
|
|
|
bg_color.r = 0;
|
|
|
|
|
bg_color.g = 0;
|
|
|
|
|
bg_color.b = 0;
|
|
|
|
|
bg_color.a = 0;
|
|
|
|
|
|
|
|
|
|
NotificationModule_AddInfoNotificationEx(rpl.name, 30.0f, text_color, bg_color, nullptr, nullptr, true);
|
|
|
|
|
|
|
|
|
|
NotificationModule_AddInfoNotification("applying patches!!!!");
|
|
|
|
|
|
|
|
|
|
void* game_data_region = (void*)rpl.dataAddr;
|
|
|
|
|
|
|
|
|
|
auto str_loc = (char*)(0x000009ac + (uint32_t)game_data_region);
|
|
|
|
|
|
2026-07-18 00:50:36 +02:00
|
|
|
strcpy(str_loc, "https://splatpost.spbr.net/post");
|
2026-05-16 22:18:39 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-19 19:10:08 +01:00
|
|
|
INITIALIZE_PLUGIN() {
|
|
|
|
|
WHBLogCafeInit();
|
|
|
|
|
WHBLogUdpInit();
|
|
|
|
|
|
|
|
|
|
Config::Init();
|
|
|
|
|
|
|
|
|
|
if (NotificationModule_InitLibrary() != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
|
|
|
|
DEBUG_FUNCTION_LINE("NotificationModule_InitLibrary failed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if using pretendo then (try to) apply the ssl patches
|
|
|
|
|
Inkay_Initialize(Config::connect_to_network);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEINITIALIZE_PLUGIN() {
|
2024-10-29 18:24:13 +00:00
|
|
|
Inkay_Finalize();
|
2024-10-19 19:10:08 +01:00
|
|
|
NotificationModule_DeInitLibrary();
|
|
|
|
|
|
|
|
|
|
WHBLogCafeDeinit();
|
|
|
|
|
WHBLogUdpDeinit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ON_APPLICATION_START() {
|
2025-01-30 18:26:01 +01:00
|
|
|
// Tell the module the plugin is running!
|
2026-05-16 22:18:39 +02:00
|
|
|
splatoon_patcher();
|
2025-01-30 18:26:01 +01:00
|
|
|
Inkay_SetPluginRunning();
|
2024-10-19 19:10:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ON_APPLICATION_ENDS() {
|
|
|
|
|
|
|
|
|
|
}
|