Category: ReverseEngineering

  • RE’ing Kung Fu for NES, Part 3

    Progress Update

    I spent about another month of reverse engineering Kung Fu for the NES. As always I keep making progress but boy does it feel slow sometimes. I’ve managed to map out even more memory locations, some definitely some less definitely. I’ve started tracing the different modes and sub modes, but sticking to the simpler ones like the title screen, the “save Sylvia” screen, and the ending screen. I’ve found various routines for music/effect playing and drawing code and some object handling code like knives and effects. I’ve found areas related to enemies’ position, state, and timers but it’s still pretty vague right now. But little by little, the code reveals itself. Still a long way to go but it’s steady progress

    Mesen

    I’ve been using Mesen as my emulator of choice because of it’s great debugging features. As more and more of the RAM gets figured out the memory viewer just becomes swaths of uncategorized red areas, as seen above. So I made a fork and added a feature to specify the highlight color for labels, as seen below.

    I’m unsure whether I did it “correctly” and it changes a file format so I don’t know if I’ll want to make a Pull Request out of it.

    Development Quandaries

    I haven’t tackled the main game update routine yet because 1) I haven’t found it and 2) I’m already intimidated by the code in “basic” areas that I feel like I have no chance right now at the larger, more complex functions. I’m sure I’ll eventually get to it and come to understand it but I wish it would go faster.

    As usual I’ve been using ChatGPT to answer questions about working in 6502 code and to explain bits of code to me. I don’t know how I feel about using something like Claude to do the analysis. I feel it would go much faster, but I’ve got all these scattered thoughts about it.

    • I would have to spend money on Claude (or whatever) when using my brain is free.
    • But my brain is tired.
    • Will it cost me 20$ or 1000$? I have no idea. Do I love Kung Fu that much to spend money on it?
    • Using AI in theory should let me be able to finish and move on to something else faster.
    • I don’t know how it would make me feel about the result. It feels like cheating, but do I love Kung Fu that much to do everything on my own? To have it take the time it takes?
    • Would the results even be correct? From experience I can’t trust AI’s results as-is so I’d need to intervene often or use it in very focused way.
    • I don’t want to do a “fire and forget” reverse engineering on the game with AI. I don’t want to do a “decomp” where it just translates the code blindly. I want to properly document all the code so that I could in theory port it to proper C later, just like I did with Downland.
    • Part of me is like: it’s a 40 year old game! Who cares?
    • I’m thin skinned and I don’t want people to get angry at me for something that’s a hobby for fun.
    • I don’t mind my current usage of AI. Using ChatGPT as a reference and a helper I’m totally okay with. Not being an assembly programmer by any stretch, I’m happy I can use it to answer all my shamefully noob questions without bothering anybody on a discussion forum. And it’s free.

    So I don’t know. For now I’m sticking to my current working scheme. After spending a good month on it I want to work on something else for a while. I don’t mind having this project be something I work on from time to time.

    On to the next thing!

  • Very Modest Experimenting with PS2Recomp

    Lately there’s been a lot of stir about “decomps” and “recomps”, projects that take retro games and convert their machine code into higher level languages and then get ported to other platforms. There’s been a lot of projects like these for Nintendo 64 gams, bringing titles like Mario 64 and Zelda 64 to PC. It’s really, really exciting for someone like me who wants to take old neglected games and bring them into different platforms.

    Modern Vintage Gamer posted an explainer on decomps and recomps on YouTube.

    A lot of projects are posted with their progress on decomp.dev.

    One of my personal favorite projects is the decompilation of Virtua Racing on the 32X by Matias Zanolli. I hope he does Virtua Fighter next! 🙂

    I wanted to try my hand at one of these but didn’t know where to start. Then I saw a video from Video Game Esoterica about the PS2Recomp project. I’ve always wanted to see Atlus’ whimsical Sky Gunner get ported and improved so I thought I’d take a look at PS2Recomp and try it out with the game.

    Even with PS2Recomp as a starting point I still had no idea what to do. Luckily there’s Plastered Crab’s YouTube video, PS2Recomp – How to get started recompiling.

    I followed the multi-step instructions and while it took a wee bit of additional finagling, I managed to get something running, which is a lot farther than what I usually get when I try something completely new.

    After that I didn’t get very far. I’m not at all familiar with PS2 development so I can’t tell how things are supposed to work. I could trace and debug the code and see it was doing stuff but I didn’t have any idea if it was correct or not.

    I asked the peeps on the PS2 Recomp Discord and Ran-J was gracious enough to answer my noob questions. But after a while I figured it wasn’t a very effective debug cycle as I couldn’t do much on my own due to my lack of PS2 knowledge.

    So I’ll leave it at that for now. I’ll always keep an eye on the PS2 Recomp project. One day, SkyGunner, you’ll get ported.