2024-03-24 11:18:47 +01:00
|
|
|
#include "globals.h"
|
2021-04-06 16:58:19 +02:00
|
|
|
#include "modpackSelector.h"
|
2024-03-24 11:18:47 +01:00
|
|
|
#include "utils/config.h"
|
2022-02-04 15:05:17 +01:00
|
|
|
#include "utils/logger.h"
|
2022-04-22 17:37:16 +02:00
|
|
|
#include <content_redirection/redirection.h>
|
2021-04-06 16:58:19 +02:00
|
|
|
#include <coreinit/title.h>
|
2022-02-04 15:05:17 +01:00
|
|
|
#include <wups.h>
|
2022-09-18 13:04:02 +02:00
|
|
|
#include <wups/config/WUPSConfigItemBoolean.h>
|
2021-04-06 16:58:19 +02:00
|
|
|
|
|
|
|
WUPS_PLUGIN_NAME("SDCafiine");
|
2022-04-22 17:37:16 +02:00
|
|
|
WUPS_PLUGIN_DESCRIPTION("SDCafiine");
|
2022-09-19 17:22:08 +02:00
|
|
|
WUPS_PLUGIN_VERSION(VERSION_FULL);
|
2021-04-06 16:58:19 +02:00
|
|
|
WUPS_PLUGIN_AUTHOR("Maschell");
|
|
|
|
WUPS_PLUGIN_LICENSE("GPL");
|
|
|
|
|
2021-10-02 11:43:15 +02:00
|
|
|
WUPS_USE_WUT_DEVOPTAB();
|
2024-03-24 11:18:47 +01:00
|
|
|
WUPS_USE_STORAGE("sdcafiine"); // Unique id for the storage api
|
2022-04-22 17:37:16 +02:00
|
|
|
|
|
|
|
INITIALIZE_PLUGIN() {
|
|
|
|
ContentRedirectionStatus error;
|
2022-09-18 00:29:12 +02:00
|
|
|
if ((error = ContentRedirection_InitLibrary()) != CONTENT_REDIRECTION_RESULT_SUCCESS) {
|
2022-09-18 13:04:02 +02:00
|
|
|
DEBUG_FUNCTION_LINE_ERR("Failed to init ContentRedirection. Error %s %d", ContentRedirection_GetStatusStr(error), error);
|
2022-04-22 17:37:16 +02:00
|
|
|
OSFatal("Failed to init ContentRedirection.");
|
|
|
|
}
|
2022-09-18 13:04:02 +02:00
|
|
|
|
2024-03-24 11:18:47 +01:00
|
|
|
InitStorageAndConfig();
|
2023-12-27 20:06:45 +01:00
|
|
|
|
2024-03-24 11:18:47 +01:00
|
|
|
gContentLayerHandle = 0;
|
|
|
|
gAocLayerHandle = 0;
|
2022-04-22 17:37:16 +02:00
|
|
|
}
|
|
|
|
|
2021-04-06 16:58:19 +02:00
|
|
|
/* Entry point */
|
|
|
|
ON_APPLICATION_START() {
|
2022-01-30 20:47:29 +01:00
|
|
|
initLogging();
|
2022-09-18 13:04:02 +02:00
|
|
|
if (gSDCafiineEnabled) {
|
|
|
|
HandleMultiModPacks(OSGetTitleID());
|
|
|
|
} else {
|
|
|
|
DEBUG_FUNCTION_LINE("SDCafiine is disabled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-04 15:05:17 +01:00
|
|
|
ON_APPLICATION_ENDS() {
|
2024-03-24 11:18:47 +01:00
|
|
|
if (gContentLayerHandle != 0) {
|
|
|
|
ContentRedirection_RemoveFSLayer(gContentLayerHandle);
|
|
|
|
gContentLayerHandle = 0;
|
2022-04-22 17:37:16 +02:00
|
|
|
}
|
2024-03-24 11:18:47 +01:00
|
|
|
if (gAocLayerHandle != 0) {
|
|
|
|
ContentRedirection_RemoveFSLayer(gAocLayerHandle);
|
|
|
|
gAocLayerHandle = 0;
|
2022-09-18 13:04:02 +02:00
|
|
|
}
|
2022-01-30 20:47:29 +01:00
|
|
|
deinitLogging();
|
2021-04-06 16:58:19 +02:00
|
|
|
}
|