Building on osx w/o rec or rend

This commit is contained in:
Stefanos Kornilios Mitsis Poiitids 2014-09-30 12:00:46 +03:00
parent aa33d230e5
commit f14932c362
13 changed files with 174 additions and 25 deletions

View File

@ -17,7 +17,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <linux/tcp.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <unistd.h>
#endif
@ -262,4 +262,4 @@ size_t core_fsize(core_file* fc)
else {
return HTTP_GET(f->host, f->port, f->path, 0, 0,0);
}
}
}

View File

@ -570,7 +570,9 @@ error:
u32 sz= 512*1024*1024 + sizeof(Sh4RCB) + ARAM_SIZE + 0x10000;
void* rv=mmap(0, sz, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
verify(rv != NULL);
munmap(rv,sz);
printf("%X\n",rv);
return (u8*)rv + 0x10000 - unat(rv)%0x10000;//align to 64 KB (Needed for linaro mmap not to extend to next region)
}
#endif
@ -590,8 +592,13 @@ void _vmem_bm_reset()
#else
mprotect(p_sh4rcb, sizeof(p_sh4rcb->fpcb), PROT_NONE);
madvise(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MADV_DONTNEED);
#ifdef MADV_REMOVE
//Linux, Android
madvise(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MADV_REMOVE);
//madvise(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MADV_FREE);
#else
//OSX, ?
madvise(p_sh4rcb,sizeof(p_sh4rcb->fpcb),MADV_FREE);
#endif
#endif
printf("Freeing fpcb\n");
@ -631,6 +638,10 @@ bool _vmem_reserve()
verify((sizeof(Sh4RCB)%PAGE_SIZE)==0);
virt_ram_base=(u8*)_nvmem_alloc_mem();
if (virt_ram_base==0)
return false;
p_sh4rcb=(Sh4RCB*)virt_ram_base;
#if HOST_OS==OS_WINDOWS
@ -644,9 +655,6 @@ bool _vmem_reserve()
#endif
virt_ram_base+=sizeof(Sh4RCB);
if (virt_ram_base==0)
return false;
//Area 0
//[0x00000000 ,0x00800000) -> unused
unused_buffer(0x00000000,0x00800000);

View File

