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 16, 2024
2 parents ee07de2 + 9cbce41 commit c784693
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 49 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,12 @@ target_: $(TARGET)

$(TARGET): $(OBJS)
ifeq ($(PARTIAL_LINKING), 1)
$(LD) -o $(basename $(TARGET))1.o -r --gc-sections $(addprefix -u , $(shell cat frontend/libretro-extern)) $^
$(OBJCOPY) --keep-global-symbols=frontend/libretro-extern $(basename $(TARGET))1.o $(basename $(TARGET)).o
$(LD) -o $(basename $(TARGET))1.o -r --gc-sections \
$(addprefix -u ,$(shell cat frontend/libretro-extern)) \
$(addprefix -u ,$(EXTRA_EXTERN_SYMS)) $^
$(OBJCOPY) --keep-global-symbols=frontend/libretro-extern \
$(addprefix -G ,$(EXTRA_EXTERN_SYMS)) \
$(basename $(TARGET))1.o $(basename $(TARGET)).o
$(AR) rcs $@ $(basename $(TARGET)).o
else ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $^
Expand Down
8 changes: 5 additions & 3 deletions Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ else ifeq ($(platform), vita)
CFLAGS += -DVITA
CFLAGS += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -marm
CFLAGS += -fsingle-precision-constant -mword-relocations -fno-unwind-tables
CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize -funroll-loops
CFLAGS += -fno-optimize-sibling-calls
CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize
#CFLAGS += -funroll-loops # ~280K bloat
#CFLAGS += -fno-optimize-sibling-calls # debug?
CFLAGS += -I$(VITASDK)/include -Ifrontend/vita
CFLAGS += -DNO_DYLIB
CFLAGS_LAST += -O3
Expand All @@ -344,9 +345,10 @@ else ifeq ($(platform), vita)
DYNAREC = ari64
ARCH = arm
PARTIAL_LINKING = 1
NO_PTHREAD=1
NO_MMAP := 1
NO_POSIX_MEMALIGN := 1
HAVE_PHYSICAL_CDROM = 0
EXTRA_EXTERN_SYMS += _newlib_vm_size_user

# CTR(3DS)
else ifeq ($(platform), ctr)
Expand Down
35 changes: 1 addition & 34 deletions frontend/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ static psx_map_t custom_psx_maps[] = {

static int init_vita_mmap()
{
int n;
void *tmpaddr;
addr = malloc(64 * 1024 * 1024);
if (addr == NULL)
Expand All @@ -587,6 +586,7 @@ static int init_vita_mmap()
custom_psx_maps[5].buffer = tmpaddr + 0x2000000;
memset(tmpaddr, 0, 0x2210000);
#if 0
int n;
for(n = 0; n < 5; n++){
sceClibPrintf("addr reserved %x\n",custom_psx_maps[n].buffer);
}
Expand Down Expand Up @@ -2457,31 +2457,6 @@ static void update_variables(bool in_flight)
}
#endif

#if 0 // currently disabled, see USE_READ_THREAD in libpcsxcore/cdriso.c
if (P_HAVE_PTHREAD) {
var.value = NULL;
var.key = "pcsx_rearmed_async_cd";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "async") == 0)
{
Config.AsyncCD = 1;
Config.CHD_Precache = 0;
}
else if (strcmp(var.value, "sync") == 0)
{
Config.AsyncCD = 0;
Config.CHD_Precache = 0;
}
else if (strcmp(var.value, "precache") == 0)
{
Config.AsyncCD = 0;
Config.CHD_Precache = 1;
}
}
}
#endif

var.value = NULL;
var.key = "pcsx_rearmed_noxadecoding";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
Expand Down Expand Up @@ -3703,14 +3678,6 @@ void retro_deinit(void)
update_audio_latency = false;
}

#ifdef VITA
#include <psp2/kernel/threadmgr.h>
int usleep(unsigned long us)
{
sceKernelDelayThread(us);
}
#endif

