Skip to content

Commit

Permalink
Merge pull request #3 from DeltaNeverUsed/MemLeak-Dev
Browse files Browse the repository at this point in the history
Mem leak dev
  • Loading branch information
DeltaNeverUsed authored Jul 29, 2023
2 parents fa4abce + b6b0365 commit 0289b47
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ODTKRA/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ void start_process(std::string path) {
ShellExecute(NULL, L"open", (LPCWSTR)std::wstring(tempstr.begin(), tempstr.end()).c_str(), NULL, NULL, SW_SHOWDEFAULT);
HWND hWindowHandle;

Sleep(500);

//wait for window to load
std::cout << "Waiting for window to load" << std::endl;
while ((hWindowHandle = get_winhandle((LPCWSTR)L"Oculus Debug Tool")) == NULL) {
Expand All @@ -155,7 +157,8 @@ void start_process(std::string path) {

std::cout << "Waiting for window to be focused" << std::endl;
while (GetForegroundWindow() != hWindowHandle) {
SwitchToThisWindow(hWindowHandle, true);
if (doKillODTThread) return;
SetForegroundWindow(hWindowHandle);
Sleep(50);
}
std::cout << "ODT window focused!" << std::endl;
Expand Down Expand Up @@ -192,11 +195,16 @@ void parse_args(int argc, char* argv[]) {
}
}

bool threadRunning;

void doToggle() {
threadRunning = true;
start_process(ODTPath);
if (!doKillODTThread)
Sleep(100);
killODT(0);

threadRunning = false;
}

int main(int argc, char* argv[]) {
Expand Down Expand Up @@ -236,8 +244,10 @@ int main(int argc, char* argv[]) {

if (tk - lastIdle < seconds(15))
{
doKillODTThread = true;
refresh_loop = tk;
if (threadRunning) {
doKillODTThread = true;
refresh_loop = tk;
}
}
else
{
Expand Down

0 comments on commit 0289b47

Please sign in to comment.