diff --git a/core/deps/coreio/coreio.cpp b/core/deps/coreio/coreio.cpp index afc54e905..1b34208aa 100644 --- a/core/deps/coreio/coreio.cpp +++ b/core/deps/coreio/coreio.cpp @@ -13,11 +13,11 @@ #include #include -#if HOST_OS == OS_LINUX +#if HOST_OS == OS_LINUX || HOST_OS == OS_DARWIN #include #include #include - #include + #include #include #include #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); } -} \ No newline at end of file +} diff --git a/core/hw/maple/maple_devs.cpp b/core/hw/maple/maple_devs.cpp index 2a2b6cf4b..3bfe9f531 100755 --- a/core/hw/maple/maple_devs.cpp +++ b/core/hw/maple/maple_devs.cpp @@ -547,7 +547,7 @@ struct maple_sega_vmu: maple_base } } config->SetImage(lcd_data_decoded); -#ifndef TARGET_PANDORA +#if !defined(TARGET_PANDORA) && HOST_OS != OS_DARWIN push_vmu_screen(lcd_data_decoded); #endif #if 0 diff --git a/core/hw/mem/_vmem.cpp b/core/hw/mem/_vmem.cpp index 847aadec0..01838ab9b 100644 --- a/core/hw/mem/_vmem.cpp +++ b/core/hw/mem/_vmem.cpp @@ -546,7 +546,13 @@ error: void* _nvmem_alloc_mem() { -#ifndef _ANDROID + +#if HOST_OS == OS_DARWIN + string path = GetPath("/dcnzorz_mem"); + fd = open(path.c_str(),O_CREAT|O_RDWR|O_TRUNC,S_IRWXU|S_IRWXG|S_IRWXO); + unlink(path.c_str()); + verify(ftruncate(fd,RAM_SIZE + VRAM_SIZE +ARAM_SIZE)==0); +#elif !defined(_ANDROID) fd = shm_open("/dcnzorz_mem", O_CREAT | O_EXCL | O_RDWR,S_IREAD | S_IWRITE); shm_unlink("/dcnzorz_mem"); if (fd==-1) @@ -559,18 +565,15 @@ error: #else fd = ashmem_create_region(0,RAM_SIZE + VRAM_SIZE +ARAM_SIZE); - if (false)//this causes writebacks to flash -> slow and stuttery - { - fd = open("/data/data/com.reicast.emulator/files/dcnzorz_mem",O_CREAT|O_RDWR|O_TRUNC,S_IRWXU|S_IRWXG|S_IRWXO); - unlink("/data/data/com.reicast.emulator/files/dcnzorz_mem"); - } #endif 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 @@ -635,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 @@ -648,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); diff --git a/core/hw/pvr/Renderer_if.cpp b/core/hw/pvr/Renderer_if.cpp index f58662546..a8d9bdd82 100644 --- a/core/hw/pvr/Renderer_if.cpp +++ b/core/hw/pvr/Renderer_if.cpp @@ -221,8 +221,8 @@ void rend_end_wait() bool rend_init() { -#if NO_REND - renderer = rend_norend(); +#ifdef NO_REND + rend = rend_norend(); #else #if HOST_OS == OS_WINDOWS @@ -233,7 +233,7 @@ bool rend_init() #endif -#if !defined(_ANDROID) +#if !defined(_ANDROID) && HOST_OS != OS_DARWIN rthd.Start(); #endif diff --git a/core/hw/pvr/Renderer_if.h b/core/hw/pvr/Renderer_if.h index d95fcecb3..0d181a86a 100644 --- a/core/hw/pvr/Renderer_if.h +++ b/core/hw/pvr/Renderer_if.h @@ -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(); \ No newline at end of file +Renderer* rend_norend(); diff --git a/core/hw/pvr/ta_vtx.cpp b/core/hw/pvr/ta_vtx.cpp index 7a813b7aa..5f03bfe7a 100644 --- a/core/hw/pvr/ta_vtx.cpp +++ b/core/hw/pvr/ta_vtx.cpp @@ -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]; diff --git a/core/hw/sh4/dyna/ngen.h b/core/hw/sh4/dyna/ngen.h index 1a7592fa8..e0fce9447 100644 --- a/core/hw/sh4/dyna/ngen.h +++ b/core/hw/sh4/dyna/ngen.h @@ -49,13 +49,14 @@ #define CODE_SIZE (4*1024*1024) -#if HOST_OS==OS_LINUX -extern "C" { -#endif //alternative emit ptr, set to 0 to use the main buffer extern u32* emit_ptr; extern u8* CodeCache; +#if HOST_OS==OS_LINUX || HOST_OS==OS_DARWIN +extern "C" { +#endif + void emit_Write32(u32 data); void emit_Skip(u32 sz); u32 emit_FreeSpace(); @@ -120,6 +121,6 @@ void ngen_CC_Finish(shil_opcode* op); RuntimeBlockInfo* ngen_AllocateBlock(); -#if HOST_OS==OS_LINUX +#if HOST_OS==OS_LINUX || HOST_OS==OS_DARWIN } #endif diff --git a/core/hw/sh4/sh4_if.h b/core/hw/sh4/sh4_if.h index 8dddb8302..aaf61f04c 100644 --- a/core/hw/sh4/sh4_if.h +++ b/core/hw/sh4/sh4_if.h @@ -215,7 +215,7 @@ struct fpscr_t }; struct { - u32 nil : 2+1+1+1+1+4+8+1; + u32 _nil : 2+1+1+1+1+4+8+1; u32 PR_SZ : 2; u32 nilz : 11; }; diff --git a/core/hw/sh4/sh4_interpreter.h b/core/hw/sh4/sh4_interpreter.h index 0b8f4bd10..e66026457 100644 --- a/core/hw/sh4/sh4_interpreter.h +++ b/core/hw/sh4/sh4_interpreter.h @@ -52,13 +52,13 @@ void ExecuteDelayslot(); void ExecuteDelayslot_RTE(); -#if HOST_OS==OS_LINUX +#if HOST_OS==OS_LINUX || HOST_OS==OS_DARWIN extern "C" { #endif int UpdateSystem(); int UpdateSystem_INTC(); -#if HOST_OS==OS_LINUX +#if HOST_OS==OS_LINUX || HOST_OS==OS_DARWIN } #endif \ No newline at end of file diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index 44d20c2f7..c53c05e74 100755 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -24,7 +24,7 @@ #include #endif -#if !defined(ANDROID) +#if !defined(ANDROID) && 0 #include #include #include @@ -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 #include #include //#include @@ -32,8 +35,9 @@ 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) +#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext->__ss.__pc) #elif HOST_CPU == CPU_MIPS #ifdef _ANDROID #define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.sc_pc) @@ -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 @@ -58,8 +62,11 @@ bool BM_LockedWrite(u8* address); void fault_handler (int sn, siginfo_t * si, void *ctxr) { + +#ifndef HOST_NO_REC bool dyna_cde=((u32)GET_PC_FROM_CONTEXT(ctxr)>(u32)CodeCache) && ((u32)GET_PC_FROM_CONTEXT(ctxr)<(u32)(CodeCache+CODE_SIZE)); - +#endif + ucontext_t* ctx=(ucontext_t*)ctxr; //printf("mprot hit @ ptr 0x%08X @@ code: %08X, %d\n",si->si_addr,ctx->uc_mcontext.arm_pc,dyna_cde); @@ -88,7 +95,9 @@ void install_fault_handler (void) act.sa_sigaction = fault_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_SIGINFO; - sigaction(SIGSEGV, &act, &segv_oact); + + //this is broken on osx/ios/mach in general + sigaction(SIGSEGV, &act, &segv_oact); } @@ -116,8 +125,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() { @@ -158,6 +169,8 @@ void cResetEvent::Wait()//Wait for signal , then reset void VArray2::LockRegion(u32 offset,u32 size) { +#if HOST_OS != OS_DARWIN + //darwin doesn't have sane exception handling, leave this off for now. u32 inpage=offset & PAGE_MASK; u32 rv=mprotect (data+offset-inpage, size+inpage, PROT_READ ); if (rv!=0) @@ -165,6 +178,7 @@ void VArray2::LockRegion(u32 offset,u32 size) printf("mprotect(%08X,%08X,R) failed: %d | %d\n",data+offset-inpage,size+inpage,rv,errno); die("mprotect failed ..\n"); } +#endif } void print_mem_addr() @@ -216,6 +230,10 @@ double os_GetSeconds() return a.tv_sec-tvs_base+a.tv_usec/1000000.0; } +void os_DebugBreak() +{ + __builtin_trap(); +} void enable_runfast() { diff --git a/core/linux/nixprof.cpp b/core/linux/nixprof.cpp index 7dd97db8d..cf1b7b06e 100644 --- a/core/linux/nixprof.cpp +++ b/core/linux/nixprof.cpp @@ -57,7 +57,7 @@ typedef struct ucontext_t #endif #if HOST_CPU == CPU_ARM -#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.arm_pc) +#define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext->__ss.__pc) #elif HOST_CPU == CPU_MIPS #ifdef _ANDROID #define GET_PC_FROM_CONTEXT(c) (((ucontext_t *)(c))->uc_mcontext.sc_pc) @@ -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 @@ -314,6 +314,8 @@ void* prof(void *ptr) fclose(maps); fclose(prof_out); + + return 0; } void sample_Start(int freq) diff --git a/core/nullDC.cpp b/core/nullDC.cpp index 0ce14dffe..e20dd9801 100755 --- a/core/nullDC.cpp +++ b/core/nullDC.cpp @@ -131,7 +131,7 @@ void plugins_Reset(bool Manual) void* webui_th(void* p) { - #if (HOST_OS == OS_WINDOWS || HOST_OS == OS_LINUX) && !defined(TARGET_PANDORA) + #if (HOST_OS == OS_WINDOWS || HOST_OS == OS_LINUX) && !defined(TARGET_PANDORA) && defined(WEBUI) webui_start(); #endif @@ -170,7 +170,7 @@ int dc_init(int argc,wchar* argv[]) int rv= 0; - if (!LoadRomFiles(GetPath("/data/"))) + if (!LoadRomFiles(GetPath("/data/")) && !LoadRomFiles(GetPath("/"))) { return -3; } diff --git a/core/rec-ARM/arm_dyna.cpp b/core/rec-ARM/arm_dyna.cpp index a7bf2289c..f78598fba 100755 --- a/core/rec-ARM/arm_dyna.cpp +++ b/core/rec-ARM/arm_dyna.cpp @@ -2,6 +2,7 @@ #include #include "types.h" +#ifndef HOST_NO_REC #include "hw/sh4/sh4_opcode_list.h" #include "hw/sh4/sh4_mmr.h" @@ -58,7 +59,7 @@ struct DynaRBI: RuntimeBlockInfo #if !defined(ARMCC) void CacheFlush(void* code, void* pEnd) { -#ifndef _ANDROID +#if !defined(_ANDROID) && HOST_OS!=OS_DARWIN __clear_cache((void*)code, pEnd); #else void* start=code; @@ -2217,3 +2218,5 @@ RuntimeBlockInfo* ngen_AllocateBlock() { return new DynaRBI(); }; + +#endif diff --git a/core/rec-ARM/ngen_arm.S b/core/rec-ARM/ngen_arm.S index 8e95cc79d..baa832e01 100644 --- a/core/rec-ARM/ngen_arm.S +++ b/core/rec-ARM/ngen_arm.S @@ -7,13 +7,14 @@ .equ BM_BLOCKLIST_MASK, 65532 @FFFC .equ CPU_RATIO, 5 +#define CSYM(n) _##n @@@@@@@@@@ some helpers @@@@@@@@@@ -.global do_sqw_nommu_area_3 +.global CSYM(do_sqw_nommu_area_3) @r0: addr @r1: sq_both -do_sqw_nommu_area_3: +CSYM(do_sqw_nommu_area_3): add r3,r1,#0x0C000000 @ get ram ptr from r1, part 1 and r2,r0,#0x20 @ SQ# selection, isolate ubfx r0,r0,#5,#19 @ get ram offset @@ -24,23 +25,23 @@ vldm r1,{d0-d3} vstm r3,{d0-d3} bx lr -.global TAWriteSQ +.global CSYM(TAWriteSQ) @r0: addr @r1: sq_both -TAWriteSQ: +CSYM(TAWriteSQ): BIC R3, R0, #0xFE000000 @clear unused bits AND R0, R0, #0x20 @SQ#, isolate CMP R3, #0x800000 @TA write? ADD R0, R1, R0 @SQ#, add to SQ ptr -BCC _Z13ta_vtx_data32Pv @TA write? +BCC CSYM(_Z13ta_vtx_data32Pv) @TA write? -TAWriteSQ_yuv: +CSYM(TAWriteSQ_yuv): CMP R3, #0x1000000 @Yuv write ? -BCS TAWriteSQ_vram +BCS CSYM(TAWriteSQ_vram) MOV R1, #1 -B _Z8YUV_dataPjj +B CSYM(_Z8YUV_dataPjj) -TAWriteSQ_vram: @vram write .. +CSYM(TAWriteSQ_vram): @vram write .. #ifdef TARGET_IPHONE bkpt #0 #else @@ -54,50 +55,53 @@ vldm r1,{d0-d3} vstm r3,{d0-d3} bx lr + +#ifndef HOST_NO_REC + @@@@@@@@@@ ngen_LinkBlock_*****_stub @@@@@@@@@@ -.global ngen_LinkBlock_Generic_stub -ngen_LinkBlock_Generic_stub: +.global CSYM(ngen_LinkBlock_Generic_stub) +CSYM(ngen_LinkBlock_Generic_stub): mov r1,r4 @ djump/pc -> in case we need it .. - b ngen_LinkBlock_Shared_stub + b CSYM(ngen_LinkBlock_Shared_stub) -.global ngen_LinkBlock_cond_Branch_stub -ngen_LinkBlock_cond_Branch_stub: +.global CSYM(ngen_LinkBlock_cond_Branch_stub) +CSYM(ngen_LinkBlock_cond_Branch_stub): mov r1,#1 - b ngen_LinkBlock_Shared_stub + b CSYM(ngen_LinkBlock_Shared_stub) -.global ngen_LinkBlock_cond_Next_stub -ngen_LinkBlock_cond_Next_stub: +.global CSYM(ngen_LinkBlock_cond_Next_stub) +CSYM(ngen_LinkBlock_cond_Next_stub): mov r1,#0 - b ngen_LinkBlock_Shared_stub + b CSYM(ngen_LinkBlock_Shared_stub) -.global ngen_LinkBlock_Shared_stub -ngen_LinkBlock_Shared_stub: +.global CSYM(ngen_LinkBlock_Shared_stub) +CSYM(ngen_LinkBlock_Shared_stub): mov r0,lr sub r0,#4 @go before the call - bl rdv_LinkBlock + bl CSYM(rdv_LinkBlock) bx r0 @@@@@@@@@@ ngen_FailedToFindBlock_ @@@@@@@@@@ -.global ngen_FailedToFindBlock_ -ngen_FailedToFindBlock_: +.global CSYM(ngen_FailedToFindBlock_) +CSYM(ngen_FailedToFindBlock_): mov r0,r4 - bl rdv_FailedToFindBlock + bl CSYM(rdv_FailedToFindBlock) bx r0 @@@@@@@@@@ ngen_blockcheckfail @@@@@@@@@@ -.global ngen_blockcheckfail -ngen_blockcheckfail: - bl rdv_BlockCheckFail +.global CSYM(ngen_blockcheckfail) +CSYM(ngen_blockcheckfail): + bl CSYM(rdv_BlockCheckFail) bx r0 @@ -110,8 +114,8 @@ ngen_blockcheckfail: -.global ngen_mainloop -ngen_mainloop: +.global CSYM(ngen_mainloop) +CSYM(ngen_mainloop): push { r4-r12,lr } @@ -121,26 +125,26 @@ push { r4-r12,lr } mov r8, r0 @Load context ldr r4, [r8,#-184] @load pc - b no_update @Go to mainloop ! + b CSYM(no_update) @Go to mainloop ! @this code is here for fall-through behavior of do_iter - .global intc_sched -intc_sched: @ next_pc _MUST_ be on ram + .global CSYM(intc_sched) +CSYM(intc_sched): @ next_pc _MUST_ be on ram add r9,r9,#SH4_TIMESLICE mov r4,lr - bl UpdateSystem + bl CSYM(UpdateSystem) mov lr,r4 cmp r0,#0 bxeq lr @faster than bxeq r4 (as it should, call stack cache) do_iter: mov r0,r4 - bl rdv_DoInterrupts + bl CSYM(rdv_DoInterrupts) mov r4,r0 -.global no_update -no_update: @ next_pc _MUST_ be on r4 *R4 NOT R0 anymore* +.global CSYM(no_update) +CSYM(no_update): @ next_pc _MUST_ be on r4 *R4 NOT R0 anymore* sub r2,r8,#33816576 ubfx r1,r4,#1,#23 @@ -156,18 +160,18 @@ bx lr end_ngen_mainloop: @@@@@@@@@@ ngen_mainloop @@@@@@@@@@ -.global arm_compilecode -arm_compilecode: -bl CompileCode -b arm_dispatch +.global CSYM(arm_compilecode) +CSYM(arm_compilecode): +bl CSYM(CompileCode) +b CSYM(arm_dispatch) #ifdef TARGET_IPHONE -Xarm_Reg: .word arm_Reg -XEntryPoints: .word EntryPoints +Xarm_Reg: .word CSYM(arm_Reg) +XEntryPoints: .word CSYM(EntryPoints) #endif -.global arm_mainloop -arm_mainloop: @(cntx,lookup_base,cycles) +.global CSYM(arm_mainloop) +CSYM(arm_mainloop): @(cntx,lookup_base,cycles) push {r4,r5,r8,r9,lr} @@ -182,10 +186,10 @@ push {r4,r5,r8,r9,lr} ldr r5,[r8,#192] @load cycle count add r5,r0 @add cycles for this timeslice - b arm_dispatch + b CSYM(arm_dispatch) -.global arm_dispatch -arm_dispatch: +.global CSYM(arm_dispatch) +CSYM(arm_dispatch): #ifdef TARGET_IPHONE ldrd r0,r1,[r8,#184] @load: Next PC, interrupt #else @@ -199,19 +203,19 @@ arm_dispatch: ldr pc,[r4,r2,lsl #2] arm_dofiq: - bl CPUFiq - b arm_dispatch + bl CSYM(CPUFiq) + b CSYM(arm_dispatch) -.global arm_exit -arm_exit: +.global CSYM(arm_exit) +CSYM(arm_exit): str r5,[r8,#192] @if timeslice is over, save remaining cycles pop {r4,r5,r8,r9,pc} @@@@@@ @matrix mul #ifndef _ANDROID -.global ftrv_asm -ftrv_asm: +.global CSYM(ftrv_asm) +CSYM(ftrv_asm): @r0=dst,r1=vec,r2=mtx @@ -228,8 +232,8 @@ vstm r0,{d4,d5} bx lr -.global fipr_asm -fipr_asm: +.global CSYM(fipr_asm) +CSYM(fipr_asm): @ vdot @ idp=fr[n+0]*fr[m+0]; @@ -251,3 +255,5 @@ vmov r0,s0 bx lr #endif + +#endif diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index bc62b0bd7..1a08702f9 100755 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -354,6 +354,7 @@ gl_ctx gl; int screen_width; int screen_height; +#if HOST_OS != OS_DARWIN #ifdef GLES // Create a basic GLES context bool gl_init(void* wind, void* disp) @@ -599,6 +600,8 @@ void gl_swap() } #endif +#endif + struct ShaderUniforms_t { @@ -903,7 +906,7 @@ bool gles_init() if (!gl_create_resources()) return false; -#ifdef GLES +#if defined(GLES) && HOST_OS != OS_DARWIN #ifdef TARGET_PANDORA fbdev=open("/dev/fb0", O_RDONLY); #else @@ -1670,7 +1673,10 @@ bool RenderFrame() } else { +#if HOST_OS != OS_DARWIN + //Fix this in a proper way glBindFramebuffer(GL_FRAMEBUFFER,0); +#endif } //Clear depth @@ -1678,7 +1684,7 @@ bool RenderFrame() if (settings.rend.WideScreen) glClearColor(pvrrc.verts.head()->col[2]/255.0f,pvrrc.verts.head()->col[1]/255.0f,pvrrc.verts.head()->col[0]/255.0f,1.0f); else - glClearColor(0,0,0,1.0f); + glClearColor(0,1,0,1.0f); glClearDepthf(0.f); glCheck(); glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glCheck(); diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 064c37766..f9e95b816 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -4,7 +4,7 @@ #ifdef GLES #ifdef TARGET_IPHONE //apple-specific ogles2 headers -#include +//#include #include #include #else @@ -26,7 +26,8 @@ #endif -#define glCheck() verify(glGetError()==GL_NO_ERROR) +#define glCheck() false +//verify(glGetError()==GL_NO_ERROR) #define eglCheck() false #define VERTEX_POS_ARRAY 0 @@ -57,7 +58,7 @@ struct PipelineShader struct gl_ctx { -#ifdef GLES +#if defined(GLES) && HOST_OS != OS_DARWIN struct { EGLNativeWindowType native_wind; diff --git a/core/rend/norend/norend.cpp b/core/rend/norend/norend.cpp index 494fbdd21..03ec7564a 100644 --- a/core/rend/norend/norend.cpp +++ b/core/rend/norend/norend.cpp @@ -7,6 +7,7 @@ void rend_text_invl(vram_block* bl) { } struct norend : Renderer { + bool Init() { return true; @@ -15,14 +16,20 @@ 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; } - bool Process(TA_context*) { } void Present() { } }; Renderer* rend_norend() { return new norend(); } + +u32 GetTexture(TSP tsp,TCW tcw) { return 0; } diff --git a/core/rend/rend.h b/core/rend/rend.h index 25c7b56fc..3386fbdf8 100644 --- a/core/rend/rend.h +++ b/core/rend/rend.h @@ -1,3 +1,11 @@ #pragma once #include "hw/pvr/ta_ctx.h" -#include "hw/pvr/Renderer_if.h" \ No newline at end of file +#include "hw/pvr/Renderer_if.h" + + +#ifdef GLuint +GLuint +#else +u32 +#endif +GetTexture(TSP tsp,TCW tcw); diff --git a/core/stdclass.h b/core/stdclass.h index f7f351bbc..762bcaa54 100644 --- a/core/stdclass.h +++ b/core/stdclass.h @@ -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() diff --git a/core/types.h b/core/types.h index 8f1604c72..ac79bd7e3 100644 --- a/core/types.h +++ b/core/types.h @@ -438,9 +438,9 @@ using namespace std; #if DEBUG //force -#define INLINE +#define INLINE __inline //sugest -#define SINLINE +#define SINLINE __inline #else //force #define INLINE __forceinline diff --git a/shell/ios/emulator.xcodeproj/project.pbxproj b/shell/ios/emulator.xcodeproj/project.pbxproj index 70d2bd0b9..36cde6436 100644 --- a/shell/ios/emulator.xcodeproj/project.pbxproj +++ b/shell/ios/emulator.xcodeproj/project.pbxproj @@ -7,6 +7,13 @@ objects = { /* Begin PBXBuildFile section */ + 8497BCBF1A41A0E900EFB9ED /* common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCBC1A41A0E900EFB9ED /* common.cpp */; }; + 8497BCC01A41A0E900EFB9ED /* nixprof.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCBD1A41A0E900EFB9ED /* nixprof.cpp */; }; + 8497BCC21A41B02000EFB9ED /* ios_main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCC11A41B02000EFB9ED /* ios_main.mm */; }; + 8497BCC91A41BFBA00EFB9ED /* alsa_audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCC41A41BFBA00EFB9ED /* alsa_audiostream.cpp */; }; + 8497BCCA1A41BFBA00EFB9ED /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCC51A41BFBA00EFB9ED /* audiostream.cpp */; }; + 8497BCCB1A41BFBA00EFB9ED /* ds_audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCC71A41BFBA00EFB9ED /* ds_audiostream.cpp */; }; + 8497BCCF1A41BFD800EFB9ED /* coreio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8497BCCD1A41BFD800EFB9ED /* coreio.cpp */; }; 87078A8718A47FE90034C7A0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87078A8618A47FE90034C7A0 /* Foundation.framework */; }; 87078A8918A47FE90034C7A0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87078A8818A47FE90034C7A0 /* CoreGraphics.framework */; }; 87078A8B18A47FE90034C7A0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87078A8A18A47FE90034C7A0 /* UIKit.framework */; }; @@ -16,7 +23,7 @@ 87078A9B18A47FE90034C7A0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 87078A9A18A47FE90034C7A0 /* AppDelegate.m */; }; 87078AA318A47FE90034C7A0 /* Shader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 87078AA218A47FE90034C7A0 /* Shader.fsh */; }; 87078AA518A47FE90034C7A0 /* Shader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 87078AA418A47FE90034C7A0 /* Shader.vsh */; }; - 87078AA818A47FE90034C7A0 /* EmulatorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87078AA718A47FE90034C7A0 /* EmulatorViewController.m */; }; + 87078AA818A47FE90034C7A0 /* EmulatorViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 87078AA718A47FE90034C7A0 /* EmulatorViewController.mm */; }; 87078AAA18A47FE90034C7A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87078AA918A47FE90034C7A0 /* Images.xcassets */; }; 9C7A393318C804A80070BB5F /* reicast.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 9C7A393218C804A80070BB5F /* reicast.entitlements */; }; 9C7A3AA218C806E00070BB5F /* cfg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A395118C806DE0070BB5F /* cfg.cpp */; }; @@ -170,18 +177,13 @@ 9C7A3B3918C806E00070BB5F /* ImgReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A6118C806E00070BB5F /* ImgReader.cpp */; }; 9C7A3B3A18C806E00070BB5F /* ioctl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A6318C806E00070BB5F /* ioctl.cpp */; }; 9C7A3B3F18C806E00070BB5F /* nullDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A7C18C806E00070BB5F /* nullDC.cpp */; }; - 9C7A3B4018C806E00070BB5F /* alsa_audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A7E18C806E00070BB5F /* alsa_audiostream.cpp */; }; - 9C7A3B4118C806E00070BB5F /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A7F18C806E00070BB5F /* audiostream.cpp */; }; - 9C7A3B4218C806E00070BB5F /* ds_audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8118C806E00070BB5F /* ds_audiostream.cpp */; }; 9C7A3B4318C806E00070BB5F /* profiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8418C806E00070BB5F /* profiler.cpp */; }; 9C7A3B4418C806E00070BB5F /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8618C806E00070BB5F /* README.md */; }; 9C7A3B4518C806E00070BB5F /* arm_dyna.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8818C806E00070BB5F /* arm_dyna.cpp */; }; 9C7A3B4618C806E00070BB5F /* ngen_arm.S in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8918C806E00070BB5F /* ngen_arm.S */; }; - 9C7A3B4718C806E00070BB5F /* d3d11.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8C18C806E00070BB5F /* d3d11.cpp */; }; 9C7A3B4818C806E00070BB5F /* gldraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8E18C806E00070BB5F /* gldraw.cpp */; }; 9C7A3B4918C806E00070BB5F /* gles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A8F18C806E00070BB5F /* gles.cpp */; }; 9C7A3B4A18C806E00070BB5F /* gltex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A9118C806E00070BB5F /* gltex.cpp */; }; - 9C7A3B4B18C806E00070BB5F /* norend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A9318C806E00070BB5F /* norend.cpp */; }; 9C7A3B4C18C806E00070BB5F /* TexCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A9518C806E00070BB5F /* TexCache.cpp */; }; 9C7A3B4E18C806E00070BB5F /* stdclass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3A9918C806E00070BB5F /* stdclass.cpp */; }; 9C7A3B5918C81A4F0070BB5F /* SWRevealViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C7A3B5818C81A4F0070BB5F /* SWRevealViewController.m */; }; @@ -218,6 +220,17 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 8497BCBC1A41A0E900EFB9ED /* common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = common.cpp; sourceTree = ""; }; + 8497BCBD1A41A0E900EFB9ED /* nixprof.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nixprof.cpp; sourceTree = ""; }; + 8497BCBE1A41A0E900EFB9ED /* typedefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = typedefs.h; sourceTree = ""; }; + 8497BCC11A41B02000EFB9ED /* ios_main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ios_main.mm; sourceTree = ""; }; + 8497BCC41A41BFBA00EFB9ED /* alsa_audiostream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alsa_audiostream.cpp; sourceTree = ""; }; + 8497BCC51A41BFBA00EFB9ED /* audiostream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audiostream.cpp; sourceTree = ""; }; + 8497BCC61A41BFBA00EFB9ED /* audiostream_rif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audiostream_rif.h; sourceTree = ""; }; + 8497BCC71A41BFBA00EFB9ED /* ds_audiostream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ds_audiostream.cpp; sourceTree = ""; }; + 8497BCC81A41BFBA00EFB9ED /* oslib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oslib.h; sourceTree = ""; }; + 8497BCCD1A41BFD800EFB9ED /* coreio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = coreio.cpp; sourceTree = ""; }; + 8497BCCE1A41BFD800EFB9ED /* coreio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coreio.h; sourceTree = ""; }; 87078A8318A47FE90034C7A0 /* emulator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = emulator.app; sourceTree = BUILT_PRODUCTS_DIR; }; 87078A8618A47FE90034C7A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 87078A8818A47FE90034C7A0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -232,7 +245,7 @@ 87078AA218A47FE90034C7A0 /* Shader.fsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.fsh; path = Shaders/Shader.fsh; sourceTree = ""; }; 87078AA418A47FE90034C7A0 /* Shader.vsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.vsh; path = Shaders/Shader.vsh; sourceTree = ""; }; 87078AA618A47FE90034C7A0 /* EmulatorViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = EmulatorViewController.h; path = emulator/EmulatorViewController.h; sourceTree = ""; }; - 87078AA718A47FE90034C7A0 /* EmulatorViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EmulatorViewController.m; path = emulator/EmulatorViewController.m; sourceTree = ""; }; + 87078AA718A47FE90034C7A0 /* EmulatorViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = EmulatorViewController.mm; path = emulator/EmulatorViewController.mm; sourceTree = ""; }; 87078AA918A47FE90034C7A0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = emulator/Images.xcassets; sourceTree = ""; }; 87078AB018A47FE90034C7A0 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 9C7A393218C804A80070BB5F /* reicast.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = reicast.entitlements; sourceTree = ""; }; @@ -509,22 +522,15 @@ 9C7A3A7118C806E00070BB5F /* gl3platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl3platform.h; sourceTree = ""; }; 9C7A3A7318C806E00070BB5F /* khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = khrplatform.h; sourceTree = ""; }; 9C7A3A7C18C806E00070BB5F /* nullDC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nullDC.cpp; sourceTree = ""; }; - 9C7A3A7E18C806E00070BB5F /* alsa_audiostream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alsa_audiostream.cpp; sourceTree = ""; }; - 9C7A3A7F18C806E00070BB5F /* audiostream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = audiostream.cpp; sourceTree = ""; }; - 9C7A3A8018C806E00070BB5F /* audiostream_rif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audiostream_rif.h; sourceTree = ""; }; - 9C7A3A8118C806E00070BB5F /* ds_audiostream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ds_audiostream.cpp; sourceTree = ""; }; - 9C7A3A8218C806E00070BB5F /* oslib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oslib.h; sourceTree = ""; }; 9C7A3A8418C806E00070BB5F /* profiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = profiler.cpp; sourceTree = ""; }; 9C7A3A8518C806E00070BB5F /* profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = profiler.h; sourceTree = ""; }; 9C7A3A8618C806E00070BB5F /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; 9C7A3A8818C806E00070BB5F /* arm_dyna.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = arm_dyna.cpp; sourceTree = ""; }; 9C7A3A8918C806E00070BB5F /* ngen_arm.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ngen_arm.S; sourceTree = ""; usesTabs = 1; }; - 9C7A3A8C18C806E00070BB5F /* d3d11.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = d3d11.cpp; sourceTree = ""; }; 9C7A3A8E18C806E00070BB5F /* gldraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gldraw.cpp; sourceTree = ""; }; 9C7A3A8F18C806E00070BB5F /* gles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gles.cpp; sourceTree = ""; }; 9C7A3A9018C806E00070BB5F /* gles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gles.h; sourceTree = ""; }; 9C7A3A9118C806E00070BB5F /* gltex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gltex.cpp; sourceTree = ""; }; - 9C7A3A9318C806E00070BB5F /* norend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = norend.cpp; sourceTree = ""; }; 9C7A3A9418C806E00070BB5F /* rend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rend.h; sourceTree = ""; }; 9C7A3A9518C806E00070BB5F /* TexCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TexCache.cpp; sourceTree = ""; }; 9C7A3A9618C806E00070BB5F /* TexCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TexCache.h; sourceTree = ""; }; @@ -588,6 +594,38 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 8497BCBB1A41A0E900EFB9ED /* linux */ = { + isa = PBXGroup; + children = ( + 8497BCBC1A41A0E900EFB9ED /* common.cpp */, + 8497BCBD1A41A0E900EFB9ED /* nixprof.cpp */, + 8497BCBE1A41A0E900EFB9ED /* typedefs.h */, + ); + path = linux; + sourceTree = ""; + }; + 8497BCC31A41BFBA00EFB9ED /* oslib */ = { + isa = PBXGroup; + children = ( + 8497BCC41A41BFBA00EFB9ED /* alsa_audiostream.cpp */, + 8497BCC51A41BFBA00EFB9ED /* audiostream.cpp */, + 8497BCC61A41BFBA00EFB9ED /* audiostream_rif.h */, + 8497BCC71A41BFBA00EFB9ED /* ds_audiostream.cpp */, + 8497BCC81A41BFBA00EFB9ED /* oslib.h */, + ); + path = oslib; + sourceTree = ""; + }; + 8497BCCC1A41BFD800EFB9ED /* coreio */ = { + isa = PBXGroup; + children = ( + 8497BCCD1A41BFD800EFB9ED /* coreio.cpp */, + 8497BCCE1A41BFD800EFB9ED /* coreio.h */, + ); + name = coreio; + path = deps/coreio; + sourceTree = ""; + }; 87078A7A18A47FE90034C7A0 = { isa = PBXGroup; children = ( @@ -632,6 +670,7 @@ 9C7A393418C805980070BB5F /* Third-Party Frameworks */, 87078A9118A47FE90034C7A0 /* Supporting Files */, 9C7A393818C806DE0070BB5F /* Emulator Core Code */, + 8497BCC11A41B02000EFB9ED /* ios_main.mm */, ); name = reicast; path = emulator; @@ -674,7 +713,7 @@ 9C7A3B5A18C81BC80070BB5F /* SideDrawerViewController.h */, 9C7A3B5B18C81BC80070BB5F /* SideDrawerViewController.m */, 87078AA618A47FE90034C7A0 /* EmulatorViewController.h */, - 87078AA718A47FE90034C7A0 /* EmulatorViewController.m */, + 87078AA718A47FE90034C7A0 /* EmulatorViewController.mm */, ); name = "View Controller Subclasses"; path = ..; @@ -714,6 +753,9 @@ 9C7A393818C806DE0070BB5F /* Emulator Core Code */ = { isa = PBXGroup; children = ( + 8497BCCC1A41BFD800EFB9ED /* coreio */, + 8497BCC31A41BFBA00EFB9ED /* oslib */, + 8497BCBB1A41A0E900EFB9ED /* linux */, 9C7A393918C806DE0070BB5F /* arm_emitter */, 9C7A394F18C806DE0070BB5F /* build.h */, 9C7A395018C806DE0070BB5F /* cfg */, @@ -723,7 +765,6 @@ 9C7A3A5A18C806E00070BB5F /* imgread */, 9C7A3A6518C806E00070BB5F /* khronos */, 9C7A3A7C18C806E00070BB5F /* nullDC.cpp */, - 9C7A3A7D18C806E00070BB5F /* oslib */, 9C7A3A8318C806E00070BB5F /* profiler */, 9C7A3A8618C806E00070BB5F /* README.md */, 9C7A3A8718C806E00070BB5F /* rec-ARM */, @@ -1232,18 +1273,6 @@ path = KHR; sourceTree = ""; }; - 9C7A3A7D18C806E00070BB5F /* oslib */ = { - isa = PBXGroup; - children = ( - 9C7A3A7E18C806E00070BB5F /* alsa_audiostream.cpp */, - 9C7A3A7F18C806E00070BB5F /* audiostream.cpp */, - 9C7A3A8018C806E00070BB5F /* audiostream_rif.h */, - 9C7A3A8118C806E00070BB5F /* ds_audiostream.cpp */, - 9C7A3A8218C806E00070BB5F /* oslib.h */, - ); - path = oslib; - sourceTree = ""; - }; 9C7A3A8318C806E00070BB5F /* profiler */ = { isa = PBXGroup; children = ( @@ -1265,9 +1294,7 @@ 9C7A3A8A18C806E00070BB5F /* rend */ = { isa = PBXGroup; children = ( - 9C7A3A8B18C806E00070BB5F /* d3d11 */, 9C7A3A8D18C806E00070BB5F /* gles */, - 9C7A3A9218C806E00070BB5F /* norend */, 9C7A3A9418C806E00070BB5F /* rend.h */, 9C7A3A9518C806E00070BB5F /* TexCache.cpp */, 9C7A3A9618C806E00070BB5F /* TexCache.h */, @@ -1275,14 +1302,6 @@ path = rend; sourceTree = ""; }; - 9C7A3A8B18C806E00070BB5F /* d3d11 */ = { - isa = PBXGroup; - children = ( - 9C7A3A8C18C806E00070BB5F /* d3d11.cpp */, - ); - path = d3d11; - sourceTree = ""; - }; 9C7A3A8D18C806E00070BB5F /* gles */ = { isa = PBXGroup; children = ( @@ -1294,14 +1313,6 @@ path = gles; sourceTree = ""; }; - 9C7A3A9218C806E00070BB5F /* norend */ = { - isa = PBXGroup; - children = ( - 9C7A3A9318C806E00070BB5F /* norend.cpp */, - ); - path = norend; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -1455,6 +1466,7 @@ 9C7A3B2418C806E00070BB5F /* bsc.cpp in Sources */, 9C7A3AD318C806E00070BB5F /* zip_free.c in Sources */, 9C7A3AB918C806E00070BB5F /* pngwtran.c in Sources */, + 8497BCCA1A41BFBA00EFB9ED /* audiostream.cpp in Sources */, 9C7A3B4918C806E00070BB5F /* gles.cpp in Sources */, 9C7A3ADD18C806E00070BB5F /* zip_rename.c in Sources */, 9C7A3ADB18C806E00070BB5F /* zip_new.c in Sources */, @@ -1464,6 +1476,7 @@ 9C7A3AB318C806E00070BB5F /* pngrtran.c in Sources */, 9C7A3AEC18C806E00070BB5F /* zip_strerror.c in Sources */, 9C7A3AB718C806E00070BB5F /* pngwio.c in Sources */, + 8497BCCB1A41BFBA00EFB9ED /* ds_audiostream.cpp in Sources */, 9C7A3B2D18C806E00070BB5F /* ubc.cpp in Sources */, 9C7A3B2618C806E00070BB5F /* cpg.cpp in Sources */, 9C7A3B1A18C806E00070BB5F /* ta.cpp in Sources */, @@ -1481,8 +1494,8 @@ 9C7A3AF318C806E00070BB5F /* crc32.c in Sources */, 9C7A3B5F18C81D090070BB5F /* BrowserTableViewController.m in Sources */, 9C7D581019301E140004EA2C /* CloudVMUViewController.m in Sources */, + 8497BCC01A41A0E900EFB9ED /* nixprof.cpp in Sources */, 9C7A3AE118C806E00070BB5F /* zip_set_file_comment.c in Sources */, - 9C7A3B4118C806E00070BB5F /* audiostream.cpp in Sources */, 9C7A3AB118C806E00070BB5F /* pngread.c in Sources */, 9C7A3AAC18C806E00070BB5F /* png.c in Sources */, 9C7A3AC718C806E00070BB5F /* zip_error_get_sys_type.c in Sources */, @@ -1496,8 +1509,10 @@ 9C7A3B1218C806E00070BB5F /* maple_if.cpp in Sources */, 9C7A3AC818C806E00070BB5F /* zip_error_strerror.c in Sources */, 9C7A3AF518C806E00070BB5F /* infback.c in Sources */, + 8497BCCF1A41BFD800EFB9ED /* coreio.cpp in Sources */, 9C7A3B0E18C806E00070BB5F /* sb_mem.cpp in Sources */, 9C7A3B5C18C81BC80070BB5F /* SideDrawerViewController.m in Sources */, + 8497BCC21A41B02000EFB9ED /* ios_main.mm in Sources */, 9C7A3B2C18C806E00070BB5F /* tmu.cpp in Sources */, 9C7A3B4C18C806E00070BB5F /* TexCache.cpp in Sources */, 9C7A3B1618C806E00070BB5F /* pvr_regs.cpp in Sources */, @@ -1522,7 +1537,7 @@ 9C7A3B1D18C806E00070BB5F /* blockmanager.cpp in Sources */, 9C7A3B2B18C806E00070BB5F /* serial.cpp in Sources */, 9C7A3B4A18C806E00070BB5F /* gltex.cpp in Sources */, - 87078AA818A47FE90034C7A0 /* EmulatorViewController.m in Sources */, + 87078AA818A47FE90034C7A0 /* EmulatorViewController.mm in Sources */, 9C7A3ACD18C806E00070BB5F /* zip_file_get_offset.c in Sources */, 9C7A3B2818C806E00070BB5F /* intc.cpp in Sources */, 9C7A3B3A18C806E00070BB5F /* ioctl.cpp in Sources */, @@ -1546,9 +1561,10 @@ 9C7A3AF018C806E00070BB5F /* zip_unchange_data.c in Sources */, 9C7A3AB218C806E00070BB5F /* pngrio.c in Sources */, 9C7A3AC118C806E00070BB5F /* zip_entry_free.c in Sources */, - 9C7A3B4018C806E00070BB5F /* alsa_audiostream.cpp in Sources */, 9C7A3AE518C806E00070BB5F /* zip_source_filep.c in Sources */, 9C7A3B0318C806E00070BB5F /* dsp.cpp in Sources */, + 8497BCC91A41BFBA00EFB9ED /* alsa_audiostream.cpp in Sources */, + 8497BCBF1A41A0E900EFB9ED /* common.cpp in Sources */, 9C7A3B0B18C806E00070BB5F /* holly_intc.cpp in Sources */, 87078A9718A47FE90034C7A0 /* main.m in Sources */, 9C7A3AC418C806E00070BB5F /* zip_error.c in Sources */, @@ -1569,12 +1585,10 @@ 9C7A3B3918C806E00070BB5F /* ImgReader.cpp in Sources */, 9C7A3ACC18C806E00070BB5F /* zip_file_error_get.c in Sources */, 9C7A3B3F18C806E00070BB5F /* nullDC.cpp in Sources */, - 9C7A3B4218C806E00070BB5F /* ds_audiostream.cpp in Sources */, 9C7A3B0618C806E00070BB5F /* arm_mem.cpp in Sources */, 9C7A3AAF18C806E00070BB5F /* pngmem.c in Sources */, 9C7A3AAB18C806E00070BB5F /* elf64.cpp in Sources */, 9C7A3ADE18C806E00070BB5F /* zip_replace.c in Sources */, - 9C7A3B4B18C806E00070BB5F /* norend.cpp in Sources */, 9C7A3B0C18C806E00070BB5F /* sb.cpp in Sources */, 9C7A3B0118C806E00070BB5F /* aica_if.cpp in Sources */, 9C7A3ADF18C806E00070BB5F /* zip_set_archive_comment.c in Sources */, @@ -1583,7 +1597,6 @@ 9C7A3AC318C806E00070BB5F /* zip_err_str.c in Sources */, 9C7A3B4818C806E00070BB5F /* gldraw.cpp in Sources */, 9C7A3AE618C806E00070BB5F /* zip_source_free.c in Sources */, - 9C7A3B4718C806E00070BB5F /* d3d11.cpp in Sources */, 9C7A3AAE18C806E00070BB5F /* pngget.c in Sources */, 9C7A3AB018C806E00070BB5F /* pngpread.c in Sources */, 9C7A3AF118C806E00070BB5F /* adler32.c in Sources */, @@ -1632,7 +1645,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 5.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 2; }; name = Debug; }; @@ -1666,7 +1679,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 5.0; SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 2; VALIDATE_PRODUCT = YES; }; name = Release; @@ -1689,6 +1702,7 @@ "DEBUG=1", "TARGET_IPHONE=1", "$(inherited)", + "HOST_NO_REC=1", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1703,7 +1717,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "armv7 armv7s"; + VALID_ARCHS = armv7; WRAPPER_EXTENSION = app; }; name = Debug; @@ -1724,6 +1738,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "GLES=1", "TARGET_IPHONE=1", + "HOST_NO_REC=1", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1738,7 +1753,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; TARGETED_DEVICE_FAMILY = "1,2"; - VALID_ARCHS = "armv7 armv7s"; + VALID_ARCHS = armv7; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/shell/ios/emulator/AppDelegate.m b/shell/ios/emulator/AppDelegate.m index 5207e7f4f..7b4096ee9 100644 --- a/shell/ios/emulator/AppDelegate.m +++ b/shell/ios/emulator/AppDelegate.m @@ -17,6 +17,7 @@ else [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; // Override point for customization after application launch. + return YES; } diff --git a/shell/ios/emulator/EmulatorViewController.m b/shell/ios/emulator/EmulatorViewController.m deleted file mode 100644 index 6002ad3cf..000000000 --- a/shell/ios/emulator/EmulatorViewController.m +++ /dev/null @@ -1,385 +0,0 @@ -// -// EmulatorViewController.m -// emulator -// -// Created by Karen Tsai (angelXwind) on 2014/3/5. -// Copyright (c) 2014 Karen Tsai (angelXwind). All rights reserved. -// - -#import "EmulatorViewController.h" -#import - -#define BUFFER_OFFSET(i) ((char *)NULL + (i)) - -// Uniform index. -enum -{ - UNIFORM_MODELVIEWPROJECTION_MATRIX, - UNIFORM_NORMAL_MATRIX, - NUM_UNIFORMS -}; -GLint uniforms[NUM_UNIFORMS]; - -// Attribute index. -enum -{ - ATTRIB_VERTEX, - ATTRIB_NORMAL, - NUM_ATTRIBUTES -}; - -GLfloat gCubeVertexData[216] = -{ - // Data layout for each line below is: - // positionX, positionY, positionZ, normalX, normalY, normalZ, - 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, - 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, - 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, - 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, - 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, - 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, - - 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, - -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, - 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, - 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, - -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, - -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, - - -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, - -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, - -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, - -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, - -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, - -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, - - -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, - 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, - -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, - -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, - 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, - 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, - - 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, - -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, - 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, - 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, - -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, - -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, - - 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, - -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, - 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, - 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, - -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, - -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f -}; - -@interface ViewController () { - GLuint _program; - - GLKMatrix4 _modelViewProjectionMatrix; - GLKMatrix3 _normalMatrix; - float _rotation; - - GLuint _vertexArray; - GLuint _vertexBuffer; -} -@property (strong, nonatomic) EAGLContext *context; -@property (strong, nonatomic) GLKBaseEffect *effect; - -- (void)setupGL; -- (void)tearDownGL; - -- (BOOL)loadShaders; -- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file; -- (BOOL)linkProgram:(GLuint)prog; -- (BOOL)validateProgram:(GLuint)prog; -@end - -@implementation ViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - - if (!self.context) { - NSLog(@"Failed to create ES context"); - } - - GLKView *view = (GLKView *)self.view; - view.context = self.context; - view.drawableDepthFormat = GLKViewDrawableDepthFormat24; - - [self setupGL]; -} - -- (void)dealloc -{ - [self tearDownGL]; - - if ([EAGLContext currentContext] == self.context) { - [EAGLContext setCurrentContext:nil]; - } -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - - if ([self isViewLoaded] && ([[self view] window] == nil)) { - self.view = nil; - - [self tearDownGL]; - - if ([EAGLContext currentContext] == self.context) { - [EAGLContext setCurrentContext:nil]; - } - self.context = nil; - } - - // Dispose of any resources that can be recreated. -} - -- (void)setupGL -{ - [EAGLContext setCurrentContext:self.context]; - - [self loadShaders]; - - self.effect = [[GLKBaseEffect alloc] init]; - self.effect.light0.enabled = GL_TRUE; - self.effect.light0.diffuseColor = GLKVector4Make(1.0f, 0.4f, 0.4f, 1.0f); - - glEnable(GL_DEPTH_TEST); - -} - -- (void)tearDownGL -{ - [EAGLContext setCurrentContext:self.context]; - - glDeleteBuffers(1, &_vertexBuffer); - - - //Is this needed? xcode fails to resole it - glDeleteVertexArraysOES(1, &_vertexArray); - - - self.effect = nil; - - if (_program) { - glDeleteProgram(_program); - _program = 0; - } -} - -#pragma mark - GLKView and GLKViewController delegate methods - -- (void)update -{ - float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height); - GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f); - - self.effect.transform.projectionMatrix = projectionMatrix; - - GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f); - baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f); - - // Compute the model view matrix for the object rendered with GLKit - GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f); - modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); - modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); - - self.effect.transform.modelviewMatrix = modelViewMatrix; - - // Compute the model view matrix for the object rendered with ES2 - modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f); - modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); - modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); - - _normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL); - - _modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix); - - _rotation += self.timeSinceLastUpdate * 0.5f; -} - -- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect -{ - glClearColor(0.65f, 0.65f, 0.65f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - - //See .. - glBindVertexArrayOES(_vertexArray); - - // Render the object with GLKit - [self.effect prepareToDraw]; - - glDrawArrays(GL_TRIANGLES, 0, 36); - - // Render the object again with ES2 - glUseProgram(_program); - - glUniformMatrix4fv(uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX], 1, 0, _modelViewProjectionMatrix.m); - glUniformMatrix3fv(uniforms[UNIFORM_NORMAL_MATRIX], 1, 0, _normalMatrix.m); - - glDrawArrays(GL_TRIANGLES, 0, 36); -} - -#pragma mark - OpenGL ES 2 shader compilation - -- (BOOL)loadShaders -{ - GLuint vertShader, fragShader; - NSString *vertShaderPathname, *fragShaderPathname; - - // Create shader program. - _program = glCreateProgram(); - - // Create and compile vertex shader. - vertShaderPathname = [[NSBundle mainBundle] pathForResource:@"Shader" ofType:@"vsh"]; - if (![self compileShader:&vertShader type:GL_VERTEX_SHADER file:vertShaderPathname]) { - NSLog(@"Failed to compile vertex shader"); - return NO; - } - - // Create and compile fragment shader. - fragShaderPathname = [[NSBundle mainBundle] pathForResource:@"Shader" ofType:@"fsh"]; - if (![self compileShader:&fragShader type:GL_FRAGMENT_SHADER file:fragShaderPathname]) { - NSLog(@"Failed to compile fragment shader"); - return NO; - } - - // Attach vertex shader to program. - glAttachShader(_program, vertShader); - - // Attach fragment shader to program. - glAttachShader(_program, fragShader); - - // Bind attribute locations. - // This needs to be done prior to linking. - glBindAttribLocation(_program, GLKVertexAttribPosition, "position"); - glBindAttribLocation(_program, GLKVertexAttribNormal, "normal"); - - // Link program. - if (![self linkProgram:_program]) { - NSLog(@"Failed to link program: %d", _program); - - if (vertShader) { - glDeleteShader(vertShader); - vertShader = 0; - } - if (fragShader) { - glDeleteShader(fragShader); - fragShader = 0; - } - if (_program) { - glDeleteProgram(_program); - _program = 0; - } - - return NO; - } - - // Get uniform locations. - uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX] = glGetUniformLocation(_program, "modelViewProjectionMatrix"); - uniforms[UNIFORM_NORMAL_MATRIX] = glGetUniformLocation(_program, "normalMatrix"); - - // Release vertex and fragment shaders. - if (vertShader) { - glDetachShader(_program, vertShader); - glDeleteShader(vertShader); - } - if (fragShader) { - glDetachShader(_program, fragShader); - glDeleteShader(fragShader); - } - - return YES; -} - -- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file -{ - GLint status; - const GLchar *source; - - source = (GLchar *)[[NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil] UTF8String]; - if (!source) { - NSLog(@"Failed to load vertex shader"); - return NO; - } - - *shader = glCreateShader(type); - glShaderSource(*shader, 1, &source, NULL); - glCompileShader(*shader); - -#if defined(DEBUG) - GLint logLength; - glGetShaderiv(*shader, GL_INFO_LOG_LENGTH, &logLength); - if (logLength > 0) { - GLchar *log = (GLchar *)malloc(logLength); - glGetShaderInfoLog(*shader, logLength, &logLength, log); - NSLog(@"Shader compile log:\n%s", log); - free(log); - } -#endif - - glGetShaderiv(*shader, GL_COMPILE_STATUS, &status); - if (status == 0) { - glDeleteShader(*shader); - return NO; - } - - return YES; -} - -- (BOOL)linkProgram:(GLuint)prog -{ - GLint status; - glLinkProgram(prog); - -#if defined(DEBUG) - GLint logLength; - glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength); - if (logLength > 0) { - GLchar *log = (GLchar *)malloc(logLength); - glGetProgramInfoLog(prog, logLength, &logLength, log); - NSLog(@"Program link log:\n%s", log); - free(log); - } -#endif - - glGetProgramiv(prog, GL_LINK_STATUS, &status); - if (status == 0) { - return NO; - } - - return YES; -} - -- (BOOL)validateProgram:(GLuint)prog -{ - GLint logLength, status; - - glValidateProgram(prog); - glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength); - if (logLength > 0) { - GLchar *log = (GLchar *)malloc(logLength); - glGetProgramInfoLog(prog, logLength, &logLength, log); - NSLog(@"Program validate log:\n%s", log); - free(log); - } - - glGetProgramiv(prog, GL_VALIDATE_STATUS, &status); - if (status == 0) { - return NO; - } - - return YES; -} - -@end diff --git a/shell/ios/emulator/EmulatorViewController.mm b/shell/ios/emulator/EmulatorViewController.mm new file mode 100644 index 000000000..2aa2404c6 --- /dev/null +++ b/shell/ios/emulator/EmulatorViewController.mm @@ -0,0 +1,138 @@ +// +// EmulatorViewController.m +// emulator +// +// Created by Karen Tsai (angelXwind) on 2014/3/5. +// Copyright (c) 2014 Karen Tsai (angelXwind). All rights reserved. +// + +#import "EmulatorViewController.h" +#import + +#include "types.h" +#include "profiler/profiler.h" +#include "cfg/cfg.h" +#include "rend/TexCache.h" +#include "hw/maple/maple_devs.h" +#include "hw/maple/maple_if.h" + +@interface ViewController () { +} + +@property (strong, nonatomic) EAGLContext *context; +@property (strong, nonatomic) GLKBaseEffect *effect; + +- (void)setupGL; +- (void)tearDownGL; +- (void)emuThread; + +@end + +//who has time for headers +extern int screen_width,screen_height; +bool rend_single_frame(); +bool gles_init(); +extern "C" int reicast_main(int argc, char* argv[]); + + +@implementation ViewController + +-(void)emuThread +{ + install_prof_handler(1); + + + //This looks like the right place, rite? + char text[2]=""; + + char* prms[2]; + prms[0]=text; + + reicast_main(1, prms); +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + + if (!self.context) { + NSLog(@"Failed to create ES context"); + } + + GLKView *view = (GLKView *)self.view; + view.context = self.context; + view.drawableDepthFormat = GLKViewDrawableDepthFormat24; + + [self setupGL]; + + if (!gles_init()) + die("OPENGL FAILED"); + + NSThread* myThread = [[NSThread alloc] initWithTarget:self + selector:@selector(emuThread) + object:nil]; + [myThread start]; // Actually create the thread +} + +- (void)dealloc +{ + [self tearDownGL]; + + if ([EAGLContext currentContext] == self.context) { + [EAGLContext setCurrentContext:nil]; + } +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + + if ([self isViewLoaded] && ([[self view] window] == nil)) { + self.view = nil; + + [self tearDownGL]; + + if ([EAGLContext currentContext] == self.context) { + [EAGLContext setCurrentContext:nil]; + } + self.context = nil; + } + + // Dispose of any resources that can be recreated. +} + +- (void)setupGL +{ + [EAGLContext setCurrentContext:self.context]; + +} + +- (void)tearDownGL +{ + [EAGLContext setCurrentContext:self.context]; + +} + +#pragma mark - GLKView and GLKViewController delegate methods + +- (void)update +{ + +} + + +- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect +{ + screen_width = view.drawableWidth; + screen_height = view.drawableHeight; + + glClearColor(0.65f, 0.65f, 0.65f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + while(!rend_single_frame()) ; +} + + +@end diff --git a/shell/ios/emulator/MainStoryboard.storyboard b/shell/ios/emulator/MainStoryboard.storyboard index db60bd89a..8a0522c90 100644 --- a/shell/ios/emulator/MainStoryboard.storyboard +++ b/shell/ios/emulator/MainStoryboard.storyboard @@ -1,557 +1,21 @@ - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -560,848 +24,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + diff --git a/shell/ios/emulator/emulator-Info.plist b/shell/ios/emulator/emulator-Info.plist index 7bdce4f25..97ae06acd 100644 --- a/shell/ios/emulator/emulator-Info.plist +++ b/shell/ios/emulator/emulator-Info.plist @@ -5,11 +5,11 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - ${PRODUCT_NAME} + Reicast CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.camerize.$(PRODUCT_NAME:rfc1034identifier) + com.reicast.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -27,7 +27,7 @@ UIMainStoryboardFile MainStoryboard UIMainStoryboardFile~ipad - Main_iPad + MainStoryboard UIPrerenderedIcon UIRequiredDeviceCapabilities @@ -50,6 +50,10 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIFileSharingEnabled + + NSHighResolutionCapable + UIViewControllerBasedStatusBarAppearance diff --git a/shell/ios/emulator/ios_main.mm b/shell/ios/emulator/ios_main.mm new file mode 100644 index 000000000..0bc2df4af --- /dev/null +++ b/shell/ios/emulator/ios_main.mm @@ -0,0 +1,114 @@ +// +// ios_main.m +// emulator +// +// Created by admin on 12/17/14. +// Copyright (c) 2014 Karen Tsai (angelXwind). All rights reserved. +// + +#import + +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include "hw/sh4/dyna/blockmanager.h" +#include + + +int msgboxf(const wchar* text,unsigned int type,...) +{ + va_list args; + + wchar temp[2048]; + va_start(args, type); + vsprintf(temp, text, args); + va_end(args); + + //printf(NULL,temp,VER_SHORTNAME,type | MB_TASKMODAL); + puts(temp); + return 0; +} + +void common_linux_setup(); +int dc_init(int argc,wchar* argv[]); +void dc_run(); + +u16 kcode[4]; +u32 vks[4]; +s8 joyx[4],joyy[4]; +u8 rt[4],lt[4]; + +extern "C" int reicast_main(int argc, wchar* argv[]) +{ + //if (argc==2) + //ndcid=atoi(argv[1]); + + string homedir = [ [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] objectAtIndex:0] path] UTF8String]; + SetHomeDir(homedir); + + printf("Home dir is: %s\n",GetPath("/").c_str()); + + common_linux_setup(); + + settings.profile.run_counts=0; + + dc_init(argc,argv); + + dc_run(); + + return 0; +} + +void os_DoEvents() { + +} + + +u32 os_Push(void*, u32, bool) { + return 1; +} + +void os_SetWindowText(const char* t) { + puts(t); +} + +void os_CreateWindow() { + +} + +void UpdateInputState(u32 port) { + +} + +void get_mic_data(u8* ) { + +} + +void* libPvr_GetRenderTarget() { + return 0; +} + +void* libPvr_GetRenderSurface() { + return 0; + +} + +bool gl_init(void*, void*) { + return true; +} + +void gl_term() { + +} + +void gl_swap() { + +} \ No newline at end of file diff --git a/shell/mac86/Makefile b/shell/mac86/Makefile new file mode 100644 index 000000000..aab1ebf97 --- /dev/null +++ b/shell/mac86/Makefile @@ -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