Hello. I haven't been able to find where to find the soundtrack for TWEWY - Final Remix, so here's a guide to dump it from the NSP for the time being. This requires knowledge of basic Nintendo Switch reverse-engineering (knowing how to follow community instructions should be enough, but some of the key-dumping stuff is relatively involved), and some familiarity with Python. I tested this on a Linux system, but "in theory" you ought to be able to do this on Windows, if you have the right Python stuff installed. But, I haven't tried this.
You will need:
You will need:
- A (legally-obtained) copy of the game's .NSP file. I am afraid cannot help you here.
- hactool for your platform
Grab this from here: https://github.com/SciresM/hactool - The key file to give to hactool. This has been called "prod.keys" or "keys.ini" or "keys.txt". There have been tools out there that will help you dump the keys from your console. I am afraid I cannot give you mine.
- Python installed on your system (python3 I think)
- UnityPack installed on your system (or downloaded and installed locally - see my hacky guide below).
Grab from here: https://github.com/HearthSim/UnityPack
You may be able to use some other kind of Unity unpacker (I imagine they exist for Windows) but your mileage may vary - (Optional) vorbiscomment installed on your system (sudo apt install vorbiscomment), or google for the Windows version.
- (Optional) a script to rename the tracks to something useful, and to give them useful metadata
Grab from: (see attached)
- Use hactool to extract the NSP file into its sections:
Run:
hactool -k path/to/keys.txt -x --intype=pfs0 path/to/game.nsp --outdir=twewy_extract
You should end up with a directory called "twewy_extract" which contains a few files.
- Use hactool to further extract the ROMFS section of the game. Go into the "twewy_extract" directory and find the biggest .NCA file in there. This is the ROMFS file.
Run:
hactool -k path/to/keys.txt -x --romfsdir=twewy_romfs path/to/romfs_file.nca
(replace 'romfs_file.nca' with the long filename of the ROMFS file from above. It will have a bunch of numbers in the name)
You should end up with a directory called "twewy_romfs", which should contain one or two more directories (which, in turn, contain a ton of stuff).
- Grab the unity-encoded soundtrack.
Go into twewy_romfs/Data/StreamingAssets/Assets/sounds/bgm/ and you should see a bunch of .unity3d files. These are the music tracks, packed in the unity3d format. Copy these someplace.
- Set up UnityPack. (If you have some other Unity extractor that works, skip this step and just use that instead).
If you're cool with UnityPack, try to use your system's python3 package manager to install 'unitypack'.
If that fails, just grab it from https://github.com/HearthSim/UnityPack
In either case, find the unitypack/enums.py file of whatever instance of UnityPack you are using, and edit it, to add the following line at the bottom:
NintendoSwitch = 38
NOTE: Make sure this line is indented the same way as the lines above it (eight spaces)! Python very much cares about whitespace.
If installing UnityPack from github:
* You'll probably need to also install its dependencies via pip.
* I forget what the full list is, but I want to say you'll want to pip3 install decrunch fsb5 IntEnum lz4, (and whatever else it says it's missing when you go to run unityextract).
* After cloning UnityPack, I had to run the following steps to keep it from barfing. This basically "installs" UnityPack to a local directory, and then tells Python where to find it (so that you don't have to install the whole thing in your system python directory). This may be due to me having all my python stuff outdated, though. Your mileage may vary.
cd UnityPack
mkdir -p local/lib/python3.4/site-packages
export PYTHONPATH=local/lib/python3.4/site-packages
python3 setup.py install --prefix local
And then to actually run unityextract, I had to run:
export PYTHONPATH=local/lib/python3.4/site-packages
python3 ./local/bin/unityextract
* If facing python problems, refer to https://xkcd.com/1987/ for what you've gotten yourself into. This was by far the most frustrating part of the whole process
- Use unityextract to unpack the .unity3d files that you grabbed in step 3.
Run:
unityextract --all --out sountrack/ path/to/your/unity3d/files/*.unity3d
You will end up with a directory called "soundtrack" containing a bunch of .ogg files. This is the soundtrack!
- Optionally, copy the attached twewy_soundtrack.py file into the "soundtrack" directory and run it. This will use the "vorbiscomment" utility to rename them to something more useful, and to assign metadata.
If you're on Windows, you might need to edit the script (use Notepad++) to replace "vorbiscomment" with "vorbiscomment.exe" in the two obvious places, though I have not tried this.
- Consider buying the soundtrack when it comes out...
Attachments
Last edited by evilwombat,