void SysPrintf(const char *fmt, ...)
{
va_list list;
Expand Down
5 changes: 3 additions & 2 deletions frontend/vita/sys/mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#define MMAN_H

#include <stdlib.h>
#include <stdio.h>
#include <psp2/kernel/sysmem.h>
//#include <psp2/kernel/sysmem.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -17,6 +16,7 @@ extern "C" {

#define MAP_FAILED ((void *)-1)

#if 0 // not used
static inline void* mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
(void)prot;
Expand Down Expand Up @@ -62,6 +62,7 @@ static inline int munmap(void *addr, size_t len)
return sceKernelFreeMemBlock(uid);

}
#endif

#ifdef __cplusplus
};
Expand Down
6 changes: 4 additions & 2 deletions libpcsxcore/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,16 @@ cycle_multiplier_overrides[] =
/* Syphon Filter - reportedly hangs under unknown conditions */
{ 169, { "SCUS94240" } },
/* Psychic Detective - some weird race condition in the game's cdrom code */
{ 222, { "SLUS00165", "SLUS00166", "SLUS00167" } },
{ 222, { "SLES00070", "SLES10070", "SLES20070" } },
{ 200, { "SLUS00165", "SLUS00166", "SLUS00167" } },
{ 200, { "SLES00070", "SLES10070", "SLES20070" } },
/* Vib-Ribbon - cd timing issues (PAL+ari64drc only?) */
{ 200, { "SCES02873" } },
/* Zero Divide - sometimes too fast */
{ 200, { "SLUS00183", "SLES00159", "SLPS00083", "SLPM80008" } },
/* Eagle One: Harrier Attack - hangs (but not in standalone build?) */
{ 153, { "SLUS00943" } },
/* Sol Divide: FMV timing */
{ 200, { "SLUS01519", "SCPS45260", "SLPS01463" } },
};

/* Function for automatic patching according to GameID. */
Expand Down
10 changes: 6 additions & 4 deletions libpcsxcore/mdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
*/

/*
* >= 10 for Galerians
* >= 14 for Sol Divide
* <= 18 for "Disney's Treasure Planet"
* Psychic Detective may break on *any* change
*/
#define MDEC_BIAS 10
#define MDEC_BIAS 14
#define MDEC_DELAY 1024

#define DSIZE 8
#define DSIZE2 (DSIZE * DSIZE)
Expand Down Expand Up @@ -654,9 +656,9 @@ void psxDma1(u32 adr, u32 bcr, u32 chcr) {
log_unhandled("mdec: bork\n");

/* define the power of mdec */
set_event(PSXINT_MDECOUTDMA, words * MDEC_BIAS);
set_event(PSXINT_MDECOUTDMA, words * MDEC_BIAS + MDEC_DELAY);
/* some CPU stalling */
psxRegs.cycle += words;
psxRegs.cycle += words * MDEC_BIAS / 4;
}

void mdec1Interrupt() {
Expand Down
3 changes: 1 addition & 2 deletions libpcsxcore/new_dynarec/new_dynarec.c
Original file line number Diff line number Diff line change
Expand Up @@ -6322,12 +6322,11 @@ void new_dynarec_init(void)
#ifdef VITA
sceBlock = getVMBlock(); //sceKernelAllocMemBlockForVM("code", sizeof(*ndrc));
if (sceBlock <= 0)
SysPrintf("sceKernelAllocMemBlockForVM failed: %x\n", sceBlock);
SysPrintf("getVMBlock failed: %x\n", sceBlock);
int ret = sceKernelGetMemBlockBase(sceBlock, (void **)&ndrc);
if (ret < 0)
SysPrintf("sceKernelGetMemBlockBase failed: %x\n", ret);
sceKernelOpenVMDomain();
sceClibPrintf("translation_cache = 0x%08lx\n ", (long)ndrc->translation_cache);
#elif defined(_MSC_VER)
ndrc = VirtualAlloc(NULL, sizeof(*ndrc), MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
Expand Down

0 comments on commit c784693

Please sign in to comment.