idaxex icon indicating copy to clipboard operation
idaxex copied to clipboard

Xex1Tool Resource dump overwriting resources with same name

Open Landcross opened this issue 3 years ago • 3 comments

I've got this xex file (from the game 007 Legends) that contains 2 resources with the exact same name. I can't get the first file because xex1tool overwrites the first file with the second file. It'd be nice if a detection can be added for cases where one resource name appears multiple times in the same .xex file and append some kind of suffix (e.g. _1) to the exported filename.

Landcross avatar Oct 11 '22 19:10 Landcross

Huh that's weird, wonder how it ended up like that, pretty sure the kernel funcs for XEXs only allow access to the resources by name, so if two resources shared a name then one would be made pretty much inaccessible, maybe was included into there by mistake.

Guess we can probably add a list that tracks each filename that's extracted and check against that to see if we already wrote to that filename, if so then add a number like you mentioned, will look into it shortly.

emoose avatar Oct 11 '22 23:10 emoose

Got something working for it in https://github.com/emoose/idaxex/commit/fb281eca0e21a90689d996d46efbec78d82bce33, seems to work fine when I edit an XEX to use duplicate names at least, first one will have normal name while duplicates should get _1/_2/etc added to the end.

Here's a build with that: xex1tool-fb281ec.zip

emoose avatar Oct 12 '22 02:10 emoose

Yeah, it seemed weird to me that it's even possible to have double resource names, but I didn't know enough about the matter myself to know for sure. So far, it's the only of such cases I ran in to, but to be fair I haven't checked that much yet.

Thanks for the super quick fix though. Just tested it out on the above mentioned xex file and it now indeed dumps 2 resource files instead of 1. I hashed both files and it is a bit of a bummer though that I now know that both resource files are, in fact, identical. That does at least explain how it works with 2 identical resource names I guess: they're the same file anyway so it doesn't matter.

Thanks though! 😃

Landcross avatar Oct 12 '22 05:10 Landcross