@ -219,7 +219,7 @@ void rend_end_wait()
bool rend_init()
{
#if NO_REND
#ifdef NO_REND
rend = rend_norend();
#else

View File

@ -17,6 +17,12 @@ void rend_set_fb_scale(float x,float y);
void rend_text_invl(vram_block* bl);
#ifdef GLuint
GLuint
#else
u32
#endif
GetTexture(TSP tsp,TCW tcw);
///////
@ -43,4 +49,4 @@ struct Renderer
Renderer* rend_D3D11();
Renderer* rend_GLES2();
Renderer* rend_norend();
Renderer* rend_norend();

View File

@ -8,7 +8,7 @@
#include "ta.h"
#include "ta_ctx.h"
#include "pvr_mem.h"
#include "rend/gles/gles.h"
//#include "rend/gles/gles.h"
#include "Renderer_if.h"
u32 ta_type_lut[256];

View File

@ -24,7 +24,7 @@
#include <X11/Xutil.h>
#endif
#if !defined(ANDROID)
#if !defined(ANDROID) && 0
#include <linux/joystick.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -134,6 +134,7 @@ void SetupInput()
lt[port]=0;
}
#if 0
if (true) {
#ifdef TARGET_PANDORA
const char* device = "/dev/input/event4";
@ -154,10 +155,10 @@ void SetupInput()
else
perror("evdev open");
}
#endif
// Open joystick device
JoyFD = open("/dev/input/js0",O_RDONLY);
#if 0
if(JoyFD>=0)
{
int AxisCount,ButtonCount;
@ -181,10 +182,12 @@ void SetupInput()
printf("Using Xbox 360 map\n");
}
}
#endif
}
bool HandleKb(u32 port) {
struct input_event ie;
#if 0
//struct input_event ie;
if (kbfd < 0)
return false;
@ -278,17 +281,19 @@ bool HandleKb(u32 port) {
printf("type %i key %i state %i\n", ie.type, ie.code, ie.value);
}
#endif
#endif
return true;
}
bool HandleJoystick(u32 port)
{
struct js_event JE;
//struct js_event JE;
// Joystick must be connected
if(JoyFD<0) return false;
#if 0
while(read(JoyFD,&JE,sizeof(JE))==sizeof(JE))
if (JE.number<MAP_SIZE)
{
@ -367,8 +372,9 @@ bool HandleJoystick(u32 port)
break;
}
}
#endif
return true;
}
extern bool KillTex;
@ -678,7 +684,7 @@ int main(int argc, wchar* argv[])
init_sound();
#endif
#if defined(USES_HOMEDIR)
#if defined(USES_HOMEDIR) && 0
string home = (string)getenv("HOME");
if(home.c_str())
{

View File

@ -2,6 +2,9 @@
#include "cfg/cfg.h"
#if HOST_OS==OS_LINUX
#define _XOPEN_SOURCE 1
#define __USE_GNU 1
#include <ucontext.h>
#include <poll.h>
#include <termios.h>
//#include <curses.h>
@ -32,6 +35,7 @@ struct sigcontext uc_mcontext;
} ucontext_t;
#endif
#if HOST_CPU == CPU_ARM
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.arm_pc)
#elif HOST_CPU == CPU_MIPS
@ -44,7 +48,7 @@ struct sigcontext uc_mcontext;
#ifdef _ANDROID
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.eip)
#else
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.gregs[REG_EIP])
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext->__ss.__eip)
#endif
#else
#error fix ->pc support
@ -116,8 +120,10 @@ cResetEvent::cResetEvent(bool State,bool Auto)
{
//sem_init((sem_t*)hEvent, 0, State?1:0);
verify(State==false&&Auto==true);
mutx = PTHREAD_MUTEX_INITIALIZER;
cond = PTHREAD_COND_INITIALIZER;
//mutx = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_init(&mutx, NULL);
//cond = PTHREAD_COND_INITIALIZER;
pthread_cond_init(&cond, NULL);
}
cResetEvent::~cResetEvent()
{
@ -216,6 +222,10 @@ double os_GetSeconds()
return a.tv_sec-tvs_base+a.tv_usec/1000000.0;
}
void os_DebugBreak()
{
__builtin_trap();
}
void enable_runfast()
{

View File

@ -68,7 +68,7 @@ typedef struct ucontext_t
#ifdef _ANDROID
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.eip)
#else
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.gregs[REG_EIP])
#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext->__ss.__eip)
#endif
#else
#error fix ->pc support

View File

