domingo, 13 de julio de 2014

Installing Debian and Stepmania on a Pump It Up arcade.

If you got fed up and bored with the game that your machine comes with, NX2 in my case, and you want to add new songs, charts and stuff to your personal arcade, follow this guide.


This is still work in progress so the guide needs polishing. This will come as I work on it.
Now to the guide:


Pumpy setup by Zim_256.
This guide is based on Debian 7.5.0 32bit (i386) and Stepmania 5 Beta 1a (then upgraded to SM5 Beta 3).
Download the Debian disc named "debian-7.5.0-i386-DVD-1.iso" otherwise you'll get another install experience or another software kit and the steps in this guide will become invalid. Linux is about the same animal altogether but things change from time to time or from one distro version to another. Burn that thing to a DVD, R flavor is up to you, if you use RW, make sure the disc is new and clean.
Get a new hard drive for the PIU machine, remove the key and the Andamiro drive from the machine, be careful with it, store it away safely. Don't mess with it and most important, DON'T FUCK WITH THE SYSTEM WITH THE ORIGINAL ANDAMIRO HDD CONNECTED. ONE BAD MOVE AND YOU'LL CLEAR THE ENTIRE DRIVE. REMOVE THE ANDAMIRO DRIVE AND KEY BEFORE DOING ANY WORK ON THE MACHINE. Get any drive that your system may support, IDE, SATA, doesn't matter as long as it works on the motherboard. MK9 supports any kind of drive.
Wanna get a cheap 1TB drive? Buy a Verbatim external USB 3.0 HDD, open the case and rip the drive out, it's a standard laptop hard drive.
Now, connect a DVD player on the machine, pop in your Debian disc, power it up, press F12 on boot, choose to boot from the CDROM (USB CDROM if you're using an USB drive) and let the setup begin.
Install the base system, make sure there is no network connectivity because it will fuck things up. Remove the ethernet cable from the PC (if any).
Use the normal install, avoid the graphic one
- Tip: Don't install the system in the arcade machine if you have an old CRT monitor, the installer uses a weird refresh rate, not supported by the monitor and it will render the display useless. If you replaced the CRT monitor or yours is a multiscan, ignore this warning.
- If you ignored the warning and the monitor got scrambled output, restart the installer using CTRL + ALT + DEL and when the install menu appears, go to the help and type install vga=normal fb=off. This will be enough to let you install but things will get messy again when the system reboots.
- Let me suggest you one more time, DON'T install this system on the arcade. It's pointless. Get an LCD or a good multiscan CRT monitor until you get all things up and running. It will make your life easier.

Follow the setup and accept all default actions, partition as the installer says, don't change things. If it wants to connect to the network, choose "Do not setup the network at this time". Remember that having internet at this point will fuck things up.
At the last point when you need to select packages, choose the desktop environment and the default tools, remove printing, server and everything else.

Reboot the machine, if you're setting this up using the arcade's monitor it will start up with a scrambled screen, fix this BEFORE it gets to the graphical environment because if it starts at 1024x768@75Hz, your monitor will blow up. Press CTRL+ALT+DEL if you can't read the screen and wait until the system reboots.

Now, at the bootloader (Grub), go to rescue system, login as root then edit the file at /etc/default/grub (type "nano /etc/default/grub")
edit this line as this "GRUB_CMDLINE_LINUX="nomodeset"" then remove the hash at the beggining of the lines "GRUB_GFXMODE=640x480" and "GRUB_TERMINAL=console". Press CTRL+O and CTRL+X.
Type "update-grub" then restart, you should be left at a gnarly 80x25 text console.
Now you should uninstall GNOME as it's the default window manager installed by the CD.
Login as root and type aptitude, browse the installed packages and find Gnome desktop environment, press -, now browse the not installed packages and find XFCE, press +, then press g. After everything is updated, press q to quit aptitude.
Reboot using ctrl+alt+del
Login as non-root
type startx, this will drop you on the desktop environment, it will probably run at the max resolution, find your way to lower this to 640x480@60Hz

Now go to the nvidia website (on another computer) and download the linux driver for your card. Place that file on a removable USB drive and rename it to nvidia.run.
Go to your linux box and copy that to your user folder (/home/[you]/)

Get ready, shit is about to get really nasty.

Log out of X, probably log out from the console and log in as root.
What you need to do now is install the nvidia driver, that thing is complicated because the driver requires some components already up and running on your computer that aren't installed by default. Those are developer components and at this point your linux box, the system installed and the nvidia driver thinks you're a linux whiz, which you are not.
I'm going to spoonfed you some commands and stuff, if anything doesn't work, research the net, this is coming from the top of my head and I'll probably update this text if I get the chance of doing this all again, this comes from trial and error mostly.
First things first, maybe you'll get lucky and can get the driver install without whining, try this:
cd /home/[you]
sh nvidia.run
The driver will try to install. If it succeeds, you're lucky and ignore a little bit of this guide. Chances are that it will not.
If it fails, welcome to the real world.
After you get kicked out of the installer, do this:
apt-get install gcc-4.6
GCC will get installed
now do this:
apt-get install make
then:
aptitude
now find inside aptitude, the kernel sources and install them. The sources are in non installed, kernel, main, linux-headers-3.2.0-4-686-pae. Push +, then g and g again. Enter when prompted then q to quit aptitude.
Install only the sources for your machine, don't install AMD64 or 486, just 686.
Now, there's another conflict. Your machine has 2 gcc versions installed and you cannot choose which one the nvidia installer is going to use. Unless you do this:
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 10
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20
then
update-alternatives --config gcc
and choose 4.6
Now:
sh nvidia.run
and it will install happily, choose to let the installer modify your X settings and reboot, log in as you and type "startx". You'll be greeted by XFCE at full 1680x1050 (or whatever) resolution.

Now to the fun part. Connect the linux box to the network and make sure you have internet connectivity.
You do not have internet? Oh, great.
Where are you now? In xfce? get out of there and go to the console, type logout, then login as root.
type "nano /etc/network/interfaces"
You'll have now on the screen a text file that says something like this:

auto lo
iface lo inet loopback

Position your cursor at the end of loopback and press enter, type this:
allow-hotplug eth0
iface eth0 inet dhcp
Now save with CTRL+O and exit with CTRL+X
Reboot.

Log in as root, start xfce, go to the globe that is on the dock on the bottom of the screen, that'll start IceWeasel, open any website to check if you have internet. If you do, download stepmania. Go to code.google.com/p/sm-ssc/downloads/list and download the linux version.
While you wait, go to a console and type "glxinfo | grep direct" and see if it says "Direct rendering: Yes". If it does, you're almost ready to go.
Extract the stepmania folder to any folder on your system.
Try to run it.
Nothing happens?
Try it from a console.
It probably whines about something not installed.
Go to the package manager (as root, don't try this as user otherwise XFCE will hang) and install ffmpeg, libmad, libpng15 (you need google for this one), then you should probably update libgc (again, google).
I found on another guide that this commands installs everything you'll need, use with caution and take into account any error that it might spit out, the command is for Mint, not debian so some packages may not be found, it's a big chunk so i put it between these lines:

----------Begin command ------------
apt-get install libasound2-dev libpulse-dev libmad0-dev libtheora-dev libvorbis-dev libpng-dev \
libswscale-dev libavutil-dev libavformat-dev libavcodec-dev \
libjpeg-dev libglu1-mesa-dev libgl1-mesa-dev libgtk2.0-dev xorg-dev libxrandr-dev libbz2-dev \
libglew1.5-dev automake1.10 build-essential curl g++
----------End command ------------
The complete list of dependencies listed in the stepmania website is as follows:

    autoconf and automake
    GCC and G++
    OpenGL libraries and headers (The libraries should come with your graphics card driver; headers are Debian: mesa-common-dev)
    GLU libraries and headers (Debian: libglu1-mesa-dev)
    GLEW 1.5 or newer (Debian: depending on your OS version, libglew1.5-dev or libglew1.6-dev or liblgew1.7-dev and so on)
    X11 libraries and headers
    Especially: Xtst and Xrandr (Debian: libxtst-dev and libxrandr-dev respectively)
    libpng (Debian: libpng12-dev)
    libjpeg (Debian: libjpeg8-dev)
    zlib (Debian: zlib1g-dev)
    libBZ2 (Debian: libbz2-dev)
    libogg and libvorbis (Debian: libogg-dev and libvorbis-dev respectively)
    libpthread (Debian: part of libc6-dev)
    yasm (for building ffmpeg)
    Headers and libraries for one or more of: ALSA (Debian: libasound-dev), OSS (kernel headers actually), PulseAudio (Debian: libpulse-dev), and/or JACK (Debian: libjack-dev)
    and of course, GNU make.

So all that needs to be installed and working.
Try to run SM again, if it works, configure the graphics to run on fullscreen, 640x480, 60Hz.
Quit the game and copy all your music, themes and stuff to the game folders.
Try if your stuff works.
After that, configure the desktop resolution to 640x480@60Hz, log out, shut down, put the linux box back into the arcade, connect everything, turn it on, make sure everything is working. You may need a keyboard at this point. Log in, play the game, exit the game and configure the system to auto-start, make a script to log you on automatically, make another to launch XFCE, then another to launch stepmania when XFCE is up.
That's it. You're done.

Oh, wait, no. You're not.
There's still fun shit to do so bear with me.
You probably noticed that nothing in the arcade works with that version of the game we just installed. That's ok if you want to play with your lame keyboard but since this is an arcade setup, we need to make the arcade part work.
Ditch that stepmania you downloaded and get the sources from github. We're going to... dum, dum, duuummm.... BUILD FROM SOURCES. Yeah, shit just got real.
The problem with the game from google code is that it refuses to work with the PIUIO board, we need to recompile the PIUIO support in the game and add a little kernel hack to linux to be able to use the pads and lights.
Since I don't want to reinvent the wheel I'll leave you guys this guide, this is not mine and I can't find the author, follow it and you should be good to go. Some parts regarding the linux installation have been hacked away. You don't need that, you probably have linux installed already.

-------------------------- Guide begin -------------------------------------
----------------------------------------------------------------------------

This command will install ALL the dependencies needed to run StepMania 5.

$ sudo apt-get install libasound2-dev libpulse-dev libmad0-dev libtheora-dev libvorbis-dev libpng-dev \
libswscale-dev libavutil-dev libavformat-dev libavcodec-dev \
libjpeg-dev libglu1-mesa-dev libgl1-mesa-dev libgtk2.0-dev xorg-dev libxrandr-dev libbz2-dev \
libglew1.5-dev automake1.10 build-essential curl g++

^^ Note: This command only works on Ubuntu and Debian-based OS'.

You will get prompted at some point for something that I believed is related to xorg.dev, press " y " and enter, and let the command finish its work. It should take another 5-10 minutes to finish. Sit back and jack off to BBW Girlfriends.

When the command has finished downloading the dependencies, run this command:

$ sudo apt-get install mercurial

This will be the tool needed to grab the SM5 source. When it finishes installing, you can download SM5:

$ hg clone https://code.google.com/p/sm-ssc/

This will take about 5-10 minutes, so go back to BBW Girlfriends and get busy.

After it is done grabbing SM5, you'll need to apply a small file swap which is a patch to make the lights work properly:

Download this file: http://www.mediafire.com/?zb7erwhry4ulslu

^^ I will be adding this file to either my Google drive and keeping a copy on web server. If you ever see this link die, please PM me and I will provide you the file with a fixed link.

Next, go to sm-ssc/src/arch/Lights and replace the file "LightsDriver_Linux_PIUIO.cpp" via the GUI because is quicker. After you confirm that the file was replaced by the new one, when you get to compileing, the executable and now the pads lights will be working as well when it is done.

Now, go to the sm-ssc directory:

$ cd ../../
$ ls

You should see a file called autogen.sh. Do this command to generate the build file:

$ ./autogen.sh

When that finishes, do this command:

$ ./Utils/build.sh

Once again, you're going to be sitting here for a while, about 15-20 minutes. So go buy a subscription to BBW Girlfriends and get back to work on your sex life.

If you a build error early on about a missing OpenGL library, run the massive apt-get command above that gets all the dependencies to make sure everything installed correctly.

If you get no error messages after it finished compiling, you should be able to go run SM5. Get a mouse or something and navigate to sm-ssc from the Home folder shortcut on the desktop. Find the executable file and double-click it, SM5 should boot up. If it does, you're done the hardest part, and now we can move onto the fun part, getting PIUIO to work.

Back in your terminal (Assuming you didn't close it, because if you did, you're a fucking retard) navigate to the folder where your zip file is.

$ cd /media/"pathtoyourpiuiozipfile"/

Unzip it:

$ unzip djpohly-piuio-48ae8ab.zip

Go into the directory:

$ cd djpohly-piuio-48ae8ab
$ ls

You should see a "mod" folder:

$ cd mod
$ ls

If you see a file called Makefile, type this in and hit enter:

$ make

This will generate a series of module files.

$ ls

Look for piuio.ko and do this.

$ sudo cp piuio.ko /lib/modules/your-kernel-version/updates

Note: This command might be different for you if you're not using the suggested OS linked above. Basically, you want to place this file in the same folder as your extra modules in your kernel version.

Next cd to the directory:

$ cd /lib/modules/your-kernel-version/updates

Run these two commands:

$ depmod -a
$ modprobe piuio

Then you'll need to add a command to a startup script so the PIUIO can be used outside of root-access:

$ cd /etc
$ sudo pluma rc.local

Note: pluma is a text editor built into Linux Mint 13, so if you're using a different operating system, you might use either gedit or vi.

You should get a text editor opened. In the line right above "exit 0", enter this in:

chmod a+wrx /dev/piuio0

Save the file, exit out of terminal and everything else. Go to your StepMania 5 build and start the game.

If you succeed, you should get the same result that I made a video of:

http://www.youtube.com/watch?v=j_ucFXfU_vI&feature=g-upl

Note: I gave credit to Shakesoda because I thought djpohly was an alias of him, when he's really a different person entirely, whose name is DJ Pohly. Alas, the credit goes to him for making this. Keep in mind this driver doesn't have lights completely working right but that might get fixed in a future update, and I'll post in this thread if I come across this update. Enjoy and ask your questions and comment here.

UPDATE: Please read this extra step!:

You will want to go into your Preferences.ini folder, and find these values:

PadStickSeconds=0.000000
InputDebounceTime=0.000000
ThreadedInput=1
UseDedicatedMenuButtons=1 (It might already be set to 0)

Change them to:

PadStickSeconds=0.050000
InputDebounceTime=0.050000
ThreadedInput=0
UseDedicatedMenuButtons=0

I noticed an issue with the panels occasionally double-firing both in the menus and in gameplay, giving me pad "Bad"'s. Both SonGohanX and BatteryShark pointed this stuff out to me and it fixed the issue, so props to them for this information.

Also, if you cannot find your Preferences.ini file, it is because you have not enabled hidden files and folders in your Linux settings. To change this, simply open your home folder, click "View" on the top row of menu options, and click "Show Hidden Files". This will make all the hidden content appear. After this is done, scroll down the directory listing and you'll see a folder called ".stepmania-5.0", double-click that folder, then double-click the "Save" folder, and then double-click the "Preferences.ini" file to edit whatever you wish.

As for the dedicated buttons, I would recommend setting that to "0" so you can use the pads for navigation as opposed to just a keyboard. If you have an official button board for a GX cabinet or if you have the buttons available because you personally own a FX/CX/TX cabinet, THE DRIVER FOR THE PIUIO WILL NOT MAKE YOUR BUTTON BOARD WORK! I've been asked this a few times and I'm just making it clear now that it is not compatible and it requires a separate driver. If I come across a driver for it, I'll update the guide for instructions to install it. If you find it, post it in this thread and I'll test it and if I confirm that it works, I'll append it to the guide.

-------------------------- Guide ends --------------------------------------
----------------------------------------------------------------------------

No hay comentarios:

Publicar un comentario