diff --git a/bsnes/target-bsnes/program/program.hpp b/bsnes/target-bsnes/program/program.hpp index 21cc5127..abecf693 100644 --- a/bsnes/target-bsnes/program/program.hpp +++ b/bsnes/target-bsnes/program/program.hpp @@ -222,7 +222,7 @@ public: }; ProducerConsumerQueue pendingRpcCommands; - nall::thread* rpcHandlerThread; + nall::thread rpcHandlerThread; bool fastForwarding = false; bool rewinding = false; diff --git a/bsnes/target-bsnes/program/rpc.cpp b/bsnes/target-bsnes/program/rpc.cpp index c081ed8b..2b392f53 100644 --- a/bsnes/target-bsnes/program/rpc.cpp +++ b/bsnes/target-bsnes/program/rpc.cpp @@ -1,11 +1,19 @@ -auto Program::startRpcListener() -> void { +#include +auto Program::startRpcListener() -> void { + // NB: There is no cross-platform way to read from a pipe in a non-blocking + // way. So instead, we're going to spin up a blocking thread that reads stdin + // and processes it. What's even worse, is that we can't even properly + // terminate this thread since there's no timeout on blocking stdin reads, + // all we can do is force-terminate this thread on exit. + rpcHandlerThread = nall::thread::create([&](auto param) { + OutputDebugStringA("HELLO IT WORKED LOOK AT THIS\n"); + }); } auto Program::stopRpcListener() -> void { - + rpcHandlerThread.cancel(); } auto Program::processRpcCommands() -> void { - } \ No newline at end of file