Aha it was indeed a hardware problem. One of my sticks of RAM took a crap. I pulled one stick and left one in. After turning the computer back on, Ubuntu did a test and the word FAIL was in red. Don't remember what it was pertaining to since I wasn't paying attention (rebooted right after I turned around) so it was obviously talking about the ram. I let it reboot, ran xmame, and of course the computer shutdown.
Pulled the stick out, put the other one back in, no FAIL, and xmame ran without shutting down. ^-^
Ok so I just got yet another random shut down. Except, this time, the shut down menu randomly popped up. I know for a FACT I did not even move my mouse up there and clicked the shut down icon. Anyways, I clicked cancel, and what do you know. Computer shuts down.
Regarding this shutdown, it wasn't orderly. Menu came up, I clicked cancel and it immediately shut down. Also, the diagnostics never showed any errors. It wasn't until I pulled out the working RAM stick that it showed a hardware problem. ^-^
It seems I have bad luck with RAM though. A Powermac G4 I used to have disposed of 2 RAM sticks, and this one disposes of 1. O.O
Thank you bersl2 and nweaver!!