From: notaz Date: Mon, 23 Feb 2026 02:15:20 +0000 (+0200) Subject: build fixes X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe8bcf34b9fc8472dc979cadb0b24af240bd5efd;p=pcsx_rearmed.git build fixes --- diff --git a/Makefile b/Makefile index 5e377d1c..3975e3a8 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,9 @@ HAVE_CHD ?= 1 ifneq ($(DEBUG)$(DEBUG_SYMS), 00) CFLAGS += -ggdb endif +CFLAGS_OPT ?= -Ofast ifneq ($(DEBUG), 1) -CFLAGS += -Ofast +CFLAGS += $(CFLAGS_OPT) ifneq ($(ASSERTS), 1) CFLAGS += -DNDEBUG endif diff --git a/Makefile.libretro b/Makefile.libretro index 4dc2f0ce..97813dad 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -600,6 +600,7 @@ else ifeq ($(platform), emscripten) NO_MMAP = 1 # we can use -lz for emscripten's built-in zlib port WANT_ZLIB=0 + CFLAGS_OPT = -O2 CFLAGS += -DNO_DYLIB -DNO_SOCKET CFLAGS += -msimd128 -ftree-vectorize # when compiling with pthreads... diff --git a/libpcsxcore/lightrec/mem_wiiu.c b/libpcsxcore/lightrec/mem_wiiu.c index 7cba547f..83f1e114 100644 --- a/libpcsxcore/lightrec/mem_wiiu.c +++ b/libpcsxcore/lightrec/mem_wiiu.c @@ -68,18 +68,20 @@ int lightrec_init_mmap(void) { wiiu_unmap(avail_va + 0x200000 * i, 0x200000); goto cleanup_allocations; } - psxM = (void*)avail_va; + psxRegs.ptrs.psxM = (void*)avail_va; - psxP = wiiu_mmap(avail_va + 0x1f000000, 0x10000, psx_parallel); - psxH = wiiu_mmap(avail_va + 0x1f800000, 0x10000, psx_scratch); - psxR = wiiu_mmap(avail_va + 0x1fc00000, 0x80000, psx_bios); + psxRegs.ptrs.psxP = wiiu_mmap(avail_va + 0x1f000000, 0x10000, psx_parallel); + psxRegs.ptrs.psxH = wiiu_mmap(avail_va + 0x1f800000, 0x10000, psx_scratch); + psxRegs.ptrs.psxR = wiiu_mmap(avail_va + 0x1fc00000, 0x80000, psx_bios); - if (psxP == MAP_FAILED || psxH == MAP_FAILED || psxR == MAP_FAILED) { + if (psxRegs.ptrs.psxP == MAP_FAILED || psxRegs.ptrs.psxH == MAP_FAILED || + psxRegs.ptrs.psxR == MAP_FAILED) + { for (int i = 0; i < 4; i++) - wiiu_unmap(psxM + 0x200000 * i, 0x200000); - wiiu_unmap(psxP, 0x10000); - wiiu_unmap(psxH, 0x10000); - wiiu_unmap(psxR, 0x80000); + wiiu_unmap(psxRegs.ptrs.psxM + 0x200000 * i, 0x200000); + wiiu_unmap(psxRegs.ptrs.psxP, 0x10000); + wiiu_unmap(psxRegs.ptrs.psxH, 0x10000); + wiiu_unmap(psxRegs.ptrs.psxR, 0x80000); goto cleanup_allocations; } @@ -97,10 +99,10 @@ cleanup_allocations: void lightrec_free_mmap(void) { for (int i = 0; i < 4; i++) - wiiu_unmap(psxM + 0x200000 * i, 0x200000); - wiiu_unmap(psxP, 0x10000); - wiiu_unmap(psxH, 0x10000); - wiiu_unmap(psxR, 0x80000); + wiiu_unmap(psxRegs.ptrs.psxM + 0x200000 * i, 0x200000); + wiiu_unmap(psxRegs.ptrs.psxP, 0x10000); + wiiu_unmap(psxRegs.ptrs.psxH, 0x10000); + wiiu_unmap(psxRegs.ptrs.psxR, 0x80000); free(psx_mem); free(psx_parallel); free(psx_scratch); diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index c13e9825..d9f834dd 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -697,15 +697,15 @@ static u32 memcheck_read(u32 a) { if ((a >> 16) == 0x1f80) // scratchpad/IO - return *(u32 *)(psxH + (a & 0xfffc)); + return *(u32 *)(psxRegs.ptrs.psxH + (a & 0xfffc)); if ((a >> 16) == 0x1f00) // parallel - return *(u32 *)(psxP + (a & 0xfffc)); + return *(u32 *)(psxRegs.ptrs.psxP + (a & 0xfffc)); // if ((a & ~0xe0600000) < 0x200000) // RAM - return *(u32 *)(psxM + (a & 0x1ffffc)); + return *(u32 *)(psxRegs.ptrs.psxM + (a & 0x1ffffc)); } #if 0 @@ -761,8 +761,8 @@ void do_insn_trace(void) #if 0 if (psxRegs.cycle == 190230) { - dump_mem("/mnt/ntz/dev/pnd/tmp/psxram_i.dump", psxM, 0x200000); - dump_mem("/mnt/ntz/dev/pnd/tmp/psxregs_i.dump", psxH, 0x10000); + dump_mem("/mnt/ntz/dev/pnd/tmp/psxram_i.dump", psxRegs.ptrs.psxM, 0x200000); + dump_mem("/mnt/ntz/dev/pnd/tmp/psxregs_i.dump", psxRegs.ptrs.psxH, 0x10000); printf("dumped\n"); exit(1); } @@ -937,8 +937,8 @@ void do_insn_cmp(void) i+8, allregs_p[i+8], i+16, allregs_p[i+16], i+24, allregs_p[i+24]); printf("PC: %08x/%08x, cycle %u, next %u\n", psxRegs.pc, ppc, psxRegs.cycle, psxRegs.next_interupt); - //dump_mem("/tmp/psxram.dump", psxM, 0x200000); - //dump_mem("/mnt/ntz/dev/pnd/tmp/psxregs.dump", psxH, 0x10000); + //dump_mem("/tmp/psxram.dump", psxRegs.ptrs.psxM, 0x200000); + //dump_mem("/mnt/ntz/dev/pnd/tmp/psxregs.dump", psxRegs.ptrs.psxH, 0x10000); exit(1); ok: //psxRegs.cycle = rregs.cycle + 2; // sync timing diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index 7f666e57..426e408a 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -104,7 +104,7 @@ static void intException(psxRegisters *regs, u32 pc, u32 cause) { if (cause != 0x20) { //FILE *f = fopen("/tmp/psx_ram.bin", "wb"); - //fwrite(psxM, 1, 0x200000, f); fclose(f); + //fwrite(psxRegs.ptrs.psxM, 1, 0x200000, f); fclose(f); log_unhandled("exception %08x @%08x ra=%08x\n", cause, pc, regs->GPR.n.ra); }