Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5656c92
ss/vdp2: fix opportunistic Fetch cache key (issue #71 regression)
LibretroAdmin May 17, 2026
c14e1e3
ss.cpp: convert BusRW_DB_* reference params to pointers (C-compat)
LibretroAdmin May 17, 2026
1c0d273
sh7095.h: delete 13 dead member-style decls inside SH7095 struct body
LibretroAdmin May 17, 2026
77ec9a0
Cleanups
LibretroAdmin May 17, 2026
26a7efc
ss.cpp: rename C-callable wrappers to disambiguate from sh7095.h decls
LibretroAdmin May 17, 2026
ec43074
scu: DSPS typedef + scu.inc:219 missing-`=` for C-compat init
LibretroAdmin May 17, 2026
99442d8
scu.inc: convert auto& / range-for / references to C-compat pointers
LibretroAdmin May 17, 2026
8f71e30
Buildfix
LibretroAdmin May 17, 2026
eff3af1
Remove unused headers
LibretroAdmin May 17, 2026
82a87bf
Cleanups
LibretroAdmin May 17, 2026
6633b9c
Get rid of unused math operations
LibretroAdmin May 17, 2026
c41840d
mednafen-types.h: MDFN_STATIC_ASSERT fallback uses __LINE__, not __CO…
LibretroAdmin May 17, 2026
172e38b
ss.cpp: include emuspec.h directly for EmulateSpecStruct typedef
LibretroAdmin May 17, 2026
98bbcc4
sh7095.inc: drop C++11 auto/constexpr keywords (C89/MSVC-89 compat)
LibretroAdmin May 17, 2026
009b6f8
scu.inc: gate three extern "C" { } blocks with #ifdef __cplusplus
LibretroAdmin May 17, 2026
099bbab
ss: rename ss.cpp -> ss.c, drop 22 extern "C" markers, move to SOURCES_C
LibretroAdmin May 17, 2026
2365033
sh7095s_rsu.inc: convert 4 C++11 typed enums to plain enums (C89/MSVC…
LibretroAdmin May 17, 2026
c2cd39d
mednafen-types.h: add MDFN_UNREACHABLE for portable dead-arm hints
LibretroAdmin May 17, 2026
0635542
sh7095: replace computed-goto resume dispatch with switch-based dispa…
LibretroAdmin May 17, 2026
e12c1b9
scu.inc: drop C++ default args on 15 bus-IO helpers; fix 18 callers
LibretroAdmin May 17, 2026
1f3e4e8
scu.inc: replace MDAP(DSP.DataRAM) with explicit C-compat cast
LibretroAdmin May 17, 2026
27751aa
sh7095.inc: add MSVC-C89 fallback path for RESUME_VAR type-check macro
LibretroAdmin May 17, 2026
765bfd5
scu/scu_dsp_*: drop redundant `extern` from 5 DSP_*FuncTable definitions
LibretroAdmin May 17, 2026
1c3a1a9
scu/sh7095: drop 6 dead local variables left over from source-fold pa…
LibretroAdmin May 17, 2026
cbc9414
scsp: name the Timers inner struct, retire 10 auto* in scsp.inc (C-co…
LibretroAdmin May 17, 2026
5dd3c84
scsp.inc: convert C++11 range-based-for at SCSP_StateAction tail to i…
LibretroAdmin May 17, 2026
44166cb
scsp.inc: convert 2 `uint16_t&` reference decls + 88 use sites to poi…
LibretroAdmin May 17, 2026
cf8425b
m68k.h: promote `BUS_INT_ACK_AUTO` enum from class scope to file scope
LibretroAdmin May 17, 2026
5cafd34
m68k: free-function `M68K_Construct(M68K*, bool)` alongside the M68K(…
LibretroAdmin May 17, 2026
78f4919
m68k: move the 10-fn M68K_* free-function API out-of-line with extern…
LibretroAdmin May 17, 2026
ef45c3f
m68k.h: gate class-method / template declarations behind `#ifdef __cp…
LibretroAdmin May 17, 2026
fd5bf98
sound_glue.cpp -> sound_glue.c: last .cpp in mednafen/ss/ retired
LibretroAdmin May 17, 2026
986a1bd
m68k: retire the now-dead M68K::M68K() ctor and M68K::~M68K() dtor
LibretroAdmin May 17, 2026
55216b2
m68k: inline M68K::SetIPL and M68K::SetExtHalted into their extern "C…
LibretroAdmin May 17, 2026
1d05025
m68k: retire gen.cpp and gen_split.cpp — build-time C++ generators no…
LibretroAdmin May 17, 2026
0ebf053
ss/sh7095: replace FRT tick loop with O(1) closed-form FRC update
pstef May 15, 2026
8fbb4a5
Initialize a64emit
pstef May 17, 2026
eb811d5
ss/scu: native aarch64 JIT translator for DSP slot dispatch
pstef May 10, 2026
a08973c
ss/scsp: native aarch64 JIT translator for MPROG
pstef May 13, 2026
e21829d
scsp,scu: emit perf jitdump records
pstef May 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,30 @@ ifeq (,$(findstring msvc,$(platform)))
CXXFLAGS += -MMD -MP
endif

# DSP JIT (SCU + SCSP MPROG): on by default. The aarch64 backend uses
# oaknut (C++20, header-only) via thin extern-"C" shims
# (scu_dsp_jit_oaknut.cpp / scsp_dsp_jit_oaknut.cpp); the JIT bodies
# themselves are C (scu_dsp_jit.c / scsp_dsp_jit.c). Source-level
# guards keep the JIT a no-op on non-aarch64 builds. A runtime
# libretro option (`beetle_saturn_jit`) further gates whether the
# compiled JIT code is dispatched. Pass WANT_JIT=0 to drop the JIT at
# compile time (slightly smaller binary, no oaknut dep).
WANT_JIT ?= 1
ifeq ($(WANT_JIT), 1)
CFLAGS += -DWANT_JIT
CXXFLAGS += -DWANT_JIT
endif
# SCU DSP JIT perf jitdump emitter: writes /tmp/jit-<pid>.dump in the
# Linux perf jitdump format so `perf inject --jit` can resolve [JIT] tid
# samples to per-slot symbols (dsp_<l|n>_pc<XX>_<kind>). Diagnostic
# only; the writer itself is cheap (one writev per compiled slot) but
# the dump file grows unbounded over long runs. Requires WANT_JIT=1.
ifeq ($(WANT_DSP_JIT_PERF_DUMP), 1)
CFLAGS += -DWANT_DSP_JIT_PERF_DUMP
endif
$(CORE_EMU_DIR)/scu_dsp_jit_oaknut.o: CXXFLAGS += -std=c++20 -I$(DEPS_DIR)/oaknut/include
$(CORE_EMU_DIR)/scsp_dsp_jit_oaknut.o: CXXFLAGS += -std=c++20 -I$(DEPS_DIR)/oaknut/include

OBJOUT = -o
LINKOUT = -o

Expand Down
32 changes: 20 additions & 12 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,20 @@ ifeq ($(NEED_TREMOR), 1)
FLAGS += -DNEED_TREMOR
endif

SOURCES_CXX += \
$(CORE_EMU_DIR)/sound_glue.cpp \
$(CORE_EMU_DIR)/ss.cpp

# sound.cpp -> sound.c + sound_glue.cpp. The orchestration half
# (SOUND_* public ABI, the SOUND_Update 32.32 fixed-point cycle
# loop, the SCSP IBuffer ring, the setjmp recovery point) moves
# to C; the C++ class instances (SS_SCSP SCSP, M68K SoundCPU),
# the eight M68K bus callbacks they need, and scsp.inc stay in
# the new sound_glue.cpp. The two halves exchange state through
# sound_internal.h: a handful of extern "C" SoundGlue_* wrappers
# around the M68K / SS_SCSP class methods sound.c needs, and four
SOURCES_C += $(CORE_EMU_DIR)/ss.c \
$(CORE_EMU_DIR)/sound_glue.c \
$(CORE_EMU_DIR)/scsp_dsp_jit.c \
$(CORE_EMU_DIR)/jitdump.c

# sound.cpp -> sound.c + sound_glue.cpp (Phase-6c) -> sound_glue.c
# (Phase-9). The orchestration half (SOUND_* public ABI, the
# SOUND_Update 32.32 fixed-point cycle loop, the SCSP IBuffer ring,
# the setjmp recovery point) lives in sound.c; the struct instances
# (SS_SCSP SCSP, M68K SoundCPU -- both retired from being C++
# class types), the eight M68K bus callbacks they need, and
# scsp.inc live in sound_glue.c. The two halves exchange state
# through sound_internal.h: a set of SoundGlue_* C-linkage wrappers
# around the M68K_* / SS_SCSP_* free-function APIs, and four
# extern symbols (SOUND_next_scsp_time, SOUND_jbuf, IBuffer,
# SOUND_IBufferCount) owned by sound.c that the glue side reads /
# writes during the bus-callback and RunSCSP paths.
Expand All @@ -90,6 +92,10 @@ SOURCES_CXX += \
# The STATE_MASK_* enum was hoisted out of `struct DSPS` to file
# scope so the same `STATE_MASK_EXECUTE` spelling compiles in
# both C and C++.
# scu_dsp_jit.c: the SCU DSP slot-dispatch JIT body lives in C
# (orchestration, emit_*, entry/exit stubs, looped-slot cache,
# perf jitdump writer). Instructions are emitted directly via the
# in-tree a64emit C library.

# db.cpp -> db.c. Dead std:: helpers (DB_GetInternalDB,
# DB_GetHHDescriptions, FDIDToString) were removed in an earlier
Expand Down Expand Up @@ -147,6 +153,8 @@ SOURCES_C += $(CORE_EMU_DIR)/db.c \
$(CORE_EMU_DIR)/scu_dsp_mvi.c \
$(CORE_EMU_DIR)/scu_dsp_jmp.c \
$(CORE_EMU_DIR)/scu_dsp_misc.c \
$(CORE_EMU_DIR)/scu_dsp_jit.c \
$(CORE_EMU_DIR)/a64emit.c \
$(CORE_EMU_DIR)/sound.c \
$(CORE_EMU_DIR)/ss_state.c \
$(CORE_EMU_DIR)/ss_init.c
Expand Down
20 changes: 20 additions & 0 deletions libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,26 @@ static void check_variables(bool startup)
cdimagecache = true;
}

var.key = "beetle_saturn_jit_scu";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
setting_jit_scu = false;
else
setting_jit_scu = true;
}

var.key = "beetle_saturn_jit_scsp";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
setting_jit_scsp = false;
else
setting_jit_scsp = true;
}

var.key = "beetle_saturn_shared_int";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
Expand Down
28 changes: 28 additions & 0 deletions libretro_core_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,34 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"disabled"
},
{
"beetle_saturn_jit_scu",
"SCU DSP JIT Binary Translator",
NULL,
"Use the native aarch64 JIT binary translator for the SCU DSP. Has no effect on non-aarch64 builds. Restart required.",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"enabled"
},
{
"beetle_saturn_jit_scsp",
"SCSP DSP JIT Binary Translator",
NULL,
"Use the native aarch64 JIT binary translator for the SCSP DSP (MPROG). Has no effect on non-aarch64 builds. Restart required.",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"enabled"
},
{
"beetle_saturn_initial_scanline",
"Initial Scanline",
Expand Down
2 changes: 2 additions & 0 deletions libretro_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ bool setting_multitap_port1;
bool setting_multitap_port2;
bool opposite_directions;
bool setting_midsync;
bool setting_jit_scu = true;
bool setting_jit_scsp = true;
4 changes: 3 additions & 1 deletion libretro_settings.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __LIBRETRO_SETTINGS_HDR__
#define __LIBRETRO_SETTINGS_HDR__

#include <stdbool.h>
#include <boolean.h>

enum
{
Expand Down Expand Up @@ -33,5 +33,7 @@ extern bool setting_multitap_port1;
extern bool setting_multitap_port2;
extern bool opposite_directions;
extern bool setting_midsync;
extern bool setting_jit_scu;
extern bool setting_jit_scsp;

#endif
4 changes: 1 addition & 3 deletions mednafen/emuspec.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#define __MDFN_EMUSPEC_H

#include <stdint.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
#include <boolean.h>

#include "video/surface.h"

Expand Down
58 changes: 0 additions & 58 deletions mednafen/git.h
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
#ifndef __MDFN_GIT_H
#define __MDFN_GIT_H

#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <libretro.h>

#include "video/surface.h"

#include "state.h"
#include "settings-common.h"

struct MemoryPatch;

struct CheatFormatStruct
{
const char *FullName; //"Game Genie", "GameShark", "Pro Action Catplay", etc.
const char *Description; // Whatever?

bool (*DecodeCheat)(const std::string& cheat_string, MemoryPatch* patch); // *patch should be left as initialized by MemoryPatch::MemoryPatch(), unless this is the
// second(or third or whatever) part of a multipart cheat.
//
// Will throw an std::exception(or derivative) on format error.
//
// Will return true if this is part of a multipart cheat.
};

MDFN_HIDE extern const std::vector<CheatFormatStruct> CheatFormatInfo_Empty;

struct CheatInfoStruct
{
//
// InstallReadPatch and RemoveReadPatches should be non-NULL(even if only pointing to dummy functions) if the emulator module supports
// read-substitution and read-substitution-with-compare style(IE Game Genie-style) cheats.
//
// See also "SubCheats" global stuff in mempatcher.h.
//
void (*InstallReadPatch)(uint32_t address, uint8_t value, int compare); // Compare is >= 0 when utilized.
void (*RemoveReadPatches)(void);
uint8_t (*MemRead)(uint32_t addr);
void (*MemWrite)(uint32_t addr, uint8_t val);

const std::vector<CheatFormatStruct>& CheatFormatInfo;

bool BigEndian; // UI default for cheat search and new cheats.
};

MDFN_HIDE extern const CheatInfoStruct CheatInfo_Empty;

/* EmulateSpecStruct now lives in mednafen/emuspec.h so it can be
included from C TUs (the libretro entry-point is converted to C
in the same commit that introduced emuspec.h). This include
Expand All @@ -58,24 +18,6 @@ MDFN_HIDE extern const CheatInfoStruct CheatInfo_Empty;
relying on those defaults now zero-init explicitly. */
#include "emuspec.h"

struct GameDB_Entry
{
std::string GameID;
bool GameIDIsHash = false;
std::string Name;
std::string Setting;
std::string Purpose;
};

struct GameDB_Database
{
std::string ShortName;
std::string FullName;
std::string Description;

std::vector<GameDB_Entry> Entries;
};

//===========================================

#include "mdfn_gameinfo.h"
Expand Down
Loading