build fixes
authornotaz <notasas@gmail.com>
Mon, 23 Feb 2026 02:15:20 +0000 (04:15 +0200)
committernotaz <notasas@gmail.com>
Tue, 24 Feb 2026 00:10:41 +0000 (02:10 +0200)
Makefile
Makefile.libretro
libpcsxcore/lightrec/mem_wiiu.c
libpcsxcore/new_dynarec/emu_if.c
libpcsxcore/psxinterpreter.c

index 5e377d1..3975e3a 100644 (file)
--- 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
index 4dc2f0c..97813da 100644 (file)
@@ -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...
index 7cba547..83f1e11 100644 (file)
@@ -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);
index c13e982..d9f834d 100644 (file)
@@ -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
index 7f666e5..426e408 100644 (file)
@@ -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);
        }