From: twinaphex Date: Tue, 4 Mar 2014 04:26:59 +0000 (+0100) Subject: (PSP) Add PSP target X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f18d0e083ce89df07ef7a0c0cf5dc200638ad5d2;p=picodrive.git (PSP) Add PSP target --- diff --git a/Makefile b/Makefile index d31779c..9201afb 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,11 @@ clean: $(RM) -r .opk_data $(TARGET): $(OBJS) +ifeq ($(STATIC_LINKING), 1) + $(AR) rcs $@ $(OBJS) +else $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS) +endif pprof: platform/linux/pprof.c $(CC) -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@ diff --git a/Makefile.libretro b/Makefile.libretro index ec165cd..a2a4daf 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -75,6 +75,19 @@ else ifeq ($(platform), psp1) CC = psp-gcc$(EXE_EXT) AR = psp-ar$(EXE_EXT) CFLAGS += -DPSP -G0 + STATIC_LINKING = 1 + +asm_memory = 0 +asm_render = 0 +asm_ym2612 = 0 +asm_misc = 0 +asm_cdpico = 0 +asm_cdmemory = 0 +asm_mix = 0 + use_cyclone = 0 + use_fame = 1 + use_drz80 = 0 + use_cz80 = 1 else ifeq ($(platform), xenon) TARGET := $(TARGET_NAME)_libretro_xenon360.a CC = xenon-gcc$(EXE_EXT) diff --git a/platform/libretro.c b/platform/libretro.c index 9ce13c5..72b7a1b 100644 --- a/platform/libretro.c +++ b/platform/libretro.c @@ -6,12 +6,18 @@ * See COPYING file in the top-level directory. */ +#ifdef PSP +#define NO_MMAP +#endif + #define _GNU_SOURCE 1 // mremap #include #include #include #ifndef _WIN32 +#ifndef NO_MMAP #include +#endif #else #include #include @@ -161,6 +167,30 @@ static void munmap(void *addr, size_t length) UnmapViewOfFile(addr); /* ruh-ro, we leaked handle from CreateFileMapping() ... */ } +#elif defined(NO_MMAP) +#define PROT_EXEC 0x04 +#define MAP_FAILED 0 +#define PROT_READ 0 +#define PROT_WRITE 0 +#define MAP_PRIVATE 0 +#define MAP_ANONYMOUS 0 + +void* mmap(void *desired_addr, size_t len, int mmap_prot, int mmap_flags, int fildes, size_t off) +{ + return malloc(len); +} + +void munmap(void *base_addr, size_t len) +{ + free(base_addr); +} + +int mprotect(void *addr, size_t len, int prot) +{ + /* stub - not really needed at this point since this codepath has no dynarecs */ + return 0; +} + #endif #ifndef MAP_ANONYMOUS