Home Artists Posts Import Register

Content

I've been working around the clock (mostly) on this massive refactor and reorganisation mini project to bring the app quality up to AppStore standards.

I've finally been able to compile and run the app in the latest XCode using pure Swift packages for cores.

A bunch of the app code has also been refactored into smaller, purpose-focused modules.

Some examples of new local Swift packages that are composed of either existing Swift code or translated Objective-C code are;
- PVAudio, PVHashing, PVLibrary, PVSupport, PVEmulatorCore, PVCoreBridge, PVLogging, PVAudio, PVCoreAudio, PVWebServer etc

The names are self-explanatory.

The Game Database search code is a new (well, old but revived) rewrite with newer/better Swift wrappers for SQLite.

The file importer and rar/zip/7zip decompressor are all new. This is actually giving me some issues at the moment—minor stuff. I really need to update some of the code paths for Swift's newer async/await pattern to avoid a lot of main thread blocking I/O. Again, this is minor-ish stuff but still a "must complete" task before release.

I'm shocked that once it was built, the app mostly just loaded where I left off without errors or crashes.

The other major task is a few code block stubs (empty functions) for the Metal View controller.

Oh, and I also rewrote/converted the OpenGLES and Metal rendering view controllers/run loops. That was a major PITA since the Swift APIs drastically differ from Objective-C due to all the raw pointers and memory buffers involved with 3D graphics.

I only have the Metal CRT, etc. filter loading code to finish and some higher-performance 'memcpy' code to copy each frame out of the running cores video buffer into the GPU.

The current code does a basic C pointer, `memcpy,` with no vector alignment or anything. This can be greatly improved, and I have to rework it a bit anyway since Swift kind of hates talking back and forth with C/C++ `void *` memory buffers.

That reminds me, the Audio ring buffer code was also completely rewritten. It's probably only slightly faster, but again, being Swift code, it should be much easier to add some features I wanted to the game audio, such as filters (EQ, bit-depth effects, spatial audio, time stretching / compressing dithering on slow/sped up gameplay, etc.).

I've also been slowly working on fixing all the iCloud code. iCloud SDK sucks, I'll leave it at that.

I don't have an ETA, probably at least another week, most likely 2, definitely less than 3.

I've made a TODO list of my remaining tasks, and it's manageable.

I do have to convert Mupen, PSP and a few other cores from `.xcodeproj` sub-projects to Swift 'Package.swift' modules. I made some scripts that dump the build flags and file paths for each target, so it's easy to deal with even the vast cores with hundreds of files. We only build part of most cores since we don't need things like their frontend, Linux/Windows/Android code, etc, so it's not as simple as saying, "Build everything in these folders". I usually have to list each file to build, but the scripts help since the hard work was already done when I made the original XCode .framework sub-projects over the years.

I'll let some bugs slip after an initial release, like the PS1 joystick on external controllers, which is overly sensitive compared to other cores. MD5 shortcuts are not working anymore, and there are other annoying but not critical show-stopping bugs.

One last thing. The minimum iOS version is still iOS 14. The open-source builds work with iOS 13. Because it's so untested with alternative code paths, I'm not sure how great it works, but some people still use it on older devices.

I may end up bumping the app-store version minimums to iOS 15 or even iOS 17 so I can use better Swift UI and, most importantly, async/await, Swift @Observable, and SwiftData, which would make my life a million times easier when dealing with both iCloud and main-thread-blocking code.

I'll try to get a few versions into the store with 14 support, though, and then bump it to 17 so I can rewrite a lot of the file read/write and database code to be asynchronous with way less code and bugs. Let me know what you think.

Comments

Korbin Caleb Bennett-Gold

Love this, great job! Releasing a version with more compatibility sounds very generous, I’m sure people would take advantage of that, beyond that, take advantage of anything that makes your life easier finishing this project! Even older iOS users will eventually upgrade.

Avernus

Take your time, I can wait for a better Provenance, once you are ready then go!