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
#ifdef HAVE_CHD
static int handlechd(const char *isofile) {
+ int frame_offset = 150;
+ int file_offset = 0;
+
chd_img = calloc(1, sizeof(*chd_img));
if (chd_img == NULL)
goto fail_io;
cddaBigEndian = TRUE;
numtracks = 0;
- int frame_offset = 0;
- int file_offset = 0;
memset(ti, 0, sizeof(ti));
while (1)
SysPrintf("chd: %s\n", meta);
if (md.track == 1) {
- md.pregap = 150;
if (!strncmp(md.subtype, "RW", 2)) {
subChanMixed = TRUE;
if (!strcmp(md.subtype, "RW_RAW"))
subChanRaw = TRUE;
}
}
- else
- sec2msf(msf2sec(ti[md.track-1].length) + md.pregap, ti[md.track-1].length);
ti[md.track].type = !strncmp(md.type, "AUDIO", 5) ? CDDA : DATA;
sec2msf(frame_offset + md.pregap, ti[md.track].start);
sec2msf(md.frames, ti[md.track].length);
- ti[md.track].start_offset = file_offset;
+ ti[md.track].start_offset = file_offset + md.pregap;
- frame_offset += md.pregap + md.frames + md.postgap;
- file_offset += md.frames + md.postgap;
+ // XXX: what about postgap?
+ frame_offset += md.frames;
+ file_offset += md.frames;
numtracks++;
}
ReadTrack(cdr.SetSectorPlay);
cdr.TrackChanged = FALSE;
+ StopReading();
if (!Config.Cdda)
CDR_play();
#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;
//mem the vibration value for Large motor;
pad[port].Vib[1] = value;
- if (in_type[port] == PSE_PAD_TYPE_STANDARD &&
- in_type[port] == PSE_PAD_TYPE_NEGCON)
+ if (in_type[port] != PSE_PAD_TYPE_ANALOGPAD)
break;
//vibration
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);