Add HAVE_DYNAREC ifdef
This commit is contained in:
parent
512f7f5b27
commit
51d78afa09
5
Makefile
5
Makefile
|
@ -48,6 +48,7 @@ ifeq ($(platform), unix)
|
|||
fpic := -fPIC
|
||||
FORCE_32BIT := -m32
|
||||
CPU_ARCH := x86_32
|
||||
HAVE_DYNAREC := 1
|
||||
SHARED := -shared $(FORCE_32BIT) -Wl,--version-script=link.T
|
||||
ifneq ($(findstring Haiku,$(shell uname -a)),)
|
||||
LIBM :=
|
||||
|
@ -215,6 +216,10 @@ OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_ASM:.S=.o)
|
|||
|
||||
DEFINES = -DHAVE_STRINGS_H -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DINLINE=inline -DPC_BUILD -Wall -Werror=implicit-function-declaration
|
||||
|
||||
ifeq ($(HAVE_DYNAREC), 1)
|
||||
DEFINES += -DHAVE_DYNAREC
|
||||
endif
|
||||
|
||||
ifeq ($(CPU_ARCH), arm)
|
||||
DEFINES += -DARM_ARCH
|
||||
endif
|
||||
|
|
|
@ -18,6 +18,8 @@ SOURCES_C := $(CORE_DIR)/main.c \
|
|||
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_DYNAREC), 1)
|
||||
|
||||
ifeq ($(CPU_ARCH), x86_32)
|
||||
SOURCES_ASM += $(CORE_DIR)/x86/x86_stub.S
|
||||
endif
|
||||
|
@ -27,4 +29,6 @@ SOURCES_ASM += $(CORE_DIR)/arm/arm_stub.S \
|
|||
$(CORE_DIR)/arm/video_blend.S
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
INCFLAGS := -I$(CORE_DIR)
|
||||
|
|
5
cpu.c
5
cpu.c
|
@ -4054,6 +4054,11 @@ void raise_interrupt(irq_type irq_raised)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_DYNAREC
|
||||
u8 *memory_map_read [8 * 1024];
|
||||
u8 *memory_map_write[8 * 1024];
|
||||
#endif
|
||||
|
||||
void execute_arm(u32 cycles)
|
||||
{
|
||||
u32 pc = reg[REG_PC];
|
||||
|
|
|
@ -48,11 +48,13 @@ u32 ewram_code_max = 0xFFFFFFFF;
|
|||
u32 *rom_branch_hash[ROM_BRANCH_HASH_SIZE];
|
||||
|
||||
// Default
|
||||
#ifdef HAVE_DYNAREC
|
||||
u32 idle_loop_target_pc = 0xFFFFFFFF;
|
||||
u32 iwram_stack_optimize = 1;
|
||||
#endif
|
||||
u32 force_pc_update_target = 0xFFFFFFFF;
|
||||
u32 translation_gate_target_pc[MAX_TRANSLATION_GATES];
|
||||
u32 translation_gate_targets = 0;
|
||||
u32 iwram_stack_optimize = 1;
|
||||
u32 allow_smc_ram_u8 = 1;
|
||||
u32 allow_smc_ram_u16 = 1;
|
||||
u32 allow_smc_ram_u32 = 1;
|
||||
|
|
|
@ -2280,6 +2280,8 @@ s32 load_game_config(char *gamepak_title, char *gamepak_code, char *gamepak_make
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (dynarec_enable)
|
||||
{
|
||||
if(!strcmp(current_variable, "idle_loop_eliminate_target"))
|
||||
idle_loop_target_pc = strtol(current_value, NULL, 16);
|
||||
|
||||
|
@ -2298,6 +2300,7 @@ s32 load_game_config(char *gamepak_title, char *gamepak_code, char *gamepak_make
|
|||
{
|
||||
iwram_stack_optimize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(!strcmp(current_variable, "flash_rom_type") &&
|
||||
!strcmp(current_value, "128KB"))
|
||||
|
@ -3381,9 +3384,12 @@ void gba_load_state(const void* src)
|
|||
state_mem_read_ptr = src;
|
||||
savestate_block(read);
|
||||
|
||||
if (dynarec_enable)
|
||||
{
|
||||
flush_translation_cache_ram();
|
||||
flush_translation_cache_rom();
|
||||
flush_translation_cache_bios();
|
||||
}
|
||||
|
||||
oam_update = 1;
|
||||
gbc_sound_update = 1;
|
||||
|
|
|
@ -9,11 +9,13 @@ ifeq ($(TARGET_ARCH),arm)
|
|||
LOCAL_CFLAGS += -DANDROID_ARM -DARM_ARCH
|
||||
LOCAL_ARM_MODE := arm
|
||||
CPU_ARCH := arm
|
||||
HAVE_DYNAREC := 1
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_CFLAGS += -DANDROID_X86
|
||||
CPU_ARCH := x86_32
|
||||
HAVE_DYNAREC := 1
|
||||
endif
|
||||
|
||||
#ifeq ($(TARGET_ARCH),mips)
|
||||
|
|
14
libretro.c
14
libretro.c
|
@ -20,6 +20,7 @@ struct retro_perf_callback perf_cb;
|
|||
|
||||
static cothread_t main_thread;
|
||||
static cothread_t cpu_thread;
|
||||
int dynarec_enable;
|
||||
|
||||
void switch_to_main_thread(void)
|
||||
{
|
||||
|
@ -33,7 +34,10 @@ static inline void switch_to_cpu_thread(void)
|
|||
|
||||
static void cpu_thread_entry(void)
|
||||
{
|
||||
#ifdef HAVE_DYNAREC
|
||||
if (dynarec_enable)
|
||||
execute_arm_translate(execute_cycles);
|
||||
#endif
|
||||
execute_arm(execute_cycles);
|
||||
}
|
||||
|
||||
|
@ -97,7 +101,10 @@ void retro_init()
|
|||
init_gamepak_buffer();
|
||||
init_sound(1);
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#if defined(HAVE_DYNAREC)
|
||||
dynarec_enable = 1;
|
||||
#if defined(HAVE_MMAP)
|
||||
|
||||
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,
|
||||
|
@ -109,6 +116,9 @@ void retro_init()
|
|||
ram_translation_ptr = ram_translation_cache;
|
||||
bios_translation_ptr = bios_translation_cache;
|
||||
#endif
|
||||
#else
|
||||
dynarec_enable = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void retro_deinit()
|
||||
|
@ -116,7 +126,7 @@ void retro_deinit()
|
|||
perf_cb.perf_log();
|
||||
memory_term();
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_DYNAREC)
|
||||
munmap(rom_translation_cache, ROM_TRANSLATION_CACHE_SIZE);
|
||||
munmap(ram_translation_cache, RAM_TRANSLATION_CACHE_SIZE);
|
||||
munmap(bios_translation_cache, BIOS_TRANSLATION_CACHE_SIZE);
|
||||
|
|
2
main.c
2
main.c
|
@ -117,9 +117,11 @@ void init_main(void)
|
|||
execute_cycles = 960;
|
||||
video_count = 960;
|
||||
|
||||
#ifdef HAVE_DYNAREC
|
||||
flush_translation_cache_rom();
|
||||
flush_translation_cache_ram();
|
||||
flush_translation_cache_bios();
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 no_alpha = 0;
|
||||
|
|
Loading…
Reference in New Issue