mirror of
https://github.com/FunKey-Project/gpsp_libretro.git
synced 2026-01-07 15:05:16 +01:00
initial funkey changes to compile
This commit is contained in:
parent
300d0c0028
commit
76ecae0961
63
Makefile
63
Makefile
@ -30,6 +30,8 @@ ifeq ($(platform),)
|
||||
endif
|
||||
endif
|
||||
|
||||
platform = funkey
|
||||
|
||||
|
||||
ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64)
|
||||
|
||||
@ -393,6 +395,67 @@ else ifeq ($(platform), gcw0)
|
||||
CFLAGS += -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
|
||||
USE_LIBCO = 0
|
||||
|
||||
# FunKey S
|
||||
else ifeq ($(platform), funkey)
|
||||
TARGET := $(TARGET_NAME)_libretro.so
|
||||
OD_TOOLCHAIN ?= /opt/FunKey-sdk-2.0.0/
|
||||
CC := $(OD_TOOLCHAIN)bin/arm-funkey-linux-musleabihf-gcc
|
||||
CXX := $(OD_TOOLCHAIN)bin/arm-funkey-linux-musleabihf-g++
|
||||
LD := $(OD_TOOLCHAIN)bin/arm-funkey-linux-musleabihf-gcc
|
||||
AR = $(OD_TOOLCHAIN)bin/arm-funkey-linux-musleabihf-ar
|
||||
|
||||
|
||||
# fpic := -fPIC
|
||||
# SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined -fPIC
|
||||
# #CFLAGS += -march=armv7-a+neon-vfpv4 -mtune=cortex-a7 -mfpu=neon-vfpv4 -Ofast -fno-PIC -fdata-sections -ffunction-sections -fsingle-precision-constant -fno-common -fno-builtin -DFUNKEY
|
||||
# CFLAGS += -Ofast \
|
||||
# -flto=4 -fwhole-program -fuse-linker-plugin \
|
||||
# -fdata-sections -ffunction-sections -Wl,--gc-sections \
|
||||
# -fno-stack-protector -fno-ident -fomit-frame-pointer \
|
||||
# -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
|
||||
# -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
|
||||
# -fmerge-all-constants -fno-math-errno \
|
||||
# -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7-a
|
||||
# # HAVE_NEON = 1
|
||||
# # ARCH = arm
|
||||
# # BUILTIN_GPU = neon
|
||||
# # HAVE_DYNAREC := 1
|
||||
# # CFLAGS += -DARM_MEMORY_DYNAREC
|
||||
# CFLAGS += -DARM -DARM_ARCH
|
||||
# # USE_LIBCO = 1
|
||||
# #LDFLAGS += -static-libgcc -static-libstdc++
|
||||
|
||||
pic := -fPIC
|
||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined -fPIC
|
||||
CFLAGS += -Ofast \
|
||||
-flto=4 -fwhole-program -fuse-linker-plugin \
|
||||
-fdata-sections -ffunction-sections -Wl,--gc-sections \
|
||||
-fno-stack-protector -fno-ident -fomit-frame-pointer \
|
||||
-falign-functions=1 -falign-jumps=1 -falign-loops=1 \
|
||||
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
|
||||
-fmerge-all-constants -fno-math-errno \
|
||||
-marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
|
||||
CXXFLAGS = $(CFLAGS) -std=gnu++11
|
||||
CPPFLAGS += $(CFLAGS)
|
||||
ASFLAGS += $(CFLAGS)
|
||||
HAVE_NEON = 1
|
||||
ARCH = arm
|
||||
BUILTIN_GPU = neon
|
||||
CPU_ARCH := arm
|
||||
HAVE_DYNAREC = 1
|
||||
USE_LIBCO = 0 ## IMPORTANT to be 0!
|
||||
CFLAGS += -DARM -DARM_ARCH
|
||||
CFLAGS += -DARM_MEMORY_DYNAREC
|
||||
ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
|
||||
CFLAGS += -march=armv7-a
|
||||
else
|
||||
CFLAGS += -march=armv7ve
|
||||
# If gcc is 5.0 or later
|
||||
ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
|
||||
LDFLAGS += -static-libgcc -static-libstdc++
|
||||
endif
|
||||
endif
|
||||
|
||||
# Windows
|
||||
else
|
||||
TARGET := $(TARGET_NAME)_libretro.dll
|
||||
|
||||
17
libretro.c
17
libretro.c
@ -48,7 +48,7 @@ static int translation_caches_inited = 0;
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH (512)
|
||||
#define MAX_PATH (1024)
|
||||
#endif
|
||||
|
||||
// 59.72750057 hz
|
||||
@ -848,15 +848,19 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
use_libretro_save_method = 0;
|
||||
check_variables(1);
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
set_input_descriptors();
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
#if defined(HAVE_DYNAREC)
|
||||
if (dynarec_enable)
|
||||
{
|
||||
#if defined(HAVE_MMAP)
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
rom_translation_cache = mmap(NULL, ROM_TRANSLATION_CACHE_SIZE,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
ram_translation_cache = mmap(NULL, RAM_TRANSLATION_CACHE_SIZE,
|
||||
@ -864,6 +868,7 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
bios_translation_cache = mmap(NULL, BIOS_TRANSLATION_CACHE_SIZE,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
rom_translation_ptr = rom_translation_cache;
|
||||
ram_translation_ptr = ram_translation_cache;
|
||||
bios_translation_ptr = bios_translation_cache;
|
||||
@ -885,6 +890,7 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
dynarec_enable = 0;
|
||||
#endif
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
char filename_bios[MAX_PATH];
|
||||
const char* dir = NULL;
|
||||
|
||||
@ -894,6 +900,7 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
|
||||
extract_directory(main_path, info->path, sizeof(main_path));
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir)
|
||||
strncpy(filename_bios, dir, sizeof(filename_bios));
|
||||
else
|
||||
@ -901,6 +908,7 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
|
||||
strncat(filename_bios, "/gba_bios.bin", sizeof(filename_bios));
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &dir) && dir)
|
||||
strncpy(save_path, dir, sizeof(save_path));
|
||||
@ -909,10 +917,12 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
|
||||
if (load_bios(filename_bios) != 0)
|
||||
{
|
||||
printf("Could not load BIOS: %s\n", filename_bios);
|
||||
error_msg("Could not load BIOS image file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
if (bios_rom[0] != 0x18)
|
||||
{
|
||||
info_msg("You have an incorrect BIOS image.");
|
||||
@ -920,6 +930,7 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
info_msg("It is strongly recommended that you obtain the correct BIOS file.");
|
||||
}
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
memset(gamepak_backup, -1, sizeof(gamepak_backup));
|
||||
gamepak_filename[0] = 0;
|
||||
if (load_gamepak(info, info->path) != 0)
|
||||
@ -927,13 +938,17 @@ bool retro_load_game(const struct retro_game_info* info)
|
||||
error_msg("Could not load the game file.");
|
||||
return false;
|
||||
}
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
|
||||
reset_gba();
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
init_context_switch();
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
set_memory_descriptors();
|
||||
|
||||
printf("in %s l.%d\n", __func__, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user