robertnunn / DRG-Save-Editor

Rock and stone!
GNU General Public License v3.0
104 stars 23 forks source link

Vanity items support #10

Closed ctrpetersen closed 2 years ago

ctrpetersen commented 3 years ago

Hi, wonderful program! Support for the limited time cosmetics would be a fantastic addition. I'm not sure how they're stored in the save files, as I've only done replacements, not addition.

I wrote a small python script to parse out the IDs of each respective vanity item. The only issue I'm having is getting the display name that doesn't include having to open each item in HxD. The display name is stored in the VAN_*.uexp file, but they're at different offsets with different patterns before them. Maybe there's a trick to getting these, I don't know.

Regardless, I've included the limited time cosmetics should they be of interest. The full vanity items list is also included, but with internal names and not display names. vanity_items.txt

Scale Brigade Armor:

All:
353754CB4488504AB67B182352B5F645 | Headwear

Driller:
E2992249A6DEE54C9E24B8F0DD323284 | Armor
71901424329FB349A131DA3FE28D4E0E | Paintjob

Engineer:
2861696F10B99E489999D64B461D198C | Armor
E3EF1EB3CCCFA740811FBC0D34D255DE | Paintjob

Gunner:
93312B33E1A90B43A9993F85A3C5184D | Armor
03CD615742F2704B896EE8C0A3ADA7E1 | Paintjob

Scout:
ACCE3B911AFCB94EB51983B6476D5DD2 | Armor
B9D24EEB4FD0A14A93831A3E5C20B61B | Paintjob

Seasonal

465DB9B55AB90042A74F6543224EF239 | Pumpkin King
B18A57F1C2FDE4488C63020614A2C5D3 | The Witching Hour
B74D2AA0A0175C4492140E719F5C410D | Horned Horror
F7778610C4EE57429D0FE3E072D0C44B | Yuletide Cap
7D0F0AF81E5F5E4E909E6C21A3A5F6B2 | Antler Cap
7E5F17AD19714345952C0A1AE2B7AC2F | Yuletide Sock
E3262E0F64C14A4EBB0825454CF0EE80 | Stay Frosty
E5A1E0B62DB8D44BBDDE07D6F201B537 | Frosty Top Hat
587E3CB7F1EBE443ACB223C09D01DA94 | Oktoberfest Fedora
EB84DD847132DB4787AB9D380E542339 | Party Hat - Year One
2AC3F4701722B34983F6AC56AA9B833D | Party Hat - Year Two
D581DDB7FB221C4C842FA0EE52A75B1F | Party Hat - Year Three
robertnunn commented 3 years ago

Thanks for going to all the trouble of extracting those GUIDS! I had a similar issue with going through the asset files trying to find display names to go with the GUIDs, I would agree that there is likely a trick to finding them, but such a trick escapes me at the moment.

Unfortunately I don't have a ton of time to put into this aside from bugfixes. I also am not sure how to directly unlock cosmetic items, so I'm not sure I can incorporate these changes at the moment. I use Qt Designer v5.11.1 to design the interface, so if you want to put in a pull request, I'd be happy to review it and would definitely add your name (and a link to your github) to the readme. But to be clear, I don't have any plans to add new functionality in the next few months.

ctrpetersen commented 3 years ago

I had another look at it. It seems they're simply stored in an array of unlocked vanity item GUIDS for each class. Replacing it is easy enough, one can even unlock everything manually, it just takes some time. Just find a vanity item you know the id of, make sure it's unequipped (just unlocked), then replace it in the 4 instances it occurs. Surprisingly I had no issues with this - the game even lets you buy the old one again, letting you repeat it forever until you have all the vanity unlocks.

Automating it however seems much harder. Each class has an array called UnLockedVanityItemIDs (sic), where the 2nd, 4th, 6th and 8th instances will be the actual arrays. The last two looks to be some sort of descriptor? This is the 5th class, the internal testing class.

Regardless, adding anything to it (not replacing) will cause the game to hang on load. It seems this is more related to changing the size of the file (checksums?), rather than adding to the array. To proceed, one would most likely need to deserialize the entire file and repack it.

This is unfortunately way out of my skill level. I'm putting what I found for clarity anyhow -- maybe someone else will have a look. I might give it another look in the next weeks, see if I can find the differences between the files on a vanity item unlock.

Like described, unlocking everything is possible, just kinda cumbersome to do so. If I find anything more, or a solution (having display names working as well would be perfect), I'll post or do a PR if I get anything working.

robertnunn commented 3 years ago

I think the reason it's hanging on load is because those arrays you saw have a value just before the listing that defines the length of the array, so you're creating a mismatch between how long the game is told the array is and how long the array actually is.

array length defined Here, the length is 134, meaning there are 134 GUIDs in the array. If you update that value as well, it should load just fine.

If you do manage to find out some pairings of GUID and display name, The best way to provide that data (even if incomplete) would be to copy the format seen in "guids.json". Then I would just have to create a new area of the GUI for managing that and much of the weapon overclock code could be reused. Thanks for poking around, you seem to be discovering the same thing I did, that you're gonna spend WAY too much time staring at a hex editor for this :P

ctrpetersen commented 3 years ago

Wow, thank you! I'll have a go at it later today.

In the meantime, I tried my hand at parsing the display names again. It's janky as hell but it does work in most cases. vanity_items_temp.txt This is definitely not the best way. I'm probably gonna end up writing some quick and dirty CLI tool that just prints all alphanumeric strings to the console, and manually selecting which one is the correct one. Still a bit tedious, but much better than having to open each one in HxD.

Thank you for the size information, I'll experiment with this later today. This is my first time working with hexadecimal (and binary data), so all of this is new to me. I'll probably put up a PR sometime in the next days if all goes well.

AmigoBarba commented 3 years ago

@ctrpetersen It might be a long shot, but did you make any progress on this?

robertnunn commented 2 years ago

For the record, I have no plans to add cosmetics support.