PS2 Julian's various PS2 projects (Worklog)

I fixed a couple of warnings with the new toolchain in Simple Media System, and reworked it to not use realloc64. Those changes work perfectly fine with the old toolchain, but still black screens with the new toolchain.

But, here's the odd thing… The executable compiled with the new toolchain works fine in PCSX2.

So for now, I'll put it aside until I at least get a real hardware debugger working so I can see where it black screens.
 
I implemented support for splitting decompiled output by filename in my STABS parser, and diffed most of the EE/IOP differences of the other tools. I think the last big thing to diff is the debugger.

For now, I'll leave the network daemon and the MRP driver for later.

---

I'd think it would be nice to make a mock framework for libraries in ps2sdk, so they can be compiled and run in a Linux based environment and use code quality tools like american fuzzy lop, Valgrind, clang-tidy etc. to find more issues. It would be basically be doing what is done in pfsshell, but implementing more abstracted APIs like cdvd, rom/ioprp, spu2, memory card, usb, etc.

---

lwext4 seems like a nice library to embed ext4 support.

https://github.com/gkostka/lwext4

If getting fragments offset and size is implemented, it could be useful for OPL.

---

I've been taking a look at more filesystem solutions for UDPBD.

It seems like nbdkit is a pretty good library.

There exists the linuxdisk plugin for nbdkit, which can expose a filesystem as ext2/ext3/ext4. https://libguestfs.org/nbdkit-linuxdisk-plugin.1.html
There also exists the floppy plugin for nbdkit, which can expose a filesystem as FAT32. Unlike QEMU VVFAT, it is not marked as experimental and can support file above 2GB up to 4GB. https://libguestfs.org/nbdkit-floppy-plugin.1.html

Both plugins mentioned above expose a read-only filesystem. However, there exists a copy-on-write filter in nbdkit which can make it possible to make those filesystems read-write: https://libguestfs.org/nbdkit-cow-filter.1.html
The copy-on-write filter implementation in nbdkit is cleaner than the write support in QEMU VVFAT.

So, basically, the lifecycle would go like this:

1. Start nbdkit server with linuxdisk or floppy plugin
2. Attach NBD block device exposed with nbdkit
3. Start UDPBD server with attached NBD block device
4. Use UDPBD client however you want
5. Stop UDPBD server
6. Mount NBD block device exposed with nbdkit
7. Synchronize changes to local directory using e.g. rsync
8. Unmount NBD block device
9. Detach NBD block device
10. Stop nbdkit server (destroying the COW data, which should be synced in step 7)
 
Last edited:
Here is what I found for the poweroff handler behavior:

* It is only enabled when dev9 is powered.
* This single line allows the poweroff handler to occur:
Code:
DEV9_REG(DEV9_R_POWER) = (DEV9_REG(DEV9_R_POWER) & ~1) | 0x04;
* On some consoles, powering off **immediately** after the power off interrupt handler is called will cause the red and green lights to be lit simultaneously. This is a bug in the mechacon firmware where they forgot to cancel the timer for turning the green light back on.
* Even when dev9 is enabled on slim consoles, the power off interrupt handler is not enabled.
* Even on slim consoles, sceCdCancelPOffRdy doesn't appear to be stubbed in its mechacon firmware.

I also took a look at the mechacon firmware, and there doesn't seem to be a simple command to enable the power off interrupt handler on all consoles without touching the dev9 registers.
So probably need to patch or backdoor the functionality in.
 
Since the arcade modules don't have version information in them like the SCE library modules, I decided to sort them based on their modified date on the memory card image instead.
To facilitate this, I added timestamp support to the "extract" command of mymc. You can find this change in the "timestamp" branch of my mymc repository.

For now, I'm applying the type information from the arcade CDVD module to the retail CDVD module (mainly related to ISO9660 etc).

Also, another thing in the DVR cdvd module is a SCMD to reset the DVRP, and it consumes a single argument.
 
A little note about mixing signed and unsigned variables in comparison operators… it will do an unsigned comparison, no matter which side is signed or unsigned.
 
I'm planning on moving some modules to ps2sdk:
sercman, secrsif
fsck, fssk, hdck, hdsk

I'm mostly finished with type recovery on the following modules:
cdvdman, cdvdfsv
romdrv, adddrv, addrom2

I've made quite a bit of progress labeling these modules:
sysmem, loadcore, loadfile, modload

Once I'm done, this should make it so that:
* Use the encrypt/decrypt functions within applications
* File system check within applications, and also in pfsshell
* Dual layer disc support for the consoles that support it
* Read the ROM
* All filesystem modules will now have source code, so can make a EE-side iomanX more possible
* Module unloading support
* Remote LoadModuleBuffer without sbv patching
 
Last edited:
Right now, the UDPBD driver involves invasive changes to the SMAP driver. One thing I'd like to do is split off those changes into a separate module.

Also, I'd like to make a client that uses the standard BSD sockets API. This may be slower, but should allow it to co-exist with the SMB1 driver. This would also make it easier to debug on POSIX based platform.

---

I'm slowly working on converting the psx-scene processed archive to XHTML. But it seems like LuaJIT pattern handling seems to be bugged, so I'll probably need to rewrite my script in Python. I wrote the script to process the archive in Moonscript before I switched to Python.
 
For IRX handling using unpatched binutils, I'm probably going to clean unneeded sections on EE, then xfer it to IOP.
Seems like objcopy and strip really don't want to remove the .symtab and .strtab sections

Basically it goes like this:
1. Check if .iopmod and .rel.* sections exists. If they don't, stop here and don't modify anything
2. Remove other sections like symbol tables and debug information
 
I rebased the EE MMI changes onto GCC 11.3.0. They can be found in my fork of GCC in the ee-v11.3.0-mmi branch.

I removed the shift accumulator / funnel shift related stuff.
 
Upstream, unpatched binutils and GCC are now being used for the IOP toolchain!
This means it should be much easier to update the IOP toolchain in the future.

To manage the IRX specific sections like the specific e_type field in the header and the .iopmod section, a new tool, ps2-iopgen is being used. It does most of the basic stuff as psp-prxgen from PSPSDK does.
 
Little tidbit...

If you are porting or writing a recompiler targeting the r5900 processor, please note the EE short loop bug issue.

Otherwise, the generated code will not work properly on older systems.
 
mbedtls would be needed in order to allow HTTPS communication.

If I can get it to read from an out-of-tree mbedtls_config.h, that would be nice...
 

Similar threads

Back
Top