Forums > Talk > Games
Apr 7th, 2024 at 5:53 am (edited)
#2325
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 PSP

I'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.
Joined04/01/24
Posts33
Apr 7th, 2024 at 11:05 pm
#2327
Read this earlier and didn't think to reply to it, really neat stuff! I would guess that you're not getting song metadata due to a localization file, yeah. Perhaps if you can find it and inject new strings into it? (That's where I've been spoiled by Guitar Hero II modding, because that game uses locale strings for basically everything, and it's dead easy to just add onto the scripts now, no replacement or injection required.)

Using leaked Sony developer tools is super duper illegal but nobody cares.
I love how much Sony dev stuff is just floating around. I've been using PS2 SDK tools for encoding video and building master disc PS2 ISOs for ages now. You'd think Sony would do a better job at keeping ahold of that stuff.
Apr 8th, 2024 at 10:01 am
#2328
I thought making a new PSARC was off the table but I finally got my hands on the original psarc tool for Vita that was missing from all my SDKs for some reason. Thanks to Wirlaburla for digging that up for me.

I'll be writing a guide later. I've been up all night so I won't go super in depth with visuals but for the sake of full disclosure I'll quote the steps I used:
Essentially just:
psp2psarc list "path/to/original/data.psarc" > "list.txt"
Then clean that up with regex until you ONLY have the file paths, none of the other junk (ps3 hacking wiki has a guide on this). This will give you a file list you can add your own files to as well, psp2psarc.exe will use this later.

Now dump your assets and mod them as you want. dumping is a lot easier than making a new psarc and there are like 15~ different programs that can do it but for the sake of convenience just use psp2psarc itself since you already have it.

Then to repack the assets use these settings. the -a and -i flags are super important otherwise the game will crash at startup:
psp2psarc create --skip-missing-files -j12 -a -i -Ilist.txt -odata.psarc
This works around the exFAT limitation and the game works flawlessly. The major downside to this approach is that you'd have to repack the entire game every time you changed anything, and the DLC or update patches might use different compression settings. Might be a good time to write a mod manager for all this.

Bonk suggested adding a reference to a mod folder in the frontend (main menu) XML which in theory would only require the data.psarc to be repacked just once.

I also went ahead and tested Zone mode in the HD Fury DLC and can confirm the game doesn't break without the FFT files, it just doesn't render the visualizer at all. So thanks to Psygnosis for adding some fault tolerance

Apr 8th, 2024 at 10:28 pm (edited)
#2330
Found it.


For editing the playlist you'll have to dabble in 3 locations:

/audio/music - contains the actual audio and visualizer files. Frontend folder contains the main menu theme, Frontend Demo contains the multiplayer lobby music, the other folders are for the playlist numbered from first to last.
/plugins/music/Definition.xml - The playlist metadata used by the game to actually create the playlist from /audio/music.
/plugins/languages/(your language)/entries.xml - Contains every string in the game plus some leftovers from previous games. As I showed above the names of each song is here with the identifier "MT_XX" (literally "music track") which must match the ID of the song in the playlist file.

Coincidentally there was a MT_12 specifically for an extra song slot. nothing after that though. Wonder if the game would have died if I added a 13th song without editing this?

Localization files were updated in data02.psarc in one of the game's patches so you'll need to rebuild your playlist mod into data02.arc so it loads on top of everything else.
Guest posting not allowed
Please log in to post a reply.