mirror of
https://github.com/wiiu-env/wiiload_plugin.git
synced 2024-11-22 02:29:15 +01:00
Workaround for restarting the current application after loading a new plugin
This commit is contained in:
parent
b20b41901b
commit
6e44a24e1e
13
src/main.cpp
13
src/main.cpp
@ -1,6 +1,8 @@
|
||||
#include <wups.h>
|
||||
#include "utils/TcpReceiver.h"
|
||||
#include <whb/log_udp.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <sysapp/launch.h>
|
||||
|
||||
WUPS_PLUGIN_NAME("Wiiload");
|
||||
WUPS_PLUGIN_DESCRIPTION("Wiiload Server");
|
||||
@ -26,9 +28,18 @@ void stopThread() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ON_APPLICATION_END() {
|
||||
DEBUG_FUNCTION_LINE("Kill thread");
|
||||
stopThread();
|
||||
}
|
||||
|
||||
bool gDoRelaunch __attribute__((section(".data"))) = 0;
|
||||
|
||||
ON_VYSNC() {
|
||||
// On each frame check if we want to exit.
|
||||
if(gDoRelaunch){
|
||||
SYSRelaunchTitle(0, NULL);
|
||||
gDoRelaunch = 0;
|
||||
DCFlushRange(&gDoRelaunch, sizeof(gDoRelaunch));
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "utils/utils.h"
|
||||
#include <wups_backend/PluginUtils.h>
|
||||
#include <coreinit/debug.h>
|
||||
#include <coreinit/cache.h>
|
||||
|
||||
#define RPX_TEMP_PATH "fs:/vol/external01/wiiu/apps/"
|
||||
#define RPX_TEMP_FILE "fs:/vol/external01/wiiu/apps/temp.rpx"
|
||||
@ -25,7 +26,7 @@ void _SYSLaunchTitleWithStdArgsInNoSplash(uint64_t, uint32_t);
|
||||
}
|
||||
|
||||
TcpReceiver::TcpReceiver(int32_t port)
|
||||
: CThread(CThread::eAttributeAffCore0), exitRequested(false), serverPort(port), serverSocket(-1) {
|
||||
: CThread(CThread::eAttributeAffCore1, 16,0x20000), exitRequested(false), serverPort(port), serverSocket(-1) {
|
||||
|
||||
resumeThread();
|
||||
}
|
||||
@ -62,8 +63,6 @@ void TcpReceiver::executeThread() {
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("");
|
||||
|
||||
if ((ret = listen(serverSocket, 1)) < 0) {
|
||||
socketclose(serverSocket);
|
||||
return;
|
||||
@ -84,7 +83,9 @@ void TcpReceiver::executeThread() {
|
||||
socketclose(clientSocket);
|
||||
|
||||
if (result > 0)
|
||||
if (result >= 0){
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("Server socket accept failed %i %d", clientSocket, wiiu_geterrno());
|
||||
OSSleepTicks(OSMicrosecondsToTicks(100000));
|
||||
@ -102,6 +103,7 @@ typedef struct __attribute((packed)) {
|
||||
char path[256];
|
||||
} LOAD_REQUEST;
|
||||
|
||||
extern bool gDoRelaunch;
|
||||
int32_t TcpReceiver::loadToMemory(int32_t clientSocket, uint32_t ipAddress) {
|
||||
DEBUG_FUNCTION_LINE("Loading file from ip %08X", ipAddress);
|
||||
|
||||
@ -260,7 +262,8 @@ int32_t TcpReceiver::loadToMemory(int32_t clientSocket, uint32_t ipAddress) {
|
||||
PluginUtils::destroyPluginContainer(finalList);
|
||||
} else {
|
||||
PluginUtils::destroyPluginContainer(finalList);
|
||||
SYSRelaunchTitle(NULL, NULL);
|
||||
gDoRelaunch = 1;
|
||||
DCFlushRange(&gDoRelaunch, sizeof(gDoRelaunch));
|
||||
}
|
||||
|
||||
free(loadAddress);
|
||||
|
Loading…
Reference in New Issue
Block a user