-
-
Notifications
You must be signed in to change notification settings - Fork 108
Example 2 ‐ Extracting a GCG card
For this second example, we will see how to export a Genshin GCG card and the animations for Klee's card. We will not explain all the elements already seen before to focus on the new subjects seen here. And while a GCG card is very specific it is again a way to present a lot of situations you may face even in others games.
So unlike before, we will need to rebuild the AssetMap but a different version, to do go to Options > Export Options, and uncheck Minimal AssetMap
Then rebuild the map only.
Warning
It is recommended that you build it in a MessagePack format (not JSON or XML as it may be GB in size!) and that you also don't overwrite your previous map too, this map is for special assets that cannot be seen by default. You usually won't need but in this case, we will, so you should save it as a second file like genshin map full.map
You should also check the setting again once it is done so you don't forget, non-minimal asset maps are way bigger than normal one and way slower to navigate through in the AssetBrowser
Once done, we load the map as usual and search for gcg_cardface_char_avatar_[character name] and we load all the assets, there shouldn't be many, once done we head over to the Asset list tab.
Tip
Some characters have a different internal name. To find it, you can use this site as a reference, go to the Avatar folder and search here
In here we will look for 3 specific assets :
| Name | Type |
|---|---|
Gcg_CardFace_Char_Avatar_Klee_Spine |
Texture2D |
Gcg_CardFace_Char_Avatar_Klee_Spine.skel |
TextAsset |
Gcg_CardFace_Char_Avatar_Klee_Spine_Atlas |
MonoBehavior |
Note
The non-minimal asset map we built allows us to acquire the MonoBehavior asset that we need, the others can be seen using a normal asset map
So first, we will select both the Texture and the Text asset only, and export them using Export > Selected assets.
Note
Text assets, as the name indicates, contain text, but they are usually used for storing binary files that do not fall in the usual Unity types. For example, here the asset name ends with .skel, and the text data is gibberish; that's because it's the literal data of the .skel file. You can easily notice that if a text asset ends with an extension, otherwise it may actually be text (some file formats are also text, like .json that you may encounter)
Once they are extracted, we will select the third asset, the tool may give you a pop-up asking you to select a file, for hoyo games and a lot of encrypted ones, that file is not easily obtainable, and in the context of this extraction, we don't need it anyway, so you can just dismiss it. Then extract the asset using Export > Raw > Selected assets.
Now we need to work on the files a bit, starting with the MonoBehavior one ending in .dat, open it an hex editor of your choice, and it should look like this :
Now let's focus on the Decoded text column, in here we will look for the second occurrence of the card name, ending in .tga :
Then select all the bytes before that and remove them, so the beginning of the file should now look like this :
Now, we will select the .tga part and replace it with .png. After done, we will go to the bottom of the file to finish.
In here, we will look for the end of the text, also marked by the end of the last number, select the bytes after and remove them too :
And then save the file ! And you can also rename it to something like Gcg_CardFace_Char_Avatar_Klee_Spine.atlas.
Note
What we just did was cleaning the raw export of the MonoBehavior, these types needs the file that the tool asked us to give that we didn't to parse them, so we exported as raw and removed the useless data, this worked because it was storing an .atlas file (which used to be a TextAsset before so that's why), but others MonoBehavior assets may not be that simple to extract !
Once this step is done, we should be able to go but a lot of tools won't support the .skel file, so you need to convert it. For that use this tool and run it using :
skel2json.exe Gcg_CardFace_Char_Avatar_Klee_Spine.skel Gcg_CardFace_Char_Avatar_Klee_Spine.json
After the conversion is done, you can use any online spine viewer like this one to test by giving it your .atlas, .png and .json.
[!INFO] The GCG cards use something called spine for animations, you can search on the internet for any spine tool to work on them or edit them
In some cases, after importing your 3 files the tool may still fail to preview the card, this can happen if the json was improperly made, like in the case of Citlali :
To fix that, we will open the .json file in a JSON editor or validator and search for syntax errors :
By clicking on the first error, we can see where the issue is :
The name was ending with "" which was escaping the quote and breaking the syntax, so let's open it in a text editor and remove the backslash.
Just to make sure there aren't any other issues let's validate the json again :
Perfect ! Now let's try loading the 3 files again.
Looks good, so that's it, we are fully done now (●'◡'●)
Something is missing ? Outdated instructions ? Need some more help ? Join the discord and ask !