Sammi-Husky / Sm4sh-Tools

Miscellaneous tools for dealing with smash 4 files.
40 stars 26 forks source link

Params - Empty groups get ignored #54

Open Dr-HyperCake opened 7 years ago

Dr-HyperCake commented 7 years ago

When editing parameter files, empty groups - that is, groups which are defined, but have no values and are immediately followed by another group definition - are ignored.

Due to this, when saving a parameter file that had an empty group in it, that group definition is not included. This can cause crashes in-game.

I think a solution to this would be to read in the empty group, display it as exactly what it is (a group with entries that have no values), and include this group definition when saving.

Sammi-Husky commented 7 years ago

Do you have an example file you could show me? I believe what you're probably seeing is what's supposed to be embedded groups (groups within groups) which aren't supported, as it's impossible to know the size of the parent group the way the files are structured.

Each param file is supposed to be read into the game INDIVIDUALLY by it's own parser, so reading them in generically with one editor wasn't something they intended. Because of this, the only way we actually can read them in generically causes some issues.

Namely, that the count field in the group definition is not a value count field. It's a STRUCT count field, and the only way to know the size of the structs the group contains is by reading in EVERY value we come across until we see another group definition and then divide the total number of values read by the original group's struct entries count field (because the structs in a group are all the same size and formats).

Dr-HyperCake commented 7 years ago

Apologies, I meant to give examples but it must have slipped my mind. The only two files I have seen this in are fighter_param_vl_bayonetta.bin and fighter_param_vl_zelda.bin, both of which are in param\fighter.

Bayonetta's has this at offset 0x2CBF, where a group with 2 entries is defined, but no values are present before the next group definition. Attempting to use this file after this group definition has been removed causes a game crash upon entering a match with Bayonetta.

Zelda's has this at offset 0x2A16, where a group with 1 entry is defined but, again, no values are present before the next group definition. Attempting to use this file after this group definition has been removed causes a game crash upon Zelda's Phantom projectile being reflected.

Sammi-Husky commented 7 years ago

I have a few idea for maybe fixing these issues and making parameters structure 1:1 to how the game sees it. I'll keep this issue open and updated as I work it out