@ -131,7 +131,7 @@ void plugins_Reset(bool Manual)
void* webui_th(void* p)
{
#if HOST_OS == OS_WINDOWS || HOST_OS == OS_LINUX
#if (HOST_OS == OS_WINDOWS || HOST_OS == OS_LINUX) && defined(WEBUI)
webui_start();
#endif

View File

@ -7,6 +7,7 @@ void rend_text_invl(vram_block* bl) { }
struct norend : Renderer
{
bool Init()
{
return true;
@ -15,9 +16,14 @@ struct norend : Renderer
void Resize(int w, int h) { }
void Term() { }
bool Process(TA_context* ctx) { return true; }
void DrawOSD() { }
bool Render()
{
return !pvrrc.isRTT;
return true;//!pvrrc.isRTT;
}
void Present() { }
@ -25,3 +31,5 @@ struct norend : Renderer
Renderer* rend_norend() { return new norend(); }
u32 GetTexture(TSP tsp,TCW tcw) { return 0; }

View File

@ -1,3 +1,11 @@
#pragma once
#include "hw/pvr/ta_ctx.h"
#include "hw/pvr/Renderer_if.h"
#include "hw/pvr/Renderer_if.h"
#ifdef GLuint
GLuint
#else
u32
#endif
GetTexture(TSP tsp,TCW tcw);

View File

@ -220,7 +220,8 @@ public :
#if HOST_OS==OS_WINDOWS
InitializeCriticalSection(&cs);
#else
mutx=PTHREAD_MUTEX_INITIALIZER;
//mutx=PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_init ( &mutx, NULL);
#endif
}
~cMutex()

102
shell/mac86/Makefile Normal file
View File

@ -0,0 +1,102 @@
LOCAL_PATH := $(call my-dir)
FOR_LINUX :=1
NOT_ARM := 1
NO_REC := 1
NO_REND := 1
#WEBUI :=1
RZDCY_SRC_DIR = ../../core
include $(RZDCY_SRC_DIR)/core.mk
CXX=${CC_PREFIX}g++
CC=${CC_PREFIX}gcc
AS=${CC_PREFIX}as
STRIP=${CC_PREFIX}strip
LD=${CC}
MFLAGS := -m32
#-marm -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp -funroll-loops
ASFLAGS := -m32
#-march=armv7-a -mfpu=neon -mfloat-abi=softfp
LDFLAGS := -m32 -g
SOURCES := cfg/ hw/arm7/ hw/aica/ hw/asic/ hw/ hw/gdrom/ hw/maple/ \
hw/mem/ hw/pvr/ hw/sh4/ hw/sh4/rec_v2/ plugins/ profiler/ serial_ipc/ \
hw/extdev/ hw/arm/ imgread/ linux/ linux-dist/ ./ rec-ARM/ deps/zlib/ deps/chdr/ deps/crypto/ arm_emitter/
CXXFLAGS := -m32 -g -O3 -D RELEASE -c -D TARGET_LINUX_x86 -D HOST_NO_REC -D NO_REND
CXXFLAGS += -fno-strict-aliasing
CXXFLAGS += -ffast-math -ftree-vectorize
#-fprefetch-loop-arrays
#-std=c++0x
CXXFLAGS += $(CFLAGS) $(MFLAGS) -fno-exceptions -fno-rtti
# CXXFLAGS += -D SUPPORT_X11
ifdef PGO_MAKE
CXXFLAGS += -fprofile-generate -pg
LDFLAGS += -fprofile-generate
else
CXXFLAGS += -fomit-frame-pointer
endif
ifdef PGO_USE
CXXFLAGS += -fprofile-use
endif
ifdef LTO_TEST
CXXFLAGS += -flto -fwhole-program
LDFLAGS +=-flto -fwhole-program
endif
INCS := -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/deps -I$(RZDCY_SRC_DIR)/khronos -I../linux-deps/include
LIBS := -L../linux-deps/lib/x86 -L./enta_viv
#LIBS += -lglapi
LIBS += -lm # -lrt -lEGL -lGLESv2 #-lglslcompiler -lIMGegl -lpvr2d -lsrv_um
LIBS += -lpthread # -lX11 -lXdmcp -lXau
OBJECTS=$(RZDCY_FILES:.cpp=.build_obj)
OBJECTS:=$(OBJECTS:.c=.build_obj)
OBJECTS:=$(OBJECTS:.S=.build_obj)
OBJECTS:=$(patsubst $(RZDCY_SRC_DIR)/%,obj/%,$(OBJECTS))
EXECUTABLE_STRIPPED=nosym-reicast.elf
EXECUTABLE=reicast.elf
PACKAGE_FILES=$(EXECUTABLE_STRIPPED) default.gcw0.desktop icon-32.png
all: $(CPPFILES) $(EXECUTABLE) $(EXECUTABLE_STRIPPED)
$(EXECUTABLE): $(OBJECTS)
echo $(RZDCY_FILES)
$(CXX) $(MFLAGS) $(EXTRAFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
$(EXECUTABLE_STRIPPED): $(EXECUTABLE)
cp $< $@ && $(STRIP) $@
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