Skip to content

Instantly share code, notes, and snippets.

@brook2
Created December 25, 2013 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brook2/8120542 to your computer and use it in GitHub Desktop.
Save brook2/8120542 to your computer and use it in GitHub Desktop.
diff -x higan -x '*.so' -x '*~' -x '*.o' -uNr higan_v093r11_trace/src/gb/gb.hpp higan_v093r11_sockpair/src/gb/gb.hpp
--- higan_v093r11_trace/src/gb/gb.hpp 2013-05-05 08:54:22.000000000 +0100
+++ higan_v093r11_sockpair/src/gb/gb.hpp 2013-12-24 08:28:09.858114736 +0000
@@ -20,6 +20,9 @@
#include <libco/libco.h>
+extern int sockSIO;
+extern int sockSCK;
+
namespace GameBoy {
struct Thread {
cothread_t thread;
diff -x higan -x '*.so' -x '*~' -x '*.o' -uNr higan_v093r11_trace/src/target-ethos/ethos.cpp higan_v093r11_sockpair/src/target-ethos/ethos.cpp
--- higan_v093r11_trace/src/target-ethos/ethos.cpp 2013-12-02 16:09:21.000000000 +0000
+++ higan_v093r11_sockpair/src/target-ethos/ethos.cpp 2013-12-24 08:27:25.890112617 +0000
@@ -5,6 +5,9 @@
Program* program = nullptr;
DSP dspaudio;
+int sockSIO;
+int sockSCK;
+
Emulator::Interface& system() {
if(program->active == nullptr) throw;
return *program->active;
@@ -39,6 +42,19 @@
}
Program::Program(int argc, char** argv) {
+ int fd1[2], fd2[2];
+
+ socketpair(PF_LOCAL, SOCK_STREAM, 0, fd1);
+ socketpair(PF_LOCAL, SOCK_STREAM, 0, fd2);
+ if(fork()) {
+ sockSIO = fd1[0];
+ sockSCK = fd2[0];
+ }
+ else {
+ sockSIO = fd1[1];
+ sockSCK = fd2[1];
+ }
+
ananke.open("ananke");
program = this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment