From 376a36bf5706fac8d16e3a7a022cec93f09cae4f Mon Sep 17 00:00:00 2001 From: ~skmp Date: Tue, 17 Feb 2015 00:55:11 +0200 Subject: [PATCH] Emscripten: Hacky support, can boot bios - Add TARGET_BOUNDED_EXECUTION, TARGET_EMSCRIPTEN - Add emscripten makefile Of course, there's no jit at this point --- core/hw/sh4/interpr/sh4_interpreter.cpp | 9 +++- core/linux-dist/main.cpp | 29 +++++++---- core/nullDC.cpp | 9 ++-- shell/emscripten/Makefile | 66 +++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 shell/emscripten/Makefile diff --git a/core/hw/sh4/interpr/sh4_interpreter.cpp b/core/hw/sh4/interpr/sh4_interpreter.cpp index 2ba673c18..918edeeb2 100644 --- a/core/hw/sh4/interpr/sh4_interpreter.cpp +++ b/core/hw/sh4/interpr/sh4_interpreter.cpp @@ -38,7 +38,11 @@ void Sh4_int_Run() s32 l=SH4_TIMESLICE; +#if !defined(TARGET_BOUNDED_EXECUTION) do +#else + for (int i=0; i<10000; i++) +#endif { do { @@ -50,10 +54,13 @@ void Sh4_int_Run() } while(l>0); l+=SH4_TIMESLICE; UpdateSystem_INTC(); - +#if !defined(TARGET_BOUNDED_EXECUTION) } while(sh4_int_bCpuRun); sh4_int_bCpuRun=false; +#else + } +#endif } void Sh4_int_Stop() diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index 84bc16ecf..e08e47956 100755 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -32,7 +32,7 @@ map x11_keymap; #endif -#if !defined(ANDROID) && HOST_OS != OS_DARWIN +#if !defined(ANDROID) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) #include #include #include @@ -138,8 +138,7 @@ void SetupInput() rt[port]=0; lt[port]=0; } - -#if HOST_OS != OS_DARWIN +#if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) if (true) { #ifdef TARGET_PANDORA const char* device = "/dev/input/event4"; @@ -160,10 +159,10 @@ void SetupInput() else perror("evdev open"); } -#endif + // Open joystick device JoyFD = open("/dev/input/js0",O_RDONLY); -#if HOST_OS != OS_DARWIN + if(JoyFD>=0) { int AxisCount,ButtonCount; @@ -191,7 +190,7 @@ void SetupInput() } bool HandleKb(u32 port) { -#if HOST_OS != OS_DARWIN +#if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) if (kbfd < 0) return false; @@ -297,7 +296,7 @@ bool HandleJoystick(u32 port) // Joystick must be connected if(JoyFD<0) return false; -#if HOST_OS != OS_DARWIN +#if HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) struct js_event JE; while(read(JoyFD,&JE,sizeof(JE))==sizeof(JE)) if (JE.number