… added new notification names relating to iCloud syncing; updated PVFile initializers to use iCloud as relativeRoot where necessary; added posting a notification when ROMs db finished initializing; updated pathDecoded to use a function that does NOT return nil; updated game importer to post a notification when finished importing; added a case for determineSystems to check the current parent directory and use that as the system identifier if the import path isn't in the import directory; updated Realm converters to allow non MainActor; added actualPartialPath on PVFile that fixes the partialPath; added check for file existence in PVImageFile calculateSizeData(); added date/timestamp on logs; added actors for concurrent collections and database access; refactored iCloud code from app delegate to iCloudSync; fixed/implemented missing iCloud syncing for all directories; added deletion of iCloud files if the app was closed by checking in the db and purge those that no longer exist; added code to pre-download files initially because the iCloud documents API doesn't play nice when there's 500+ files; added aggregating multi file ROMs into a dictionary and sends those to import once everything has been downloaded, per iteration (initial or normal sync); added attempt to convert a PV 2.x to a 3.x save state; added an errors queue that can be used to display to the user any iCloud sync issues
User description
What does this PR do
Adds iCloud syncing to provenance. Removes constant values and replaces them with build variables for entitlements, plist and project files.
Where should the reviewer start
It would be easiest to just start with the build variables added
How should this be manually tested
I tested a multitude of combinations. So it was a small library and a large library. Within that it could be a combination of a small number of files for each kind: ROMs, Save States, Battery States, BIOS, Screenshots and RetroArch. For the ROMs different tests of just single file ROMs and then mixing with multi file ROMs. The importer sometimes imports those multi file ROMs fine and sometimes not. I believe that requires another PR if the upcoming import changes doesn't fix it. Really the ROMs and save states is what matters for many files because everything else doesn't get imported into the db. a small library would be less than 500 files and a large one would be larger than that, I would say at least 1k-2k files overall. The large libraries benefits from the pre-downloading. On older chips, it can be really sluggish for large libraries, but that's expected since the hardware is dated.
Any background context you want to provide
None.
What are the relevant tickets
Only one I can find is this one: Game Library Syncing
Screenshots (important for UI changes)
No UI changes
Questions
PR Type
Enhancement, Bug fix
Description
Introduces a comprehensive iCloud sync system overhaul, leveraging async/actor-based concurrency for robust file and database management, including new types, protocols, and thread-safe data structures.
Adds a Mednafen network play server implementation, including C/C++ bridges, configuration, error handling utilities, and protocol logic.
Implements a Realm-based SwiftUI game library driver for efficient game data access and preview support.
Adds advanced DeltaSkin input handling, supporting comprehensive button mapping, analog controls, and special emulator commands.
Introduces a retrowave-styled in-game menu and default controller skin for the emulator, with dynamic layouts, neon effects, and responsive UI.
Integrates audio visualizer support into the emulator view controller, with multiple visualization modes and seamless SwiftUI/UIKit integration.
Updates controller mappings (e.g., Lynx, PS2) for improved accuracy and bug fixes, including null checks and button tag corrections.
Adds or updates various utility headers and implementations (MD5, time, types, Reachability) to support new features and system integration.
Refactors and expands iCloud sync logic to support large libraries, error handling, and notification-based triggers.
Removes obsolete SwiftUI views and components, streamlining the UI codebase.
Changes walkthrough 📝
18 files
MednafenControllerMappings.h
Update Lynx controller mapping array to add Pause buttonCores/Mednafen/Sources/MednafenGameCoreC/include/MednafenGameCoreC/MednafenControllerMappings.h
LynxMapmapping array to include an additional element,changing its mapping order and adding a new value (8) at the end.
MednafenServerBridge.c
Add C bridge for Mednafen server main entry pointCores/Mednafen/Sources/MednafenServerBridge/MednafenServerBridge.c
mednafen_server_main)to invoke the Mednafen server's main function from other code, passing
a configuration path.
server's main function.
MednafenServerBridge.h
Add header for Mednafen server C bridge entry pointCores/Mednafen/Sources/MednafenServerBridge/include/MednafenServerBridge.h
mednafen_server_mainfunction forexternal use.
main.c
Add main function stub for Mednafen server bridge integrationCores/Mednafen/Sources/mednafen-server/src/main.c
main_functionfor use with the C bridge.
md5.cpp
Add RFC 1321 compliant MD5 implementationCores/Mednafen/Sources/mednafen-server/src/md5.cpp
finish, and ASCII string conversion.
md5.h
Add header for MD5 hashing functionsCores/Mednafen/Sources/mednafen-server/src/md5.h
structure and function prototypes.
mednafen-server.cpp
Add Mednafen network play server implementationCores/Mednafen/Sources/mednafen-server/src/mednafen-server.cpp
server.
client/game management, and main server loop.
logic.
time64.cpp
Add time utility functions for monotonic time and sleepCores/Mednafen/Sources/mednafen-server/src/time64.cpp
and sleeping for a specified duration.
time64.h
Add header for time utility functionsCores/Mednafen/Sources/mednafen-server/src/time64.h
sleep.
types.h
Add types header for fixed-width integers and macrosCores/Mednafen/Sources/mednafen-server/src/types.h
compiler-specific macros for inlining and attributes.
counterparts.
Reachability.h
Add public header for Reachability frameworkExternal/Reachability.swift/Sources/Reachability.h
RealmGameLibraryDriver.swift
Add Realm-based SwiftUI game library driver and data sourcePVUI/Sources/PVUIBase/SwiftUI/GameMoreInfoUI/Drivers/RealmGameLibraryDriver.swift
for SwiftUI.
using Realm.
delegate methods.
iCloudSync.swift
Major iCloud sync system overhaul with async/actor concurrency androbust file/database managementPVLibrary/Sources/PVLibrary/Importer/iCloud/iCloudSync.swift
new async/actor-based concurrency models.
handling, and file management.
iCloudRomsSyncer classes for handling different file types.
ConcurrentQueue, ConcurrentDictionary, ConcurrentSingle).
error handling, and database purging.
notification-based sync triggers.
DeltaSkinInputHandler.swift
Add DeltaSkinInputHandler for advanced skin-based input mapping andforwardingPVUI/Sources/PVUIBase/SwiftUI/DeltaSkins/Models/DeltaSkinInputHandler.swift
Skins and forward it to the emulator core or controller.
special command support (quicksave, quickload, fast forward, slow
motion).
robust input state management.
input forwarding.
RetroMenuView.swift
Introduce retrowave-styled SwiftUI in-game menu with skin/filteroptionsPVUI/Sources/PVUIBase/PVEmulatorVC/RetroMenuView.swift
RetroMenuViewimplementing a retrowave-styledin-game menu for the emulator.
dynamic content and responsive layout.
applies user selections with session/game/system scope.
orientation handling, and async skin loading.
EmulatorWithSkinView+DefaultSkin.swift
Add retrowave-styled default controller skin for emulator viewPVUI/Sources/PVUIBase/SwiftUI/DeltaSkins/Views/Display/EmulatorWithSkinView+DefaultSkin.swift
skin with retrowave styling.
D-pad, joystick, action, shoulder, and utility buttons.
grids, sun effects, and touch indicators.
system-specific control layouts.
PVEmulatorViewController+AudioVisualizer.swift
Add audio visualizer integration and management to emulator viewcontrollerPVUI/Sources/PVUIBase/PVEmulatorVC/PVEmulatorViewController+AudioVisualizer.swift
PVEmulatorViewControllerfor audio visualizersupport.
audio visualizer styles (standard, circular, Metal-based).
preferences for visualizer mode.
positioning and z-order.
PVAzaharCore.swift
Specify skin support capability for Azahar coreCores/Citra/PVAzaharCore/Core/PVAzaharCore.swift
supportsSkinsproperty tofalsefor the Azahar core.1 files
config.h
Add generated config header for Mednafen server buildCores/Mednafen/Sources/mednafen-server/include/config.h
available system features, library versions, and package information.
functions and headers).
2 files
errno_holder.cpp
Add error handling utility for errno string managementCores/Mednafen/Sources/mednafen-server/src/errno_holder.cpp
ErrnoHolderclass for error handling.with support for
strerror_rif available.errno_holder.h
Add header for error handling utility classCores/Mednafen/Sources/mednafen-server/src/errno_holder.h
ErrnoHolderC++ class for managingerror codes and messages.
2 files
runloop.c
Add null check for current_core in core_run functionCoresRetro/RetroArch/PVRetroArchCore/Core/runloop.c
current_corein thecore_runfunction toprevent potential crashes.
current_coreisNULL.PVPS2ControllerViewController.swift
Fix PS2 controller cross button tag assignment for lowercase variantPVUI/Sources/PVUIBase/Controller/Systems/PVPS2ControllerViewController.swift
button.
101 files