{"id":40,"date":"2023-01-28T02:28:01","date_gmt":"2023-01-28T01:28:01","guid":{"rendered":"http:\/\/localhost\/wordpress\/?p=40"},"modified":"2023-01-30T19:44:31","modified_gmt":"2023-01-30T18:44:31","slug":"modding-the-silver-case-part-2-extracting-repacking","status":"publish","type":"post","link":"http:\/\/localhost\/wordpress\/2023\/01\/28\/modding-the-silver-case-part-2-extracting-repacking\/","title":{"rendered":"Modding The Silver Case (Part 2): Extracting & Repacking"},"content":{"rendered":"\n

Our previous <\/a>post explained how to prepare a game for modding. Today, it’s about time we do the actual modding part!<\/p>\n\n\n\n

<\/p>\n\n\n\n

The game was made with Unity<\/strong>. As such, its mostly comprised of .assets files, just like the PC version, with one particularity: the heaviest (and most important) assets have been compressed within a .psarc<\/strong> archive, a proprietary format used by Sony games since the PS3 <\/em>era.<\/p>\n\n\n

\n
\"\"<\/figure><\/div>\n\n
\n
\"\"
General folder layout. The “Media” folder contains some .assets files, as well as a “StreamingAssets” folder which contains the game’s videos as .MP4s<\/em>.<\/figcaption><\/figure><\/div>\n\n\n

<\/p>\n\n\n\n

In 2020, I used a tool named Karameru<\/a> <\/strong>to extract the .psarc<\/em> archives. This time I used Noesis<\/strong><\/a>, a tool widely-used to preview 3D models from different formats, but also for extracting some types of archives, which .psarc<\/em> is part of.<\/p>\n\n\n\n

\"\"
Right-clicking on the archive and selecting “Export” allows us to extract it wherever we want.<\/em><\/figcaption><\/figure>\n\n\n\n

<\/p>\n\n\n\n

Once the archive is extracted, we can treat its contents like a usual Unity <\/em>game folder. Unfortunately, this means more extracting and repacking but it won’t be a problem, as this time we have the whole Unity modding community behind our back!<\/p>\n\n\n\n

My favorite tool for extracting Unity .assets<\/em> files is AssetStudio<\/strong><\/a>, a software that has been faithful to me since 2019, when I first used it on the PC <\/em>version of the game. It’s very easy of use for previewing and extracting the contents within the archives, but it unfortunately does not support reimporting\/repacking.<\/p>\n\n\n\n

\"\"
When we use the “Load folder” option on our extracted archive, we can see all the TextAsset (JSON messages) and Texture2D (image textures) we need to replace. We can extract them by using the “Export” option<\/em>.<\/figcaption><\/figure>\n\n\n\n

<\/p>\n\n\n\n

Once the files we want are extracted, we can edit them to our leisure. I won’t elaborate much on this part, but one thing I can say is that AssetStudio <\/em>does its best to convert the assets into commonly-used formats: .txt\/.json<\/em> files for the TextAsset <\/em>files, .png<\/em> files for the Texture2D<\/em> ones, .wav <\/em>for the AudioClip<\/em>… Surely, we won’t have much research works to find software able to work with these file formats!<\/p>\n\n\n\n

Anyway, after editing the extracted filed to our will, we will reimport them with a russian tool called UnityEX<\/a> <\/strong>(YandexDisk<\/a> mirror). Just like AssetStudio<\/em>, it’s a tool I got familiar with in 2019, when I worked with the PC <\/em>version. It has been helpful enough for me to donate to its developer in order to get all the features of the program, such as the Unity <\/em>2020-2021 support (more on that on the official forum thread<\/a>), but we can work with the freeware version as well, since the game has been compiled with Unity<\/em>‘s 2016-2017 SDK!<\/p>\n\n\n

\n
\"\"
UnityEX in action on the game’s “resources.assets” archive.<\/em><\/figcaption><\/figure><\/div>\n\n\n

Unlike AssetStudio<\/em>, UnityEX<\/em> only opens one file at a time, which doesn’t matter since all the content we need is stored within the resources.assets<\/em> file. When we open an archive within UnityEX, we can extract the files by right-clicking them, then by pressing “Extract with convert or Raw”: this will convert a file to a more common extension if it’s known (like AssetStudio<\/em> does), or leave it as-is. <\/p>\n\n\n

\n
\"\"
The extracted files go to a new folder named “Unity_Assets_Files<\/em>“, which will contain another folder bearing the same name as our .assets<\/em> file, in this case resources<\/em>.<\/em><\/figcaption><\/figure><\/div>\n\n\n

By hitting the “Import all files”<\/em> button in UnityEX<\/em>, the program will look all the files from the folder mentioned above, compare the filenames to the ones within the opened .assets <\/em>archive, then replace each matching occurence. Any .png<\/em> file is automatically converted into a .tex Texture2D<\/em> file, then reinserted in the archive. If the program finds a filename that doesn’t correspond to anything in the archive, it will give a warning and askip if we want to continue anyway. <\/p>\n\n\n

\n
\"\"
You might not see the difference, but the green bar being halfway through is a sign of the importing process being in progress.<\/em><\/figcaption><\/figure><\/div>\n\n\n

Now that the resources.assets<\/em> has been edited, it’s time to do the whole process… Backwards! First, we need to repack the folder containing the extracted .assets<\/em> files back to a .psarc file. This time, instead of Karameru<\/em>, I used Total Commander<\/a>, a freeware file manager which had the benefit of supporting .psarc <\/em>repacking thanks to a third-party plugin<\/a> by BEKETATA<\/em>.<\/p>\n\n\n\n

\"\"
Right-clicking on the folder, then clicking “File > Pack…” does the trick.<\/em><\/figcaption><\/figure>\n\n\n\n

<\/p>\n\n\n\n

And… that’s it! Now, we have our modded archive.psarc<\/em> file, ready to get inserted back into the game. As there are multiple ways of doing that, which both take a fair amount of time and dedication, I will document them in a final post, one that will get more focused on the PS4<\/em>-side manipulation than the PC<\/em> one.<\/p>\n\n\n\n

\"\"
Our custom videos folder, as well as our modded archive, are ready to go. The archive_og.psarc file is a mere emergency backup.<\/em><\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"

In this post, I will explain how to work with the (not so) niche and proprietary .PSARC archive format, as well as the (even less) niche and proprietary Unity .assets archive format.<\/p>\n","protected":false},"author":1,"featured_media":42,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16,12],"tags":[10,7,8,14],"_links":{"self":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts\/40"}],"collection":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/comments?post=40"}],"version-history":[{"count":12,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts\/40\/revisions"}],"predecessor-version":[{"id":68,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/posts\/40\/revisions\/68"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/media\/42"}],"wp:attachment":[{"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/media?parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/categories?post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/localhost\/wordpress\/wp-json\/wp\/v2\/tags?post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}