dev, computing and games

Finished J.R.R. Tolkien's Lord of the Rings (SNES)

This is an action-RPG based on the book series, pre-Peter Jackson movie IP.

This game has some cool moments and good atmosphere and potential to be good. Still, it was held back by many technical problems. This game ended up being a rabbit hole into something else.

A couple weeks ago, I cleared the last boss, the Balrog using the full party (minus Gandalf, since having him in your party prevents you from beating the boss; also Boromir is E_NOTIMPL) and finished the game but didn't get such a good ending because Merry and Pippin died in the boss fight. They die really easily.
So last Saturday, I booted up the game with the intention to resume at the boss fight, attempt it again and keep them alive.

However the password I had written down was rejected by the game. I swear to goodness I wrote it down correctly. I went upstairs to my computer, reproduced the situation with an emulator. It turns out, the game will indeed give you invalid passwords and that's what happened here. So I went about trying to figure out how to "fix" my password.

The password system itself involves encoding a bunch of the game state in a certain way with a checksum. This game is a bit unusual in that there are no saves to the cartridge, it hashes together literally all the state into a 48-character-long password. It took a bit of effort, but I figured out how to derive the password. From there, how to un-glitch my password and preserve the progress I had (items, character stats, door open+close state) while letting it be accepted by the game. With this, I was able to re-attempt the boss fight and get the good ending!

After trying many different passwords looking for patterns, I cracked the password algorithm. It was not too much more work to put it into a program in case other people run into the same issues.

I posted the program to Github https://github.com/clandrew/lotrpwcheck/ .

As for the ending itself it was pretty cool, there is a scene where you meet Galadriel and she shows you the mirror. Although they never released a Vol II for SNES, I can see the next one picking up where this one left off.

September 5th, 2019 at 1:49 am
4 Responses to “J.R.R. Tolkien's Lord of the Rings”
  1. 1
    Xiaopang Says:

    Your LOTR-Password-Checker looks really nice! When I had the game as a kid, I tried to understand the password system, but had no luck. Would be really cool if you could explain it a bit more in detail. Also, is there a chance that you could supply a Windows build for those that don’t have the means to compile it themselves?

  2. 2
    CAndrews Says:

    Thank you for your comment! Sure, happy to give more detail. Basically the password is set up of these groupings of characters

    111222 333444
    555666 777888
    abcdef ghijkl

    zzzzzz zzzzzz

    The 1s describe Samwise’s level, equipment and whether he is in the party.
    The 2s are that for Merry.
    The 3s for Frodo.
    The 4s for Pippin
    The 5s for Legolas
    The 6s for Aragorn
    The 7s for Gimli
    The 8s for Gandalf

    The ‘a’ tells you where you saved at (e.g., Hobbiton, Rivendell). you can notice how when you save, the game doesn’t save your precise location.

    The b-i keep the state of quest flags and doors, whether they’re unlocked or not. These weren’t important to what I was trying to do (was just trying to keep my levels+inventory but spawn at a valid location) so I didn’t try and reverse-enginner exactly what flag means what, so you’ll notice they’re not exposed through the editor. It could be interesting to do sometime.

    The j-l three characters are a checksum meant to keep you from easily cheating the game by trying random passwords. It feeds the whole rest of the password, including the inventory code into some math and you get a three-character result. The three characters have to match that math for it to be accepted as a valid password.

    The z’s are the inventory code at the bottom encodes what items were in your inventory.

    I can go into more detail for each of these if you want too

    I got this info by doing things in the game and seeing how they affected the password. Also once I found out how to compute checksums, experimenting with a whole bunch different passwords and seeing the result. for example, here’s some of the ones I tried
    https://github.com/clandrew/lotrpwcheck/blob/master/PWData.txt

    Sure if you want a Windows binary there’s a release in the GitHub repo here
    https://github.com/clandrew/lotrpwcheck/releases/tag/v1.1

  3. 3
    Mexxxi Says:

    Are you by chance the same guy who goes by FascinatedBox and who posted a pretty good explanation of the password system here:

    https://www.speedrun.com/lotrsnes/thread/iq9sf

  4. 4
    CAndrews Says:

    No, that’s not me. That’s a good post though and I can imagine how cracking the passwords would be good for speedrunning. Also helps to know that person had the same problem with the Moria spawn location that I did 😛

    You can see my reverse-engineering work plainly in the source code for my editor, but this might be a good reason to get it into a technical document format for people who want that. As for that post, there are some things I didn’t know (the last few paragraphs about glitching). If you put together the things I found and the things from that post that’s a lot of good info.