FunctionPatcherModule/source/main.cpp

48 lines
1.0 KiB
C++
Raw Normal View History

2020-06-06 22:15:47 +02:00
#include <wums.h>
#ifdef DEBUG
2020-06-06 22:15:47 +02:00
#include <whb/log_udp.h>
#include <whb/log_cafe.h>
#include <whb/log_module.h>
#endif // DEBUG
2020-06-06 22:15:47 +02:00
#include "function_patcher.h"
2021-09-24 14:49:20 +02:00
2020-06-06 22:15:47 +02:00
WUMS_MODULE_EXPORT_NAME("homebrew_functionpatcher");
WUMS_MODULE_SKIP_ENTRYPOINT();
2020-06-06 22:15:47 +02:00
uint32_t moduleLogInit = false;
uint32_t cafeLogInit = false;
uint32_t udpLogInit = false;
2020-06-06 22:15:47 +02:00
WUMS_APPLICATION_STARTS() {
#ifdef DEBUG
if (!(moduleLogInit = WHBLogModuleInit())) {
cafeLogInit = WHBLogCafeInit();
udpLogInit = WHBLogUdpInit();
}
#endif // DEBUG
2020-06-06 22:15:47 +02:00
FunctionPatcherResetLibHandles();
}
WUMS_APPLICATION_REQUESTS_EXIT() {
#ifdef DEBUG
if (moduleLogInit) {
WHBLogModuleDeinit();
moduleLogInit = false;
}
if (cafeLogInit) {
WHBLogCafeDeinit();
cafeLogInit = false;
}
if (udpLogInit) {
WHBLogUdpDeinit();
udpLogInit = false;
}
#endif // DEBUG
2020-06-06 22:15:47 +02:00
}
WUMS_EXPORT_FUNCTION(FunctionPatcherPatchFunction);
2020-06-12 21:10:59 +02:00
WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreFunctions);
WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreDynamicFunctions);