PS2 Julian's various PS2 projects (Worklog)

I adapted the sources from http://lukasz.dk/mirror/cdvdmania/cdvdman.zip for ps2sdk.

It compiles, but I can definitely tell you it will not run.

However, it will serve as a reference for the cleaned up code I'm writing based on the Open PS2 Loader CDVDMAN module.
The current progress is in cdvdfsv_cdvdman branch in my ps2iop repository.

Next up…
* Reducing duplicated definitions of cdvdman between ps2sdk and Open PS2 Loader
* Splitting up the file IO, SCMD, and NCMD handling in Open PS2 Loader CDVDMAN
* Splitting up the SCMD and NCMD handling in Open PS2 Loader CDVDFSV
* Finish up implementation of standard functions in sysclib (except sprintf)
 
This month is getting close to the end…
I made the Open PS2 Loader changes mentioned above, and also added backwards compatibility for MCSERV and PADMAN.

I'll probably work on as much of the following as I can before the month ends:
* Finish up implementation of standard functions in sysclib
* Add FUSE support to pfsshell

Once that is done, I'll probably work on some of my other projects, like Kirikiri SDL2, GLTF offline import to Unity datamodel, and reversing of a certain game's 3D model format.
 
Finished implementation of sysclib.
This can be found in my ps2iop repo in the sysclib branch. This will probably be upstreamed to ps2sdk later…

For now, here is a size comparison:
10,077 - SYSCLIB from ROM (toolchain version 1.3.4)
10,045 - SYSCLIB from IOPRP (toolchain version 3.1.0)
12,720 - C version of functions
12,792 - MIPS version of optimized functions
33,396 - MIPS+Full printf (floats and exponents)

The following sources were used (with minimal modifications):
embeddedartistry/libc bfa3d49: https://github.com/embeddedartistry/libc
musl 1.2.2: https://musl.libc.org/
mpaland/printf d3b9846: https://github.com/mpaland/printf
newlib 4.1.0: https://sourceware.org/newlib/

SYSCLIB 1.3.4 didn't support floats or long long in printf, so I think this is OK to disable support for those formats.
 
Last edited:
I played a bit with pycparser's AST output. It seems like it should be easier to automatically generate bindings for SIF IOP<->EE communications with just the function prototype (and any dependent structure/enum types). This should help quite a bit with the cdvdfsv boilerplate.

I'll probably implement switching between automatic and manual structure layout for when compatibility between RPC versions is important.

I took a look at the DVR driver. It seems the communication between IOP and DVRP is like the SIF RPC between IOP and EE.
Also, interestingly dvr_hddX: and dvr_pfsX: are implemented at the filesystem level and not the block device level. This means that filesystem related functions (open file, list file, read file, directory listings, fragmentation etc) are performed on the DVRP and not the IOP.

I also quickly reversed the flash driver. It compiles, but it probably doesn't work because I haven't validated the write size to various addresses. It's in one of my branches in the ps2iop repository.
xfromman seems like it's just the memory card driver reworked to use the flash driver as the block device. However, the current implementation of mcman in ps2sdk seems to have assumptions about memory card baked into it, so I may try working vmc_fs from wLE into the flash driver instead.
 
Last edited:
W5SQ05r.jpg

This system is very quiet now, no more whine :)
For the fan adapter, this is what I used: https://www.thingiverse.com/thing:735038
For the PC board fan, I used the following: https://www.amazon.com/gp/product/B07DXNT9J9
For the EE/GS fans, I used the following: https://www.amazon.com/gp/product/B009NQLT0M
It may be challenging to insert the PC card once the EE/GS fans are placed, but it is still possible.

Now, time to debug why udpbd won't load in OPL…
 
Oh, that's interesting. I never heard of such thing.

PS: I love to see how clean this dev station is. Most of them looks like home for mites but this one is like new from factory. ;]
 
PS: I love to see how clean this dev station is. Most of them looks like home for mites but this one is like new from factory. ;]
Yeah, I cleaned up the disintegrating foam and the dust inside the system so it looks nice.

---

I took a look at udpbd and found where it hangs. It hangs inside an infinite loop in threadman after completion of the sceCdInit RPC call after IOP module replacement reboot. (This took a while to figure out because there are no symbols…)
I'll probably adapt udpbd to the smap-ingame driver, and try again later…

In the future, I'd like to improve the tooling around udpbd. At the moment, just like USB, you need a FAT32 filesystem disk image with defragmented ISOs. It would be interesting to implement something like QEMU's VVFAT in the future…
 
I did some more work on CDVDMAN. Most of the trivial SCMDs are now implemented (but untested).
For now, the current work on CDVDMAN won't work until I fix iomanX/filexio to be standalone and backwards compatible (like I did with mcserv and padman), since it relies on the extended ops table for devctl.

I also worked on the flash and DVR driver. The flash driver has a bit more readable structure/names, while the DVR driver now compiles.

I originally reversed the DVR driver to try to avoid using the installer or any other DESR system software to copy files out of the extended partition (which is limited to 4GB in size), and allow to copy files out using ftp or other protocol.

As usual, my work is in my ps2iop repository on separate branches.

---

Just for the heck of it, I decided to attempt to get pcsx4all to compile. It was surprisingly not too hard (but it most likely won't work). You can see my progress in the "ps2" branch of my "pcsx4all" fork repo.
 
Last edited:
Great news. So do You have working DESR or coding blindly? Just curious.

By "flash", You mean "xfrom" like from uLE Balika's mod? Granting access to internal DESR flash like to Memory Card (since it have also MCFS and have 8MiB)?

Also wonderful news for a guy who last time seeking a way to easily copy contents from partitions outside __mbr boundary.
 
Great news. So do You have working DESR or coding blindly? Just curious.
I haven't tested on DESR yet because I haven't set up the debugging environment yet.
By "flash", You mean "xfrom" like from uLE Balika's mod? Granting access to internal DESR flash like to Memory Card (since it have also MCFS and have 8MiB)?
I don't plan on reimplementing xfromman since it would be unnecessary duplication (instead preferring manipulation by using vmc_fs or on PC). For now, I plan on implementing flash dump and restore features (like the feature in FMCBInstaller or Memory Card Annihilator)

---

Right now, developing for the IOP is somewhat difficult because there are no gdb stubs etc for IOP, and IOP modules with debug information won't load correctly with modules from SDK 1.3.4. Also, the IOP memory is limited to 2MB on retail models, compared to 8MB for DESR/DTL-T models, so the space for debugging messages/DECI2 modules/etc is limited.

One possibility of accelerating emulators is using the native sound mixing of the SPU2 instead of mixing sound in software. I would like to use libsd in a POSIX environment, similar to how you can use APA/PFS in a POSIX environment with pfsshell. This should reduce the development cycle and would get me much closer to the SPC700 player I've been wanting to write for a while.
For now, I have aopsf and psflib outputting raw PCM to stdout correctly (with debug output!).

I think it would be nice to have a generic "IOP system library API on POSIX API" shim library for other programs to use, instead of it being stuck inside pfsshell. I plan for it to be a development platform over usage of libraries like usbd (over libusb), atad (interfacing to filesystem or block device), bdm (interfacing to filesystem or block device), thbase/related libraries (over pthread), iomanX (filesystem development, possibly using FUSE), etc…
 
I found some bugs in udpbd regarding reading large sector sizes, so I sent a merge request.
I also put a trimmed down udpbd driver in my udpbd branch of OPL.
I also pushed the udpbd_hackjob branch with additional debugging helpers left in the code.

Up next…
* Improve server software (VHD or QEMU VVFAT support?)
* Write sector support
* Configurable IP address
 
I updated my HDDOSD resource deobfuscation program so that it works on the command line. It's pretty much a combination of bitshifts and xor over 8 bytes at a time (64 bit integer).

I wonder why they just obfuscated the first 512 bytes and not the entire file? Who knows
 
I mostly wrote an adapter to translate FUSE to iomanX. Here are some things I found…

iomanX doesn't support "seekdir", so there are less optimizations available when partially listing a directory.
FUSE doesn't support "devctl", "ioctl2", "format", "mount", "umount", so disk management needs to be done some other way.
iomanX doesn't support flush/fsync to a single file, while FUSE doesn't support sync to the entire filesystem.

When converting between sceCdCLOCK and time_t, sceCdCLOCK should be in JST while time_t should be in UTC.
 

Similar threads

Back
Top