Building ITGmania for 505’s Cab

tl;dr:

If you’re running on Debian (Ubuntu 20.04 for me), building ITGmania 0.6.1, the latest version at time of writing, didn’t work just by following the instructions in the Build folder. This is what I had to do:

  1. Using a Linux distro (no WSL, sorry), ITGm’s source code at itgmania/Utils/Dockerfile-linux-amd64 lists all the correct packages that need to be installed; apt-get install these as a basis
  2. Ubuntu’s repo doesn’t have a recent enough version of CMake to build the program. Get rid of any installed versions with apt remove purge cmake and do a hash -r to clear the executable location cache. Then, for an easy one-liner, snap install cmake --classic to get the actual latest version. The rest is (or should!) be as usual:
  3. git clone --depth=1 https://github.com/itgmania/itgmania.git in an appropriate location that suits you
  4. cd in and git submodule update --init to grab other stuff like Simply Love and based FFmpeg[1]
  5. cd into Build and cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release .. && cmake .. (or other build types if you wish)
  6. make -j$(nproc)
  7. 🤞🏻

Context

SMASH! 2023 is one month away and I finally have my competition’s system (website, API, and a song “unlocker”) completed, ready to test out on the actual environment: the cab that’s going to said convention.

When some sort of condition is met (that I can track via the Uploads folder), the unlocker will create a symbolic link of the next song that I’ve kept outside the Songs folder, into the Songs folder (an issue I came across whilst working on this has been documented previously).

This means, I needed the capability to reload the song list every time I got back into song selection, which was easy enough to implement.[2] In other words, I had a reliance on this feature from ITGmania.

I think. SM5 might be able to do this, but I just know that ITGm definitely can.

Day 1: Ezclap Attempt (Prebuilt)

If I could avoid building myself, I would – and so I gave the prebuilt binary (latest was 0.6.1 at time of writing) a try: chmod 755, make a Portable.ini file, then give it a spin.

Except it took me straight back to the command line in Terminal. No error message, no log files. I haven’t checked other places.

Day 2: Building From Source

At this rate, I was going to have to get the cab online. I brought my other wireless dongle specifically for connectivity, and decided to do a routine apt-get update && apt-get upgrade whilst I’m at it. This was fine... except that it also upgraded NVIDIA’s drivers, causing the PC to boot to a black screen. The driver version was tagged recommended and tested; go figure.

After fixing that and getting back on track, I proceeded to do a good ol’ git pull of ITGm and generate the files for that sauce with CMake. After installing all the prerequisite packages by following the instructions from SM5, as advised in the readme of ITGm’s Build folder, I came upon my next issue: libusb couldn’t be found, and I should consider setting LIBUSB_INCLUDE_DIR as an environment variable. It should be noted that SM5 doesn’t have a prerequisite on this package.

A brief search on this issue gave me very little leads. Two of the two suggested I install libusb-1.0-0-dev, but that didn’t solve the problem.

By that time, the arcade had to close for the night.

Day 3: The Correct LibUSB

After coming home, I did a search for LibUSB in ITGm’s source code on GitHub, and noticed a Dockerfile with an apt-get command to additionally install libusb-dev. Okay... whoops.

Uninstalling the presumably old version (important, otherwise CMake gets confused which one to use), and installing this one instead, I gave it another try on my Ubuntu “box”, a Windows WSL2 instance. It’s day three and I’d rather get as much right as possible before going back to the arcade.

This time, CMake was successful, but building was a no-go: I got a lot of =no: not found lines (or =yes) when building FFmpeg. I wasn’t able to find a lot of clues regarding this error except for one vague, non-related discussion mentioning WSL, so I... used my website host, the only proper Ubuntu instance I had access to from home, to build it.

Finally, make’ing worked successfully, and I was ready to download it (a 117 MB binary) from the server.

It should be noted that when remotely attempting to run the game via terminal, you need to specify the display that SM5/ITGm intends to run on (it can’t run in a terminal, after all). So, I duplicated my script for running SM5 and replaced the executable with ITGm...

Boom! I have a window.


[1] Are you an FFmpeg enthusiast too?

[2] ITGmania implements their song reloading function, accessible through various means, by doing exactly the same thing as ScreenReloadSongs – the option that you normally choose via the operator menu. Except, this inherited screen, called ScreenReloadSongsSSM, sets the next screen to ScreenSelectMusic instead of the title screen.

Given that SL-Branches.lua determines what screen to load next when we get back to selecting the next song, I modified this function so that it loads ScreenReloadSongsSSM instead of the regular SSM. This works, because [see above paragraph in bold].