How to reverse engineer & patch a Game Boy ROM

Sdílet
Vložit
  • čas přidán 18. 04. 2020
  • In this video, we patch a Game Boy ROM using Ghidra!
    The first two parts: • Hacking the Game Boy c...
    Links from the Video:
    - My ghidra scripts: github.com/ghidraninja/ghidra...
    - GhidraBoy: github.com/Gekkio/GhidraBoy/
    - Gekkio @ Disobey 2018: • Disobey 2018 - Reverse...
    - Pokered: github.com/pret/pokered
    Errata:
    - It's DISOBEY, not Obey
    You can also find me on Twitter: / ghidraninja
  • Věda a technologie

Komentáře • 110

  • @jimmydelagarza3208
    @jimmydelagarza3208 Před 3 lety +53

    This is awesome, I applied the basic principles in your video and was able to reverse engineer a portion of my favorite all SNES game Chrono Trigger to find a portion of the code where experience is added. At first I found the value where the total experience was stored in ram, and use breakpoints to walk backwards until eventually I was able to find the code where it was calculated. In Chrono Trigger they calculate how much xp to add after each monster is killed in battle, and it's stored in a ram value that is then used after the battle is complete to display and ultimately add to the character's pools. There was a CLC just before the ADC, so i changed the opcode in that byte of the rom to the one for ASL, which doubles experience. I made a new game genie code from this and now I get to enjoy this game again without all the extra grinding required to level up. It's so much better than some of the other codes I've seen which just grant levels or experience.. the game plays much smoother and you still feel a sense of accomplishment. Anyway, thank you for walking through this, this is my first time diving into assembly even though I'm a veteran software developer of 25 years and it's alot of fun, I can't wait to make patches for my other favorite games now.

  • @Any_key404
    @Any_key404 Před 4 lety +31

    These tools are much nicer than the hex editors and patch makers we were using twenty something years ago when hacking all of the Pokémon encounters into a single game and translating G/S

    • @Squirrelies1
      @Squirrelies1 Před 2 lety +4

      bruh I remember being in a dalnet irc channel and translating gold and silver back in the day with a group of people. Small world.

  • @Tigrou7777
    @Tigrou7777 Před 4 lety +101

    I know Ghidra (and the fact it can output C like code), but I did not know it worked with GB roms. Thanks for the video.

    • @kneesnap1041
      @kneesnap1041 Před 4 lety +1

      It's because ghidra turns stuff into an intermediary language.

    • @willaimwoods4841
      @willaimwoods4841 Před 3 lety +4

      Well the GB is Z80 based. So it would be reletively easy to add support into ghidra

  • @BananaMan77777777777
    @BananaMan77777777777 Před 4 lety +42

    Wow. Great video! It's absolutely crazy how people have managed to reverse engineer the entire game that builds to a bit for bit identical to the real rom

    • @animowany111
      @animowany111 Před rokem +2

      Well, sure, you can get a disassembly that gets you something bit-for-bit identical when rebuilt fairly easily "just use a disassembler lol", the project is so much more than that though. If you just use a disassembler you get a barely usable blob of assembly. If you make any changes like adding code you will completely break the ROM, since lots of pointers would be badly disassembled and hence would now point to incorrect places, so you basically need to do the same as you would do with binary patching, add call instructions to some faraway unused place, add your code there, and return to the code being very careful you don't break anything.
      The project is amazing because it actually documents all that code, split into many files, makes lots of changes so the code is easy to modify, has a really nice build system that lets you modify sprites as actual image files instead of just binary blobs of data compressed in a nonstandard manner, etc.

  • @user_romanport
    @user_romanport Před 4 lety +9

    Loving these collaboration videos between you and LiveOverflow! Can't wait to see more!

  • @hawaiian_guy
    @hawaiian_guy Před 3 lety +4

    You are amazing! Being able to create and explain how to make possible the biggest rumour on videogame history is just mind blowing. Thank you very much!!

  • @rakeshchowdhury202
    @rakeshchowdhury202 Před 4 lety +28

    My childhood right here. Patching modding game roms, adding new elements, and maps. Quality Content 🙂

    • @satibel
      @satibel Před 4 lety +4

      Back then I stopped at making action replay codes.

  • @dwats250
    @dwats250 Před 4 lety +2

    Just found your channel and watched a few videos. Liked and subbed. Amazing vids and nostalgia overflow!

  • @TheThirdPrice
    @TheThirdPrice Před 4 lety +39

    Legit just got so excited that you uploaded

  • @draemon123
    @draemon123 Před 4 lety +6

    Nice video ! I love this collaboration ! Hope this will get you some new subscribers ^^

  • @ale0x788
    @ale0x788 Před 4 lety +1

    Awesome Video!!! Game modding is what brought me into this field years ago, so there a tad of nostalgia for me too...

  • @Bruh-hd4rj
    @Bruh-hd4rj Před 2 lety

    I just discovered your channel and I already love it !

  • @MoritzDerErste
    @MoritzDerErste Před 4 lety +1

    Super cool video! I noticed your channel via LiveOverflow. Keep up the good work!

  • @jeremypatrickdahan
    @jeremypatrickdahan Před 4 lety +37

    Actually, I discovered Live Overflow via *your* channel !

  • @gopherbobz
    @gopherbobz Před 2 lety

    Ha I love that you made the truck move!!! Brings a smile to my face.

  • @Michael-im5mq
    @Michael-im5mq Před 4 lety +1

    Awesome video and subscribed. I love Gameboy since I got one as a kid as well as reverse engineering gameboy games!

  • @calebleeb5775
    @calebleeb5775 Před 4 lety +5

    I didn't think it was that rare, but I'm subscribed to you and hadn't watched any LiveOverflow... hope you get some traffic in the reverse direction haha

  • @jimlkosmo5730
    @jimlkosmo5730 Před 4 lety +23

    Great vid! Next stop should be an arduino/esp based sd cartridge.

    • @proxy1035
      @proxy1035 Před 4 lety +6

      you could go a tiny step further and use an SRAM chip in combination with an ATmega/ESP. so when you start the gameboy it loads a program from SD into the SRAM chip, which then functions as ROM (ie the gameboy cannot write to it, only the ATmega/ESP can).
      that way the gameboy doesn't have to access the ATmega/ESP directly, which should make the code easier as the ATmega/ESP doesn't need to constantly check for reads/writes from the gameboy, it just needs to load data into it once every time it's powered on.

  • @MrMegaManFan
    @MrMegaManFan Před 3 lety

    Serious question hope you can help - how do you patch the GBA NES Classic games so they work correctly on an EverDrive X5? I own a dozen of these and want to play backups but they’ve got loads of unnecessary ram size checks and stuff like that which make them run like crap when detected.

  • @AmyraCarter
    @AmyraCarter Před 4 lety +1

    1:32 Is BGB just as good as Sameboy?
    The text scrolling doesn't bug me that much, but that was cool to see automated all the same. Thing is, wouldn't that affect all message box type scenes, including Hall Of Fame and such?

  • @Porygonal64
    @Porygonal64 Před 3 lety +1

    One thing I want to be able to do is dissect and disassemble compressed data.
    I've been translating a Japanese-Only NeoGeo Pocket Color game, and while the text characters were uncompressed graphics, the menus use compressed graphics, which I cannot directly edit.

  • @SimilakChild
    @SimilakChild Před 3 lety

    There is a NES Famicon ROM that I want to convert to an SNES ROM.. is that possible?

  • @edkhil
    @edkhil Před 3 lety +1

    Hi, maybe I'm a little late but I'd like to know how you knew which steps to follow in order to export a functioning ROM. I mean, how did you know that you had to order each block of memory because otherwise it would't have worked? Did you learn it somewhere? If yes, where? I tried searching for this specific thing but didn't find anything, please share!

  • @basti7848
    @basti7848 Před 4 lety +2

    Nice, can't wait to watch this

  • @EspireMike
    @EspireMike Před 4 lety +1

    These videos are soooooo good! Thankyou!

  • @das_evoli
    @das_evoli Před rokem +1

    Do you have any tips how I could start to learn this stuff? The content of the video felt really advanced. I'm a software developer so Im advanced in programming and know the basics of Memory Adresses

  • @robinhood3841
    @robinhood3841 Před 4 lety

    From where start revese engineering and how to master it ??

  • @user-db7vy8sf2h
    @user-db7vy8sf2h Před 11 měsíci +1

    I would like to do a hack rom of gen1, could you help me?

  • @MaxReckless99
    @MaxReckless99 Před 3 lety +2

    this guy is crazy...in a good way. amazing

  • @TheLoneAlpaca
    @TheLoneAlpaca Před 4 lety +1

    Awesome and interesting video!!

  • @Der_Arathok
    @Der_Arathok Před 4 lety +19

    So know MewTwos Cave is full of Truck Cabins!

  • @muellerhans
    @muellerhans Před 4 lety

    Will there be videos about the GBA/GBA roms?

  • @MysticRL
    @MysticRL Před 4 lety

    Your videos are like a rollercoaster

  • @paprika5487
    @paprika5487 Před 4 lety +1

    Very nice video!

  • @JPxKillz
    @JPxKillz Před 4 lety

    Awesome, I'm a little lost, where did you learn to use Ghidra so well?

  • @shootdol
    @shootdol Před 7 měsíci

    Thanks. It's great help to me. Could you advise me any hint to translate Japanese. I'm trying to translate Dragon Ball Z - Gokuu Hishouden. I can't read scripts by decoding shift-jis. I think it's kind of compress or something..

  • @embodyingocean189
    @embodyingocean189 Před 4 lety +5

    tysm that's so cool!

  • @shyleshsrinivasan5092
    @shyleshsrinivasan5092 Před 4 lety +1

    Thanks a lot for this video !

  • @SPARTYchannel
    @SPARTYchannel Před 4 lety +2

    WOW, what a video!

  • @Kowyvaxy
    @Kowyvaxy Před rokem

    Hey, could u make video tutorial for reverse engineer pokemon brilliant diamond?

  • @ariss3304
    @ariss3304 Před 4 lety

    im curious about how similar this is to GBA reverse engineering

  • @FutureTrunksMood
    @FutureTrunksMood Před 3 lety

    brooo u are insaaaaane

  • @DoorThief
    @DoorThief Před 4 lety +1

    Wow that was awesome

  • @MotherTurf
    @MotherTurf Před 3 lety

    Amazing work thank you

  • @duuqnd
    @duuqnd Před 4 lety +2

    Very fascinating stuff. I've always wanted to try to reverse engineer old games like this. It's too bad the game I want to reverse engineer uses some strange kind of compression making it difficult to decompile/disassemble the code. I'll get around to it eventually for sure though.

  • @buzz1ebee
    @buzz1ebee Před 4 lety

    Great video! I'm interested in your course but unfortunately it's taking place during working hours. Will there be a fully remote course at some point or are you planning to deliver the course on a weekend sometime soon? I have a piece of firmware that I would like to tweak but struggling to get started so I'm definitely interested.

  • @disabledmallis
    @disabledmallis Před 4 lety +2

    Good stuff

  • @PirateKnO
    @PirateKnO Před 4 lety +5

    Could I suggest reverse engineer popular NES games, due to NesDevWiki all important registers are there explained in an exhausting detail, which would make reverse engineering easier

  • @rashira9610
    @rashira9610 Před 3 lety +1

    That's insane. About 12 years ago I had pointed out to someone on yahoo answers that asked if the mew myth was real, that it might be possible for someone to make a romhack that implements it via working in the ROM code...and someone has actually gone and done it.

  • @undefined06855
    @undefined06855 Před 3 lety

    I really don’t know what you are saying but I like it

  • @ShadowBanned0
    @ShadowBanned0 Před 3 lety

    Is it possible to modify sound files with this?

    • @hythlodaeus5818
      @hythlodaeus5818 Před rokem

      The Game Boy doesn't use sound files, it essentially has a mini digital synthesizer, and you sequence sounds by creating commands (very similar to how he does it in this video, actually), to create different wave forms. So you'd need to learn the registers/commands to control those, and then play around with it to get the sounds you want; you'd still be limited to those classic sounds though.

  • @bekircandal3528
    @bekircandal3528 Před 4 lety +1

    This is awesome..

  • @kruemmelbande5078
    @kruemmelbande5078 Před 4 lety

    That dont work on Windows. The debugger opens a console, but i cant write anytging into it, or have any more options.

    • @valkon_
      @valkon_ Před 3 lety

      By complete luck when I ^C on terminal I was able to execute commands, but the terminal doesn't look as a helpful as on MAC. I tried on WSL also but with similar results.

  • @Aliferopoulos
    @Aliferopoulos Před 4 lety +1

    This is amazing content. Thank you for posting!

  • @elvirus6994
    @elvirus6994 Před 4 lety +1

    I'm trying to replicate the Mew Myth on the code, does anybody know what line is Vermillion Dock in wild_mons.asm?

    • @stacksmashing
      @stacksmashing  Před 4 lety

      It's line 94! :)

    • @elvirus6994
      @elvirus6994 Před 4 lety

      @@stacksmashing Thanks for the quick response, I love when the CZcamsrs respond to their comments (I know that when you've got 29,7m subscribers one more is nothing but consider-me subscribed), I'll try it tomorrow( I imagine that we're in different time zones). Keep making these amazing videos.

  • @KiritoGaming94
    @KiritoGaming94 Před 2 lety

    i know its old but... you say at 7:15 "go to the backtrace and use the earliest entry" ... WHICH backtrace ???
    you dont show where it is and in the backtrace you have open, its dont there...
    where i can get the similar point (by you "5d57")...
    PS: im german and have to make it for german versions...

  • @phosphenius7602
    @phosphenius7602 Před 4 lety +11

    Amazing that people still hack GB games in 2020!

  • @fouadal5769
    @fouadal5769 Před 3 lety

    OMG this is so cool

  • @MisterEpsilon
    @MisterEpsilon Před rokem

    Ah, Ghidra. The ol trusty NSA RE tool. It's quite fun once you get used to it.

  • @myboredom1236
    @myboredom1236 Před 4 lety

    excelent video, i will try reverse engineering

  • @neoXXquick
    @neoXXquick Před 4 lety +1

    nice...

  • @viktormaletin6634
    @viktormaletin6634 Před 4 lety +1

    I know this is probably a small thing but GBA4iOS? Jailbroken? :)

    • @stacksmashing
      @stacksmashing  Před 4 lety +1

      Nah just self-compiled :)
      github.com/CocoaBob/GBA4iOS

    • @viktormaletin6634
      @viktormaletin6634 Před 4 lety

      stacksmashing / Ghidra Ninja Did you sign the IPA with AltStore or just push it with Xcode? Love to see people working on these things.

    • @stacksmashing
      @stacksmashing  Před 4 lety

      I compiled it myself and signed + installed it with Xcode

    • @viktormaletin6634
      @viktormaletin6634 Před 4 lety

      stacksmashing / Ghidra Ninja I see. Well great work anyways; love your content so keep up the great work. Some of the most educations but then simultaneously skill-testing content and experiences out there. Much love

  • @btarg1
    @btarg1 Před 4 lety

    Every Stacksmashing and LiveOverflow video ends in, "there was a MUCH simpler way of doing this"

  • @gir489returns2
    @gir489returns2 Před rokem

    Interesting. You should reverse and explain the missingno glitch.

    • @stacksmashing
      @stacksmashing  Před rokem

      @liveoverflow, who I did this series with, covered missingno!
      m.czcams.com/video/bxzrtU7VtPU/video.html

  • @henke37
    @henke37 Před 4 lety +1

    You got very lucky that the game is so simple that it actually has a dedicated wait for dialogue loop. No event oriented programming here.

  • @JusChannel
    @JusChannel Před 4 lety

    Hey
    Could you maybe do some ds/3ds modding stuff
    And i mean not save editor (the editors that are already finsished)
    I mean real hex modding etc (i tried mod my game saves of animal crossing new horizons but its all in old chinese and doesnt make sence at all)
    Would be nice
    Nintendo ds/3ds or switch modding
    Thanks in adventage
    Sincerly,
    3ds_hacker

  • @chudbabies
    @chudbabies Před 3 lety

    @2:31 that certainly is the easy way.
    Would be more interested in building teh game to register a smooth auto-scroll mod, instead of a janky hack.

  • @t4rif4ri
    @t4rif4ri Před 4 lety

    I didnt get much of this, but its nice

    • @unnamedchannel1237
      @unnamedchannel1237 Před 3 lety +1

      A bit like females, I don’t get much of them but they are nice when I do

    • @t4rif4ri
      @t4rif4ri Před 3 lety

      @@unnamedchannel1237 hahahah😂👍

  • @ciaokid2104
    @ciaokid2104 Před 4 lety

    Bist du Luxemburger?

  • @DJ4461
    @DJ4461 Před rokem

    0:08
    Thats pokemon red and pokemon RED, not blue. You may be colorblind.

  • @yunix898
    @yunix898 Před 2 lety

    Thanks bro! It was hard to understand because im 13 and from germany but thanks! Sub from me ;)

  • @mohamededrees979
    @mohamededrees979 Před 3 lety +1

    Brilliant I have a challenge I know some brilliant mind like you Will solve it I need help with a Korean nintendo wii Locked on error 003 after update there is way to fix it but it's a painful and I can't find a modchip if there any way through software please and a lot of thanks to you for your time and work

  • @iProgramInCpp
    @iProgramInCpp Před 4 lety +1

    All your item needs fulfilled!
    Isn't that a reference to "All your base are belong to us"?

    • @noxabellus
      @noxabellus Před 4 lety

      wtf? not all sentences beginning with "all your" are a reference to that meme, this doesnt even sound similar
      also, pokemon red and blue predate that meme anyways

    • @iProgramInCpp
      @iProgramInCpp Před 4 lety

      @@noxabellus it's an example of engrish, just like all your base are belong to us

    • @Starwort
      @Starwort Před 4 lety

      @@iProgramInCpp 'All your item needs fulfilled' is valid as a sentence though (even if it would be better followed by 'here')

  • @AgentLazarus
    @AgentLazarus Před 5 měsíci

    Imagine trying to write a debugger without having a debugger, for the debugger though..😂🎉

  • @ClosestNearUtopia
    @ClosestNearUtopia Před 3 lety

    Please patch the truck, create a dungeon, let us catch mew ‘legit’ instead of doing the hack a the ?celladon? Bridge!:)

  • @blackferrets820
    @blackferrets820 Před 4 lety

    Now flash it to an empty card

  • @Khivy94
    @Khivy94 Před 3 lety

    ça c'est du parlé Anglais à la "accent Français" ...

  • @eneskdk5543
    @eneskdk5543 Před 4 lety

    You are singing.

  • @feedbrains8979
    @feedbrains8979 Před 3 lety

    .

  • @joveaaron-real
    @joveaaron-real Před 4 lety

    "Joystick" is NOT the + that you can find in the console. Its called "D-PAD".

  • @tswan137
    @tswan137 Před 3 lety

    Refers to Red as Ash...
    *Literally unwatchable*

  • @gregorymirabella1423
    @gregorymirabella1423 Před 4 lety +1

    *laughs in mew glitch*

  • @wulfenlord
    @wulfenlord Před 4 lety

    Disliked & reported to Nintendo, you flipping pirate