337 Commits
Author SHA1 Message Date
J1coding 818a513e95 iOS: Skip RetroAchievements re-initialization when already active
VMManager::Internal::CPUThreadInitialize() can run more than once in
a process lifetime on mobile hosts that tear down and rebuild the CPU
thread across game launches. Achievements::Initialize() asserts
`!s_client && !s_http_downloader` at the top, so a second call with
RetroAchievements enabled fired pxFailRel("No client and downloader")
and aborted the process. The crash only manifested on hosts that
re-enter CPUThreadInitialize without an intervening Achievements
shutdown, which is why desktop builds never hit it.

Gate the call with !Achievements::IsActive(), which checks the same
s_client pointer the assertion reasons about. The normal cold-start
path (s_client == nullptr) still calls Initialize(); a second entry
with the client already constructed is now a no-op, matching the
expectation the rest of the file already has.

Verified by repeated launch/exit/relaunch cycles on iOS with
RetroAchievements enabled: no abort, and the client initialises
exactly once per process.
2026-07-18 17:45:52 +02:00
Jeen 431ca0c063 iOS: port JIT and W^X foundation, refresh SwiftUI frontend, fix critical boot and display bugs
Port the complete JIT and write-xor-execute infrastructure to DarwinMisc with four JitModes (Simulator, Legacy, LuckTXM, LuckNoTXM), dual-mapping via vm_remap for writable code aliases, the csops CS_DEBUGGED probe for JIT availability detection, brk assembly helpers for the TXM protocol, and the W^X toggle functions. Connect the JIT foundation to the code emitters through AsmHelpers dual-map bridge, Memory.cpp MmapCodeDualMap allocation, and the aR5900 LegacyEnsureExecutable path. Refresh the iOS SwiftUI frontend from the iOS-refresh branch, bringing in 11 missing and 20 drifted Swift files plus ios_main.mm integration. Switch the CI to a real device build using the iphoneos SDK. Fix the Achievements crash by gracefully degrading when no HTTPDownloader is available (no CURL on iOS). Fix the Metal surface to reuse the UIView's existing CAMetalLayer instead of an orphaned allocation that caused half-screen crops. Fix GS memory allocation by using mmap and vm_remap instead of shm_open which is blocked by the iOS sandbox. Suppress the false positive Graphics not Automatic OSD warning. Merge upstream master and resolve all resulting compile errors.
2026-07-12 16:39:22 +02:00
Jeen 14fc29c0cd iOS: gate macOS-only APIs behind TARGET_OS_IPHONE and add frontend link stubs
Gate all macOS-only system APIs behind TARGET_OS_IPHONE checks across the shared core: ApplicationServices, IOKit, mouse APIs, AppKit, MetalFX, CDVD Darwin sources, USB, discord-rpc, cubeb CoreAudio HAL, and BSD networking headers in DEV9. Port TARGET_OS_IPHONE guards for DEV9 AdapterUtils with iOS fallbacks for sockaddr_dl, rt_msghdr, and sysctl. Add ARMSX2_ROOT to the include path for the frontend's common include style. Drop the global _M_ARM64 define that triggered fast_float MSVC intrin.h inclusion since __aarch64__ covers the core paths. Gate MTLFeatureSet_macOS_GPUFamily1_v1 behind !TARGET_OS_IPHONE. Fix missing unistd.h and gate pthread_jit_write_protect_np which is unavailable on iOS. Add stubs for DarwinMisc JIT diagnostics, Achievements stats and info APIs, Discord_Register, Host capture callbacks, and the host hotkeys map so the frontend links cleanly. Merge upstream master.
2026-07-12 16:38:59 +02:00
Jeen b5e581b1f3 iOS: remove Android and React Native source, wire CMake build system, and add self-contained build workflow
Strip the legacy Android, React Native, Java, Gradle, and res/ directories from platforms/ios that were inherited from the original port. Configure the CMake build for the iOS target with local module discovery, PCAP and CURL guards, rapidyaml source path fixes, Vulkan disabled, lz4 build flags scoped, libjpeg-turbo skipped on iOS, and the Qt UI and test runners turned off. Set CMAKE_SYSTEM_PROCESSOR to arm64 for cross-compilation. Add a self-contained GitHub Actions workflow that builds an unsigned IPA for real devices using the iphoneos SDK, named with the commit SHA. Merge upstream master to stay current.
2026-07-12 16:38:18 +02:00
jpolo1224 d01b94d055 Recover mono ui-overhaul (PR#3 base + session UI edits) + prebuilt native .so from vc1063 2026-07-11 08:35:55 -04:00
jpolo1224 ed3cd1eed8 Android: re-apply mobile GS (VK push-descriptor fallback + GLES) onto canonical, guarded
Re-apply the Android-specific GS deltas on top of the canonical GS as guarded hunks so
PC/mac/Linux/Windows stay byte-for-canonical:

- VK: restore the push-descriptor fallback (Adreno/Mali stall inside
  vkCmdPushDescriptorSetKHR -> textures never bind -> black screen) as a capability-gated
  path; desktop keeps push descriptors unchanged. Mobile vendor gates
  (Mali/Adreno/PowerVR/Xclipse), dyn_shaderc, FIFO_RELAXED present mode, PowerVR swapchain
  width-align. depth_feedback forced off only under #if __ANDROID__ (desktop keeps
  feedback_loops()).
