wiiload_plugin/src/main.cpp

46 lines
1.1 KiB
C++
Raw Normal View History

#include "globals.h"
2019-11-24 14:35:38 +01:00
#include "utils/TcpReceiver.h"
2022-02-04 15:47:35 +01:00
#include "utils/logger.h"
#include <coreinit/debug.h>
#include <rpxloader/rpxloader.h>
2022-02-04 15:47:35 +01:00
#include <wups.h>
2019-11-24 14:35:38 +01:00
WUPS_PLUGIN_NAME("Wiiload");
WUPS_PLUGIN_DESCRIPTION("Wiiload Server");
WUPS_PLUGIN_VERSION("0.1");
WUPS_PLUGIN_AUTHOR("Maschell");
WUPS_PLUGIN_LICENSE("GPL");
2021-09-24 20:51:39 +02:00
WUPS_USE_WUT_DEVOPTAB();
2019-11-24 14:35:38 +01:00
TcpReceiver *thread = nullptr;
2019-11-24 14:35:38 +01:00
INITIALIZE_PLUGIN() {
RPXLoaderStatus error;
if ((error = RPXLoader_InitLibrary()) != RPX_LOADER_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE_ERR("WiiLoad Plugin: Failed to init RPXLoader. Error %d", error);
} else {
gLibRPXLoaderInitDone = true;
}
thread = nullptr;
}
/* Entry point */
ON_APPLICATION_START() {
initLogging();
DEBUG_FUNCTION_LINE("Start wiiload thread");
2022-10-06 23:07:36 +02:00
thread = new (std::nothrow) TcpReceiver(4299);
if (thread == nullptr) {
DEBUG_FUNCTION_LINE_ERR("Failed to create wiiload thread");
}
2019-11-24 14:35:38 +01:00
}
ON_APPLICATION_ENDS() {
2022-10-06 23:07:36 +02:00
DEBUG_FUNCTION_LINE("Stop wiiload thread!");
if (thread != nullptr) {
delete thread;
thread = nullptr;
}
2022-10-06 23:07:36 +02:00
DEBUG_FUNCTION_LINE_VERBOSE("Done!");
deinitLogging();
}