[HN Gopher] Spider-Man (Neversoft) Decompilation Project Progres...
       ___________________________________________________________________
        
       Spider-Man (Neversoft) Decompilation Project Progress Checkpoint -
       May 2024
        
       Author : krystalgamer
       Score  : 86 points
       Date   : 2024-05-10 17:55 UTC (5 hours ago)
        
 (HTM) web link (krystalgamer.github.io)
 (TXT) w3m dump (krystalgamer.github.io)
        
       | foxtacles wrote:
       | I've been working on a similar project (LEGO Island
       | decompilation). We've developed an extensive set of annotations
       | and corresponding tools that facilitate matching the
       | assembly/binary:
       | 
       | https://github.com/isledecomp/isle/tree/master/tools
       | 
       | We've been considering creating a separate project/repository for
       | the tools since they might be interesting for other projects such
       | as yours as well.
        
         | bee_rider wrote:
         | I loved that game growing up. Now the brick-by-brick song is
         | stuck in my head.
         | 
         | It really captured the open ended nonsense feeling of sitting
         | down and playing with legos.
        
         | tnetenbaa wrote:
         | Is this Mr.MattKC himself on HN?!
        
           | rzzzt wrote:
           | The profile picture tells me it's a different person, unless
           | he is also a master of disguise.
        
             | foxtacles wrote:
             | Yeah I'm not Matt :) No idea if he is on HN
        
         | krystalgamer wrote:
         | > We've been considering creating a separate project/repository
         | for the tools since they might be interesting for other
         | projects such as yours as well.
         | 
         | Happy to use anything that makes my life easier! I myself also
         | started to prototype some tools -
         | https://github.com/krystalgamer/spidey-decomp/tree/master/to...
         | - but didn't get much far. I see there's quite a bit of overlap
         | so I might integrate them on my workflow
         | 
         | Curious to know about `patch_c2.py` it mentions a bugged
         | warning. Is that patch just to remove the warning or something
         | deeper?
        
           | foxtacles wrote:
           | It just removes the warning, which is impossible to get rid
           | of otherwise. This bug has persisted all the way into MSVC
           | 6.0:
           | 
           | https://web.archive.org/web/20000519112833/https://support.m.
           | ..
           | 
           | Since the warning is relatively useless we opted to fix
           | C2.EXE so that it is never emitted. It generates a lot of
           | noise during compilation otherwise (if you are using
           | templates).
        
         | jchw wrote:
         | As someone who is very interested in decompiling old Windows
         | executables, this is very relevant to my interests. Thanks for
         | the link!
        
       | semolino wrote:
       | Cool to see krystalgamer here on HN. I found them a few years ago
       | through the (then super tiny) SM2000 modding scene on youtube. It
       | was my first 3D game, and I still have dreams about the graphics.
       | Their work on the resource unpacker utility allowed me to make
       | custom skins of my own characters for the game, which I
       | screenshotted and used for a comic. It's weird: I often think and
       | dream in the visual language of that game.
       | 
       | Anywayyyyy, will be following this development more closely now.
       | Would be really cool to eventually see some type of level editor
       | for this game, or maybe a multiplayer server (akin to this Bomb
       | Rush Cyberfunk mod: https://thunderstore.io/c/bomb-rush-
       | cyberfunk/p/NotNet/SlopC... )
        
         | krystalgamer wrote:
         | Thanks so much for the kind words! Did you end up publishing
         | your skins?
         | 
         | > Would be really cool to eventually see some type of level
         | editor for this game
         | 
         | So there's already a tool by Zedek that can export the models
         | to blender (not sure about re-importing). I heard that PSXPrev
         | by rickomax can work with the game files but never tried
         | myself. As for level editor, there was this guy that came into
         | the community and made a proper level unpacker + packer, it was
         | primitive but worked much better than anything that I've ever
         | done. Sadly he disappeared but his tool still floats around
         | from what I remember.
         | 
         | > maybe a multiplayer server
         | 
         | I get asked about this a lot :D Multiplayer will be a challenge
         | in the way it handles events, there's a lot of hardcoded stuff.
         | Not saying it's impossible, but it'd require a big re-write of
         | the engine.
        
       | xyst wrote:
       | I can't imagine decompiling a project that was likely written by
       | at least a team of a dozen developers over the course of 2-3 yrs
       | to be completed by a single person.
       | 
       | Looking at the commit history, I see only contributions by the
       | author "krystalgamer". Wild.
       | 
       | Rare to find a person with such resolve and enjoyment. Wish this
       | person good luck!
        
         | krystalgamer wrote:
         | Appreciate your kind words!
        
       | AdmiralAsshat wrote:
       | Nice project. Spider-Man (2000) was a great game for the time. It
       | had a solid action/platforming engine, it had voice-acting with a
       | number of actors pulled from some of the animated shows that were
       | running at the time, and it came out before the 2002 Sam Riami
       | film that forced most subsequent games to follow the movie
       | timelines. I played the N64 version at the time, and found it
       | fairly polished and _much_ better than most of the Spider-Man
       | games that came out before it (Arcade 's Revenge, Maximum
       | Carnage, Separation Anxiety, to name a few).
       | 
       | I would argue it would hold the crown for best Spider-Man game
       | for some time until the flawed masterpiece Spider-Man 2 (2004)
       | gave us truly amazing web-slinging physics in a sandbox
       | environment, or the less-free-but-tighter-overall Ultimate
       | Spider-Man in 2005.
        
         | causality0 wrote:
         | If you haven't tried it, I highly recommend the Dreamcast
         | version. It has the graphics and voice-acting of the PC version
         | with the tight analog controls of the N64 version.
        
       | boricj wrote:
       | I've been working on my own reverse-engineering/decompilation
       | project ( _Tenchu: Stealth Assassins_ ) and I've created a Ghidra
       | extension that can export a program selection as a working,
       | relocatable object file [1].
       | 
       | I've had some really good results on x86 since writing an
       | analyzer for an architecture where relocation spots target 4-byte
       | immediate fields inside of instructions is fairly easy.
       | Unfortunately, the PlayStation uses a MIPS processor and writing
       | an analyzer for split HI16/LO16 relocations is proving to be a
       | devilishly tricky problem. I got it to a point where it works
       | well enough on MIPS most of the time, but there's always a new
       | weird edge case hidden inside a function thousands of
       | instructions long where it breaks down...
       | 
       | [1] https://github.com/boricj/ghidra-delinker-extension
        
       | jchw wrote:
       | I've been doing a bit of research on and off for the past few
       | years on decompilation and it's definitely challenging to decide
       | how close you want to go to matching. If you can get the _exact_
       | compiler and _exact_ compilation settings, it 's totally feasible
       | to do matching decompilation, and if you're able to make this
       | somehow incremental such that you can incrementally work up to
       | 100% matching over time, it seems like a really good approach,
       | but it requires a lot of groundwork and understanding how the
       | compiler and linker really work. In the process of matching
       | compilation of functions on a binary I was analyzing that was
       | compiled with Visual Studio 2003, I realized that very subtle
       | differences can cause e.g. different register allocation, even in
       | an old compiler with dramatically less sophisticated optimization
       | passes.
       | 
       | Anyway, I guess this tangent is really unrelated, but I think
       | more people should be embarking on decompilation projects. It's
       | very fun, and it's uniquely rewarding if you manage to get some
       | non-trivial decompilation of code to work properly.
       | 
       | I had one odd use case for decompiling that was actually, as far
       | as I know, completely licit: WebView2Loader. Microsoft
       | distributed the WebView2 SDK as 3-BSD so that you could integrate
       | it into your applications without worrying about licensing, but
       | the glue logic that actually interacts with the WebView2
       | installation and instantiates the COM objects is closed source.
       | But... since it is closed-source 3-BSD, without a EULA... we can
       | reverse engineer it. It being a relatively small shim, I did just
       | that[1]. This was an easy exercise armed with an interactive
       | disassembler, and since it was relatively simple and very small I
       | didn't need to bother with matching anything: I just roughly
       | replicated the behavior instead. The use case for this was
       | allowing people to make WebView2 bindings that didn't have any
       | external dependencies; the OpenWebView2Loader code was ported to
       | Pascal and Go by others, making it possible to have pure bindings
       | that don't require any C code or external DLLs and can directly
       | talk to the WebView2 installation. There's now a static copy of
       | the WebView2Loader with the SDK, which obviates some of the use
       | of this, but this is still a nice approach for Go where you can
       | entirely avoid CGo or messing with weird object format
       | conversion. (It's way better than my original approach for
       | WebView2 in Go, which is to emulate the Windows linker to link
       | and execute an entirely in-memory copy of the WebView2Loader DLL
       | using a lot of unsafe code. That _also_ works, but it is much
       | more bug prone and frankly horrifying.)
       | 
       | [1]: https://github.com/jchv/OpenWebView2Loader
        
         | boricj wrote:
         | Perfect decompilation definitely has its advantages, but that's
         | something I simply don't have it in me to pull off. Tracking
         | down derelict toolchains and SDKs, endlessly tweaking compiler
         | options and source code to get that thousand instruction long
         | function to match perfectly is not for everybody.
         | 
         | The trouble with decompilation projects is that there's hardly
         | any tooling or literature available on the topic [1], so people
         | usually end up developing custom tooling and methodology on
         | their own to solve their issues. For example, personally I went
         | down the path of delinking programs back into object files in
         | my own project. While I find it quite nifty, it also isolates
         | me on my own desert island and I know of other decompilation
         | projects with totally different approaches in a similar
         | situation.
         | 
         | Decompilation projects can be quite intellectually rewarding,
         | but they are essentially R&D projects in a barely explored
         | field. Wander off the thin strip of beaten path and you're
         | basically on your own in an endless primordial jungle.
         | 
         | [1] At least until decomp.me came along, but that's geared for
         | perfect decompilation only. Any other approach and you're still
         | on your own.
        
       | suroot wrote:
       | Which decompiler?
        
       | wiseowise wrote:
       | Man, makes me sad just how much time and effort is wasted on
       | decompiling those old games.
       | 
       | All of this effort could've been spent on implementing features
       | and fixing bugs by super dedicated fans of the games. Instead,
       | there's a constant fight with code and bloodsucking lawyers of
       | greedy companies who don't give a single shit about those games.
       | 
       | Most of those aren't even sold anymore. Destined to rot, because
       | of petty reasons.
        
         | xen2xen1 wrote:
         | The journey is it's own reward, my son.
        
       | king_geedorah wrote:
       | Awesome project. The PS1 version of this game is one of my
       | favorites from growing up and also the reason my home server's
       | hostname was "eelnats" for many years.
        
       ___________________________________________________________________
       (page generated 2024-05-10 23:00 UTC)