sdcafiine_plugin/src/main.cpp

52 lines
1.4 KiB
C++
Raw Normal View History

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"
#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");
WUPS_PLUGIN_DESCRIPTION("SDCafiine");
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
INITIALIZE_PLUGIN() {
ContentRedirectionStatus error;
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);
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;
}
2021-04-06 16:58:19 +02:00
/* Entry point */
ON_APPLICATION_START() {
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;
}
2024-03-24 11:18:47 +01:00
if (gAocLayerHandle != 0) {
ContentRedirection_RemoveFSLayer(gAocLayerHandle);
gAocLayerHandle = 0;
2022-09-18 13:04:02 +02:00
}
deinitLogging();
2021-04-06 16:58:19 +02:00
}