Files
parallel-ps2/Makefile.common
libretroadmin 80c1251d80 SPR: the scratchpad DMA channels in C89
SPR.cpp becomes C. Hw.cpp's MFIFO entry points and vucpu_execute_block
get C linkage, THREAD_VU1 is asked through emu_config_thread_vu1(), and
VU.h and VUmicro.h lose their // comments, which a C89 lane read into
vu1RunCycles.

Copies between the scratchpad and memory now stay inside what they
address: a run past the end of main RAM reads on from the zero source,
one through VU0's 4 KiB windows mirrors instead of running into VU1, the
scratchpad's own window wraps, the scratchpad copied onto itself goes
front to back, interleave transfers to or from a bus error no longer
copy through NULL, and a source-chain tag at a bus error raises BEIS and
stops the channel instead of being read through NULL. tests/eespr replays
both channels against the transcript the C++ made and checks each of
these.
2026-11-09 04:22:07 +01:00

714 lines
27 KiB
Makefile

SOURCES_CXX :=
SOURCES_C :=
SOURCES_CC :=
SOURCES_ASM :=
# ----------------------------------------------------------------------------
# Directories
# ----------------------------------------------------------------------------
DEPS_DIR := $(CORE_DIR)/3rdparty
LIBRETRO_DIR := $(CORE_DIR)/libretro
LIBRETRO_COMM_DIR := $(LIBRETRO_DIR)/libretro-common
COMMON_DIR := $(CORE_DIR)/common
LRPS2_DIR := $(CORE_DIR)/pcsx2
PGS_DIR := $(LRPS2_DIR)/GS/parallel-gs
GRANITE_DIR := $(PGS_DIR)/Granite
# ----------------------------------------------------------------------------
# Include flags
# ----------------------------------------------------------------------------
# Mirrors what the cmake LIBRETRO=ON build resolves to for pcsx2_libretro/PCSX2/
# common targets. Order matters: project headers first, then 3rdparty.
INCFLAGS := \
-I$(CORE_DIR) \
-I$(LRPS2_DIR) \
-I$(LRPS2_DIR)/x86 \
-I$(COMMON_DIR) \
-I$(COMMON_DIR)/include \
-I$(LIBRETRO_DIR) \
-I$(LIBRETRO_COMM_DIR)/include \
-I$(DEPS_DIR) \
-I$(DEPS_DIR)/include \
-I$(DEPS_DIR)/xbyak \
ifeq ($(HAVE_OPENGL), 1)
INCFLAGS += -I$(DEPS_DIR)/glad/include
endif
ifeq ($(HAVE_VULKAN), 1)
INCFLAGS += \
-I$(DEPS_DIR)/vulkan-headers/include \
-I$(GRANITE_DIR)/util \
-I$(GRANITE_DIR)/vulkan \
-I$(GRANITE_DIR)/application/global \
-I$(GRANITE_DIR)/third_party/volk \
-I$(PGS_DIR)/gs
endif
# ----------------------------------------------------------------------------
# Defines mirroring cmake's LIBRETRO=ON Windows build
# ----------------------------------------------------------------------------
ifeq ($(HAVE_OPENGL), 1)
ifeq ($(GLES3), 1)
FLAGS += -DHAVE_OPENGLES -DHAVE_OPENGLES3 -DENABLE_OPENGL
else ifeq ($(GLES), 1)
FLAGS += -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DENABLE_OPENGL
else
FLAGS += -DHAVE_OPENGL -DCORE -DENABLE_OPENGL
endif
endif
ifeq ($(HAVE_VULKAN), 1)
FLAGS += -DHAVE_VULKAN -DENABLE_VULKAN -DHAVE_PARALLEL_GS \
-DGRANITE_SHIPPING
endif
ifeq ($(NEED_THREADING), 1)
FLAGS += -DWANT_THREADING -DHAVE_THREADS
endif
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
FLAGS += -DFRONTEND_SUPPORTS_RGB565
endif
# ----------------------------------------------------------------------------
# AArch64 (arm64) recompiler backend (PR #143)
# ----------------------------------------------------------------------------
# VIXL is the AArch64 code emitter (aarch64 target only). The arm64 recompiler
# TUs include its headers, so its include dir and the two VIXL config defines
# must be visible to the whole core, not just the VIXL objects -- cmake sets
# them PUBLIC on the vixl target for exactly this reason.
ifeq ($(IS_ARM64), 1)
INCFLAGS += -I$(DEPS_DIR)/vixl/src
FLAGS += -D_ARCH_64=1 \
-DVIXL_INCLUDE_TARGET_AARCH64
# The staging buffer grows via mremap() on Linux; Darwin has no mremap,
# so it uses VIXL's realloc backend there, same as upstream VIXL on Mac.
ifneq (,$(filter osx ios% tvos%,$(platform)))
FLAGS += -DVIXL_CODE_BUFFER_MALLOC
else
FLAGS += -DVIXL_CODE_BUFFER_MMAP
endif
endif
CFLAGS += $(FLAGS)
CXXFLAGS += $(FLAGS)
# ============================================================================
# libretro-common (C)
# ============================================================================
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/HW/GSObjectPool.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSFlatMap.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSStableMap.c \
$(LRPS2_DIR)/GS/GSPage2Tile.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSHiresMem.c \
$(LRPS2_DIR)/GS/Renderers/HW/GSHashTable.c \
$(LRPS2_DIR)/GS/Renderers/HW/GSSpriteSnap.c \
$(LRPS2_DIR)/GS/Renderers/HW/GSTargetBudget.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSStableGroup.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSRetireRing.c \
$(LRPS2_DIR)/USB/libretro-usb/ohci_dma.c \
$(LRPS2_DIR)/memcard_ecc.c \
$(LRPS2_DIR)/CDVD/CDVDnvram.c \
$(LRPS2_DIR)/CDVD/MechaMg.c \
$(LRPS2_DIR)/CDVD/MgDes.c \
$(LRPS2_DIR)/CDVD/CDVDisoReader.c \
$(LRPS2_DIR)/CDVD/cdvd_reader.c \
$(LRPS2_DIR)/CDVD/cdvd_flat.c \
$(LRPS2_DIR)/CDVD/cdvd_cso.c \
$(LRPS2_DIR)/CDVD/cdvd_chd.c \
$(LRPS2_DIR)/CDVD/cdvd_gz.c \
$(LRPS2_DIR)/CDVD/cdvd_iso.c \
$(LRPS2_DIR)/CDVD/CDVD.c \
$(LRPS2_DIR)/CDVD/CDVDcommon.c \
$(LRPS2_DIR)/CDVD/Ps1CD.c \
$(LRPS2_DIR)/CDVD/IsoFS/iso9660.c \
$(LRPS2_DIR)/CDVD/IsoFS/IsoFSCDVD.c \
$(LRPS2_DIR)/Elfheader.c \
$(LRPS2_DIR)/NearPlace.c \
$(LRPS2_DIR)/Memory.c \
$(LRPS2_DIR)/VirtualMemory.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSCodeReserve.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSScratch.c \
$(LRPS2_DIR)/GS/Renderers/DX12/GSD3D12Heap.c \
$(LRPS2_DIR)/GS/Renderers/DX12/GSD3D12Warm.c \
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
$(LIBRETRO_COMM_DIR)/compat/compat_fnmatch.c \
$(LIBRETRO_COMM_DIR)/file/retro_dirent.c \
$(LIBRETRO_COMM_DIR)/features/features_cpu.c \
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/file/file_path.c \
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
$(LIBRETRO_COMM_DIR)/string/rstrtod.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
$(LIBRETRO_COMM_DIR)/time/rtime.c \
$(LIBRETRO_COMM_DIR)/memmap/memmap.c \
$(LIBRETRO_COMM_DIR)/memmap/memalign.c \
$(LIBRETRO_COMM_DIR)/fastjmp/fastjmp.c \
$(LIBRETRO_COMM_DIR)/faulthandler/faulthandler.c \
$(LIBRETRO_COMM_DIR)/formats/dds/rdds.c \
$(LIBRETRO_COMM_DIR)/rthreads/rthreads.c \
$(LIBRETRO_COMM_DIR)/rthreads/retro_eventcount.c \
$(LIBRETRO_COMM_DIR)/rthreads/retro_procbarrier.c \
$(LIBRETRO_COMM_DIR)/rthreads/retro_asym_eventcount.c \
$(LIBRETRO_COMM_DIR)/queues/retro_spsc.c \
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c
# bionic only declares getifaddrs()/freeifaddrs() from API 24 on, so DEV9
# uses libretro-common's netlink reimplementation there instead. WANT_IFADDRS
# is what redirects the DEV9 includes to <compat/ifaddrs.h>. Every other
# platform has the pair in libc and must not compile this object, or it would
# override libc's. Keep in step with libretro/CMakeLists.txt and
# pcsx2/CMakeLists.txt.
ifneq (,$(findstring android,$(platform)))
FLAGS += -DWANT_IFADDRS
SOURCES_C += $(LIBRETRO_COMM_DIR)/compat/compat_ifaddrs.c
endif
# ============================================================================
# libretro core entry points (C++)
# ============================================================================
SOURCES_C += \
$(LIBRETRO_DIR)/audio_queue.c \
$(LIBRETRO_DIR)/state_ext.c \
$(LIBRETRO_DIR)/USB.c
SOURCES_CXX += \
$(LIBRETRO_DIR)/main.cpp \
$(LIBRETRO_DIR)/patches.cpp
# ============================================================================
# DEV9 (SPEED expansion: ethernet + ATA hard drive)
# ============================================================================
# The pcap backend is opt-in: it hard-links libpcap on POSIX, and the
# Sockets api covers ethernet without any system dependency.
SOURCES_CXX += \
$(LRPS2_DIR)/DEV9/AdapterUtils.cpp \
$(LRPS2_DIR)/DEV9/DEV9.cpp \
$(LRPS2_DIR)/DEV9/flash.cpp \
$(LRPS2_DIR)/DEV9/net.cpp \
$(LRPS2_DIR)/DEV9/smap.cpp \
$(LRPS2_DIR)/DEV9/sockets.cpp \
$(LRPS2_DIR)/DEV9/InternalServers/DHCP_Server.cpp \
$(LRPS2_DIR)/DEV9/InternalServers/DNS_Logger.cpp \
$(LRPS2_DIR)/DEV9/InternalServers/DNS_Server.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/EthernetFrame.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/EthernetFrameEditor.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/ARP/ARP_Packet.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/ARP/ARP_PacketEditor.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/IP_Options.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/IP_Packet.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/ICMP/ICMP_Packet.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/TCP/TCP_Options.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/TCP/TCP_Packet.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/UDP/UDP_Packet.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/UDP/DHCP/DHCP_Options.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/UDP/DHCP/DHCP_Packet.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/UDP/DNS/DNS_Classes.cpp \
$(LRPS2_DIR)/DEV9/PacketReader/IP/UDP/DNS/DNS_Packet.cpp \
$(LRPS2_DIR)/DEV9/Sessions/BaseSession.cpp \
$(LRPS2_DIR)/DEV9/Sessions/ICMP_Session/ICMP_Session.cpp \
$(LRPS2_DIR)/DEV9/Sessions/TCP_Session/TCP_Session.cpp \
$(LRPS2_DIR)/DEV9/Sessions/TCP_Session/TCP_Session_In.cpp \
$(LRPS2_DIR)/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp \
$(LRPS2_DIR)/DEV9/Sessions/UDP_Session/UDP_FixedPort.cpp \
$(LRPS2_DIR)/DEV9/Sessions/UDP_Session/UDP_Session.cpp
SOURCES_C += \
$(LRPS2_DIR)/DEV9/ATA/ATA_Info.c \
$(LRPS2_DIR)/DEV9/ATA/ATA_State.c \
$(LRPS2_DIR)/DEV9/ATA/ATA_Transfer.c \
$(LRPS2_DIR)/DEV9/ATA/HddCreate.c \
$(LRPS2_DIR)/DEV9/ATA/HddImage.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_Command.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_CmdDMA.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_CmdExecuteDeviceDiag.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_CmdNoData.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_CmdPIOData.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_CmdSMART.c \
$(LRPS2_DIR)/DEV9/ATA/Commands/ATA_SCE.c
SOURCES_C += \
$(LRPS2_DIR)/ps2float.c \
$(LRPS2_DIR)/IopGte.c \
$(LRPS2_DIR)/COP2.c \
$(LRPS2_DIR)/Sif.c \
$(LRPS2_DIR)/Sif0.c \
$(LRPS2_DIR)/Sif1.c \
$(LRPS2_DIR)/sif2.c \
$(LRPS2_DIR)/DmacChannel.c \
$(LRPS2_DIR)/SPR.c \
$(LRPS2_DIR)/SaveStateBase.c \
$(LRPS2_DIR)/SaveStateFreeze.c
ifeq ($(HAVE_PCAP), 1)
SOURCES_CXX += $(LRPS2_DIR)/DEV9/pcap_io.cpp
endif
# ============================================================================
# common
# ============================================================================
SOURCES_C += \
$(LRPS2_DIR)/HostFS.c \
# common/emitter is the x86-only JIT code emitter. On aarch64 the recompilers
# that use it are gated out (VIXL is the arm64 emitter instead), so exclude it
# stays on both (it has an __aarch64__ path).
# The reference emitter implementation lives with the verification harness in
# tests/emitter/reference: it is what the byte oracles compare the C89 core
# against. The switched build (C89_EMITTER=1) emits everything through the
# header-only core in common/emitter/c89emit.h and compiles none of these.
ifneq ($(IS_ARM64), 1)
ifneq ($(C89_EMITTER), 1)
SOURCES_CXX += \
$(CORE_DIR)/tests/emitter/reference/avx.cpp \
$(CORE_DIR)/tests/emitter/reference/groups.cpp \
$(CORE_DIR)/tests/emitter/reference/jmp.cpp \
$(CORE_DIR)/tests/emitter/reference/legacy.cpp \
$(CORE_DIR)/tests/emitter/reference/legacy_sse.cpp \
$(CORE_DIR)/tests/emitter/reference/movs.cpp \
$(CORE_DIR)/tests/emitter/reference/simd.cpp \
$(CORE_DIR)/tests/emitter/reference/x86emitter.cpp
endif
endif
# ============================================================================
# pcsx2 core - emulation
# ============================================================================
SOURCES_CXX += \
$(LRPS2_DIR)/FormatString.cpp \
$(LRPS2_DIR)/Cache.cpp \
$(LRPS2_DIR)/COP0.cpp \
$(LRPS2_DIR)/Counters.cpp \
$(LRPS2_DIR)/Dmac.cpp \
$(LRPS2_DIR)/FiFo.cpp \
$(LRPS2_DIR)/FPU.cpp \
$(LRPS2_DIR)/GameDatabase.cpp \
$(LRPS2_DIR)/GameDatabaseBuiltin.cpp \
$(LRPS2_DIR)/Gif.cpp \
$(LRPS2_DIR)/Gif_Unit.cpp \
$(LRPS2_DIR)/GS.cpp \
$(LRPS2_DIR)/Hw.cpp \
$(LRPS2_DIR)/Interpreter.cpp \
$(LRPS2_DIR)/MMI.cpp \
$(LRPS2_DIR)/MTGS.cpp \
$(LRPS2_DIR)/MTVU.cpp \
$(LRPS2_DIR)/Patch.cpp \
$(LRPS2_DIR)/Pcsx2Config.cpp \
$(LRPS2_DIR)/PerformanceMetrics.cpp \
$(LRPS2_DIR)/R5900.cpp \
$(LRPS2_DIR)/R5900OpcodeImpl.cpp \
$(LRPS2_DIR)/R5900OpcodeTables.cpp \
$(LRPS2_DIR)/Vif.cpp \
$(LRPS2_DIR)/Vif_Codes.cpp \
$(LRPS2_DIR)/Vif_Transfer.cpp \
$(LRPS2_DIR)/Vif_Unpack.cpp \
$(LRPS2_DIR)/Vif0_Dma.cpp \
$(LRPS2_DIR)/Vif1_Dma.cpp \
$(LRPS2_DIR)/Vif1_MFIFO.cpp \
$(LRPS2_DIR)/VMManager.cpp \
$(LRPS2_DIR)/vtlb.cpp \
$(LRPS2_DIR)/VU0.cpp \
$(LRPS2_DIR)/VU0micro.cpp \
$(LRPS2_DIR)/VU0microInterp.cpp \
$(LRPS2_DIR)/VU1micro.cpp \
$(LRPS2_DIR)/VU1microInterp.cpp \
$(LRPS2_DIR)/VUmicro.cpp \
$(LRPS2_DIR)/VUmicroMem.cpp \
$(LRPS2_DIR)/VUops.cpp
# pcsx2/Frontend
SOURCES_CXX += \
# pcsx2/IPU. The leaf kernels build as C; the decoder stays C++.
SOURCES_C += \
$(LRPS2_DIR)/IPU/IPUdither.c \
$(LRPS2_DIR)/IPU/ipu_csc.c \
$(LRPS2_DIR)/IPU/ipu_idct.c \
$(LRPS2_DIR)/IPU/yuv2rgb.c
SOURCES_CXX += \
$(LRPS2_DIR)/IPU/IPU.cpp \
$(LRPS2_DIR)/IPU/IPU_Fifo.cpp \
$(LRPS2_DIR)/IPU/IPU_MultiISA.cpp \
$(LRPS2_DIR)/IPU/IPUdma.cpp
# pcsx2/PAD
SOURCES_CXX += $(LRPS2_DIR)/PAD/PAD.cpp
# pcsx2/USB (OHCI host-controller core, HID, Python 2 and EyeToy device
# models)
SOURCES_C += \
$(LRPS2_DIR)/USB/libretro-usb/bus.c \
$(LRPS2_DIR)/USB/libretro-usb/core.c \
$(LRPS2_DIR)/USB/libretro-usb/desc.c \
$(LRPS2_DIR)/USB/libretro-usb/hid.c \
$(LRPS2_DIR)/USB/libretro-usb/input-keymap-qcode-to-qnum.c \
$(LRPS2_DIR)/USB/libretro-usb/usb-hid.c \
$(LRPS2_DIR)/USB/libretro-usb/usb-ohci.c \
$(LRPS2_DIR)/USB/usb-python2/p2io.c \
$(LRPS2_DIR)/USB/usb-python2/py2desc.c \
$(LRPS2_DIR)/USB/usb-python2/usb-python2.c \
$(LRPS2_DIR)/USB/usb-perfect-pool/ppcam.c \
$(LRPS2_DIR)/FW.c \
$(LRPS2_DIR)/MemoryCardFile.c \
$(LRPS2_DIR)/MemoryCardProtocol.c \
$(LRPS2_DIR)/MultitapProtocol.c \
$(LRPS2_DIR)/Sio.c \
$(LRPS2_DIR)/SioFifo.c \
$(LRPS2_DIR)/IopCounters.c \
$(LRPS2_DIR)/IopDma.c \
$(LRPS2_DIR)/IopHw.c \
$(LRPS2_DIR)/IopIrq.c \
$(LRPS2_DIR)/FireWire/fatimg.c \
$(LRPS2_DIR)/FireWire/p1io.c \
$(LRPS2_DIR)/FireWire/py1desc.c
SOURCES_CXX += \
$(LRPS2_DIR)/USB/usb-eyetoy/cam-frame.cpp \
$(LRPS2_DIR)/USB/usb-eyetoy/cam-jpeg.cpp \
$(LRPS2_DIR)/USB/usb-eyetoy/eyetoy-frontend.cpp \
$(LRPS2_DIR)/USB/usb-eyetoy/eyetoy-host.cpp \
$(LRPS2_DIR)/USB/usb-eyetoy/jo_mpeg.cpp \
$(LRPS2_DIR)/USB/usb-eyetoy/usb-eyetoy-webcam.cpp
# pcsx2/ps2
SOURCES_CXX += \
$(LRPS2_DIR)/ps2/BiosTools.cpp
SOURCES_C += \
$(LRPS2_DIR)/IopBios.c \
$(LRPS2_DIR)/IopMem.c \
$(LRPS2_DIR)/R3000A.c \
$(LRPS2_DIR)/R3000AInterpreter.c \
$(LRPS2_DIR)/R3000AOpcodeTables.c \
$(LRPS2_DIR)/Mdec.c \
$(LRPS2_DIR)/ps2/pgif.c \
$(LRPS2_DIR)/ps2/Iop/IopHwRead.c \
$(LRPS2_DIR)/ps2/Iop/IopHwWrite.c \
$(LRPS2_DIR)/ps2/Iop/PsxBios.c
# pcsx2/SPU2. Every unit builds as C, the emulator-facing shim included.
SOURCES_C += \
$(LRPS2_DIR)/SPU2/ADSR.c \
$(LRPS2_DIR)/SPU2/Dma.c \
$(LRPS2_DIR)/SPU2/Mixer.c \
$(LRPS2_DIR)/SPU2/ReadInput.c \
$(LRPS2_DIR)/SPU2/RegTable.c \
$(LRPS2_DIR)/SPU2/Reverb.c \
$(LRPS2_DIR)/SPU2/ReverbResample.c \
$(LRPS2_DIR)/SPU2/spu2.c \
$(LRPS2_DIR)/SPU2/spu2freeze.c \
$(LRPS2_DIR)/SPU2/spu2sys.c
SOURCES_CXX += \
# pcsx2 CPU recompilers. x86_64 uses the x86 dynarec; aarch64 uses the native
# arm64 EE/IOP/VU recompilers + NEON VIF unpack transplanted from ARMSX2 (the
# x86 sources have no arm64 backend). CpuState.cpp only defines the EE/IOP/FPU
# register state the interpreter needs too, so it is built on both. Mirrors the
# `if(NOT _M_X86)` source swap in pcsx2/CMakeLists.txt.
ifeq ($(IS_ARM64), 1)
# JitHash.cpp is portable: on non-x86 it compiles to the exported
# pcsx2_jithash_dump stub that libretro/main.cpp calls unconditionally from
# retro_deinit. Dropping it here is an aarch64 link error -- cmake's
# pcsx2/CMakeLists.txt already keeps it in the arm64 list for this reason.
SOURCES_CXX += \
$(LRPS2_DIR)/x86/CpuState.cpp \
$(LRPS2_DIR)/x86/JitHash.cpp \
$(LRPS2_DIR)/arm64/recR3000A_arm64.cpp \
$(LRPS2_DIR)/arm64/recR5900_arm64.cpp \
$(LRPS2_DIR)/arm64/aVU.cpp \
$(LRPS2_DIR)/arm64/AsmHelpers.cpp \
$(LRPS2_DIR)/arm64/Vif_UnpackNEON.cpp \
$(LRPS2_DIR)/arm64/Vif_Dynarec_arm64.cpp
else
# pcsx2/x86 (recompilers)
SOURCES_CXX += \
$(LRPS2_DIR)/x86/CpuState.cpp \
$(LRPS2_DIR)/x86/BaseblockEx.cpp \
$(LRPS2_DIR)/x86/iCOP0.cpp \
$(LRPS2_DIR)/x86/iCore.cpp \
$(LRPS2_DIR)/x86/iFPU.cpp \
$(LRPS2_DIR)/x86/iFPUd.cpp \
$(LRPS2_DIR)/x86/iMMI.cpp \
$(LRPS2_DIR)/x86/JitHash.cpp \
$(LRPS2_DIR)/x86/iR3000A.cpp \
$(LRPS2_DIR)/x86/iR3000Atables.cpp \
$(LRPS2_DIR)/x86/iR5900Analysis.cpp \
$(LRPS2_DIR)/x86/iR5900Misc.cpp \
$(LRPS2_DIR)/x86/microVU.cpp \
$(LRPS2_DIR)/x86/newVif_Dynarec.cpp \
$(LRPS2_DIR)/x86/newVif_UnpackSSE.cpp \
$(LRPS2_DIR)/x86/ix86-32/iCore-32.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900-32.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900Arit.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900AritImm.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900Branch.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900Jump.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900LoadStore.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900Move.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900MultDiv.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900Shift.cpp \
$(LRPS2_DIR)/x86/ix86-32/iR5900Templates.cpp \
$(LRPS2_DIR)/x86/ix86-32/recVTLB.cpp
endif
# ============================================================================
# pcsx2/GS - common renderer code
# ============================================================================
SOURCES_CXX += \
$(LRPS2_DIR)/GS/GS.cpp \
$(LRPS2_DIR)/GS/GSBlock.cpp \
$(LRPS2_DIR)/GS/GSClut.cpp \
$(LRPS2_DIR)/GS/GSDrawingContext.cpp \
$(LRPS2_DIR)/GS/GSLocalMemory.cpp \
$(LRPS2_DIR)/GS/GSLocalMemoryMultiISA.cpp \
$(LRPS2_DIR)/GS/GSRingHeap.cpp \
$(LRPS2_DIR)/GS/GSState.cpp \
$(LRPS2_DIR)/GS/GSTables.cpp \
$(LRPS2_DIR)/GS/GSUtil.cpp \
$(LRPS2_DIR)/GS/GSVector.cpp \
$(LRPS2_DIR)/GS/GSXXH.cpp \
$(LRPS2_DIR)/GS/MultiISA.cpp \
\
$(LRPS2_DIR)/GS/Renderers/Common/GSDevice.cpp \
$(LRPS2_DIR)/GS/Renderers/Common/GSDirtyRect.cpp \
$(LRPS2_DIR)/GS/Renderers/Common/GSRenderer.cpp \
$(LRPS2_DIR)/GS/Renderers/Common/GSTexture.cpp \
$(LRPS2_DIR)/GS/Renderers/Common/GSVertexTrace.cpp \
$(LRPS2_DIR)/GS/Renderers/Common/GSVertexTraceFMM.cpp \
\
$(LRPS2_DIR)/GS/Renderers/HW/GSHwHack.cpp \
$(LRPS2_DIR)/GS/Renderers/HW/GSRendererHW.cpp \
$(LRPS2_DIR)/GS/Renderers/HW/GSRendererHWMultiISA.cpp \
$(LRPS2_DIR)/GS/Renderers/HW/GSTextureCache.cpp \
# pcsx2/GS/Renderers/SW - software renderer. The device + texture cache/texture
# build everywhere; the scanline JIT (GS*CodeGenerator) and rasterizer are x86
# xbyak codegen with no arm64 backend, so they are dropped on aarch64 (the HW
# renderer / paraLLEl-GS cover it; GS.cpp gates the SW path on ARCH_ARM64).
# Mirrors the `list(REMOVE_ITEM ... NOT _M_X86)` in pcsx2/CMakeLists.txt.
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/SW/GSDeviceSW.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSTextureCacheSW.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSTextureSW.cpp
# The rasterizer, the renderer and the scanline dispatcher are portable: they
# are written against GSVector4/4i, which have NEON implementations. Only the
# xbyak code generators are x86-only, and GSDrawScanline falls back to its C++
# reference path (CSetupPrim / CDrawScanline / CDrawEdge) without them.
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/SW/GSDrawScanline.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSRasterizer.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSRendererSW.cpp
ifneq ($(IS_ARM64), 1)
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSDrawScanlineCodeGenerator.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSSetupPrimCodeGenerator.all.cpp \
$(LRPS2_DIR)/GS/Renderers/SW/GSSetupPrimCodeGenerator.cpp
endif
# pcsx2/GS/Renderers/OpenGL
ifeq ($(HAVE_OPENGL), 1)
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLContext.cpp \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLProgram.cpp \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLShaderCache.cpp \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLState.cpp \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLStreamBuffer.cpp \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GSDeviceOGL.cpp \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GSTextureOGL.cpp
endif
# pcsx2/GS/Renderers/Vulkan + parallel-gs
ifeq ($(HAVE_VULKAN), 1)
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/Vulkan/GSVulkanHeap.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKSpirvPatch.c
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/Vulkan/GSDeviceVK.cpp \
$(LRPS2_DIR)/GS/Renderers/Vulkan/GSTextureVK.cpp \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKBuilders.cpp \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKLoader.cpp \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKStreamBuffer.cpp \
\
$(LRPS2_DIR)/GS/Renderers/parallel-gs/GSRendererPGS.cpp
endif
# pcsx2/GS/Renderers/DX11/DX12 (Windows only)
ifeq ($(IS_WINDOWS), 1)
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/DX11/D3D.cpp \
$(LRPS2_DIR)/GS/Renderers/DX11/D3D11ShaderCache.cpp \
$(LRPS2_DIR)/GS/Renderers/DX11/GSDevice11.cpp \
$(LRPS2_DIR)/GS/Renderers/DX11/GSTexture11.cpp \
\
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12Builders.cpp \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12DescriptorHeapManager.cpp \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12ShaderCache.cpp \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12StreamBuffer.cpp \
$(LRPS2_DIR)/GS/Renderers/DX12/GSDevice12.cpp \
$(LRPS2_DIR)/GS/Renderers/DX12/GSTexture12.cpp
endif
# ============================================================================
# parallel-gs + Granite (Vulkan only)
# ============================================================================
ifeq ($(HAVE_VULKAN), 1)
# parallel-gs core
SOURCES_CXX += \
$(PGS_DIR)/gs/gs_interface.cpp \
$(PGS_DIR)/gs/gs_renderer.cpp \
$(PGS_DIR)/gs/gs_util.cpp \
$(PGS_DIR)/gs/page_tracker.cpp
# Granite math is gone entirely: nothing in paraLLEl-GS or the Granite subset
# this core links uses it. The vector types the GS code needs are plain
# aggregates in shaders/data_structures.h, and anything arithmetic on a pair
# goes through gs/pgs_vertex_kernels.h.
# Granite util
# cli_parser, dynamic_library, message_queue are excluded: their consumers
# (viewer/slangmosh tools, audio mixer, ffmpeg decode, thread group, wsi_dxgi)
# are not built in the libretro core.
# string_helpers and thread_priority are also excluded: nm shows none of their
# defined symbols are referenced anywhere we link in.
# timeline_trace_file is needed because Granite's vulkan/device.cpp calls
# allocate_event/submit_event directly on system_handles.timeline_trace_file
# (only the GRANITE_SCOPED_TIMELINE_EVENT macros are GRANITE_SHIPPING-gated).
SOURCES_CXX += \
$(GRANITE_DIR)/util/aligned_alloc.cpp \
$(GRANITE_DIR)/util/arena_allocator.cpp \
$(GRANITE_DIR)/util/environment.cpp \
$(GRANITE_DIR)/util/logging.cpp \
$(GRANITE_DIR)/util/slab_allocator.cpp \
$(GRANITE_DIR)/util/thread_id.cpp \
$(GRANITE_DIR)/util/thread_name.cpp \
$(GRANITE_DIR)/util/timeline_trace_file.cpp \
$(GRANITE_DIR)/util/timer.cpp
# Granite vulkan
# wsi.cpp and wsi_dxgi.cpp are excluded: the libretro core integrates with the
# frontend's swapchain via retro_vulkan_* callbacks (pgs_create_device etc.)
# and does not call any Vulkan::WSI methods. Excluding wsi.cpp also avoids the
# vkAcquireFullScreenExclusiveModeEXT / vkGetPhysicalDeviceSurfacePresentModes2EXT
# undefineds it pulls in.
# pipeline_event and event_manager are gone rather than merely excluded: the
# comment here used to claim pipeline_event was excluded while line 597 built
# it anyway. paraLLEl-GS does not use Vulkan events for inter-pass
# synchronisation, and every signal_event / wait_events / begin_signal_event /
# request_pipeline_event occurrence in the subtree was a definition, never a
# call, so the whole mechanism and its two source files were removed.
SOURCES_CXX += \
$(GRANITE_DIR)/vulkan/breadcrumbs.cpp \
$(GRANITE_DIR)/vulkan/buffer.cpp \
$(GRANITE_DIR)/vulkan/buffer_pool.cpp \
$(GRANITE_DIR)/vulkan/command_buffer.cpp \
$(GRANITE_DIR)/vulkan/command_pool.cpp \
$(GRANITE_DIR)/vulkan/context.cpp \
$(GRANITE_DIR)/vulkan/cookie.cpp \
$(GRANITE_DIR)/vulkan/descriptor_set.cpp \
$(GRANITE_DIR)/vulkan/device.cpp \
$(GRANITE_DIR)/vulkan/fence.cpp \
$(GRANITE_DIR)/vulkan/fence_manager.cpp \
$(GRANITE_DIR)/vulkan/image.cpp \
$(GRANITE_DIR)/vulkan/memory_allocator.cpp \
$(GRANITE_DIR)/vulkan/pipeline_cache.cpp \
$(GRANITE_DIR)/vulkan/query_pool.cpp \
$(GRANITE_DIR)/vulkan/render_pass.cpp \
$(GRANITE_DIR)/vulkan/sampler.cpp \
$(GRANITE_DIR)/vulkan/semaphore.cpp \
$(GRANITE_DIR)/vulkan/semaphore_manager.cpp \
$(GRANITE_DIR)/vulkan/shader.cpp \
$(GRANITE_DIR)/vulkan/texture/texture_format.cpp
# Granite volk (C, single TU)
SOURCES_C += $(GRANITE_DIR)/third_party/volk/volk.c
endif
# ============================================================================
# 3rdparty - always-on dependencies
# ============================================================================
# zlib: gone. Every former consumer runs on libretro-common's clean-room
# codecs - CHD hunks through rchd, CSO frames and indexed .gz through
# rinflate (with the zran primitives), rpng through trans_stream_deflate.
# PNG: libretro-common's rpng (rinflate-native via trans_stream),
# replacing vendored libpng for the read-only texture loader.
SOURCES_C += \
$(LIBRETRO_COMM_DIR)/formats/png/rpng.c \
$(LIBRETRO_COMM_DIR)/streams/trans_stream.c \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_deflate.c \
$(LIBRETRO_COMM_DIR)/streams/trans_stream_pipe.c
# lz4: gone. ZSO frames decode through libretro-common's clean-room
# rlz4 block decoder.
SOURCES_C += $(LIBRETRO_COMM_DIR)/encodings/encoding_rlz4.c
# CHD: libretro-common's clean-room rchd stack (rchd + rflac + rzstd +
# r7z_lzma + huffman/deflate/crc32), replacing vendored libchdr. The
# decoder does no I/O of its own - the CHD reader (pcsx2/CDVD/cdvd_chd.c) drives it, feeding from
# a mapped image when the VFS provides one.
SOURCES_C += \
$(LIBRETRO_COMM_DIR)/formats/chd/rchd.c \
$(LIBRETRO_COMM_DIR)/formats/flac/rflac.c \
$(LIBRETRO_COMM_DIR)/formats/yaml/ryaml.c \
$(LIBRETRO_COMM_DIR)/formats/7z/r7z_lzma.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_rzstd.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_huffman.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_deflate.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c
# Which of rchd's hunk codecs are compiled in. Stated here rather than
# left to rchd.c's fallback: that fallback turns on DEFLATE and LZMA
# unconditionally but gates FLAC and Zstandard behind HAVE_FLAC/HAVE_RFLAC
# and HAVE_ZSTD/HAVE_RZSTD, which this build has never defined. The
# result was a reader that linked rflac.c and encoding_rzstd.c and then
# refused every 'cdfl' and 'cdzs' hunk with RCHD_ERROR_UNSUPPORTED - a
# per-hunk failure, so an image opened, reported correct geometry and a
# correct TOC, and only died on the fraction of hunks that happened to
# pick those codecs. All four objects are in SOURCES_C above, so all
# four codecs are named here.
FLAGS += -DHAVE_RCHD_DEFLATE -DHAVE_RCHD_LZMA \
-DHAVE_RCHD_FLAC -DHAVE_RCHD_ZSTD
# ----------------------------------------------------------------------------
# VIXL - vendored aarch64-only subset (3rdparty/vixl); the AArch64 code emitter
# backing the arm64 recompiler. Built only on aarch64. Sources are .cc, so they
# live in SOURCES_CC; -w is applied to their objects in the top Makefile (third
# party -- matches cmake's `-w` on the vixl target). Globbed to match cmake's
# file(GLOB) so a VIXL bump doesn't need this list touched.
# ----------------------------------------------------------------------------
ifeq ($(IS_ARM64), 1)
SOURCES_CC += \
$(wildcard $(DEPS_DIR)/vixl/src/*.cc) \
$(wildcard $(DEPS_DIR)/vixl/src/aarch64/*.cc)
endif
# glad (OpenGL)
ifeq ($(HAVE_OPENGL), 1)
SOURCES_C += $(DEPS_DIR)/glad/src/glad.c
endif
# Dynamically loaded builds only: statically linked frontends share one
# libretro-common with the core, and vfs_hybrid.o's reference to
# filestream_set_mapped_ptr_cb can pull this tree's file_stream.o into
# symbol collision with griffin.
ifneq ($(STATIC_LINKING), 1)
SOURCES_C += $(LIBRETRO_COMM_DIR)/vfs/vfs_hybrid.c
endif
# Opt-in profiler source (see PROFILER=1 in the top-level Makefile).
ifeq ($(PROFILER), 1)
SOURCES_CXX += \
$(LRPS2_DIR)/Profiler.cpp
endif