From: notaz Date: Mon, 6 Jun 2022 20:53:38 +0000 (+0300) Subject: lightrec: try to clean up intergarion, fix -O0 X-Git-Tag: r24l~458 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70939d49a6625d10c64306451cfb1f64557e780e;p=pcsx_rearmed.git lightrec: try to clean up intergarion, fix -O0 notaz/pcsx_rearmed#251 --- diff --git a/Makefile b/Makefile index 616feeb9..66675ffc 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,6 @@ ifdef PCNT CFLAGS += -DPCNT endif -LIGHTREC_CUSTOM_MAP ?= 0 -CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) - # core OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/database.o \ libpcsxcore/decode_xa.o libpcsxcore/mdec.o \ @@ -93,6 +90,8 @@ libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull ifeq "$(DYNAREC)" "lightrec" CFLAGS += -Ideps/lightning/include -Ideps/lightrec -Iinclude/lightning -Iinclude/lightrec \ -DLIGHTREC -DLIGHTREC_STATIC +LIGHTREC_CUSTOM_MAP ?= 0 +CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) deps/lightning/lib/%.o: CFLAGS += -DHAVE_MMAP ifeq ($(LIGHTREC_CUSTOM_MAP),1) LDLIBS += -lrt diff --git a/libpcsxcore/lightrec/mem.h b/libpcsxcore/lightrec/mem.h index d747c174..98dbbdeb 100644 --- a/libpcsxcore/lightrec/mem.h +++ b/libpcsxcore/lightrec/mem.h @@ -6,6 +6,8 @@ #ifndef __LIGHTREC_MEM_H__ #define __LIGHTREC_MEM_H__ +#ifdef LIGHTREC + #define CODE_BUFFER_SIZE (8 * 1024 * 1024) extern void *code_buffer; @@ -13,4 +15,14 @@ extern void *code_buffer; int lightrec_init_mmap(void); void lightrec_free_mmap(void); +#else /* if !LIGHTREC */ + +#define lightrec_init_mmap() -1 /* should not be called */ +#define lightrec_free_mmap() + +#undef LIGHTREC_CUSTOM_MAP +#define LIGHTREC_CUSTOM_MAP 0 + +#endif + #endif /* __LIGHTREC_MEM_H__ */ diff --git a/libpcsxcore/lightrec/plugin.c b/libpcsxcore/lightrec/plugin.c index 00d9c558..b347bb63 100644 --- a/libpcsxcore/lightrec/plugin.c +++ b/libpcsxcore/lightrec/plugin.c @@ -16,6 +16,7 @@ #include "../frontend/main.h" #include "mem.h" +#include "plugin.h" #if (defined(__arm__) || defined(__aarch64__)) && !defined(ALLOW_LIGHTREC_ON_ARM) #error "Lightrec should not be used on ARM (please specify DYNAREC=ari64 to make)" diff --git a/libpcsxcore/lightrec/plugin.h b/libpcsxcore/lightrec/plugin.h new file mode 100644 index 00000000..ac4291a7 --- /dev/null +++ b/libpcsxcore/lightrec/plugin.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022 Paul Cercueil + */ + +#ifndef __LIGHTREC_PLUGIN_H__ +#define __LIGHTREC_PLUGIN_H__ + +#ifdef LIGHTREC + +#define drc_is_lightrec() 1 +void lightrec_plugin_prepare_save_state(void); +void lightrec_plugin_prepare_load_state(void); + +#else /* if !LIGHTREC */ + +#define drc_is_lightrec() 0 +#define lightrec_plugin_prepare_save_state() +#define lightrec_plugin_prepare_load_state() + +#endif + +#endif /* __LIGHTREC_PLUGIN_H__ */ + diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 94fac61e..fba1112d 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -28,6 +28,7 @@ #include "gpu.h" #include "ppf.h" #include "database.h" +#include "lightrec/plugin.h" #include char CdromId[10] = ""; @@ -603,15 +604,6 @@ static const char PcsxHeader[32] = "STv4 PCSX v" PCSX_VERSION; // If you make changes to the savestate version, please increment the value below. static const u32 SaveVersion = 0x8b410006; -static int drc_is_lightrec(void) -{ -#if defined(LIGHTREC) - return 1; -#else - return 0; -#endif -} - int SaveState(const char *file) { void *f; GPUFreeze_t *gpufP; diff --git a/libpcsxcore/r3000a.h b/libpcsxcore/r3000a.h index 0e21f518..2d7ad40d 100644 --- a/libpcsxcore/r3000a.h +++ b/libpcsxcore/r3000a.h @@ -204,9 +204,6 @@ extern psxRegisters psxRegs; extern u32 event_cycles[PSXINT_COUNT]; extern u32 next_interupt; -void lightrec_plugin_prepare_save_state(void); -void lightrec_plugin_prepare_load_state(void); - void new_dyna_before_save(void); void new_dyna_after_save(void); void new_dyna_freeze(void *f, int mode);