So I'm working on this again. I have
alot of plans for it eventually. I have written half a dozen psx based patchers and refuse to update them until I can use one unified code library of my own that makes sense (lib-enigma, here).
If you give a man a fish, he eats for one day. If you teach a man to fish, he eats for many years... or something like that.
My goal with lib-enigma is to release an open source library that stops people writing code for technical things unrelated to their goal. I get I'm pretty much the scene for this at this point. But everyone benefits from biaries using consistant updates to functionality, bug fixes,etc. If I can just release a library update called by all my patcher programs this benefits greatly me enough.
So... my next feature to add is a sector read function. Not just one, but 3... sector_user_data_read, sector_edc_read, sector_ecc_read...
For those unfamiliar. a standard PSX disc track 1 is a data bin file, comprised of:
0x18 sync bytes. This tells the CDROM wth it is (for the most part).
0x800 bytes of data. This is your actual game.
0x04 EDC bytes. This is a 4 digit checksum for what the EDC should return.
0x118 ECC bytes. This is repair data based off EDC, that tries to repair raw read data.
That's an awful lot of noise repeated each sector.The new functions will further abstract this so if you just want a bunch of user data sectors that is what you will get. Lib-Enigma already solves this in it's find n replace functionality for general lossy non-offset patching, it takes every sector and chains it's user data together until the end. But much more can be done to abstact the noise (comparing true sector user data differences, etc... even tho I have sort of done this with aprip this will be done in a more library way).
The best way I can explain this, is say you are looking for 1A, 3B, 5C, 6F pattern in a PSX CD ISO. Well there is chance because every 0x800 bytes your are cut off by bs you don't care about you'll never find this where you want to with a traditional hex editor. And lets be honest, hex editors our not the same on the year of linux 2026 anyways... But by abstracting the 0x18 sync header, 0x04 EDC, and 0x114 EDC and only chaining together real data for your find n replace this is much more useful then a hex editor

I even plan on porting the user sector compare feature, so you can ignore the EDC/ECC change from the sector on the patched disc image and just see the binrary differenes. Again this all exists right now in i.e. aprip but not in a more sophisticated way for use in your own programs. Hope this makes sense to someone messing about with this stuff or who has in the past.