Repository navigation
Expand file tree
/
Copy pathMakefile.common
More file actions
658 lines (609 loc) · 24.1 KB
/
Copy pathMakefile.common
File metadata and controls
658 lines (609 loc) · 24.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
SOURCES_CXX :=
SOURCES_C :=
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 \
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$(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
endif
ifeq ($(NEED_THREADING), 1)
FLAGS += -DWANT_THREADING -DHAVE_THREADS
endif
ifeq ($(FRONTEND_SUPPORTS_RGB565), 1)
FLAGS += -DFRONTEND_SUPPORTS_RGB565
endif
CFLAGS += $(FLAGS)
CXXFLAGS += $(FLAGS)
# ============================================================================
# libretro-common (C)
# ============================================================================
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/HW/GSObjectPool.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSFastList.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSFlatMap.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSStableMap.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSTextureBase.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSTextureFormat.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSVertexTrace.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSVertexTraceFMM.c \
$(LRPS2_DIR)/GS/GSPage2Tile.c \
$(LRPS2_DIR)/GS/GSAlphaRange.c \
$(LRPS2_DIR)/GS/GSClut.c \
$(LRPS2_DIR)/GS/GSClutGPU.c \
$(LRPS2_DIR)/GS/GSEntry.c \
$(LRPS2_DIR)/GS/GSDrawingContext.c \
$(LRPS2_DIR)/GS/GSLocalMemory.c \
$(LRPS2_DIR)/GS/GSLocalMemoryMultiISA.c \
$(LRPS2_DIR)/GS/GSWrappedMemory.c \
$(LRPS2_DIR)/GS/GSLocalMemoryMaps.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSDirtyRect.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSBuddy.c \
$(LRPS2_DIR)/GS/GSOffset.c \
$(LRPS2_DIR)/GS/GSDrawQuery.c \
$(LRPS2_DIR)/GS/GSPCRTC.c \
$(LRPS2_DIR)/GS/GSStateFile.c \
$(LRPS2_DIR)/GS/GSState.c \
$(LRPS2_DIR)/GS/GSTransfer.c \
$(LRPS2_DIR)/GS/GSPsm.c \
$(LRPS2_DIR)/GS/GSRingHeap.c \
$(LRPS2_DIR)/GS/GSTables.c \
$(LRPS2_DIR)/GS/GSUtil.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/HW/GSTCSurface.c \
$(LRPS2_DIR)/GS/Renderers/HW/GSHwHack.c \
$(LRPS2_DIR)/GS/Renderers/HW/GSRendererHWCPU.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSStableGroup.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSRetireRing.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSTexturePool.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSDevice.c \
$(LRPS2_DIR)/GS/Renderers/Common/GSPresent.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/GSCodeMap.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
# ============================================================================
SOURCES_C += \
$(LIBRETRO_DIR)/main.c \
$(LIBRETRO_DIR)/disk_list.c \
$(LIBRETRO_DIR)/audio_queue.c \
$(LIBRETRO_DIR)/patches.c \
$(LIBRETRO_DIR)/state_ext.c \
$(LIBRETRO_DIR)/USB.c
# ============================================================================
# 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_C += \
$(LRPS2_DIR)/DEV9/DEV9.c \
$(LRPS2_DIR)/DEV9/net.c \
$(LRPS2_DIR)/DEV9/sockets.c \
$(LRPS2_DIR)/DEV9/PacketReader/netpkt.c \
$(LRPS2_DIR)/DEV9/Sessions/Session.c \
$(LRPS2_DIR)/DEV9/Sessions/ICMP_Session/ICMP_Session.c \
$(LRPS2_DIR)/DEV9/Sessions/TCP_Session/TCP_Session.c \
$(LRPS2_DIR)/DEV9/Sessions/UDP_Session/UDP_Session.c \
$(LRPS2_DIR)/DEV9/InternalServers/DHCP_Server.c \
$(LRPS2_DIR)/DEV9/AdapterUtils.c \
$(LRPS2_DIR)/DEV9/InternalServers/DNS_Server.c \
$(LRPS2_DIR)/DEV9/PacketReader/IP/UDP/DNS/DNS_Packet.c \
$(LRPS2_DIR)/DEV9/flash.c \
$(LRPS2_DIR)/DEV9/smap.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)/Dmac.c \
$(LRPS2_DIR)/Hw.c \
$(LRPS2_DIR)/Vif0_Dma.c \
$(LRPS2_DIR)/Vif1_Dma.c \
$(LRPS2_DIR)/Vif1_MFIFO.c \
$(LRPS2_DIR)/Gif.c \
$(LRPS2_DIR)/Gif_Unit.c \
$(LRPS2_DIR)/FiFo.c \
$(LRPS2_DIR)/VU0micro.c \
$(LRPS2_DIR)/VU0microInterp.c \
$(LRPS2_DIR)/VU1micro.c \
$(LRPS2_DIR)/VU1microInterp.c \
$(LRPS2_DIR)/VUmicro.c \
$(LRPS2_DIR)/VUmicroMem.c \
$(LRPS2_DIR)/Cache.c \
$(LRPS2_DIR)/COP0.c \
$(LRPS2_DIR)/FPU.c \
$(LRPS2_DIR)/MMI.c \
$(LRPS2_DIR)/Interpreter.c \
$(LRPS2_DIR)/R5900.c \
$(LRPS2_DIR)/Counters.c \
$(LRPS2_DIR)/MTGS.c \
$(LRPS2_DIR)/MTVU.c \
$(LRPS2_DIR)/GS.c \
$(LRPS2_DIR)/vtlb.c \
$(LRPS2_DIR)/GoemonTlb.c \
$(LRPS2_DIR)/R5900OpcodeImpl.c \
$(LRPS2_DIR)/R5900OpcodeTables.c \
$(LRPS2_DIR)/VU0.c \
$(LRPS2_DIR)/Vif_Codes.c \
$(LRPS2_DIR)/Vif_Transfer.c \
$(LRPS2_DIR)/Vif_Unpack.c \
$(LRPS2_DIR)/Vif.c \
$(LRPS2_DIR)/SaveStateBase.c \
$(LRPS2_DIR)/SaveStateFreeze.c
ifeq ($(HAVE_PCAP), 1)
SOURCES_C += $(LRPS2_DIR)/DEV9/pcap_io.c
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 (arm64/a64emit.c is the arm64 emitter), 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_C += \
$(LRPS2_DIR)/EmuOptions.c \
$(LRPS2_DIR)/VMManager.c \
$(LRPS2_DIR)/GameDatabaseFixes.c \
$(LRPS2_DIR)/Pcsx2Config.c \
$(LRPS2_DIR)/GameDatabase.c \
$(LRPS2_DIR)/GameDatabaseBuiltin.c \
$(LRPS2_DIR)/Patch.c \
$(LRPS2_DIR)/PerformanceMetrics.c \
$(LRPS2_DIR)/VUops.c
# pcsx2/Frontend
SOURCES_CXX += \
# pcsx2/IPU, all C; the decoder is compiled once per ISA (Makefile).
SOURCES_C += \
$(LRPS2_DIR)/IPU/IPU.c \
$(LRPS2_DIR)/IPU/IPU_MultiISA.c \
$(LRPS2_DIR)/IPU/IPUdither.c \
$(LRPS2_DIR)/IPU/ipu_csc.c \
$(LRPS2_DIR)/IPU/ipu_idct.c \
$(LRPS2_DIR)/IPU/ipu_tables.c \
$(LRPS2_DIR)/IPU/IPU_Fifo.c \
$(LRPS2_DIR)/IPU/IPUdma.c \
$(LRPS2_DIR)/IPU/yuv2rgb.c
# pcsx2/PAD
SOURCES_C += $(LRPS2_DIR)/PAD/PAD.c
# pcsx2/USB (OHCI host-controller core, HID, Python 2 and EyeToy device
# models), all C
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/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_C += \
$(LRPS2_DIR)/USB/usb-eyetoy/cam-frame.c \
$(LRPS2_DIR)/USB/usb-eyetoy/cam-jpeg.c \
$(LRPS2_DIR)/USB/usb-eyetoy/eyetoy-frontend.c \
$(LRPS2_DIR)/USB/usb-eyetoy/eyetoy-host.c \
$(LRPS2_DIR)/USB/usb-eyetoy/jo_mpeg.c \
$(LRPS2_DIR)/USB/usb-eyetoy/usb-eyetoy-webcam.c
# pcsx2/ps2
SOURCES_C += \
$(LRPS2_DIR)/ps2/BiosTools.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.c 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.c is portable: on non-x86 it compiles to the exported
# pcsx2_jithash_dump stub that libretro/main.c 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_C += \
$(LRPS2_DIR)/x86/CpuState.c \
$(LRPS2_DIR)/x86/JitHash.c \
$(LRPS2_DIR)/arm64/a64emit.c \
$(LRPS2_DIR)/arm64/AsmHelpers.c \
$(LRPS2_DIR)/arm64/aBlocks.c \
$(LRPS2_DIR)/arm64/Vif_UnpackNEON.c \
$(LRPS2_DIR)/arm64/Vif_Dynarec_arm64.c \
$(LRPS2_DIR)/arm64/recR3000A_arm64.c \
$(LRPS2_DIR)/arm64/recR5900_arm64.c \
$(LRPS2_DIR)/arm64/aVU.c
else
# pcsx2/x86 (recompilers), all C.
SOURCES_C += \
$(LRPS2_DIR)/x86/CpuState.c \
$(LRPS2_DIR)/x86/BaseblockEx.c \
$(LRPS2_DIR)/x86/iCOP0.c \
$(LRPS2_DIR)/x86/iCore.c \
$(LRPS2_DIR)/x86/iFPU.c \
$(LRPS2_DIR)/x86/iFPUd.c \
$(LRPS2_DIR)/x86/iMMI.c \
$(LRPS2_DIR)/x86/JitHash.c \
$(LRPS2_DIR)/x86/iR3000A.c \
$(LRPS2_DIR)/x86/iR3000Atables.c \
$(LRPS2_DIR)/x86/iR5900Analysis.c \
$(LRPS2_DIR)/x86/iR5900Misc.c \
$(LRPS2_DIR)/x86/ix86-32/iCore-32.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900-32.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900Arit.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900AritImm.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900Branch.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900Jump.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900LoadStore.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900Move.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900MultDiv.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900Shift.c \
$(LRPS2_DIR)/x86/ix86-32/iR5900Templates.c \
$(LRPS2_DIR)/x86/ix86-32/recVTLB.c \
$(LRPS2_DIR)/x86/microVU.c \
$(LRPS2_DIR)/x86/newVif_Dynarec.c \
$(LRPS2_DIR)/x86/newVif_UnpackSSE.c
endif
# ============================================================================
# pcsx2/GS - common renderer code
# ============================================================================
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/Common/GSRenderer.c \
$(LRPS2_DIR)/GS/Renderers/HW/GSRendererHWMultiISA.c
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/HW/GSRendererHW.cpp \
$(LRPS2_DIR)/GS/Renderers/HW/GSTextureCache.cpp \
# pcsx2/GS/Renderers/SW - the software renderer, on every architecture.
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/SW/GSDeviceSW.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSDrawScanline.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSRaster.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSRasterizer.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSRasterList.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSTextureCacheSW.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSTextureSW.c
# The renderer is portable: it is written against GSVector4/4i and
# gs_vector, which have NEON implementations. Only the code generators are
# x86-only (below); without them GSDrawScanline.c draws through its C
# rasterizer, which tests/swdraw runs on AArch64 in CI.
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/SW/GSRendererSW.c
ifneq ($(IS_ARM64), 1)
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/SW/GSJitX86.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSSetupPrimJit.c \
$(LRPS2_DIR)/GS/Renderers/SW/GSDrawScanlineJit.c
endif
# pcsx2/GS/Renderers/OpenGL
ifeq ($(HAVE_OPENGL), 1)
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLContext.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLProgram.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLProgramCache.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLShaderCache.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLPipeline.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLShaderSource.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLState.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLStreamBuffer.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLTextureFormat.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GLVertexInput.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GSDeviceOGL.c \
$(LRPS2_DIR)/GS/Renderers/OpenGL/GSTextureOGL.c
endif
# pcsx2/GS/Renderers/Vulkan + parallel-gs
ifeq ($(HAVE_VULKAN), 1)
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/Vulkan/GSTextureVK.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/GSVulkanHeap.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKBuilders.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKSpirvPatch.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKLoader.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/VKStreamBuffer.c \
$(LRPS2_DIR)/GS/Renderers/Vulkan/GSDeviceVK.c
SOURCES_CXX += \
$(LRPS2_DIR)/GS/Renderers/parallel-gs/GSRendererPGS.cpp
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/parallel-gs/PGSLog.c
endif
# pcsx2/GS/Renderers/DX11/DX12 (Windows only)
ifeq ($(IS_WINDOWS), 1)
SOURCES_C += \
$(LRPS2_DIR)/GS/Renderers/DX11/D3D.c \
$(LRPS2_DIR)/GS/Renderers/DX11/D3D11ShaderCache.c \
$(LRPS2_DIR)/GS/Renderers/DX11/GSDevice11.c \
$(LRPS2_DIR)/GS/Renderers/DX11/GSTexture11.c \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12Builders.c \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12DescriptorHeapManager.c \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12ShaderCache.c \
$(LRPS2_DIR)/GS/Renderers/DX12/D3D12StreamBuffer.c \
$(LRPS2_DIR)/GS/Renderers/DX12/GSDevice12.c \
$(LRPS2_DIR)/GS/Renderers/DX12/GSTexture12.c
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.
SOURCES_CXX += \
$(GRANITE_DIR)/util/thread_id.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/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/render_pass.cpp \
$(GRANITE_DIR)/vulkan/sampler.cpp \
$(GRANITE_DIR)/vulkan/semaphore.cpp \
$(GRANITE_DIR)/vulkan/semaphore_manager.cpp \
$(GRANITE_DIR)/vulkan/shader.cpp
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_xxh64.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_huffman.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_deflate.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_xxh3.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
# 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_C += \
$(LRPS2_DIR)/Profiler.c
endif