Initial commit for GitHub migration based on spice2x-25-03-03

This commit is contained in:
sp2xdev
2025-03-10 19:16:49 -07:00
parent 94af8d32c9
commit ed8c72852f
1008 changed files with 296815 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "sde.h"
#include <thread>
#include "hooks/sleephook.h"
#include "util/logging.h"
void sde_init(std::string sde_path) {
// check trailing slash
if (sde_path.length() > 0 && sde_path.back() == '\\') {
sde_path.pop_back();
}
// get PID
auto pid = GetCurrentProcessId();
// try attach
log_info("sde", "Attaching SDE ({}) to PID {}", sde_path, pid);
std::string cmd = "sde.exe -attach-pid " + to_string(pid);
std::thread t([sde_path, cmd]() {
system((sde_path + "\\" + cmd).c_str());
});
t.detach();
// wait to make sure it went through
Sleep(500);
}