Exploring Ocarina of Time’s Decompiled Codebase

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 243

  • @benvillalobos
    @benvillalobos  Місяць тому +42

    Hey folks! This video recently hit 100k views, which is absolutely mind-blowing. This has become a series and I'm getting close to cracking that opening cinematic! Some context and corrections below:
    What this codebase is: I called it "source code" but it's really not. Here's the deal: First, Nintendo wrote the original C "source code" for Ocarina of Time. To run it on an N64, they compiled it down to "machine code" that the N64 understands, but is tough for humans to read. The ZeldaRET team then analyzed that machine code and reverse-engineered it into C code that compiles back to the original machine code. So, while both codebases create the same game, they aren’t the same code.
    Mistakes will be made: I hadn’t touched C in over a decade before this, and I record these off-the-cuff to keep it interesting. Minor mistakes are edited out, and future videos will include corrections when possible. My aim here is to share the process of diving into unknown territory and learning along the way. As one viewer put it, this is like exploring the Water Temple for the first time-but in C.
    Check out the comments: The comments have been an incredible resource for corrections and in-depth explanations. The community here has been awesome.
    A huge thank you to everyone who's enjoying the series. I'm glad this is as fun for others as it is for me.

    • @frightfactoryYT
      @frightfactoryYT 28 днів тому

      Great stuff bro. Thought you had 2-300k subs upon clicking lol. I'm a new creator and get the same comments, so now I understand how they feel ;) Hope you keep growing, you deserve it

  • @biggc181
    @biggc181 Місяць тому +180

    I wish there was more content like this on the platform. I absolutely love watching breakdown of old games. Impressive C knowledge bro

    • @benvillalobos
      @benvillalobos  Місяць тому +18

      Thanks for the kind words, more to come soon!

  • @clublulu399
    @clublulu399 20 днів тому +7

    As a Zelda Fan & Coder, it makes me really appreciate looking at this code and being able to understand it.

  • @Lansolot
    @Lansolot Місяць тому +83

    If you were alive during OOT it was an experience. Everyday go home play, get stuck goto school and at the lunch table everyone would be trying to help each other get further. It was so fun when you found out something the group didn't know. A time when running to guides was way way less common.

    • @capturedlondon
      @capturedlondon Місяць тому +6

      I took the day off work to buy it

    • @riseofdayzofficial
      @riseofdayzofficial Місяць тому +2

      You know what’s insane the same thing happened to breath of the wild for me in school and everyone would ask how to get the master sword… but I love all the old games better

    • @DanielChristensen-mb5qr
      @DanielChristensen-mb5qr Місяць тому +5

      Yeah those days were truly magical. My best friend and I resorted to calling a national "nintendo hotline" with a minute fee, where we'd get guidance on how to get unstuck in the Water Temple

    • @Lansolot
      @Lansolot Місяць тому +3

      @@DanielChristensen-mb5qr The water temple was our depression period lmao. No one could figure it out for weeks

    • @ayotundeayoko5861
      @ayotundeayoko5861 Місяць тому +1

      my siblings and I pooled our allowance money to get this gem - probably a monthly wage back then in 1999 Nigeria. Booting it in the N64 was a surreal experience. Good times

  • @iosefka7774
    @iosefka7774 Місяць тому +217

    I suppose I cannot exactly blame you for misunderstanding the DmaHandler typedef given that your IDE did not actually take you to the definition of s32 for whatever reason, and function pointer syntax in C is miserable
    In case it is not mentioned later in the video, and in case anyone is curious:
    'typedef s32 (*DmaHandler)(args...)' means that we are defining a type named DmaHandler, which can hold pointers to functions which have the arguments (args...) and return a value of type s32.
    The definition for s32 itself would look something like 'typedef ... s32'. The name of the type comes last usually.
    EDIT: Some more notes:
    13:45 - A double is a 64-bit floating point value. A 'long long' is a generic type defined to hold at least as much as a 'long'. (It is vague because C's standard does not like to give actual bit counts to anything, so as to be more portable, but on most systems you will ever use, a 'long long' will be defined *in the implementation of the standard* as a 64-bit integer.)
    17:55 - A short is usually 16 bits

    • @benvillalobos
      @benvillalobos  Місяць тому +29

      Thank you for such a detailed comment! Your explanation on DEFINE_GAMESTATE is extremely helpful, cheers!

    • @gorgonflabish
      @gorgonflabish Місяць тому +9

      That's why I love humans

    • @htspencer9084
      @htspencer9084 Місяць тому +1

      You're a complete boss :D

    • @SimoneN64
      @SimoneN64 Місяць тому +9

      Small correction: the N64 does not run any operating system. The code runs bare metal. The way those processes are created and handled is via interrupts. Each time a "process" has to run, the cpu jumps to the global exception handler and from there it jumps to the appropriate code (the "process" code)

    • @iosefka7774
      @iosefka7774 Місяць тому +3

      ​@@SimoneN64 That seems like an OS? It is obviously far simpler than Windows or Linux, but those are not the only kinds of operating systems. I'm slowly confused by what distinction you imagine there is. Even an OS like Windows does not run code in some magical place; it is still on the CPU, just perhaps in a lower privilege level. And, it also uses interrupts to implement its scheduler!

  • @joshbenchpress
    @joshbenchpress Місяць тому +56

    hey mate, randomly got this in my youtube algorithm. i'm a dev from australia, and i thought this was a really great watch. very fun to see old games dissected and the thought patterns behind them

    • @benvillalobos
      @benvillalobos  Місяць тому +6

      This was a total experiment, so I'm glad to see others enjoying it as well!

    • @fvhaudsilhvdfs
      @fvhaudsilhvdfs Місяць тому +4

      @@benvillalobos i was similarly blessed by the algo with this. i would totally watch a whole series of this

    • @mikkelisaksenrobinson
      @mikkelisaksenrobinson Місяць тому

      Same here

  • @nazart7830
    @nazart7830 Місяць тому +7

    I’m currently studying CS, I really underestimated how hard it is but I find this super interesting. Thanks UA-cam algorithm for recommending this dudes channel, great video dude

    • @benvillalobos
      @benvillalobos  Місяць тому +1

      There's always something to learn, no matter how long you've been at it :) cheers!

  • @Minty_Meeo
    @Minty_Meeo Місяць тому +17

    do {...} while(0) is a common idiom for C macros to ensure the body of the macro is a single statement that requires a semicolon after it. Basically, it makes the syntax when using macros identical to when calling a function.

    • @DanielChristensen-mb5qr
      @DanielChristensen-mb5qr Місяць тому

      do (...) while(x) can also be used as one would use a while loop but ensure the loop runs once before evaluating if it should run again

    • @Minty_Meeo
      @Minty_Meeo Місяць тому +7

      Yes, but that's a more commonly understood fact because that's the intended use of do-while loops.

  • @KingBakura
    @KingBakura Місяць тому +13

    OoT started off as an N64DD game originally. So it's interesting that the devs left a lot of that disk drive boot code in the game at the beginning. Also, they were gonna use the storage on the disk to save things like link's footprints in sandy areas etc. It was going to be a persistent open world game, so it's cool to see when they downgraded the game, they left a lot of that ambitious stuff in the code base.

  • @tugaric
    @tugaric Місяць тому +3

    Ocarina of time... What a beautiful memory ❤

  • @beogeek
    @beogeek Місяць тому +7

    This is my most memorable game I ever played, I think I was around 11 years old when I played it and it took me like 3 months to finish and it was breathtaking all the way through. I did .net and java in university so I could somewhat follow along. What really strikes me is that this was created all by hand, no AI sh*t, nothing, just pure good old fashioned human ingenuity. Loved this video, enjoyed watching every minute of it! Kudos to you mate!

    • @benvillalobos
      @benvillalobos  Місяць тому +1

      Thanks for the extremely kind comment :D

    • @beogeek
      @beogeek Місяць тому

      @@benvillalobos You're most welcome, definitly make more content along the lines of this video, I'm sure many will appreciate the content!

  • @ChairmanMeow1
    @ChairmanMeow1 Місяць тому +3

    Best game man has ever made. Complete game changer in so many ways.

  • @User-oh8vi
    @User-oh8vi 18 днів тому

    Thanks for posting a video like this. I wondered how programmers often delve into codebases and I wanted to learn from them and you're my first concrete example of how it's done.

  • @alexh1687
    @alexh1687 Місяць тому +4

    I feel like such a dum-dum every time I try to read a big C project like this alone (coming from a higher level background like C#, js etc).
    It's so cool to get through it with you and see you have the same question I would have along the way, plus it's easier to see in video format, would love to see other things like these !

  • @InTheNickofTime
    @InTheNickofTime Місяць тому

    This is the equivalent of staring at an absolute breathtaking sunset for me. Video game code is so amazing, I just adore it.

  • @bishcp
    @bishcp 20 днів тому

    Subscribed!
    Never seen your channel, but as a lifelong Zelda fan who recently stumbled into Tech I can say the timing could have never been better

  • @TheMadisonHang
    @TheMadisonHang 6 днів тому

    i was ready for this, 20 years ago
    lets go

  • @devinw9088
    @devinw9088 Місяць тому +5

    That title song hits so hard for me. It’s just a wash of good nostalgia coming over me.

  • @robertjif6337
    @robertjif6337 Місяць тому +4

    I never write production C in my life, seeing this, I'm truly is a quiche eater

  • @NickoBanaa
    @NickoBanaa 23 дні тому

    Man, what a nice and different video, i'm not into the code word, but that breakdown of the game was amazing, make more content like this.

  • @Okla_Soft
    @Okla_Soft Місяць тому +9

    Instantly subbed. I’ve been wanting someone to explore the codebase of this game for a while.
    The decomp is wonderful
    I also started streaming/playing master quest and managed to beat the Demi tree so far.
    🤘🤘

  • @jasonknoll5170
    @jasonknoll5170 24 дні тому

    Dude thank you for covering this! I'm on a binge of looking at old game source code and trying to mess with it -- please keep it up. I start with doom/wolfenstein, but just as OOT, there are more games out there! Keep it up man

    • @jasonknoll5170
      @jasonknoll5170 24 дні тому

      brb watching more of your series on this

  • @scraphex
    @scraphex Місяць тому +1

    would love to see a whole series of this with Nintendo's N64 games.

  • @MortMort
    @MortMort Місяць тому +1

    This was super fun to watch!
    Would be neat to also see how they go about doing some actions like, how does their ledge detection work, or what goes into Links Attack, etc you name it!

  • @digitalhero7488
    @digitalhero7488 Місяць тому

    Great idea ! And you are right about the music its so good.

  • @eti360
    @eti360 26 днів тому

    i used this as my asmr video to calm myself before sleeping

  • @ShadyRonin
    @ShadyRonin 27 днів тому

    This video is incredible man. Thank you for this

  • @theterabyte
    @theterabyte Місяць тому

    I didn't know about mermaid, that's really cool! Thanks for making the video, found it fascinating

  • @TheMadisonHang
    @TheMadisonHang 6 днів тому

    @3:45 the way you talk about source code,
    reminds me of a way to approach sheet music

  • @RJR3006
    @RJR3006 Місяць тому

    i just started my first year as CS undergrad, i may not understand everything just yet but the concept of this video is interesting and this was enjoyable to watch. nice video man

    • @benvillalobos
      @benvillalobos  Місяць тому +2

      Thanks for the kind comment, good luck on the journey!

    • @RJR3006
      @RJR3006 Місяць тому +1

      @@benvillalobos thank you, and also if you plan on looking into any other games if its possible to access the codebase for mario 64 or Mario galaxy ill definitely be tuning in 😩

  • @tobytherock
    @tobytherock Місяць тому

    im only 10 minutes in but im really enjoying how you're explaining all this. i've been modding zelda oot since like, 2010, but it was all hex values and very rudimentary programs that could only do so much. ever since the game was decompiled, it's been my understanding its the premiere way to mod oot now, but i've never been able to interpret code quite like this. i don't know if you plan to go further, but i would watch a series of this. its pretty good

  • @goomoonryonglucifer7192
    @goomoonryonglucifer7192 Місяць тому +78

    Took me 10 mins to remember I don't understand coding 🤣

    • @TimeConvolution
      @TimeConvolution Місяць тому +20

      Just because you don’t understand decompiled C that came out of Japan doesn’t mean coding is beyond your comprehension

    • @spht9ng
      @spht9ng Місяць тому +1

      If you ever want to fall down the rabbit hole, check out the free course CS50 by Harvard

    • @FauxFaFox
      @FauxFaFox Місяць тому +10

      Wait this is coding? I thought this was ASMR.

  • @VysetheBattleMaster
    @VysetheBattleMaster 22 дні тому

    Over the years people have explored this game so hard like it’s the video game form of the Da Vinci code haha. I played this game so many times over the years and even did glitch speedruns when I got older that were fun. OOT itself is this weird game to me that feels very biblical in a lot of ways, and I’ve developed a deep personal connection to it after playing it so much, and mastering the different versions. I can’t really explain why though. I think the SRW series gives me that feeling too, but I dunno. It’s just a mindblowingly cool game.

  • @Pablo1517
    @Pablo1517 Місяць тому +9

    Now you can see why companies hesitate to release super old titles that they haven't touched in ages, as well as why it takes so long. This is the sort of thing I do for a living. Not being able to debug the code while trying to figure out what's happening is a nightmare.

    • @SuperM789
      @SuperM789 Місяць тому

      and also why they usually just emulate it.

    • @thewhitefalcon8539
      @thewhitefalcon8539 16 днів тому

      Volunteers made a customizable PC version in a matter of months, what are you talking about?

  • @IAmNotASandwich453
    @IAmNotASandwich453 Місяць тому +3

    Damn, I didnt even know we have access to a decompiled version of OoT. I need to check out that code asap :D This game is literally what even got me into Programming 11 years ago, bc watching Speedruns of it was so mesmerizing. :)

  • @ShadeAnris
    @ShadeAnris Місяць тому +1

    wow awesome video! Im glad youtube put this in my feed its a super interesting watch

  • @jvizcode4845
    @jvizcode4845 Місяць тому

    This was pretty fun to watch. Super Mario 64 code is also great to analyze.

    • @johnsmith8981
      @johnsmith8981 Місяць тому

      How did you link to a ty search like that?

  • @-iIIiiiiiIiiiiIIIiiIi-
    @-iIIiiiiiIiiiiIIIiiIi- Місяць тому +1

    Dis dude's hair is on another level. It's like, 'what if Akira Toriyama designed Max Fischer from Rushmore?'

  • @GabrielDucharme
    @GabrielDucharme Місяць тому

    I would watch 300 hours of this.

  • @Gijontin
    @Gijontin Місяць тому +1

    Just started to dabble in C to learn some programming, this video sure is pretty insightfully for me even though I don't understand too much.
    Mainly I just wanted to throw in the analogy that watching this is like playing through Water Temple for the first time but in C :P

  • @hroland
    @hroland Місяць тому

    Oh this is incredible, please make more!!

  • @clutchyfinger
    @clutchyfinger Місяць тому

    Wow I love that they were using actual musical notation for the ocarina code. I mean of course they were, but you just never think about it unless you see it in text.

  • @DrinkPetrolForJesus
    @DrinkPetrolForJesus Місяць тому

    I have been blessed by the algorithm - this is awesome thanks.
    If you're taking suggestions: Goldeneye please

  • @trile2799
    @trile2799 26 днів тому

    Please continue doing this z64 video series. Triple Like!

  • @Ignawesome
    @Ignawesome Місяць тому +3

    From what I saw here, I would assume newf was the string used to initialize the new save file name, i.e. filling it with blanks for final builds, but for debug builds the string was "ZELDAZ"

  • @purpasmart_4831
    @purpasmart_4831 Місяць тому +7

    fb stands for framebuffer, sp stands for stack pointer. Stack Top gets the element from the top of the stack. Surprised you didn't know that, it's usually tought in Comp Sci

  • @faruzzy
    @faruzzy Місяць тому

    What a time to be alive!

  • @zyhru
    @zyhru Місяць тому +1

    man i wish i can write code like this look so fun

  • @lucaslasvegas5170
    @lucaslasvegas5170 Місяць тому

    Just found you and really enjoying the video so far. :-) I know it's been two weeks but I think I can add a bit of background to two things in the initial #includes:
    CIC is Nintendo's copy protection chip. One's on the cartridge, one in the console.
    N64DD is the Nintendo 64 Disc Drive, a failed addon to the N64. OOT was initially developed as a disc based game for this addon.

  • @justindorsey2084
    @justindorsey2084 Місяць тому

    Congrats on making a hit video!
    I found this super interesting. It made a great background video for me while I was studying. It helped me get in the right mindset to try to comprehend the geologic functions of volcanoes. Like coding to understand one thing in geology you need to understand [x] prior functions that make our world turn the way it does. So, thank you for your help!
    It was fun getting lost in this code of a game I also loved as a kid. When we saw "sword health" I became very curious and personally would've gotten lost down that rabbit hole for awhile, so if you ever figure out what "sword health" is, let me know!
    Also curious, how many total lines of code the game is, just for funsies.
    Hope to see more like this from you if you so desire to continue down this rabbit hole. As others have mentioned I'd love to see the likes of FF7, other FF titles, other Zelda titles, and since you seem to like the SuperNin era based on your choice of music, Chrono Trigger would be a neat one.

    • @benvillalobos
      @benvillalobos  Місяць тому +1

      Oh man I wouldn't be surprised if the entire codebase was in the 100k+ range. Codebases have the habit of becoming jungles over time (or dungeons in this case).
      I took a note to check on sword health next time I see it. Cheers, and good luck on your studies!

  • @Rod-f6m
    @Rod-f6m Місяць тому

    bro you gotta keep doing these videos! this was so informative!

  • @ultimat3lifeform
    @ultimat3lifeform Місяць тому

    That blue paint/and/or wallpaper reminds me of a certain Scott that says hey all

  • @ItsHydraX8
    @ItsHydraX8 Місяць тому +1

    Not a coder, but im interested in it and this was fun to watch you poke through this although I understood very little. Would love to see more poking around if youre up to it!

  • @jumpkut
    @jumpkut 20 днів тому

    08:45 DKC bangers make me feel some type of way

  • @ganondalf8090
    @ganondalf8090 Місяць тому +1

    i wish people would do stuff like this with other games, like for an actual dev to go through some leaked source (wouldn't touch any rockstar stuff with a 6 foot pole tho) and talk about what's good, what's shit, etc

    • @ganondalf8090
      @ganondalf8090 Місяць тому +1

      like ive literally been looking for this kinda thing pretty much since the sm64 decomp finished

  • @mattshu
    @mattshu Місяць тому

    high quality content you're going places so i'm subbin to follow!

  • @maxdignitas3698
    @maxdignitas3698 Місяць тому +1

    Rode the algorithm all the way here!

  • @spectrecular9721
    @spectrecular9721 Місяць тому +2

    17:30 - I imagine that's just the "magic numbers" of a Zelda save file format:
    en.m.wikipedia.org/wiki/List_of_file_signatures

  • @alexanderzin
    @alexanderzin Місяць тому

    Subscribed in hope for more videos like this.

  • @david.cr96
    @david.cr96 Місяць тому +1

    Those kind of markers like the "ZELDAZ" string can be really useful when you have to look at a random piece of binary memory and figure out what is wrong with it.

  • @xfaon
    @xfaon Місяць тому +1

    my childhood game!

  • @davidbundgaard
    @davidbundgaard Місяць тому +1

    ZELDAZ is the equivalent to BM in a .bmp file or JFIF in a jpg file, or MZ in a executable PE/COFF file from Windows.

  • @devfagundes
    @devfagundes Місяць тому

    What a nice video. Thanks

  • @spongemanhere
    @spongemanhere Місяць тому +1

    i have no idea what is going on but i enjoyed this anyway

  • @igorgiuseppe1862
    @igorgiuseppe1862 Місяць тому

    19:00 i dont know the reason why they coded it like this, but probably the logic goes like this:
    is doubleMagicAcquired= a flag that is checked at the great fairy that doubles your magic, to see if its should display the cutscene and double it, or if that already happened.
    yes, you can infer this information from magicLevel, with something like: if magicLevel==16: play the cutscene, multiply magicLevel by 2, recover health to healthCapacity, and recover mana to magicLevel, else recover health to healthCapacity, and recover mana to magicLevel (skip the cutscene)...
    but that assume that the programer who coded this system already knew the value of the magicLevels that the final game would use, if the beta testers decided that the game is too easy or too hard with the current maximum magicLevel and change it to, lets say 24 (and 48 when doubled), that would have required found this hardcoded reference to the 16 number (if magicLevel==16)
    and if this value change again and again, the same problem would repeat, so it make sense to have 2 variables, one to see if the magic was already increased and other to register the final value.
    i dont know why 1 and 2 values were used.

  • @maseay91
    @maseay91 День тому

    Thanks for being smart.. making life fun for us all :) I could never lol

  • @gg-gn3re
    @gg-gn3re Місяць тому

    13:51 no a double is a floating point, longs are integers. both are still used today as is the language that is made in ~.~

  • @MissingAFew
    @MissingAFew 7 днів тому

    A video on how to compile into a useful rom would be helpful !

  • @loganmahoney2284
    @loganmahoney2284 26 днів тому

    Love this

  • @pixelcatcher123
    @pixelcatcher123 Місяць тому

    Really cool stuff hope i see more

  • @YaroKasear
    @YaroKasear Місяць тому

    If my understanding of the TriForce% from GDC and my own experience with programming is any help: Overlays aren't menus. Menus are overlays.
    This game, and probably a lot of other games on the N64, tend to use a design pattern where an instance of an object will usually have its methods (Code for acting on their data structure proper.) copied into RAM and executed there, presumably to maximize performance as at this point ROM chips were definitely a lot slower than consoles. I don't know if we saw any of the actual overlay-loading code, but my guess is most the game states, like other objects, make use of this system.

  • @BariDavidGloriaGarcia2290
    @BariDavidGloriaGarcia2290 25 днів тому

    awesome!

  • @nmnml5602
    @nmnml5602 Місяць тому

    This is me trying to review one of my coworkers Pull Requests

  • @burnedoils
    @burnedoils Місяць тому +3

    this is why commenting and documention is more vital than the code itself, this is what alot of ppl don't understand, when we make things we decide what are the limits and most of our intents wich isnt usualy in the code thats why the documentaiton is vital, whats the points, whats the goal what are the limits and then also what are unforseen clashing of certain things

    • @Daimondz1239
      @Daimondz1239 Місяць тому +8

      To be clear this is a decompilation of a OoT cartridge. Somebody (probably a whole lot of somebodies) rebuilt this C code out of the disassembled byte code from a cartridge-along with some decompilation tools. The original source code made by Nintendo probably has comments in it, and those comments are probably in Japanese. The people who did the decompiling themselves likely didn’t know the purpose of most of these things and used a lot of guess work to get the repo to where it is. A complete decompilation with thorough documentation for OoT is a huge, huge project

    • @mu5gb
      @mu5gb Місяць тому +2

      @@Daimondz1239 indeed but I’d also like to add that the naming convention they chose is very good, and probably much more expressive than the original code
      More than documentation and comments, picking good, explicit names for your functions and variables is what makes code easier or harder to understand.
      And in the late 1990s, it was pretty common to use short, cryptic names that convey both the content but also the type of the variable (so, stuff like pszBuffer which in just a few characters tells you that it’s a pointer to a zero-ended string). As someone else mentioned, C89 restricts variable names to 31 characters, and I believe there was no namespaces either, so this kind of things was necessary, but it’s more difficult to read in 2024
      So, while documentation is lacking, what I see here is honestly one of the best situations I’ve seen in my career, with decent comments and explicit names. Good job to the guys who decompiled it

  • @Satoru-z1m
    @Satoru-z1m Місяць тому

    I feel like an alien reading another alien's language

  • @wakizashilover
    @wakizashilover Місяць тому

    Interested people are interesting. Keep up the stuff you find intriguing it’s fascinating seeing people walk through thought processes

  • @Ver2ion
    @Ver2ion Місяць тому +3

    i love the mysterious bg music to this

  • @LuisaFalcone-t8h
    @LuisaFalcone-t8h 16 днів тому

    Not going to lie, when I saw the thumbnail I thought it was Dave Grohl playing zelda.

  • @lordnibbla
    @lordnibbla Місяць тому

    Good shit I can vibe to.

  • @dannynoon013910
    @dannynoon013910 Місяць тому +1

    Guessing the ZELDAZ might be an error checker for corrupt saves - ie the bytes need to start with that string to be a zelda save just a guess though

  • @vin-Espanol-uu6wh
    @vin-Espanol-uu6wh 27 днів тому

    Mario 64 next please. That will be very popular

  • @sO_RoNerY
    @sO_RoNerY Місяць тому

    Not one of mine, but it’s a great game with great music.

  • @fdwr
    @fdwr Місяць тому

    The preprocessor conditionals are curious because those cannot come from decompilation. One could tediously derive local variable and struct field purposes to name them, but you cannot unwind macros or code that was never in the binary.

  • @TheVistaGroup
    @TheVistaGroup Місяць тому +3

    This was fun man, thanks! SNES Drunk background music?

  • @TheMadisonHang
    @TheMadisonHang 6 днів тому

    this is the future of university right here

  • @BenTJacobson
    @BenTJacobson День тому

    How did they get symbols (variable names, function names, files, etc) out of decompiling the ROM?

  • @Leadbraw
    @Leadbraw Місяць тому

    really cool video, wish i was better with C

  • @sofakng163
    @sofakng163 39 хвилин тому

    Do you have a theme or layout for Visual Studio Code? (it looks like you are using that)
    I really like your setup

  • @DeepDrinks
    @DeepDrinks Місяць тому

    Nice!

  • @valshaped
    @valshaped Місяць тому +9

    // string "ZELDAZ"
    commonly known as a magic number
    Also, being reverse engineered code, none of the comments or variable names come from the original source code. The zeldaret team doesn't have access to the original code.

    • @lucetubegplusstillsux2678
      @lucetubegplusstillsux2678 Місяць тому

      It's a debug rom so *some* of it is, the stuff left printed to the console, which still has some silly comments here and there.

    • @valshaped
      @valshaped Місяць тому +2

      @@lucetubegplusstillsux2678 Yup! Being overly pedantic, that's neither a code comment nor variable name (though, being debug output, it can and does contain either!)

    • @mzxrules
      @mzxrules Місяць тому +2

      The ZELDAZ string is part of the sanity check for the save data. I think if any character is non-matching, then the save is considered corrupt even if the checksum is correct.

    • @valshaped
      @valshaped Місяць тому

      @@mzxrules Correct! Magic numbers are commonly used to identify file formats. If it's not "ZELDAZ", it could be a save file for another game entirely-or some other kind of file that happens to store a checksum in the same place as OOT

    • @mzxrules
      @mzxrules Місяць тому +2

      @@valshaped under normal circumstances, it is fairly difficult for the save chip embedded into the Ocarina of Time cartridge to hold save data for a completely different game.
      Rather, the problem is that the checksum algo for saves isn't particularly good for verifying data integrity. It simply treats the Save struct as an array of u16, and adds everything up. This means that a Save struct that was wiped to all 0s (which isn't a valid save), will pass the checksum

  • @Brombatti
    @Brombatti Місяць тому

    really cool video, an instant subscribe
    So, have idea to make more this kinda of videos?
    Greetings from Brazil

    • @benvillalobos
      @benvillalobos  Місяць тому +1

      It's already a series ;) Thanks for the comment!

  • @JoRyGu
    @JoRyGu Місяць тому +6

    A long long is not a double. A double is a double precision floating point number. A long long is just a 64 bit integer.

    • @benvillalobos
      @benvillalobos  Місяць тому +1

      Not proud of that misspeak 😉

    • @JoRyGu
      @JoRyGu Місяць тому +5

      @@benvillalobos No reason to not be proud of anything man. You're curious and exploring new stuff. That's awesome. Just because you're on camera doesn't mean you have to be omniscient.

    • @JordanManfrey
      @JordanManfrey Місяць тому

      this post made by BIGINT gang

  • @Slop_Dogg
    @Slop_Dogg Місяць тому

    i know everything and i'm a genius

  • @MrBrax
    @MrBrax Місяць тому +3

    Would be interesting to start going through gameplay logic

  • @mikkelisaksenrobinson
    @mikkelisaksenrobinson Місяць тому +1

    Very cool video. Is it possible to load the unused cutscenes?

    • @mzxrules
      @mzxrules Місяць тому +2

      If I remember correctly, the section of code with the unused cutscenes that he looked at is what I call the cutscene exit command control codes. Zelda64 has at least two different cutscene systems, one called OnePointDemo which you might imagine involves focusing the camera on one subject matter (a door unlocking, a chest dropping from the sky), and the other one is a "script" based cutscene system. The "script" based system is just a list of commands which are generally associated with a start and end frame for when the command should be active. One command is the cutscene exit command (decomp calls this CS_DESTINATION), which runs a script that acts as the end of the cutscene because it spawns you in a new destination. To restore them, you can modify an existing CS_DESTINATION to have w/e and it should usually work out of the box.

  • @BlueFinch
    @BlueFinch Місяць тому +1

    I think you would absolutely love going through the Super Mario Bros 3 (NES) codebase, decompiled and annotated by Captain Southbird. I've been doing that for many years. It is a true treasure trove.

  • @rosen8757
    @rosen8757 Місяць тому +1

    This is not the source code for ocarina of time, this is a decompiled version

    • @Digitalgems9000
      @Digitalgems9000 Місяць тому

      isn't it similar enough though? function names and stuff are the original, correct? maybe just comments are missing?

    • @rosen8757
      @rosen8757 Місяць тому +1

      @@Digitalgems9000 actually no, functions, function names and in fact all code is not the same. A decompiler takes machine instructions and translates it into C code that would compile into the original. So functions you see in this version may not even exist in the original.
      It's the people working on the decompiled version going through and naming things when they try to figure out what it actually represents.
      And that is why it's misleading to call this the source code for Ocarina of Time because the original source code will be totally different.

    • @Digitalgems9000
      @Digitalgems9000 Місяць тому

      @@rosen8757 ohh yeah that makes sense. i agree then, it's not the same at all. i thought a decompiler could xfer the function names and stuff

    • @Digitalgems9000
      @Digitalgems9000 Місяць тому

      @@rosen8757 because i have a codebase for a game called risk your life 2, by planetwide games. it was a big mmo back in the day, and it even has the comments and the old visual studio build files. server library and client side engine. the whole shebang. it's gigantic. looks like a team or studio had to work on it it's so big.

    • @rosen8757
      @rosen8757 Місяць тому

      @@Digitalgems9000 in some cases it can, for example if the N64 architecture has some system calls at specific values and the decompiler knows this it can mark those function calls with a correct name, but for any user code no.

  • @OperationsAndSmoothProductions
    @OperationsAndSmoothProductions Місяць тому +3

    Would love to see a whole series on this?

  • @HyagoPinheiro
    @HyagoPinheiro 28 днів тому

    Do you plan to do the same for Banjo Kazooie?

  • @inspecter86
    @inspecter86 8 днів тому

    TIL LInk was 5 in OoT