HackerN64 / HackerSM64

A Super Mario 64 decompilation repo based on CrashOveride95/ultrasm64 that aims to provide a flexible, easy-to-use base for creating romhacks.
323 stars 138 forks source link

Save File Optimizations #358

Open gheskett opened 2 years ago

gheskett commented 2 years ago

Save files should be optimized and allow for removal of backup saves via define.

EDIT: One issue that came up when discussing this is compatibility with Star Display programs. A plan will need to be figured out for this. @thecozies suggested potentially creating a script that builds a file to be used in Star Display, based on the save file structure. Do not put backup removal in master until this is solved, or unless save files are padded by default via define to match the expected save structure (this should probably exist regardless, since the average joe might not bother wanting to submit a star layout).

Additional requirement: Save file structs must be forced to use 8-byte alignment in some way or another (unless padding mentioned above is also written to the savefile).

gheskett commented 2 years ago

Related issue: #317

gheskett commented 7 months ago

Still unclear whether this is actually worth following through on, since it will break save trackers for saves not using Save File A

arthurtilly commented 7 months ago

this is something i do plan on doing (not as a define), i think we had a long discussion about this and planned to add padding to the save file to make it still compatible with save trackers by default but have the padding easy to remove

gheskett commented 7 months ago

Still think the best approach is to have one backup encompassing all four, though iirc? there was some other drawback that I can't remember anymore

gheskett commented 7 months ago

Another one actually is not writing backup saves means save file sizes must be 8-byte aligned rather than just 4 like before

arthurtilly commented 7 months ago

adding one big backup with a weird implementation would ruin the entire point of this (that is, to make it trivial to increase the save file size significantly)

gheskett commented 7 months ago

It should still be easy if implemented properly, I don't see why it wouldn't. Just place 1 backup slot after the four main saves.

arthurtilly commented 7 months ago

i don't see how thats preferrable over the vanilla implementation and it doesnt solve the issue of being incompatible with star tracker software

gheskett commented 7 months ago

It's preferable over vanilla still because it's equivalent to 5 save slots instead of 8

arthurtilly commented 7 months ago

i guess, but having no backups means more code can be cleaned up, more space for save file expansion, more feasible to retain star tracker support and backups are not a very useful feature anyway

gheskett commented 7 months ago

Yeah I'm mostly just worried about save file corruption but I can probably live without it if it's for sure minor enough

arthurtilly commented 7 months ago

to be clear if backups are removed save file corruption would cause the save to be wiped automatically, it wouldnt just randomly give incorrect stars or anything

gheskett commented 7 months ago

Yeah, where I definitely draw the line is removing checksums

arthurtilly commented 7 months ago

removing checksums isnt even possible, the game relies on them to initialise the save data from EEPROM garbage