Lameguy64 / mkpsxiso

ISO disc image maker written specifically for PlayStation homebrew development
GNU General Public License v2.0
223 stars 36 forks source link

Bug fixes and improvements #54

Closed N4gtan closed 1 month ago

N4gtan commented 3 months ago

Updated Actions

Created a release and debug cmake profile

Updated readme compile instruccions

Update example.xml for the new format

Avoid read funcionts being call past EoF

Fixed some compiling warnings

Added ability to maintain EDC Form 2 integrity via xml, fixes this #46

Fix posible crash if end map iterator cannot be dereferenced

Dummy sectors now saves the subheader value to the xml, so it can regenerate the correct values for non-standart (0x00/0x20) sectors

Added a HACK to check if there is a post gap dummy and some warnings if the gap is a non-standart 150 one, fixes this #44

Now outputs by default an .xml file with the name of the input is no -s arg is given, this is a QOL for easy drag & drop

Fixed calculation length of dir/file entries, fixes this #52 and this #23

Removed some duplicated lines

Dirs entries are now sort before the calculation of LBA tree

Now the program supports read/update timestamps prior to 1970 in windows

Now files are extracted/built with the original timestamps instead of being offsetted previously and then re calculated at build time. This is for better compatibily with other CD authoring tools

Added ability to maintain File Flags for games with non-standart (0x00/0x02) flags, like this #53

Fixed Root date year. Root overflows dates past 1999, but there are games from 2003 that has correct (0x67) root year, maybe that got fixed in a newer version of sony's mastering tool? I need more evidence

N4gtan commented 2 months ago

I'm not entirely sure what exactly is mismatching, but with my existing test case XMLs produced from dumpsxiso without your PR, built images aren't matching Redump anymore.

image

It's probably a good idea to ensure compatibility with older XMLs. For reference, here's one from Advan Racing:

Strange because I leaved default presets if the new xml strings are missing, but I will look at it.

Also I'm planing to push another fixes and changes I have made after checking the issue with your old xml.

CookiePLMonster commented 2 months ago

I checked my Advan Racing checksum afterwards and it seems like, while matching my test case, it seems to be including the audio track in the .bin file and therefore it still doesn't match Redump. It should be easier for you to test against my GT1 XML instead, as that has no audio tracks and the rebuilt image matches Redump:

```xml ```
N4gtan commented 2 months ago

I checked my Advan Racing checksum afterwards and it seems like, while matching my test case, it seems to be including the audio track in the .bin file and therefore it still doesn't match Redump. It should be easier for you to test against my GT1 XML instead, as that has no audio tracks and the rebuilt image matches Redump:

I just checked Advan Racing and I got a 1:1 copy, what I think is currently happening is releated to the date of files nor a XML thing, because I changed the behaviour of how they are extracted/stored. I think you alredy has the files previously with a date offsted to your local time and the changes I made does not modify the date at build time, instead modify it at extract time so it can be used with tools like CDmage preserving the same date. A workaround could be to change the system time to +9 and then check if the built image matches redump.

N4gtan commented 2 months ago

Now correctly generates the descriptor's subheader, year and file order for games built with newer Sony's mastering tool.

Changed the way directory records are written to a linear write instead of a recursive write.

Changed the way descriptor directories are written from Depth-First Search to Breadth-First Search.

The -pt command now support dummies entries.

Removed some unnecessary functions.

Some minor fixes.

N4gtan commented 2 months ago

I checked my Advan Racing checksum afterwards and it seems like, while matching my test case, it seems to be including the audio track in the .bin file and therefore it still doesn't match Redump. It should be easier for you to test against my GT1 XML instead, as that has no audio tracks and the rebuilt image matches Redump:

Tested this and the difference is the dummy form2, I deprecated the type="2336" and because of this it is defaulting to form1(0x00). Currently I'm using xa_uid with the raw subheader value because there are games that use non-standar dummies like 0x89. I really can't decide which variable to use, I just reused xa_uid so as not to create another new entry, but if u like I can reuse the type one, tell me your thoughts.

N4gtan commented 2 months ago

I reverted back to use type entry for dummies, so it now correctly generates form2 sectors if type="2336" is set.

I think this can now be safely merged.

Also added some QoL in these new commits If no output dir is given, extracts the files into a folder with the same name as the input file instead of spreading out all the files in the same folder. -lba and -lbahead args now outputs a default file if no path is given.

And some minor fixes Correct timecodes with the -lba argument. Properly fixes what this PR #51 intended Corrected the CD-DA sector calculation for -lba's arguments. Fixes this #32 Prevents a path argument from parsing another argument instead of a path.

N4gtan commented 1 month ago

As for the first point, yes I can incluide it in the xml, however it wouldn't be better to preserve the old timestamp format as an argument? Or maybe both (xml and argument)? Tell me what do you think.

As for the second point, yes u are right, I noticed that behaviour recently when I switched to linux. When compiling with MSVS the binaries were output in a "Release" folder but no with GCC.

CookiePLMonster commented 1 month ago

As for the first point, yes I can incluide it in the xml, however it wouldn't be better to preserve the old timestamp format as an argument? Or maybe both (xml and argument)? Tell me what do you think.

I partly agree, but my point is that care should be taken to avoid cases where people have their existing XML files and working directories, then update mkpsxiso, and their built ISOs "break". There are people who rely on mkpsxiso providing them accurate rebuilds to reduce the delta patch sizes, so with an update like this their xdeltas will inflate in size only because they have not re-unpacked the original ISO, which IMO they should not have to do.

N4gtan commented 1 month ago

Ok now the mkpsxiso timestamp generation should be retro-compatible. Instead of adding a new string to the xml, I just did a check on one of the new features, so since these string are new they shouldn't be present in older xml's. Added the Release binary output folder and reverted back to st_mtime because I didn't know that ctime can't be updated on linux.

It would also be good to close all the issues mentioned in this PR if it is merged.

N4gtan commented 1 month ago

Is the following okay or you mean a more simplified log?

Full changelog:

Changes only to dumpsxiso

Changes only to mkpsxiso

CookiePLMonster commented 1 month ago

Looks good, I can work with that.

CookiePLMonster commented 1 month ago

v2.10 with your changes is now out: https://github.com/Lameguy64/mkpsxiso/releases/tag/v2.10

Thanks a lot once again! That was a lot of work.