Skip to content

Commit

Permalink
Merge branch 'master' into libretro
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz committed Dec 4, 2024
2 parents 568ad74 + 6baeda4 commit 07aa882
Show file tree
Hide file tree
Showing 23 changed files with 1,544 additions and 493 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
endif

# builtin gpu
OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o plugins/gpulib/prim.o
ifeq "$(BUILTIN_GPU)" "neon"
CFLAGS += -DGPU_NEON
OBJS += plugins/gpu_neon/psx_gpu_if.o
Expand Down Expand Up @@ -272,9 +272,12 @@ OBJS += plugins/gpu_unai/old/if.o
else
CFLAGS += -DGPU_UNAI_NO_OLD
endif
plugins/gpu_unai/gpulib_if.o: plugins/gpu_unai/*.h
plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -DUSE_GPULIB=1
ifneq ($(DEBUG), 1)
plugins/gpu_unai/gpulib_if.o \
plugins/gpu_unai/old/if.o: CFLAGS += -O3
endif
CC_LINK = $(CXX)
endif

Expand Down
1 change: 0 additions & 1 deletion Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ else ifeq ($(platform), ctr)
TARGET := $(TARGET_NAME)_libretro_ctr.a
CFLAGS += -DARM11 -D_3DS -D__3DS__
CFLAGS += -DGPU_UNAI_USE_FLOATMATH -DGPU_UNAI_USE_FLOAT_DIV_MULTINV
CFLAGS += -DGPU_UNAI_USE_FLOAT_DIV_MULTINV_FOR_ONE # needed on some compilers?
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
CFLAGS += -mword-relocations
CFLAGS += -fomit-frame-pointer
Expand Down
30 changes: 19 additions & 11 deletions frontend/cspace_arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@
orr \rn, r12, lsl #6
.endm

.macro bgr555_to_rgb565_one_i rn1 rn2
and r12, lr, \rn1, lsr #5
and \rn1,lr, \rn1, lsr #10
orr r12, r11, lsl #5
and r11, lr, \rn2
orr \rn1,r12, lsl #6
.endm

.macro pld_ reg offs=#0
#ifdef HAVE_ARMV6
pld [\reg, \offs]
#endif
.endm

FUNCTION(bgr555_to_rgb565): @ void *dst, const void *src, int bytes
pld_ r1
push {r4-r11,lr}
mov lr, #0x001f
subs r2, #4*8
Expand All @@ -43,16 +50,17 @@ FUNCTION(bgr555_to_rgb565): @ void *dst, const void *src, int bytes
0:
ldmia r1!, {r3-r10}
subs r2, #4*8
bgr555_to_rgb565_one r3

pld_ r1, #32*2
bgr555_to_rgb565_one r4
bgr555_to_rgb565_one r5
bgr555_to_rgb565_one r6
bgr555_to_rgb565_one r7
bgr555_to_rgb565_one r8
bgr555_to_rgb565_one r9
bgr555_to_rgb565_one r10
bic r12, r1, #0x1f
pld_ r12, #32*1
and r11, lr, r3
bgr555_to_rgb565_one_i r3 r4
bgr555_to_rgb565_one_i r4 r5
bgr555_to_rgb565_one_i r5 r6
bgr555_to_rgb565_one_i r6 r7
bgr555_to_rgb565_one_i r7 r8
bgr555_to_rgb565_one_i r8 r9
bgr555_to_rgb565_one_i r9 r10
bgr555_to_rgb565_one_i r10 r10
stmia r0!, {r3-r10}
bge 0b

Expand Down
2 changes: 2 additions & 0 deletions include/compiler_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#ifdef __GNUC__
# define likely(x) __builtin_expect((x),1)
# define unlikely(x) __builtin_expect((x),0)
# define preload __builtin_prefetch
# ifdef __clang__
# define noinline __attribute__((noinline))
# else
Expand All @@ -11,6 +12,7 @@
#else
# define likely(x) (x)
# define unlikely(x) (x)
# define preload (x)
# define noinline
# define attr_unused
#endif
Expand Down
57 changes: 20 additions & 37 deletions libpcsxcore/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ static const char * const fractional_Framerate_hack_db[] =
"SCUS94425", "SCES02104",
};

static const char * const f1_hack_db[] =
{
/* Formula One Arcade */
"SCES03886",
/* Formula One '99 */
"SLUS00870", "SCPS10101", "SCES01979", "SLES01979",
/* Formula One 2000 */
"SLUS01134", "SCES02777", "SCES02778", "SCES02779",
/* Formula One 2001 */
"SCES03404", "SCES03423", "SCES03424", "SCES03524",
};

#define HACK_ENTRY(var, list) \
{ #var, &Config.hacks.var, list, ARRAY_SIZE(list) }

Expand All @@ -100,6 +112,7 @@ hack_db[] =
HACK_ENTRY(gpu_timing1024, dualshock_timing1024_hack_db),
HACK_ENTRY(dualshock_init_analog, dualshock_init_analog_hack_db),
HACK_ENTRY(fractional_Framerate, fractional_Framerate_hack_db),
HACK_ENTRY(f1, f1_hack_db),
};

