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 \
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
#ifndef __LIGHTREC_MEM_H__
#define __LIGHTREC_MEM_H__
+#ifdef LIGHTREC
+
#define CODE_BUFFER_SIZE (8 * 1024 * 1024)
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__ */
#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)"
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2022 Paul Cercueil <paul@crapouillou.net>
+ */
+
+#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__ */
+
#include "gpu.h"
#include "ppf.h"
#include "database.h"
+#include "lightrec/plugin.h"
#include <zlib.h>
char CdromId[10] = "";
// 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;
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);