- OGL: re-apply GLES support (EGL context, is_gles shader branches, GLES query objects),
  runtime-gated by is_gles; guard 3 desktop-reachable riders (present-path
  glInvalidateFramebuffer -> is_gles, EGL SetDisplay body -> #if __ANDROID__, restore the
  negative-swap-interval probe).
- RA toast: guard the AddRect call on IMGUI_VERSION_NUM (desktop imgui 1.92.8 swapped the
  thickness/flags args; Android vendors 1.92.6) so the toast border renders on both.
- Suppress the 'Graphics API is not set to Automatic' OSD warning on Android
  (#if !__ANDROID__); desktop keeps the canonical warning.
- REFACTOR_STATUS: mark the GS re-apply resolved; note the imgui two-copies version skew.
2026-07-10 16:52:26 -04:00
David IsztlandClaude Opus 4.8 f3ef1105af core: back out unguarded desktop regressions from the parity graft
Three shared-core behavioral changes rode into PC unguarded via ecfebfd6b2 and are
reverted to canonical; the genuinely Android-only pieces around them (force-float +
nice-priority in VMManager, guarded #if __ANDROID__) are kept:

  * MTVU: WaitForWork() -> WaitForWorkWithSpin() spin-wait swap (all platforms)
  * VMManager: removal of the 'Graphics API is not set to Automatic' OSD warning
  * VMManager: s_thread_affinities_set tracked new_pin_enable instead of the
    canonical EmuConfig.EnableThreadPinning (desktop pinning-flag behavior)

Kept as legitimate additive/guarded shared changes: the new ThreadHandle API
(SetNicePriority/GetAffinity/GetCurrentCpu) + semaphore cache-line alignment, the
GetThreadPlacementDebug helper, Oboe/SoC-name/OSD-label Android features, and the
armsx2_overrides.yaml GameDB loader (PC-safe; no override file shipped).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 19:21:58 +02:00
jpolo1224 ecfebfd6b2 Android: bring unified core to refresh-experimental parity
Vulkan render fixes (GS device backends), Oboe audio backend, GameDB armsx2_overrides.yaml override loader, EE+VU mac-port recompiler graft, PGO=optimize, and the VU-slam fix: an Android-only force-float in VMManager::SetEmuThreadAffinities (the slam was thread pinning locking the VU1 worker off the prime core, not the VU codegen). Also: CPU-name SoC-property fallback, Mali VK attachment-feedback-loop crash gate, MediaTek fbfetch disable, and on-device thread-placement diagnostic helpers.

The recompiler grafts and GS deltas are unguarded and land in the shared core (they reach the mac/Linux arm64 builds) - see REFACTOR_STATUS.md items 2 and 3 for the reconciliation this still needs; the VU graft is reducible to just the force-float fix.
2026-07-10 11:16:31 -04:00
jpolo1224 8beadadd9e Android UI/RA polish: User-Agent, toast border, controller warning
- Host::GetHTTPUserAgent: report ARMSX2/2.7.407.0 (the RA-registered client)
  instead of 'PCSX2 <gitrev>', which RA rejects as an outdated emulator and so
  disables hardcore unlocks.
- ImGuiFullscreen: fix ImGui 1.92 AddRect arg order (flags/thickness swapped)
  that drew a ~240px border on the RetroAchievements toast.
- VMManager: suppress the false 'Controller 1 has no input bindings' warning
  (Android injects pad state directly, bypassing InputManager bindings).
2026-07-09 10:23:59 -04:00
jpolo1224 11e9289454 Android: bring the platform up on the unified monorepo core
Wire platforms/android to build against the shared core and reconcile the
pieces the Android native lib needs, so the Android target compiles and
links on this repo (produces libemucore_4k.so). Per-platform builds stay
independent; the PC and iOS targets are unchanged.

Build/CMake:
- Android-aware cmake modules under platforms/android/.../cmake with
  CMAKE_MODULE_PATH repointed at them (root desktop modules untouched)
- ryml::ryml alias, TOP_CMAKE_WAS_SOURCED, drop the fatal 3rdparty
  add_subdirectory; pcsx2 PCAP guard elseif(NOT ANDROID)
- git-sync-deps step for shaderc third_party (fetch-on-demand, not
  submodules); android .gitignore for keystores/artifacts/shaderc deps
- dual-core rotation-signed build scripts (release APK + Play AAB)

Core reconciliation (APIs the native lib expects):
- GS present-cap/frameskip, Adreno framebuffer-fetch GSOption round-trip
- SPU2 channel swap + output-pause suppression
- Achievements JSON, VMManager autosave slot, WindowInfo::Android
- FileSystem SAF hooks, custom Vulkan driver path, BIOS-from-fd
- Oboe audio stream, EGL native-window, Linux/Android source guards

refresh-experimental fixes layered onto the shared recompiler/GS:
- IOP direct block chaining (aR3000A, gated s_iopBlockLinkEnabled,
  default off so behaviour is byte-identical until enabled)
- COP2 CO-bit macro-mode gate (aVU_Macro)
- EE mixed-operand constant folding
- Adreno GL coherent depth feedback via gl_LastFragDepthARM, gated to the
  Adreno GPU profile (inert on every other GPU)
- Android GPU gates: GPU-profile shader-header keystone, FIFO_RELAXED
  present mode, Mali coherent readback, Adreno-650 boot-crash gates,
  ROAA VK_ARM alias
2026-07-08 21:46:23 -04:00
David Isztl c617e5e352 Merge branch 'PCSX2Master' into macOS 2026-06-14 00:32:58 +02:00
Oleg Tolmatcev 2d09d53805 Misc: clean up COM code 2026-06-13 15:40:44 -04:00
isztldav 600f798cd8 Merge branch 'PCSX2:master' into macOS 2026-06-08 18:55:07 +02:00
refractionpcsx2 4b76157b9e GS/TC: Add new HW Readback option to force full download 2026-06-07 14:39:52 -04:00
David Isztl e773f1d0ba ARM64: microVU — add MVU_DIFF shadow differential (debug, env-gated)
Debugging tool for the microVU1 correctness regression (2D games black-screen,
FFX renders with artifacts; bug attributed to microVU1 via the VU1-rec-off test).

With env MVU_DIFF=1, recMicroVU1::Execute runs the *interpreter* as the real
(known-good) VU1 so the game keeps rendering, and runs microVU1 as a
side-effect-suppressed shadow on the same restored input, comparing VF/VI/ACC/Q
and the full 16 KB VU data memory. The first diverging program's PC is logged
and the low program memory disassembled (disVU1MicroUF/LF). s_mvuShadowRun gates
the microVU XGKICK C entry points so the shadow can't double-transfer to GS;
LoadCoreSettings forces MTVU off under MVU_DIFF so VU1 runs synchronously through
this hook (otherwise it executes on the MTVU thread).

Zero impact on normal builds (all paths gated on the env var).

Findings so far (Rayman 3): microVU1 produces huge-negative results that clamp to
-FLT_MAX (0xff7fffff) where the interpreter has small/zero values, and the Q
register lags the interpreter by exactly one DIV — consistent with a stale Q
feeding the perspective-divide MULq (collapsed geometry → black 2D / 3D artifacts).
Root op not yet isolated (math lives in dynamically-uploaded subroutines).
2026-06-06 18:58:14 +02:00
David Isztl cc06da0228 ARM64: microVU 7.8 — select CpuMicroVU0/1 on ARM64 (wiring)
Flip the ARM64 branches in VMManager to mirror the x86 path now that microVU
(Upper + Lower + flags + branches) is fully ported:

- InitializeCPUProviders: CpuMicroVU0/1.Reserve() (recMicroVU1::Reserve opens
  vu1Thread for us, so the explicit vu1Thread.Open() workaround is removed).
- ShutdownCPUProviders: CpuMicroVU1/0.Shutdown() (recMicroVU1::Shutdown waits
  on / closes vu1Thread).
- UpdateCPUImplementations: CpuVU0/1 = EnableVU0/1 ? CpuMicroVU0/1 : CpuIntVU0/1.
- ClearCPUExecutionCaches: reset CpuMicroVU0 for macro mode when EE rec is on
  but VU0 micro is off (mirrors x86).

Builds arm64, unittests 2/2. This selection alone still crashes during BIOS
boot (XGKICK packet-size misread) — fixed in the following commit.
2026-06-06 17:46:48 +02:00
David Isztl 3fa1c9e5dd ARM64: IOP (R3000A) recompiler skeleton (Phase 6.1/6.2)
New pcsx2/arm64/aR3000A.{h,cpp} implementing the psxRec provider on ARM64.
Execution model mirrors the EE rec's Phase 4.3 baseline: a C++ dispatcher loop
(recExecuteBlock) drives the IOP timeslice — recLUT block lookup (compile on
miss), per-block prologue/epilogue (save x19+LR, pin RESTATEPTR=&psxRegs, RET),
cycle debit via iopAddEECycles (PS2 x8 / PS1 gcd-carry) + gated iopEventTest,
matching R3000AInterpreter.cpp intExecuteBlock (incl HLE-BIOS a0/b0/c0 entry).

All opcodes currently single-step through the interpreter via the new
iopExecuteOneInst() (recTranslateOp returns false for everything): correct but
not yet faster than the interpreter. Native generators land next.

Wired into VMManager (reserve/shutdown/reset + psxCpu = CHECK_IOPREC ? &psxRec
: &psxInt on ARM64) and registered in CMakeLists.

Builds arm64; unittests green.
2026-06-05 09:42:23 +02:00
David Isztl 09fd682677 ARM64: EE dispatcher + delay-slot block compiler (Phase 4.3)
The EE recompiler now actually runs guest code: Cpu = &recCpu boots the BIOS
on ARM64 (Mode Changed to DVD PAL, Pad DS2 Config Finished).

- aR5900.cpp: multi-instruction recCompileBlock (per-block x19+LR prologue/
  epilogue, straight-line ops, handled-branch + delay-slot terminator, length
  cap, exit-before-uncompilable-op); recEmitBranch decodes J/JAL/JR/JALR +
  BEQ/BNE/BLEZ/BGTZ + REGIMM B*Z[AL] onto the Phase 4.1/4.2 generators; C++
  recExecute dispatcher loop (pc -> recGetBlock -> run -> cycle add ->
  _cpuEventTest_Shared, fastjmp exit); recScaleBlockCycles; reset/exit plumbing.
- Interpreter.cpp/R5900.h: intExecuteOneInst() — per-opcode interpreter fallback
  for ops the rec can't compile (COP/FPU/MMI, syscalls, traps, likely/COP
  branches), mirroring execI with the interpreter's own branch/delay-slot handling.
- VMManager.cpp: select recCpu for EE on ARM64 when CHECK_EEREC (IOP+VU still int).

Key fix: blocks clobber LR via vtlb/interp calls, so each block saves/restores
LR itself (a shared enter-trampoline + bare block crashed on the block's RET).

unittests green; arm64 binary; BIOS-boot verified with the rec active.
2026-06-04 14:19:32 +02:00
David Isztl f126a6356b ARM64: Wire EE recCpu into VMManager (Phase 1.5)
Add #else (ARM64) branches to the _M_X86 guards in VMManager so the EE
recompiler's Reserve/Reset/Shutdown run on the real VM lifecycle:
- InitializeCPUProviders: recCpu.Reserve()
- ShutdownCPUProviders:   recCpu.Shutdown()
- ClearCPUExecutionCaches: recCpu.Reset()

UpdateCPUImplementations is left untouched (Cpu = &intCpu): the rec is
reserved but NOT selected, so the interpreter stays ground truth until
real EE codegen exists. Verified on a real PS2 BIOS boot: Reserve+Reset
run, interpreter executes BIOS to pad-config, no crash.
2026-06-04 09:39:33 +02:00
chaoticgd d9e0cd55c7 Hotkeys: Check if the memory card is busy before resetting 2026-04-20 19:43:55 -04:00
Mrlinkwii 9c64627b07 OSD : add OSD message for HW AA1 2026-04-20 19:49:00 +02:00
refractionpcsx2 1fa3c6aa4a GS: Move new Draw Buffering to a UI option 2026-04-17 21:13:30 +02:00
RedPanda4552 8a3f4609a6 Discord RPC: Swap Discord app id, use const vars for Discord constants 2026-04-04 15:39:20 -04:00
TellowKrinkle f6b2887ae0 GS: Add unsafe setting warnings for debug settings
It's pretty common to forget to turn them off after debugging...
2026-03-29 11:39:20 -04:00
KamFretoZ 46e85c4586 VMManager: Make Prefer English also applies to other things 2026-03-27 17:21:33 -04:00