static const struct
Expand Down Expand Up @@ -142,35 +155,6 @@ cycle_multiplier_overrides[] =
{ 153, { "SLUS00943" } },
};

static const struct
{
const char * const id;
u32 hacks;
}
lightrec_hacks_db[] =
{
/* Formula One Arcade */
{ "SCES03886", LIGHTREC_HACK_INV_DMA_ONLY },

/* Formula One '99 */
{ "SLUS00870", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCPS10101", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES01979", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SLES01979", LIGHTREC_HACK_INV_DMA_ONLY },

/* Formula One 2000 */
{ "SLUS01134", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES02777", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES02778", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES02779", LIGHTREC_HACK_INV_DMA_ONLY },

/* Formula One 2001 */
{ "SCES03404", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES03423", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES03424", LIGHTREC_HACK_INV_DMA_ONLY },
{ "SCES03524", LIGHTREC_HACK_INV_DMA_ONLY },
};

/* Function for automatic patching according to GameID. */
void Apply_Hacks_Cdrom(void)
{
Expand Down Expand Up @@ -211,6 +195,8 @@ void Apply_Hacks_Cdrom(void)

/* Dynarec game-specific hacks */
ndrc_g.hacks_pergame = 0;
if (Config.hacks.f1)
ndrc_g.hacks_pergame |= NDHACK_THREAD_FORCE; // force without *_ON -> off
Config.cycle_multiplier_override = 0;

for (i = 0; i < ARRAY_SIZE(cycle_multiplier_overrides); i++)
Expand All @@ -229,15 +215,12 @@ void Apply_Hacks_Cdrom(void)
}
}

lightrec_hacks = 0;

for (i = 0; drc_is_lightrec() && i < ARRAY_SIZE(lightrec_hacks_db); i++) {
if (strcmp(CdromId, lightrec_hacks_db[i].id) == 0)
{
lightrec_hacks = lightrec_hacks_db[i].hacks;
if (drc_is_lightrec()) {
lightrec_hacks = 0;
if (Config.hacks.f1)
lightrec_hacks |= LIGHTREC_HACK_INV_DMA_ONLY;
if (lightrec_hacks)
SysPrintf("using lightrec_hacks: 0x%x\n", lightrec_hacks);
break;
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions libpcsxcore/new_dynarec/emu_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ static void ari64_apply_config()
else
ndrc_g.hacks &= ~NDHACK_NO_STALLS;

thread_changed = (ndrc_g.hacks ^ ndrc_g.hacks_old)
thread_changed = ((ndrc_g.hacks | ndrc_g.hacks_pergame) ^ ndrc_g.hacks_old)
& (NDHACK_THREAD_FORCE | NDHACK_THREAD_FORCE_ON);
if (Config.cycle_multiplier != ndrc_g.cycle_multiplier_old
|| ndrc_g.hacks != ndrc_g.hacks_old)
|| (ndrc_g.hacks | ndrc_g.hacks_pergame) != ndrc_g.hacks_old)
{
new_dynarec_clear_full();
}
Expand Down Expand Up @@ -485,7 +485,9 @@ static void ari64_thread_init(void)
{
int enable;

if (ndrc_g.hacks & NDHACK_THREAD_FORCE)
if (ndrc_g.hacks_pergame & NDHACK_THREAD_FORCE)
enable = 0;
else if (ndrc_g.hacks & NDHACK_THREAD_FORCE)
enable = ndrc_g.hacks & NDHACK_THREAD_FORCE_ON;
else {
u32 cpu_count = cpu_features_get_core_amount();
Expand Down
4 changes: 2 additions & 2 deletions libpcsxcore/new_dynarec/new_dynarec.c
Original file line number Diff line number Diff line change
Expand Up @@ -6292,13 +6292,13 @@ void new_dynarec_clear_full(void)
stat_clear(stat_links);

if (ndrc_g.cycle_multiplier_old != Config.cycle_multiplier
|| ndrc_g.hacks_old != ndrc_g.hacks)
|| ndrc_g.hacks_old != (ndrc_g.hacks | ndrc_g.hacks_pergame))
{
SysPrintf("ndrc config: mul=%d, ha=%x, pex=%d\n",
get_cycle_multiplier(), ndrc_g.hacks, Config.PreciseExceptions);
}
ndrc_g.cycle_multiplier_old = Config.cycle_multiplier;
ndrc_g.hacks_old = ndrc_g.hacks;
ndrc_g.hacks_old = ndrc_g.hacks | ndrc_g.hacks_pergame;
}

static int pgsize(void)
Expand Down
1 change: 1 addition & 0 deletions libpcsxcore/psxcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ typedef struct {
boolean dualshock_init_analog;
boolean gpu_timing1024;
boolean fractional_Framerate;
boolean f1;
} hacks;
} PcsxConfig;

Expand Down
Loading

0 comments on commit 07aa882

Please sign in to comment.