diff --git a/core/deps/coreio/coreio.cpp b/core/deps/coreio/coreio.cpp index 7b4a317af..94a424fe8 100644 --- a/core/deps/coreio/coreio.cpp +++ b/core/deps/coreio/coreio.cpp @@ -18,7 +18,7 @@ #include #include -#if HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN +#if FEAT_HAS_COREIO_HTTP #include #include #include @@ -27,6 +27,7 @@ #include #endif +#if FEAT_HAS_COREIO_HTTP string url_encode(const string &value) { ostringstream escaped; escaped.fill('0'); @@ -186,6 +187,7 @@ _data: return rv; } +#endif struct CORE_FILE { FILE* f; @@ -203,7 +205,7 @@ core_file* core_fopen(const char* filename) CORE_FILE* rv = new CORE_FILE(); rv->f = 0; rv->path = p; - +#if FEAT_HAS_COREIO_HTTP if (p.substr(0,7)=="http://") { rv->host = p.substr(7,p.npos); rv->host = rv->host.substr(0, rv->host.find_first_of("/")); @@ -217,7 +219,9 @@ core_file* core_fopen(const char* filename) rv->host = rv->host.substr(0, rv->host.find_first_of(":")); sscanf(port.c_str(),"%d",&rv->port); } - } else { + } else +#endif + { rv->f = fopen(filename, "rb"); if (!rv->f) { @@ -257,7 +261,9 @@ int core_fread(core_file* fc, void* buff, size_t len) if (f->f) { fread(buff,1,len,f->f); } else { + #if FEAT_HAS_COREIO_HTTP HTTP_GET(f->host, f->port, f->path, f->seek_ptr, len, buff); + #endif } f->seek_ptr += len; @@ -293,6 +299,8 @@ size_t core_fsize(core_file* fc) return rv; } else { + #if FEAT_HAS_COREIO_HTTP return HTTP_GET(f->host, f->port, f->path, 0, 0,0); + #endif } } diff --git a/core/linux/common.cpp b/core/linux/common.cpp index 40a857de9..0c5b38e3d 100644 --- a/core/linux/common.cpp +++ b/core/linux/common.cpp @@ -6,8 +6,10 @@ #define _XOPEN_SOURCE 1 #define __USE_GNU 1 #endif +#if !defined(TARGET_NACL32) #include #include +#endif //#include #include #include @@ -16,10 +18,10 @@ #include #include #include -#if !defined(_ANDROID) && !TARGET_OS_IPHONE +#if !defined(_ANDROID) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) #include + #include #endif -#include #include #include "hw/sh4/dyna/blockmanager.h" @@ -52,6 +54,7 @@ void sigill_handler(int sn, siginfo_t * si, void *segfault_ctx) { } #endif +#if defined(TARGET_NO_EXCEPTIONS) void fault_handler (int sn, siginfo_t * si, void *segfault_ctx) { rei_host_context_t ctx; @@ -99,6 +102,7 @@ void fault_handler (int sn, siginfo_t * si, void *segfault_ctx) } #endif +#endif void install_fault_handler (void) { #if !defined(TARGET_NO_EXCEPTIONS) @@ -281,7 +285,7 @@ void enable_runfast() } void linux_fix_personality() { - #if HOST_OS == OS_LINUX && !defined(_ANDROID) + #if HOST_OS == OS_LINUX && !defined(_ANDROID) && !defined(TARGET_OS_IPHONE) && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) printf("Personality: %08X\n", personality(0xFFFFFFFF)); personality(~READ_IMPLIES_EXEC & personality(0xFFFFFFFF)); printf("Updated personality: %08X\n", personality(0xFFFFFFFF)); @@ -289,6 +293,7 @@ void linux_fix_personality() { } void linux_rpi2_init() { +#if HOST_OS == OS_LINUX && !defined(TARGET_NACL32) && !defined(TARGET_EMSCRIPTEN) void* handle; void (*rpi_bcm_init)(void); @@ -302,6 +307,7 @@ void linux_rpi2_init() { rpi_bcm_init(); } } +#endif } void common_linux_setup() diff --git a/core/linux/context.cpp b/core/linux/context.cpp index 2afb09d09..2e96197d1 100644 --- a/core/linux/context.cpp +++ b/core/linux/context.cpp @@ -8,7 +8,9 @@ #define __USE_GNU 1 #endif - #include + #if !defined(TARGET_NO_EXCEPTIONS) + #include + #endif #endif @@ -27,6 +29,7 @@ void bicopy(Ta& rei, Tb& seg, bool to_segfault) { void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_segfault) { +#if !defined(TARGET_NO_EXCEPTIONS) #if HOST_CPU == CPU_ARM #if HOST_OS == OS_LINUX bicopy(reictx->pc, MCTX(.arm_pc), to_segfault); @@ -64,6 +67,7 @@ void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_se #else #error Unsupported HOST_CPU #endif + #endif } diff --git a/core/nacl/nacl.cpp b/core/nacl/nacl.cpp index a20c18660..1590a7dce 100644 --- a/core/nacl/nacl.cpp +++ b/core/nacl/nacl.cpp @@ -89,4 +89,34 @@ namespace pp { Module* CreateModule() { return new hello_world::HelloWorldModule(); } -} // namespace pp \ No newline at end of file +} // namespace pp + + +u16 kcode[4]; +u32 vks[4]; +s8 joyx[4],joyy[4]; +u8 rt[4],lt[4]; + +int get_mic_data(u8* buffer) { return 0; } +int push_vmu_screen(u8* buffer) { return 0; } + +void os_SetWindowText(const char * text) { + +} + +void os_DoEvents() { + +} + + +void UpdateInputState(u32 port) { + +} + +void os_CreateWindow() { + +} + +void os_DebugBreak() { + exit(1); +} \ No newline at end of file diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 0aaa6f04d..97b435bff 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -3,12 +3,14 @@ #ifdef GLES -#ifdef TARGET_IPHONE //apple-specific ogles2 headers +#if defined(TARGET_IPHONE) //apple-specific ogles2 headers //#include #include #include #else +#if !defined(TARGET_NACL32) #include +#endif #include #include #endif diff --git a/shell/nacl/Makefile b/shell/nacl/Makefile index 25a1bc677..fa5469d63 100644 --- a/shell/nacl/Makefile +++ b/shell/nacl/Makefile @@ -1,73 +1,45 @@ +VALID_TOOLCHAINS := pnacl newlib glibc +include $(NACL_SDK_ROOT)/tools/common.mk + LOCAL_PATH := $(call my-dir) -FOR_LINUX :=1 +#FOR_LINUX :=1 NOT_ARM := 1 NO_REC := 1 -#NO_REND := 1 +NO_REND := 1 + RZDCY_SRC_DIR = ../../core include $(RZDCY_SRC_DIR)/core.mk -PROJECT:=reicast -LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi - - -#CXX_SOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)*.cpp)) - -#CC_SOURCES += $(foreach dir,$(SOURCES),$(wildcard $(dir)*.c)) +TARGET = reicast +LIBS = ppapi_gles2 ppapi_cpp ppapi pthread +CFLAGS = -Wno-error -Wno-ignored-attributes +CFLAGS += -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/deps +CFLAGS += -D RELEASE -D TARGET_NO_REC -D TARGET_NACL32 -DNO_REND +SOURCES = $(RZDCY_FILES) ../../core/nacl/nacl.cpp # Project Build flags -WARNINGS:=-Wno-long-long -Wswitch-enum -CXXFLAGS:=-pthread -std=gnu++0x $(WARNINGS) - -CXXFLAGS += -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/deps -I$(RZDCY_SRC_DIR)/khronos -I../linux-deps/include -D RELEASE -D TARGET_NO_REC -D TARGET_NACL32 - -# -# Compute tool paths -# -# -OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) -TC_PATH:=$(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib -CXX:=$(TC_PATH)/bin/i686-nacl-g++ -CC:=$(TC_PATH)/bin/i686-nacl-gcc - -# -# Disable DOS PATH warning when using Cygwin based tools Windows -# -CYGWIN ?= nodosfilewarning -export CYGWIN +WARNINGS ?=-Wno-long-long -Wno-switch-enum +CXXFLAGS += -std=gnu++0x $(WARNINGS) -# Declare the ALL target first, to make the 'all' target the default build -all: $(PROJECT)_x86_32.nexe +# Build rules generated by macros from common.mk: -# Define 32 bit compile and link rules for C++ sources -CXX_32_OBJSX:=$(patsubst %.cpp,%.nacl_86x32_build_obj,$(RZDCY_FILES)) -CXX_32_OBJSY:=$(patsubst %.c,%.nacl_86x32_build_obj,$(CXX_32_OBJSX)) -CXX_32_OBJS:=$(patsubst %.S,%.nacl_86x32_build_obj,$(CXX_32_OBJSY)) -#CC_32_OBJS:=$(patsubst %.c,%.build_obj_nacl_32,$(CC_SOURCES)) - -x86_32_OBJS:=$(CXX_32_OBJS) $(CC_32_OBJS) +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) -%.nacl_86x32_build_obj : %.cpp $(THIS_MAKE) - $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS) - -%.nacl_86x32_build_obj : %.c $(THIS_MAKE) - $(CC) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS) - -$(PROJECT)_x86_32.nexe : $(x86_32_OBJS) - echo $(x86_32_OBJS) - $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS) - -clean: - rm $(x86_32_OBJS) - -# Define a phony rule so it always runs, to build nexe and start up server. -.PHONY: RUN -RUN: all - python ../httpd.py +# The PNaCl workflow uses both an unstripped and finalized/stripped binary. +# On NaCl, only produce a stripped binary for Release configs (not Debug). +ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG)))) +$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) +$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) +else +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) +endif +SHELL = sh +$(eval $(call NMF_RULE,$(TARGET),)) \ No newline at end of file