Closed SoftBrilliant closed 2 years ago
Ok I was trying to write some system to handle that, but realized it was not possible. Basically: You would put multiple schemas in the json for the same header, example here:
Then, you would estimate the size in bytes for each schema using the size of each datatype (short = 2, int = 4, toffset = 8, .....) (example for QuestTitle would be 0x48 for Falcom and 0x70 for CLE). You'd put them in a dictionary or something with the size as key and the schema as value, example would be : 0x70: CLE_PC_Schema 0x48: FALCOM_PS4_Schema
Reading the size for the header in the input TBL, you'd find 0x70 then access the corresponding schema with dict[0x70] (which would give CLE_PC_Schema)
then proceed like before.
Obviously this would also mean there is only one schema for one size, which is likely to happen imo, but if you want to play it safe you could store the same size schemas in an array or something and try to parse all of them until one makes sense, still risky. I wouldn't add the game as an input argument for the moment but it is still possible later to add more safety
HOWEVER, I spotted that some fields in existing schemas don't have a definite size (the "data" datatype). I think in itself that datatype is a problem, as it should have a definite size mentioned somewhere (entries have a fixed size after all). But anyway, that's how it works right now.
So I'm not going to work on this for the moment I guess, but feel free @SoftBrilliant @nnguyen259 to contribute with ideas on how to handle it. Ideally without having the user chose which schema to use as it would clearly be a hassle since it could happen for multiple headers inside the same tbl.
To accommodate for t_title.tbl in the CLE PC version and future files with multiple headers of the same name we will need support to handle headers with the same name.