Emscripten: Hacky support, can boot bios
- Add TARGET_BOUNDED_EXECUTION, TARGET_EMSCRIPTEN - Add emscripten makefile Of course, there's no jit at this point
This commit is contained in:
parent
a2831d67a0
commit
376a36bf57
|
@ -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()
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
map<int, int> x11_keymap;
|
||||
#endif
|
||||
|
||||
#if !defined(ANDROID) && HOST_OS != OS_DARWIN
|
||||
#if !defined(ANDROID) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN)
|
||||
#include <linux/joystick.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -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<MAP_SIZE)
|
||||
|
@ -784,13 +783,13 @@ int main(int argc, wchar* argv[])
|
|||
//if (argc==2)
|
||||
//ndcid=atoi(argv[1]);
|
||||
|
||||
if (setup_curses() < 0) die("failed to setup curses!\n");
|
||||
if (setup_curses() < 0) printf("failed to setup curses!\n");
|
||||
#ifdef TARGET_PANDORA
|
||||
signal(SIGSEGV, clean_exit);
|
||||
signal(SIGKILL, clean_exit);
|
||||
#endif
|
||||
|
||||
#if defined(USES_HOMEDIR) && HOST_OS != OS_DARWIN
|
||||
#if defined(USES_HOMEDIR) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN)
|
||||
string home = (string)getenv("HOME");
|
||||
if(home.c_str())
|
||||
{
|
||||
|
@ -835,7 +834,12 @@ int main(int argc, wchar* argv[])
|
|||
|
||||
dc_init(argc,argv);
|
||||
|
||||
dc_run();
|
||||
#if !defined(TARGET_EMSCRIPTEN)
|
||||
|
||||
#else
|
||||
dc_run();emscripten_set_main_loop(&dc_run, 100, false);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TARGET_PANDORA
|
||||
clean_exit(0);
|
||||
|
@ -852,5 +856,10 @@ int push_vmu_screen(u8* buffer) { return 0; }
|
|||
|
||||
void os_DebugBreak()
|
||||
{
|
||||
#if !defined(TARGET_EMSCRIPTEN)
|
||||
raise(SIGTRAP);
|
||||
#endif
|
||||
printf("DEBUGBREAK!\n");
|
||||
exit(-1);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -128,17 +128,16 @@ void plugins_Reset(bool Manual)
|
|||
//libExtDevice_Reset(Manual);
|
||||
}
|
||||
|
||||
#if !defined(TARGET_NO_WEBUI)
|
||||
|
||||
void* webui_th(void* p)
|
||||
{
|
||||
#if (HOST_OS == OS_WINDOWS || HOST_OS == OS_LINUX) && !defined(TARGET_PANDORA) && defined(WEBUI)
|
||||
webui_start();
|
||||
#endif
|
||||
|
||||
webui_start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
cThread webui_thd(&webui_th,0);
|
||||
#endif
|
||||
|
||||
int dc_init(int argc,wchar* argv[])
|
||||
{
|
||||
|
@ -151,7 +150,9 @@ int dc_init(int argc,wchar* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(TARGET_NO_WEBUI)
|
||||
webui_thd.Start();
|
||||
#endif
|
||||
|
||||
if(ParseCommandLine(argc,argv))
|
||||
{
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
FOR_LINUX :=1
|
||||
NOT_ARM := 1
|
||||
NO_REC := 1
|
||||
#NO_REND := 1
|
||||
NO_NIXPROF := 1
|
||||
RZDCY_SRC_DIR = ../../core
|
||||
|
||||
include $(RZDCY_SRC_DIR)/core.mk
|
||||
|
||||
CC_PREFIX ?=
|
||||
|
||||
CXX=${CC_PREFIX}em++
|
||||
CC=${CC_PREFIX}emcc
|
||||
#AS=${CC_PREFIX}as
|
||||
STRIP=${CC_PREFIX}emstrip
|
||||
|
||||
LD=${CC}
|
||||
|
||||
MFLAGS :=
|
||||
ASFLAGS :=
|
||||
|
||||
LDFLAGS := -g -Wl,-Map,$(notdir $@).map,--gc-sections -Wl,-O3 -Wl,--sort-common
|
||||
|
||||
|
||||
CXXFLAGS := -g -O3 -D GLES -D RELEASE -c -D TARGET_EMSCRIPTEN -D TARGET_NO_REC -D TARGET_NO_NVMEM -D TARGET_NO_WEBUI -D TARGET_NO_THREADS -D TARGET_BOUNDED_EXECUTION -D TARGET_NO_EXCEPTIONS
|
||||
CXXFLAGS += -fno-strict-aliasing
|
||||
CXXFLAGS += -ffast-math
|
||||
|
||||
CXXFLAGS += $(CFLAGS) $(MFLAGS) -fno-exceptions -fno-rtti
|
||||
|
||||
|
||||
INCS := -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/deps -I$(RZDCY_SRC_DIR)/khronos -I../linux-deps/include
|
||||
|
||||
LIBS := #emscripten has all the basic libs, and egl, and sdl, built in
|
||||
|
||||
OBJECTS=$(RZDCY_FILES:.cpp=.build.obj)
|
||||
OBJECTS:=$(OBJECTS:.c=.build.obj)
|
||||
OBJECTS:=$(OBJECTS:.S=.build.obj)
|
||||
OBJECTS:=$(patsubst $(RZDCY_SRC_DIR)/%,obj/%,$(OBJECTS))
|
||||
|
||||
|
||||
EXECUTABLE=reicast.html
|
||||
|
||||
all: $(CPPFILES) $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
echo $(RZDCY_FILES)
|
||||
$(CXX) $(MFLAGS) $(EXTRAFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ --preload-file data/dc_boot.bin --preload-file data/dc_flash.bin -s TOTAL_MEMORY=96000000
|
||||
|
||||
obj/%.build.obj : $(RZDCY_SRC_DIR)/%.cpp
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(EXTRAFLAGS) $(INCS) $(CXXFLAGS) $< -o $@
|
||||
|
||||
obj/%.build.obj : $(RZDCY_SRC_DIR)/%.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(EXTRAFLAGS) $(INCS) $(CXXFLAGS) $< -o $@
|
||||
|
||||
obj/%.build.obj : $(RZDCY_SRC_DIR)/%.S
|
||||
mkdir -p $(dir $@)
|
||||
$(AS) $(ASFLAGS) $(INCS) $< -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm $(OBJECTS) $(EXECUTABLE) -f
|
Loading…
Reference in New Issue