Implement restart flag
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include <game.h>
|
||||
#include <core.h>
|
||||
#include <utils.h>
|
||||
#include <msg.h>
|
||||
|
||||
#include <main.h>
|
||||
|
||||
@ -23,6 +24,19 @@ void unload_ctr_dec() {
|
||||
}
|
||||
}
|
||||
|
||||
void request_restart() {
|
||||
HANDLE hRestartFlag = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, "Global\\JadeiteRestartFlag");
|
||||
int *restartFlag = MapViewOfFile(hRestartFlag, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(int));
|
||||
if (!restartFlag) {
|
||||
msg_err_a("Could not map shared memory to set restart flag");
|
||||
}
|
||||
|
||||
*restartFlag = 1;
|
||||
|
||||
UnmapViewOfFile(restartFlag);
|
||||
CloseHandle(hRestartFlag);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
|
||||
// Only listen to attach
|
||||
if (reason != DLL_PROCESS_ATTACH) {
|
||||
|
||||
Reference in New Issue
Block a user