Skip to content

Commit

Permalink
fix: Fix all issues with steam re-opening unskinned, and the UI freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
shdwmtr committed Oct 14, 2024
1 parent 652945d commit 6f5cd67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/core/co_initialize/co_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ void OnBackendLoad(uint16_t ftpPort, uint16_t ipcPort)
{
try
{
// if (eventMessage.value("method", "").find("Debugger.scriptParsed") == std::string::npos &&
// eventMessage.value("method", "").find("Debugger.scriptFailedToParse") == std::string::npos &&
// eventMessage.value("method", "").find("Fetch") == std::string::npos
// )
// {
// std::cout << eventMessage.dump(4) << std::endl;
// }

const int messageId = eventMessage.value("id", -1);

if (messageId == DEBUGGER_RESUME)
Expand All @@ -313,7 +321,7 @@ void OnBackendLoad(uint16_t ftpPort, uint16_t ipcPort)
{
*hasUnpausedDebuggerPtr = false;
Logger.Warn("Failed to resume debugger, Steam is likely not yet loaded...");
Sockets::PostShared({ {"id", DEBUGGER_RESUME }, {"method", "Debugger.resume"} });
// Sockets::PostShared({ {"id", DEBUGGER_RESUME }, {"method", "Debugger.resume"} });
}
else if (eventMessage.contains("result"))
{
Expand Down Expand Up @@ -344,6 +352,7 @@ void OnBackendLoad(uint16_t ftpPort, uint16_t ipcPort)
});
});

std::this_thread::sleep_for(std::chrono::milliseconds(100));
Sockets::PostShared({ {"id", DEBUGGER_RESUME }, {"method", "Debugger.resume"} });
socketEmitterThread.join();
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/co_initialize/events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ void CoInitializer::BackendCallbacks::RegisterForLoad(EventCallback callback)

if (this->EvaluateBackendStatus())
{
Logger.Log("Firing callback as all backends are already loaded.");

callback();
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/ffi/ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <nlohmann/json.hpp>
#include <fmt/core.h>
#include <sys/log.h>
#include <thread>

class PythonGIL : public std::enable_shared_from_this<PythonGIL>
{
Expand Down Expand Up @@ -83,7 +84,7 @@ namespace JavaScript {
auto it = missedMessages.find(event);
if (it != missedMessages.end()) {
for (const auto message : it->second) {
handler(message, listenerId);
std::thread([handler, message, listenerId] { handler(message, listenerId); }).detach();
}
missedMessages.erase(it); // Clear missed messages once delivered
}
Expand Down

0 comments on commit 6f5cd67

Please sign in to comment.