MTH Hacks
VIDEO HACKS - MTH FILES
Overview of THP and MTH Format
Well, here we are. The in-game videos, finally. Before I go into structural format, I want to clear up just what are "movie files" in SSBM.
Movies in SSBM have no sound themselves. Sound is provided through the HPS files. So when the opening movie is played, the images you see on the screen come from MvOpen.mth, while the music comes from opening.hps. So if you wanted to change a movie and its sound, you'd have to do both the HPS and the MTH files. That's two hacks, for the slower readers. The MTH movie files include the opening movie, the how to movie, the 15 minute montage movie, and the clips that play when you beat 1P mode (right before the "Congratulations!" part, but after the credits).
The movies for the GameCube follow the THP format. Just like music is HPS and SSM, movies are THP. THP files hold general data about the movie, like FPS (Frames Per Second), number of frames, width and height, etc. The images themselves are just JPG image files, with minor modifications. THP files are structured to also have audio, but none of the movie files in SSBM have the audio in the same file. The THP files in SSBM are the images you see at the end of 1P mode (when the announcer says "Congratulations!"), and they vary between character, and what type of 1P mode you played through (Normal, Adventure, Allstar). MTH files are just "Mute THPs". They don't have audio capabilities, and their structure is a bit different.
Now for a more technical overview. The JPG frames, in particular. Since each frame is a JPG, can you just copy/paste a JPG into the right spot of the MTH/THP file and make it work? NO. The frames of the MTH/THP have a few changes. To quote YAGCD, "A jpeg file is structured by several markers. A marker is a two-byte code, the first of the two bytes is 0xff. The jpeg standard states that if you want to store the value 0xff, you have to store it as 0xff 0x00 (else it would be confused with a marker). This is NOT the case in .thp files, the value 0xff is stored simply as 0xff in the image data." Also worth noting, each JPG frame is seperated by a value for the next frame's size, which makes the JPG data look a little irregular in a hex editor.
Because MTH files and THP files are so similar, I'd like to outline their differences, like so - first the headers, then the frame data. Headers for MTH files are 0x40 bytes long, while headers for THPs are 0x50 bytes long. Mainly, this is because THP files have an extra line to check for audio files. I'm not going to go in any more detail for the headers like I did for HPS files above, because it doesn't seem necessary. Frames, the quasi-JPGs, have only a few differences, too. In THPs, the beginning of each frame has these three values: [size of next frame], [size of previous frame], and [size of actual JPG data]. MTHs have only [size of next frame]. At the end of each frame, the THP file marks it as the end with the FF D9 marker, while MTH marks it with the FF D9 FF marker. Minor differences.
I go into the differences a bit above, because it kind of tells the story of how I went about hacking these files. In the Wii SDK, there is a program called THPConv that makes THP files. What I did was make a THP file out of some JPGs with this THPConv, and then change the THP to a MTH according to the minor differences. Testing was initially done with a program called thpplay by a guy called "thakis". I think I got it from EmuTalk Forums. So I made a program that changes THPs to MTHs, called mth_make (keeping consistent with the names of my other programs
), and I replaced the file MvOpen.mth. The thpplay program played the movie no problem, but on checking it with Dolphin, I got frame speeds of about 2 fps, when I ususally get 27 to 40, just on the opening movie. Pressing start got me through to the menu screen, and everything was normal after that (~35 fps). Yes the movie hack worked, to an extent. I'm not sure how it will do on an actual GameCube/Wii, though.
Hacking the MTH Files
What you need:
-THPConv.exe (from the Wii SDK)
-mth_make.exe (
DOWNLOAD here)
-a movie editor program that can output movies as JPGs (I used Adobe After Effects)
0. Before you start
Make a new folder, and put THPConv.exe into it, as well as mth_make.exe. No cmd.exe necessary this time, since we can just double click the mth_make.exe and run it.
1. Getting JPGs from the movie
Find the movie you want to put into the game, and open it with whatever program you're using. This is probably the hardest part. Not everyone has access to high-end programs that can export the movie as JPGs. If you do, please post with what the program is, so I can update with it. Anyway, create a JPG sequence out of the movie, into the folder with the rest of the stuff we're using. Make sure the JPGs are sequentially numbered (###1, ###2, ###3, etc).
Technically, you can just make a bunch of JPGs with an image editor like Paint/GIMP, what have you, and call them 1.jpg, 2.jpg, 3.jpg and make your movie. I assume you all want to actually make movies, though.
2. Running the program
So. The JPGs are all in the folder along with THPConv.exe and mth_make.exe. Double click mth_make.exe and watch the magic. mth_make.exe will call THPConv, create a THP file, and then create a MTH file called "temp.mth". The MTH file is the final product. The time it takes to do this may vary depending on your computer. MTH files are the largest files in the whole ISO, and they take a while to process and change, so be patient.
3. GC-Tool etc
I only put this part in because I scared myself when I tried to replace MvOpen.mth with my temp.mth creation. My computer hung for a few minutes, and I thought GC-Tool was acting up and had frozen. But it all worked. As a reference, MTH files are pretty big, like 100 MB big (465 MB for the 15 minute one, 5 MB for the 1P mode movies), while HPS files are 6 MB on average (30 MB for that 15 minute video). And those Pl****.dat player files barely hit 500 KB. So it makes sense that GC-Tool needs more time for these MTH files.
Other Notes
SSBM THP files - A Note
The files with THP extensions in SSBM are not real THP files. They're just single images, and their headers are a bit different. So in short, you can't just run THPConv on a single JPG and use the resulting THP file to replace the one in-game. sorry. i think.
How to use THPConv.exe
Basic usage from command prompt:
"THPConv -j *.jpg -d output.thp"
which will take all the jpgs in the same folder as THPConv.exe and package them into a file called output.thp.
You can also just do one jpg, by replacing the "*.jpg" with, say, "1.jpg" or "armor.jpg" to just make THPs of those individual files.
temp.mth
Interestingly enough, the MTH I made to replace MvOpen.mth is almost half the size of the original, yet only 10 seconds shorter. Huh. Lower quality, I suppose.
DOWNLOAD here, if you're interested.
mth_make.exe
temp.mth