mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
libretro, more fixes and cleanups for windows and osx
This commit is contained in:
parent
0198149a72
commit
6b67b6aa13
6 changed files with 61 additions and 96 deletions
|
@ -37,6 +37,8 @@ asm_ym2612 = 0
|
|||
asm_misc = 0
|
||||
asm_cdmemory = 0
|
||||
asm_mix = 0
|
||||
asm_32xdraw = 0
|
||||
asm_32xmemory = 0
|
||||
|
||||
fpic :=
|
||||
|
||||
|
@ -78,6 +80,8 @@ else ifeq ($(platform), osx)
|
|||
endif
|
||||
ifeq ($(arch),ppc)
|
||||
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ -DFAMEC_NO_GOTOS
|
||||
else
|
||||
use_sh2drc = 1
|
||||
endif
|
||||
OSXVER = `sw_vers -productVersion | cut -d. -f 2`
|
||||
OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
|
||||
|
@ -99,14 +103,14 @@ else ifeq ($(platform), staticios)
|
|||
CXX += -miphoneos-version-min=8.0
|
||||
CC_AS += -miphoneos-version-min=8.0
|
||||
CFLAGS += -miphoneos-version-min=8.0
|
||||
ARCH := arm
|
||||
ARCH := aarch64
|
||||
|
||||
STATIC_LINKING = 1
|
||||
use_cyclone = 0
|
||||
use_fame = 1
|
||||
use_drz80 = 0
|
||||
use_cz80 = 1
|
||||
use_sh2drc = 0
|
||||
use_sh2drc = 1
|
||||
use_svpdrc = 0
|
||||
|
||||
# iOS
|
||||
|
@ -155,17 +159,11 @@ else ifeq ($(platform), ps3)
|
|||
NO_MMAP = 1
|
||||
DONT_COMPILE_IN_ZLIB = 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
|
||||
use_sh2drc = 1
|
||||
|
||||
# sncps3
|
||||
else ifeq ($(platform), sncps3)
|
||||
|
@ -177,17 +175,11 @@ else ifeq ($(platform), sncps3)
|
|||
NO_MMAP = 1
|
||||
DONT_COMPILE_IN_ZLIB = 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
|
||||
use_sh2drc = 1
|
||||
|
||||
# Lightweight PS3 Homebrew SDK
|
||||
else ifeq ($(platform), psl1ght)
|
||||
|
@ -199,17 +191,11 @@ else ifeq ($(platform), psl1ght)
|
|||
NO_MMAP = 1
|
||||
DONT_COMPILE_IN_ZLIB = 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
|
||||
use_sh2drc = 1
|
||||
|
||||
# PSP
|
||||
else ifeq ($(platform), psp1)
|
||||
|
@ -222,17 +208,12 @@ else ifeq ($(platform), psp1)
|
|||
NO_MMAP = 1
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
|
||||
asm_memory = 0
|
||||
asm_render = 1
|
||||
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
|
||||
use_sh2drc = 1
|
||||
|
||||
# CTR (3DS)
|
||||
else ifeq ($(platform), ctr)
|
||||
|
@ -250,14 +231,6 @@ else ifeq ($(platform), ctr)
|
|||
ARCH = arm
|
||||
ARM_ASM = 1
|
||||
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_ym2612 = 1
|
||||
asm_misc = 1
|
||||
asm_cdpico = 1
|
||||
asm_cdmemory = 1
|
||||
asm_mix = 1
|
||||
|
||||
use_cyclone = 1
|
||||
use_fame = 0
|
||||
use_drz80 = 1
|
||||
|
@ -280,14 +253,6 @@ else ifeq ($(platform), raspberrypi)
|
|||
fpic := -fPIC
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_ym2612 = 1
|
||||
asm_misc = 1
|
||||
asm_cdpico = 1
|
||||
asm_cdmemory = 1
|
||||
asm_mix = 1
|
||||
|
||||
use_cyclone = 1
|
||||
use_fame = 0
|
||||
use_drz80 = 1
|
||||
|
@ -309,14 +274,8 @@ else ifeq ($(platform), vita)
|
|||
NO_MMAP = 1
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
ARCH = arm
|
||||
ARM_ASM = 1
|
||||
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_ym2612 = 1
|
||||
asm_misc = 1
|
||||
asm_cdpico = 1
|
||||
asm_cdmemory = 1
|
||||
asm_mix = 1
|
||||
use_cyclone = 1
|
||||
use_fame = 0
|
||||
use_drz80 = 1
|
||||
|
@ -408,21 +367,14 @@ else ifeq ($(platform), emscripten)
|
|||
# GCW0
|
||||
else ifeq ($(platform), gcw0)
|
||||
TARGET := $(TARGET_NAME)_libretro.so
|
||||
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
|
||||
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
|
||||
CC = mipsel-linux-gcc
|
||||
AR = mipsel-linux-ar
|
||||
SHARED := -shared -nostdlib
|
||||
fpic := -fPIC
|
||||
LIBM :=
|
||||
DONT_COMPILE_IN_ZLIB = 1
|
||||
CFLAGS += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
|
||||
|
||||
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
|
||||
|
@ -452,6 +404,8 @@ asm_ym2612 = 1
|
|||
asm_misc = 1
|
||||
asm_cdmemory = 1
|
||||
asm_mix = 1
|
||||
asm_32xdraw = 1
|
||||
asm_32xmemory = 1
|
||||
endif
|
||||
|
||||
CFLAGS += $(fpic)
|
||||
|
|
|
@ -733,7 +733,7 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI, // x86-64,i386 common
|
|||
/* mov r <-> [ebp+#offs] */ \
|
||||
if ((offs) == 0) { \
|
||||
emith_deref_modrm(op, 0, r, rs); \
|
||||
} else if (abs(offs) >= 0x80) { \
|
||||
} else if ((s32)(offs) < -0x80 || (s32)(offs) >= 0x80) { \
|
||||
emith_deref_modrm(op, 2, r, rs); \
|
||||
EMIT(offs, u32); \
|
||||
} else { \
|
||||
|
@ -1075,7 +1075,7 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI, // x86-64,i386 common
|
|||
#define PARAM_REGS { xCX, xDX, xR8, xR9 }
|
||||
#define PRESERVED_REGS { xSI, xDI, xR12, xR13, xR14, xR15, xBX, xBP }
|
||||
#define TEMPORARY_REGS { xAX, xR10, xR11 }
|
||||
#define STATIC_SH2_REGS { SHR_SR,xBX , SHR_R(0),xR15 , SH2_R(1),xR14 }
|
||||
#define STATIC_SH2_REGS { SHR_SR,xBX , SHR_R(0),xR15 , SHR_R(1),xR14 }
|
||||
|
||||
#define host_arg2reg(rd, arg) \
|
||||
switch (arg) { \
|
||||
|
|
|
@ -1273,7 +1273,7 @@ static void dr_flush_tcache(int tcid)
|
|||
blink_free[tcid] = NULL;
|
||||
memset(unresolved_links[tcid], 0, sizeof(*unresolved_links[0]) * HASH_TABLE_SIZE(tcid));
|
||||
memset(hash_tables[tcid], 0, sizeof(*hash_tables[0]) * HASH_TABLE_SIZE(tcid));
|
||||
if (Pico32xMem->sdram != NULL) {
|
||||
|
||||
if (tcid == 0) { // ROM, RAM
|
||||
memset(Pico32xMem->drcblk_ram, 0, sizeof(Pico32xMem->drcblk_ram));
|
||||
memset(Pico32xMem->drclit_ram, 0, sizeof(Pico32xMem->drclit_ram));
|
||||
|
@ -1291,7 +1291,6 @@ static void dr_flush_tcache(int tcid)
|
|||
memset(sh2s[tcid - 1].rts_cache, -1, sizeof(sh2s[0].rts_cache));
|
||||
sh2s[tcid - 1].rts_cache_idx = 0;
|
||||
}
|
||||
}
|
||||
#if (DRC_DEBUG & 4)
|
||||
tcache_dsm_ptrs[tcid] = tcache_ring[tcid].base;
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ unsigned short scan_block(uint32_t base_pc, int is_slave,
|
|||
unsigned char *op_flags, uint32_t *end_pc,
|
||||
uint32_t *base_literals, uint32_t *end_literals);
|
||||
|
||||
#if defined(DRC_SH2) && defined(__GNUC__)
|
||||
#if defined(DRC_SH2) && defined(__GNUC__) && !defined(__clang__)
|
||||
// direct access to some host CPU registers used by the DRC if gcc is used.
|
||||
// XXX MUST match SHR_SR definitions in cpu/drc/emit_*.c; should be moved there
|
||||
// XXX yuck, there's no portable way to determine register size. Use long long
|
||||
|
|
|
@ -106,7 +106,11 @@ int sh2_execute_interpreter(SH2 *sh2c, int cycles);
|
|||
|
||||
static __inline void sh2_execute_prepare(SH2 *sh2, int use_drc)
|
||||
{
|
||||
#ifdef DRC_SH2
|
||||
sh2->run = use_drc ? sh2_execute_drc : sh2_execute_interpreter;
|
||||
#else
|
||||
sh2->run = sh2_execute_interpreter;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline int sh2_execute(SH2 *sh2, int cycles)
|
||||
|
|
|
@ -8,6 +8,20 @@ CC=${CC:-gcc}
|
|||
# endianess of target (automagically determined below)
|
||||
ENDIAN=
|
||||
|
||||
# don't do this if ELF format isn't used. it doesn't matter since offsets are
|
||||
# only needed for the asm parts (currently mips/arm32) and those have ELF
|
||||
check_elf ()
|
||||
{
|
||||
echo '#include <stdint.h>' >/tmp/getoffs.c
|
||||
echo "const int32_t val = 1;" >>/tmp/getoffs.c
|
||||
$CC $CFLAGS -I .. -c /tmp/getoffs.c -o /tmp/getoffs.o || exit 1
|
||||
if ! command -v readelf >/dev/null || ! file /tmp/getoffs.o | grep -q ELF; then
|
||||
echo "/* mkoffset.sh: no readelf or not ELF, offset table not created */" >$fn
|
||||
echo "WARNING: no readelf or not ELF, offset table not created"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# compile with target C compiler and extract value from .rodata section
|
||||
compile_rodata ()
|
||||
{
|
||||
|
@ -49,13 +63,7 @@ get_define () # prefix struct member member...
|
|||
fn="${1:-.}/pico_int_offs.h"
|
||||
if echo $CFLAGS | grep -qe -flto; then CFLAGS="$CFLAGS -fno-lto"; fi
|
||||
|
||||
# don't do this if readelf isn't available. it doesn't matter since offsets are
|
||||
# only needed for the asm parts (currently mips/arm32) and those have readelf
|
||||
if ! command -v readelf >/dev/null; then
|
||||
echo "/* mkoffset.sh: readelf not found, offset table not created */" >$fn
|
||||
echo "WARNING: readelf not found, offset table not created"
|
||||
exit
|
||||
fi
|
||||
check_elf
|
||||
# determine endianess
|
||||
echo '#include <stdint.h>' >/tmp/getoffs.c
|
||||
echo "const int32_t val = 1;" >>/tmp/getoffs.c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue