mirror of
https://github.com/PretendoNetwork/Inkay.git
synced 2025-04-02 11:02:05 -04:00
Compare commits
13 commits
c847ef8161
...
f8bc367e92
Author | SHA1 | Date | |
---|---|---|---|
|
f8bc367e92 | ||
|
cca4c57f20 | ||
|
d43faeefdf | ||
|
f3ec04dc77 | ||
|
18182f90b7 | ||
|
29a9e2e2b4 | ||
|
ac18b95632 | ||
|
f7f3977f2c | ||
|
7eb7608a35 | ||
|
f039c5948d | ||
|
3e2721b48f | ||
|
b207e3475d | ||
|
1f18eba8b2 |
8 changed files with 59 additions and 100 deletions
|
@ -1,10 +1,10 @@
|
||||||
FROM ghcr.io/wiiu-env/devkitppc:20231112
|
FROM ghcr.io/wiiu-env/devkitppc:20240505
|
||||||
|
|
||||||
COPY --from=ghcr.io/wiiu-env/libnotifications:20230621 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libnotifications:20240426 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libkernel:20230621 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libkernel:20230621 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libmocha:20231127 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libmocha:20231127 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20230719 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20240505 /artifacts $DEVKITPRO
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
CMD make -f Makefile -j$(nproc)
|
CMD make -f Makefile -j$(nproc)
|
2
Makefile
2
Makefile
|
@ -24,7 +24,7 @@ BUILD := build
|
||||||
SOURCES := src src/patches src/utils src/ext/inih
|
SOURCES := src src/patches src/utils src/ext/inih
|
||||||
DATA := data
|
DATA := data
|
||||||
INCLUDES := src src/ext/inih
|
INCLUDES := src src/ext/inih
|
||||||
DEBUG := 1
|
#DEBUG := 1
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
|
|
|
@ -15,37 +15,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Notification.h"
|
#include "Notification.h"
|
||||||
#include <coreinit/cache.h>
|
|
||||||
#include <coreinit/thread.h>
|
|
||||||
#include <notifications/notification_defines.h>
|
#include <notifications/notification_defines.h>
|
||||||
#include <notifications/notifications.h>
|
#include <notifications/notifications.h>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
static std::unique_ptr<std::thread> sShowHintThread;
|
void ShowNotification(std::string_view notification) {
|
||||||
static bool sShutdownHintThread = false;
|
auto err1 = NotificationModule_SetDefaultValue(NOTIFICATION_MODULE_NOTIFICATION_TYPE_INFO,
|
||||||
|
NOTIFICATION_MODULE_DEFAULT_OPTION_KEEP_UNTIL_SHOWN, true);
|
||||||
|
auto err2 = NotificationModule_SetDefaultValue(NOTIFICATION_MODULE_NOTIFICATION_TYPE_INFO,
|
||||||
|
NOTIFICATION_MODULE_DEFAULT_OPTION_DURATION_BEFORE_FADE_OUT,
|
||||||
|
15.0f);
|
||||||
|
|
||||||
void ShowNotification(const char * notification) {
|
if (err1 != NOTIFICATION_MODULE_RESULT_SUCCESS || err2 != NOTIFICATION_MODULE_RESULT_SUCCESS) return;
|
||||||
// Wait for notification module to be ready
|
|
||||||
bool isOverlayReady = false;
|
|
||||||
while (!sShutdownHintThread && NotificationModule_IsOverlayReady(&isOverlayReady) == NOTIFICATION_MODULE_RESULT_SUCCESS && !isOverlayReady)
|
|
||||||
OSSleepTicks(OSMillisecondsToTicks(16));
|
|
||||||
if (sShutdownHintThread || !isOverlayReady) return;
|
|
||||||
NotificationModuleStatus err = NotificationModule_SetDefaultValue(NOTIFICATION_MODULE_NOTIFICATION_TYPE_INFO, NOTIFICATION_MODULE_DEFAULT_OPTION_DURATION_BEFORE_FADE_OUT, 15.0f);
|
|
||||||
if(err != NOTIFICATION_MODULE_RESULT_SUCCESS) return;
|
|
||||||
|
|
||||||
NotificationModule_AddInfoNotification(notification);
|
NotificationModule_AddInfoNotification(notification.data());
|
||||||
}
|
|
||||||
|
|
||||||
void StartNotificationThread(const char * value) {
|
|
||||||
sShutdownHintThread = false;
|
|
||||||
sShowHintThread = std::make_unique<std::thread>(ShowNotification, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StopNotificationThread() {
|
|
||||||
if (sShowHintThread != nullptr) {
|
|
||||||
sShutdownHintThread = true;
|
|
||||||
OSMemoryBarrier();
|
|
||||||
sShowHintThread->join();
|
|
||||||
sShowHintThread.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void ShowNotification(const char * notification);
|
#include <string_view>
|
||||||
|
|
||||||
void StartNotificationThread(const char * value);
|
void ShowNotification(std::string_view notification);
|
||||||
|
|
||||||
void StopNotificationThread();
|
|
|
@ -36,7 +36,6 @@ bool Config::connect_to_network = true;
|
||||||
bool Config::need_relaunch = false;
|
bool Config::need_relaunch = false;
|
||||||
bool Config::unregister_task_item_pressed = false;
|
bool Config::unregister_task_item_pressed = false;
|
||||||
bool Config::is_wiiu_menu = false;
|
bool Config::is_wiiu_menu = false;
|
||||||
bool Config::has_displayed_popup = false;
|
|
||||||
|
|
||||||
config_strings strings;
|
config_strings strings;
|
||||||
|
|
||||||
|
@ -108,12 +107,11 @@ 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("connect_to_network changed to: %d", new_value);
|
||||||
if (new_value != Config::connect_to_network) {
|
if (new_value != Config::connect_to_network) {
|
||||||
Config::need_relaunch = true;
|
Config::need_relaunch = true;
|
||||||
|
|
||||||
// make popup display again when rebooting into another network (caused by aroma beta 17+ api changes as far as i know)
|
|
||||||
Config::has_displayed_popup = false;
|
|
||||||
}
|
}
|
||||||
Config::connect_to_network = new_value;
|
Config::connect_to_network = new_value;
|
||||||
WUPSStorageAPI::Store<bool>("connect_to_network", Config::connect_to_network);
|
if (WUPSStorageAPI::Store<bool>("connect_to_network", Config::connect_to_network) != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE("Failed to save \"connect_to_network\" value (%d)", Config::connect_to_network);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unregister_task_item_on_input_cb(void *context, WUPSConfigSimplePadData input) {
|
static void unregister_task_item_on_input_cb(void *context, WUPSConfigSimplePadData input) {
|
||||||
|
@ -126,21 +124,21 @@ static void unregister_task_item_on_input_cb(void *context, WUPSConfigSimplePadD
|
||||||
{
|
{
|
||||||
if (nn::act::IsSlotOccupied(i) && nn::act::IsNetworkAccountEx(i))
|
if (nn::act::IsSlotOccupied(i) && nn::act::IsNetworkAccountEx(i))
|
||||||
{
|
{
|
||||||
nn::boss::Task task;
|
nn::boss::Task task{};
|
||||||
nn::act::PersistentId persistentId = nn::act::GetPersistentIdEx(i);
|
nn::act::PersistentId persistentId = nn::act::GetPersistentIdEx(i);
|
||||||
|
|
||||||
__ct__Q3_2nn4boss4TaskFv(&task);
|
__ct__Q3_2nn4boss4TaskFv(&task);
|
||||||
Initialize__Q3_2nn4boss4TaskFPCcUi(&task, "oltopic", persistentId);
|
Initialize__Q3_2nn4boss4TaskFPCcUi(&task, "oltopic", persistentId);
|
||||||
|
|
||||||
// bypasses compiler warning about unused variable
|
// bypasses compiler warning about unused variable
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
uint32_t res = Unregister__Q3_2nn4boss4TaskFv(&task);
|
uint32_t res = Unregister__Q3_2nn4boss4TaskFv(&task);
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Unregistered oltopic for: SlotNo %d | Persistent ID %08x -> 0x%08x", i, persistentId, res);
|
DEBUG_FUNCTION_LINE_VERBOSE("Unregistered oltopic for: SlotNo %d | Persistent ID %08x -> 0x%08x", i, persistentId, res);
|
||||||
#else
|
#else
|
||||||
Unregister__Q3_2nn4boss4TaskFv(&task);
|
Unregister__Q3_2nn4boss4TaskFv(&task);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Finalize__Q2_2nn4bossFv();
|
Finalize__Q2_2nn4bossFv();
|
||||||
nn::act::Finalize();
|
nn::act::Finalize();
|
||||||
|
@ -174,7 +172,7 @@ static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHa
|
||||||
auto patching_cat = WUPSConfigCategory::Create(strings.network_category);
|
auto patching_cat = WUPSConfigCategory::Create(strings.network_category);
|
||||||
|
|
||||||
// config id display name default current value changed callback
|
// config id display name default current value changed callback
|
||||||
patching_cat.add(WUPSConfigItemBoolean::Create("connect_to_network", strings.connect_to_network_setting, false, Config::connect_to_network, &connect_to_network_changed));
|
patching_cat.add(WUPSConfigItemBoolean::Create("connect_to_network", strings.connect_to_network_setting, true, Config::connect_to_network, &connect_to_network_changed));
|
||||||
root.add(std::move(patching_cat));
|
root.add(std::move(patching_cat));
|
||||||
|
|
||||||
auto other_cat = WUPSConfigCategory::Create(strings.other_category);
|
auto other_cat = WUPSConfigCategory::Create(strings.other_category);
|
||||||
|
@ -198,8 +196,13 @@ static WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHa
|
||||||
};
|
};
|
||||||
|
|
||||||
WUPSConfigItemHandle unregisterTasksItem;
|
WUPSConfigItemHandle unregisterTasksItem;
|
||||||
WUPSConfigAPI_Item_Create(unregisterTasksItemOptions, &unregisterTasksItem);
|
WUPSConfigAPIStatus err;
|
||||||
WUPSConfigAPI_Category_AddItem(other_cat.getHandle(), unregisterTasksItem);
|
if ((err = WUPSConfigAPI_Item_Create(unregisterTasksItemOptions, &unregisterTasksItem)) != WUPSCONFIG_API_RESULT_SUCCESS) {
|
||||||
|
throw std::runtime_error(std::string("Failed to create config item: ").append(WUPSConfigAPI_GetStatusStr(err)));
|
||||||
|
}
|
||||||
|
if ((err = WUPSConfigAPI_Category_AddItem(other_cat.getHandle(), unregisterTasksItem)) != WUPSCONFIG_API_RESULT_SUCCESS) {
|
||||||
|
throw std::runtime_error(std::string("Failed to add config item: ").append(WUPSConfigAPI_GetStatusStr(err)));
|
||||||
|
}
|
||||||
|
|
||||||
root.add(std::move(other_cat));
|
root.add(std::move(other_cat));
|
||||||
}
|
}
|
||||||
|
@ -239,16 +242,16 @@ void Config::Init() {
|
||||||
DEBUG_FUNCTION_LINE("Connect to network value not found, attempting to migrate/create");
|
DEBUG_FUNCTION_LINE("Connect to network value not found, attempting to migrate/create");
|
||||||
|
|
||||||
bool skipPatches = false;
|
bool skipPatches = false;
|
||||||
if ((storageRes = WUPSStorageAPI::Get<bool>("skipPatches", skipPatches)) != WUPS_STORAGE_ERROR_NOT_FOUND) {
|
if (WUPSStorageAPI::Get<bool>("skipPatches", skipPatches) == WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
// Migrate old config value
|
// Migrate old config value
|
||||||
Config::connect_to_network = !skipPatches;
|
Config::connect_to_network = !skipPatches;
|
||||||
WUPSStorageAPI::DeleteItem("skipPatches");
|
WUPSStorageAPI::DeleteItem("skipPatches");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the value to the storage if it's missing.
|
// Add the value to the storage if it's missing.
|
||||||
//if (WUPSStorageAPI::Store<bool>("connect_to_network", Config::connect_to_network) != WUPS_STORAGE_ERROR_SUCCESS) {
|
if (WUPSStorageAPI::Store<bool>("connect_to_network", connect_to_network) != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
// DEBUG_FUNCTION_LINE("Failed to store bool");
|
DEBUG_FUNCTION_LINE("Failed to store bool");
|
||||||
//}
|
}
|
||||||
// commented indefinitely due to defaults likely being handled by the config api already
|
|
||||||
}
|
}
|
||||||
else if (storageRes != WUPS_STORAGE_ERROR_SUCCESS) {
|
else if (storageRes != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
DEBUG_FUNCTION_LINE("Failed to get bool %s (%d)", WUPSStorageAPI_GetStatusStr(storageRes), storageRes);
|
DEBUG_FUNCTION_LINE("Failed to get bool %s (%d)", WUPSStorageAPI_GetStatusStr(storageRes), storageRes);
|
||||||
|
|
|
@ -19,9 +19,6 @@ public:
|
||||||
static bool is_wiiu_menu;
|
static bool is_wiiu_menu;
|
||||||
|
|
||||||
static bool unregister_task_item_pressed;
|
static bool unregister_task_item_pressed;
|
||||||
|
|
||||||
// for notifications to work correctly in aroma beta 17+
|
|
||||||
static bool has_displayed_popup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct config_strings {
|
struct config_strings {
|
||||||
|
|
29
src/main.cpp
29
src/main.cpp
|
@ -179,9 +179,13 @@ INITIALIZE_PLUGIN() {
|
||||||
write_string(patch.address, patch.url);
|
write_string(patch.address, patch.url);
|
||||||
}
|
}
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches applied successfully.");
|
DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches applied successfully.");
|
||||||
|
|
||||||
|
ShowNotification(get_pretendo_message());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches skipped.");
|
DEBUG_FUNCTION_LINE_VERBOSE("Pretendo URL and NoSSL patches skipped.");
|
||||||
|
|
||||||
|
ShowNotification(get_nintendo_network_message());
|
||||||
}
|
}
|
||||||
|
|
||||||
MCP_Close(mcp);
|
MCP_Close(mcp);
|
||||||
|
@ -204,37 +208,14 @@ DEINITIALIZE_PLUGIN() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ON_APPLICATION_START() {
|
ON_APPLICATION_START() {
|
||||||
WHBLogModuleInit();
|
|
||||||
WHBLogCafeInit();
|
|
||||||
WHBLogUdpInit();
|
|
||||||
|
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Inkay " INKAY_VERSION " starting up...\n");
|
DEBUG_FUNCTION_LINE_VERBOSE("Inkay " INKAY_VERSION " starting up...\n");
|
||||||
|
|
||||||
uint64_t titleID = OSGetTitleID();
|
|
||||||
if (titleID == _SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_WII_U_MENU) && !Config::has_displayed_popup)
|
|
||||||
{
|
|
||||||
if (Config::connect_to_network) {
|
|
||||||
StartNotificationThread(get_pretendo_message());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
StartNotificationThread(get_nintendo_network_message());
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::has_displayed_popup = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_olv_libs();
|
setup_olv_libs();
|
||||||
matchmaking_notify_titleswitch();
|
matchmaking_notify_titleswitch();
|
||||||
patchAccountSettings();
|
patchAccountSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
ON_APPLICATION_ENDS() {
|
ON_APPLICATION_ENDS() {
|
||||||
// commented because it doesnt really unload inkay, just the application thread, which is a bit misleading
|
// commented because it doesnt really unload inkay
|
||||||
//DEBUG_FUNCTION_LINE_VERBOSE("Unloading Inkay...\n");
|
//DEBUG_FUNCTION_LINE_VERBOSE("Unloading Inkay...\n");
|
||||||
|
|
||||||
WHBLogModuleDeinit();
|
|
||||||
WHBLogCafeDeinit();
|
|
||||||
WHBLogUdpDeinit();
|
|
||||||
|
|
||||||
StopNotificationThread();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) DEBUG_FUNCTION_LINE(FMT, ##ARGS)
|
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) DEBUG_FUNCTION_LINE(FMT, ##ARGS)
|
||||||
#else
|
#else
|
||||||
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
|
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Add table
Reference in a new issue