Some backstory. Bonk (thatonebonk, not
me bonk) had been modding HD Fury for the PS3 years ago and wanted to make mods for the prequel 2048. They both share the same game engine but there were a few hurdles. Here was the information he gave me to start with:
HD loads assets in folders last after its own archives and never overwrites them. You can mod it with zero hassle whatsoever because you don't need to mess with compression tools. 2048 does not do this, it has a predetermined list of addon packages and always tries to load its own on top of yours. The solution is to either repack the assets over the originals or completely delete the originals and force the game to read from a folder. Deleting it is less hassle so we go with that approach.
One small problem with that! For whatever reason, the PSVita really really really really really really hates it when you extract the 2048 game files. Some textures folders (specifically /art/environments and /art/DLC1) either refuse to write to the Vita over FTP or will cause weird jank with the file system and create incomplete content or directories stuck in limbo which some systems can't even delete. I thought this was memory card corruption but I have a proposed theory I'll get to shortly.
Also, if you were thinking about meddling in the game's own folder, you can forget about it unless you have a pirated copy and you've disabled PFS somehow. Fortunately, this has already been thought over thanks to modders for other games and we have a wonderful kernel module called Repatch which can redirect the game to our unencrypted mod files somewhere else on the memory card.
So it was time to get modding. The first thing I tried to do was replace music because 2048 notoriously removed the custom playlist feature that was in the previous 3 games. Wirlaburla suggested I use Beasts by treatsforbeasts to test with as a joke.
Tests in the Vita3K emulator were a fast success. Aside from emulator bugs which I had already spotted and ignored/worked around for my testing, there was very little required to get custom music working.
The first step obviously was to convert a WAV file of the song to Sony's once-proprietary ATRAC 9 format the game uses. We use a leaked PSVita SDK utility called AT9Tool for this. (ffmpeg supports AT9 now as well but I'm sticking with the same tools the developers used to be safe.) Using leaked Sony developer tools is super duper illegal but nobody cares.
An example of the command you would run to create soundtrack files. It's really that easy!Then we ran into our first problem. The game expects an FFT file. Nobody could figure out what these were at first but removing them didn't seem to have any immediate effects. All I could tell was that the size varied from song to song so it did contain actual audio data. Thanks to ThatOneBonk it was quickly figured out that the FFT files were used to bake visualizer animations, since the Vita was missing CPU instructions needed to do it on the fly at a decent framerate. The game's Zone mode uses these for its track shaders that dance to the game music, so not super important.
The kool kids kouncil has decided: Hardware Limitation.Second problem, the track and artist name does not change when you change the metadata in the playlist. I'm still figuring this one out but my suspicion is that it's actually referencing a localization file somewhere. New tracks beyond Track 11 in the game show up as blank.
Other than that it was super easy to get in the emulator. The real problem came when I tried to get the mod onto real hardware. Repacking a new PSARC wasn't an option because the Total Commander plugin to make them wasn't making them properly and would just kill the game instantly. Folders didn't work either.
"That PSArc ain't fooling me."According to Bonk, this has something to do with DLC incompatibility, but I doubt it. Remember how earlier I said there was no problem with the emulator, but dumping the files onto a Vita caused weird I/O bugs? I'd get crashes anytime a ship or track texture tried to load, basically. Well it wasn't an issue with the PSARC extraction tools, because otherwise the emulator wouldn't behave either. The files were fine on my USB too. They only broke once on the memory card. Bonk had the same FTP failures and weird limbo file bugs that I did.
"I'm the hydra. Cut off one head, and three more will take it's place."My theory is that it's a filesystem limitation. SD2Vita cards must be TexFAT or exFAT. The emulation PC is using ext4 which is much more advanced. Fortunately we can still see our music injection work so long as we don't have any 2048 assets load, so playing the HD Fury DLC will work.
While I figure out a workaround to the texture corruption issue on the memory card, allow me to demonstrate the very first documented mod for this game, adding Beast by treatsforbeasts to the ingame playlist:
IIIIIII am the beast of PSPI'll be updating this thread later once I get closer to working out the memory card problem. If it weren't for that though, the steps have been pretty trivial so far, so it's looking promising.