13 ms·
SpaceCadetPinball – Decompilation of 3D Pinball for Windows
- nazgulsenpai 5y agoI learned a lot about 3D Pinball recently on this video [0]. It's specifically about the 64bit versions of 3D Pinball (or the lack thereof) and the reasons why. Part of that is debugging which relates to this. [0] https://youtu.be/3EPTfOTC4Jw https://youtu.be/3EPTfOTC4Jw
- 22c 5y agoDave Plummer, the programmer who ported Space Cadet pinball to ship with Windows, also recently did a video on this. https://www.youtube.com/watch?v=ThxdvEajK8g https://www.youtube.com/watch?v=ThxdvEajK8g
- kgliner 5y agoPlummer is flat out wrong that his port enabled our game to ship with Windows -- we built it for Windows (and for Microsoft) from the start. He didn't enter the picture until we were already shipping with the popular Microsoft Plus Pack (which put us on about 25% of all Windows machines). Honestly, I'd never heard of Plummer until a few years ago when a journalist asked about him. Plummer's only role, near as I can tell, was to get it working on later Windows operating systems that were 32 bit (or certain 32 bit variants), which likely extended the shipping life of the game (so, not Windows 95 or Windows 98, but the others that followed). Microsoft actually had the option in our original deal to ship with the OS when Win 95 launched and chose the Plus Pack instead. Kevin
- 22c 5y agoInteresting insight but I think you're both "right". If I'm reading you correctly and understanding Dave correctly, the game was made for running in 16-bit mode on Windows. According to Dave, Microsoft did not want to ship any applications with their "flagship" 32-bit OS that were not able to run natively in 32-bit. This, according to Dave, is also the reason you don't see Pinball shipped on the newer "64-bit" versions of Windows, despite the 32-bit version running just fine on 64-bit Windows.
- stuntkite 5y agoFinally! This has been lost for ages! I want to see someone do a breakdown on the ball physics! Gonna archive this before it's wiped from the intenet.
- swyx 5y agothis game was a huge part of my 12 year old childhood. really good times.
- WalterGR 5y agoNot just decompiled. What was done: * All structures were populated, globals and locals named. * All subs were decompiled, C pseudo code was converted to compilable C++. Loose (namespace?) subs were assigned to classes. Edit: Wow, and a lot more: https://github.com/k4zmu2a/SpaceCadetPinball/commits/master https://github.com/k4zmu2a/SpaceCadetPinball/commits/master Also see “On the attempts to resurrect Space Cadet Pinball” by Raymond Chen: https://devblogs.microsoft.com/oldnewthing/20181221-00/?p=100535 https://devblogs.microsoft.com/oldnewthing/20181221-00/?p=10...
- stefan_ 5y agoWikipedia suggests the copyright owner is Electronic Arts: https://en.wikipedia.org/wiki/Cinematronics,_LLC https://en.wikipedia.org/wiki/Cinematronics,_LLC
- moffkalast 5y agoSo we can all look forward to a reboot of space cadet on Windows 11 with lootboxes and microtransactions?
- gruez 5y ago>* All structures were populated, globals and locals named. Microsoft provides that openly via debug symbols, so it's not even anything new.
- WalterGR 5y agoAssuming it’s a debug build or a release build with absolutely no optimization. Otherwise at least some amount of manual work is suggested by the bullet point. But are PDBs even available for it? I assumed Microsoft only releases PDBs for binaries used in development scenarios.
- devmor 5y agoIf you read the README in the link, you will find the answer to your question.
- 22c 5y ago> On 64-bit bug that killed the game I had heard about this bug, I think I saw it on Dave Plummer's YouTube channel[1]. I remember thinking at the time that I am surprised nobody has tried to decompile it and figure it out, looks like k4zmu2a did and couldn't find it. Now I have more questions about the original bug reports. [1] https://www.youtube.com/channel/UCNzszbnvQeFzObW0ghk0Ckw https://www.youtube.com/channel/UCNzszbnvQeFzObW0ghk0Ckw
- worker767424 5y agoMakes me wonder why they removed Hearts from Windows 8
- phinnaeus 5y agoProbably the same collision detector issue⸮
- pedropaulovc 5y agoThe bug lore came from Raymond Chen's blog post [1] [1] Why was Pinball removed from Windows Vista? https://devblogs.microsoft.com/oldnewthing/20121218-00/?p=5803 https://devblogs.microsoft.com/oldnewthing/20121218-00/?p=58...
- selcuka 5y agoThis comment made me chuckle and also a bit sad: > [...] we simply couldn’t figure out why the collision detector was not working. Heck, we couldn’t even find the collision detector!
- unnouinceput 5y agoAnd the continuation is: "We had several million lines of code still to port, so we couldn’t afford to spend days studying the code trying to figure out what obscure floating point rounding error was causing collision detection to fail." I'd say Ray is right, not lacking the skill, but lacking the time
- brassattax 5y agoAnd it was forked and ported to emscripten! Amazing! https://alula.github.io/SpaceCadetPinball https://alula.github.io/SpaceCadetPinball
- fsckboy 5y agothat is really cool!! but the flippers are a teeny bit sluggish, screws up my timing on some stuff I know how to do (gotta love gravity well)
- LegitShady 5y agoIn the graphics settings up the FPS and it seems to work a lot better for sluggishness.
- listic 5y agoDid it really have music like that? I only remember the sounds, for some reason.
- deleted 5y ago[deleted]
- twic 5y agoI don't remember the music either, possibly because i turned it off the first time i played, and never turned it back on. The menu option to turn music off doesn't work in the web version, sadly.
- AshamedCaptain 5y agoBecause the default was to keep the music off.
- CodeArtisan 5y agoBe cautious that publishing source code generated in part or entirely from decompilation of copyrighted content may take you to court. https://torrentfreak.com/take-two-sues-enthusiasts-behind-gta-fan-projects-re3-revc-210903/ https://torrentfreak.com/take-two-sues-enthusiasts-behind-gt... https://news.ycombinator.com/item?id=28402640 https://news.ycombinator.com/item?id=28402640
- chii 5y agoif the purpose of the decompilation is for reverse engineering and api compatibility, there's a fair use argument. So the OP would need to show that the purpose is indeed for reverse engineering. IANAL, so don't actually do it...
- marcan_42 5y agoDecompiling may be legal, but publishing the decompiled source is almost always a copyright violation. Interoperability is an argument for the legality of decompilation itself (i.e. you can ignore EULA clauses that say otherwise); it doesn't make the resulting code copyright-free or automatically eligible for fair use.
- R0b0t1 5y agoWhy?
- marcan_42 5y agoBecause copyright. The decompiled code is a derivative work of the binary, and thus subject to its original copyright. You can make fair use arguments in some cases, but "I decompiled it for interoperability" isn't one of those. That just lets you decompile it privately (for analysis/research), not publish the resulting code.
- R0b0t1 5y agoThat's still a handwavy answer. I worked with game RE for a long time and the only way that publishers were able to go after people was if they used game assets. The decompiled code was, as far as I was ever aware, free game. There was almost always manual intervention to get it to build.
- Gigachad 5y agoThis is the line implementing the famous “hidden test” cheat https://github.com/k4zmu2a/SpaceCadetPinball/blob/8c4f38c0af544c5ebd6cef4971246f49bf774b68/SpaceCadetPinball/control.cpp#L661 https://github.com/k4zmu2a/SpaceCadetPinball/blob/8c4f38c0af... Looks like there are other undiscovered cheat codes too.
- TedDoesntTalk 5y agoWhat is the hidden test cheat? Your link brings me to the top of page
- selcuka 5y ago// Original allowed to enter cheats only before the first launch. std::memmove(&cheatBuffer[0], &cheatBuffer[1], 10); cheatBuffer[10] = key; if (strcmp(bufferEnd - 11, "hidden test") == 0) { pb::cheat_mode ^= true; }
- Gigachad 5y agoTyping "hidden test" and hitting enter would cause the ball to be stuck to the mouse pointer rather than playing normally. I assume this was used to test the game features but it was left in the final build.
- pastage 5y agoThe 1992 Pinball Dreams from DICE is still being published for new platforms latest release on the Amstrad.(but as unlicensed as this release seem to be)
- ur-whale 5y agoNote that they used Ghidra (the NSA-developed decompiler), which, in spite of its shady origin, is a wonderful tool.
- vadfa 5y agoHow does ghidra compare nowadays to IDA? Is it good enough already to be used as a replacement to IDA and Hex-Rays decompilation, at least for x86 code?
- saagarjha 5y agoThat would depend on your needs. For me, at least, it's largely an adequate replacement-I'd rank it as "consistently at least 50% as good, sometimes up to 200% as good as IDA". For the price it's simply unbeatable.
- bri3d 5y agoYes, I think Ghidra is "good enough" for most use cases. For some (architectures other than x86/ARM), it is vastly superior. For others (Windows and especially C++) it's not quite as good, but still useable. For C++ projects targeting Windows, IDA is still a lot better in terms of decompilation quality. The demangler and function signature system is particularly tailored to MSVC++. For other architectures, Ghidra kills IDA by virtue of abstraction - all disassembly turns into the same IR (P-code) and is decompiled from there. So, the decompiler works across all architectures with a processor spec, rather than being specialized to x86/ARM. And, the exposure of this P-code system is very powerful as well - with some clever plugin scripting for Ghidra, you can actually single-step through the P-code as though you had a full emulator/debugger, without needing to set up an entire virtual environment. https://wrongbaud.github.io/posts/kong-vs-ghidra/ https://wrongbaud.github.io/posts/kong-vs-ghidra/
- ur-whale 5y ago> How does ghidra compare nowadays to IDA? Not in the same category, IDA is really good. However, Ghidra is: a) free b) good enough for many thing One downside: the UI is convoluted.
- davidst 5y agoI am one of the original authors of Space Cadet pinball (along with Mike Sandige, lead programmer, and Kevin Gliner, producer and designer.) It is surprising and gratifying to see interest is still alive for our old game. And I can't help but be impressed by the ingenuity shown by both the decompiling effort and the playable web-based game.
- papito 5y agoWe played the hell out of it on our Windows 2000 machines during particularly boring IT labs in college, in early 2000s. The physics just seemed so spot on. I installed Win2K on a VM recently, just for this. Start Menu, type in "pinball". Ah....
- _fat_santa 5y agoWas it available on Windows 2000? I know it was a default on Windows XP. I was way too young back then to remember
- papito 5y agoDefinitely. It was available (apparently) even with a Win95 upgrade pack, so it's very old. I was not aware of it, however. I am not sure it was as easy to launch before, by just typing in "pinball" in the Start menu.
- SubiculumCode 5y agoWell, it is simply one of the best pinball games I've ever played on a computer. Interesting scoring system. Fair. Not gimmicky. Pure beauty.
- californical 5y agoWow, this game was a staple in my childhood! Just wanted to let you know that your work brought me lots of happiness as a kid, so thank you :) Out of curiosity, have you ever written about the experience? Technical challenges, the development culture, etc?
- phreezie 5y agoIf you want to play a modern, hi-resolution 3D version of Space Cadet, there was a Visual Pinball port recently by JPSalas: https://www.vpforums.org/index.php?showtopic=47560 https://www.vpforums.org/index.php?showtopic=47560
- djmips 5y agoNot technically a port but recreation. Nice work!
- gfiorav 5y agoHere are some interesting takes by the guy who ported it for XP at Microsoft. He says it would later prove very difficult to move to 64bit due to some low-level hacks/dependencies on word length in the collision detection code. https://youtu.be/ThxdvEajK8g https://youtu.be/ThxdvEajK8g
- gavinray 5y agoCould anyone speak more about how this decompilation is done from a technical perspective? This looks nothing like the pseudocode C that IDA/Ghidra spit out, so how would you go about doing this even? It says in the README: Tools used: Ghidra, Ida, Visual Studio What was done: All structures were populated, globals and locals named. All subs were decompiled, C pseudo code was converted to compilable C++. Loose (namespace?) subs were assigned to classes. Which is a bit "Draw-the-rest-of-the-fucking-owl" for me. Or am I just clueless.
- bri3d 5y agoI'm not aware of any good general-case automation for this. When I've done this in the past, it basically consists of: 1) Decompile project using Ghidra/IDA, first pass. 2) Load symbols if present (sounds like there was a PDB for this one, which makes things a lot easier). 3) Read decompilation/asm for unnamed subs and try to name them based on what they do. 4) Export all decompiled source into an editor and start copy/paste/editing into readable source. Highly manual process, for some files it's just pattern matching / renaming and goes really quickly, for others it's full reimplementation and a bit harder. And, if you look at most "decompiled game" projects, I think this is the industry standard way to do this. For example, OpenRCT2 started as a repository full of manually created source with Hex-Rays names and slowly evolved module-by-module into readable source code. (disclosure: per the child post, my original assumption that OpenRCT2 was copied out of Hex-Rays was inaccurate, since it was originally written in assembler it didn't follow a standard C ABI and the decompiler wouldn't work properly anyway).
- gavinray 5y ago> sounds like there was a PDB for this one, which makes things a lot easier Ah yeah that certainly reduces the difficulty by an order of magnitude. Do you know of anyone who has done this with high-skill as a recorded video tutorial? Seems like one of those things much easier to follow in video than text due to how complicated IDA/Ghidra are as tools.
- bri3d 5y ago
- anthk 5y agoIn you need music install timitidy and freepats.
- deleted 5y ago[deleted]
- chizhik-pyzhik 5y agoYou can get the original game data freely from Internet Archive- https://archive.org/details/SpaceCadet_Plus95 https://archive.org/details/SpaceCadet_Plus95