Exploring Ocarina of Time’s Decompiled Codebase

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

КОМЕНТАРІ • 314

  • @benvillalobos
    @benvillalobos  3 місяці тому +70

    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 2 місяці тому +1

      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

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

    When I worked at Riot Games, I sometimes had to go through old code bases with no guidance and no documentation. I felt like an idiot, struggling to make sense of it all for long periods of time. This helped my imposter syndrome a bit to see someone else do something similar. Thank you 😂

  • @biggc181
    @biggc181 3 місяці тому +218

    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  3 місяці тому +19

      Thanks for the kind words, more to come soon!

    • @khronos142
      @khronos142 15 днів тому

      more content, feed us, we are hungry

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

    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 3 місяці тому +9

      I took the day off work to buy it

    • @riseofdayzofficial
      @riseofdayzofficial 3 місяці тому +4

      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 3 місяці тому +9

      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 місяці тому +4

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

    • @ayotundeayoko5861
      @ayotundeayoko5861 3 місяці тому +4

      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 3 місяці тому +296

    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  3 місяці тому +41

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

    • @gorgonflabish
      @gorgonflabish 3 місяці тому +12

      That's why I love humans

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

      You're a complete boss :D

    • @SimoneN64
      @SimoneN64 3 місяці тому +13

      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 місяці тому +6

      ​@@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 3 місяці тому +63

    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

  • @8ddca4b80
    @8ddca4b80 22 дні тому +4

    My eyes fill with tears every time I hear the title theme... it means a lot to me

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

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

  • @nazart7830
    @nazart7830 3 місяці тому +14

    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  3 місяці тому +1

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

  • @KingBakura
    @KingBakura 3 місяці тому +26

    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.

  • @beogeek
    @beogeek 3 місяці тому +12

    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  3 місяці тому +2

      Thanks for the extremely kind comment :D

    • @beogeek
      @beogeek 3 місяці тому +1

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

  • @JacobKinsley
    @JacobKinsley 13 днів тому +2

    Its so vindicating seeing how the code parallels how I thought the game code worked as a kid

  • @Minty_Meeo
    @Minty_Meeo 3 місяці тому +26

    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 3 місяці тому

      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 3 місяці тому +11

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

    • @PlasmaSnake369
      @PlasmaSnake369 19 днів тому

      They can decompile comments?

  • @clublulu399
    @clublulu399 2 місяці тому +12

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

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

      What a day to be a coder

  • @robertjif6337
    @robertjif6337 3 місяці тому +8

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

  • @InTheNickofTime
    @InTheNickofTime 3 місяці тому +2

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

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

    After 6 years of coding and a life-time of ocarina of time worshipping, I am ready for this video.

  • @jasonknoll5170
    @jasonknoll5170 2 місяці тому +1

    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 2 місяці тому +1

      brb watching more of your series on this

  • @alexh1687
    @alexh1687 3 місяці тому +5

    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 !

  • @clutchyfinger
    @clutchyfinger 3 місяці тому +2

    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.

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

    Ocarina of time... What a beautiful memory ❤

  • @MortMort
    @MortMort 3 місяці тому +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!

  • @goomoonryonglucifer7192
    @goomoonryonglucifer7192 3 місяці тому +95

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

    • @TimeConvolution
      @TimeConvolution 3 місяці тому +24

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

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

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

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

      Wait this is coding? I thought this was ASMR.

  • @NickoBanaa
    @NickoBanaa 2 місяці тому +1

    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.

  • @TheMadisonHang
    @TheMadisonHang 2 місяці тому +1

    i was ready for this, 20 years ago
    lets go

  • @bishcp
    @bishcp 2 місяці тому

    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

  • @User-oh8vi
    @User-oh8vi 2 місяці тому

    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.

  • @Pablo1517
    @Pablo1517 3 місяці тому +10

    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 3 місяці тому +1

      and also why they usually just emulate it.

    • @thewhitefalcon8539
      @thewhitefalcon8539 2 місяці тому +2

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

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

      @@SuperM789a lot of times it’s not enough, even then companies like Nintendo will want to update UI elements to match newer consoles along with a handful of features

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

    Epic, super-interesting content!!! Also love the style of the video

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

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

  • @CrAzYpotpie
    @CrAzYpotpie 14 днів тому +2

    We have the same music tastes. Terranigma is one of the best games ever made.

  • @Okla_Soft
    @Okla_Soft 3 місяці тому +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.
    🤘🤘

  • @spectrecular9721
    @spectrecular9721 3 місяці тому +3

    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

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

    17:10 It is very common that files start with some typical characters for that kind of file because this allows to reduce the chance to a minimum that a file with incompatible data is read by the application since the application will expect all files that are read in to start with these characters.

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

    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"

  • @WH-sz3bh
    @WH-sz3bh 15 днів тому +1

    I'm pretty sure I hear aquatic ambiance from the Donkey Kong Country soundtrack. 9:00 ish.

  • @IAmNotASandwich453
    @IAmNotASandwich453 3 місяці тому +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. :)

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

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

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

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

  • @eti360
    @eti360 2 місяці тому

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

  • @lucaslasvegas5170
    @lucaslasvegas5170 3 місяці тому +1

    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.

  • @davidbundgaard
    @davidbundgaard 3 місяці тому +2

    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.

  • @TheMadisonHang
    @TheMadisonHang 2 місяці тому

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

  • @ShadyRonin
    @ShadyRonin 2 місяці тому

    This video is incredible man. Thank you for this

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

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

  • @theterabyte
    @theterabyte 3 місяці тому

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

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

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

  • @RJR3006
    @RJR3006 3 місяці тому

    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  3 місяці тому +2

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

    • @RJR3006
      @RJR3006 3 місяці тому +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 😩

  • @digitalhero7488
    @digitalhero7488 3 місяці тому

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

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

    I feel like an alien reading another alien's language

  • @tobytherock
    @tobytherock 3 місяці тому

    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

  • @AwesomeKev
    @AwesomeKev 3 місяці тому

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

  • @VysetheBattleMaster
    @VysetheBattleMaster 2 місяці тому

    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.

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

    Would love to see a whole series on this?

  • @Gijontin
    @Gijontin 3 місяці тому +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

  • @ItsHydraX8
    @ItsHydraX8 3 місяці тому +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!

  • @GabrielDucharme
    @GabrielDucharme 3 місяці тому

    I would watch 300 hours of this.

  • @david.cr96
    @david.cr96 3 місяці тому +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.

  • @faruzzy
    @faruzzy 3 місяці тому

    What a time to be alive!

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

    Cracked myself up at "What is fb?". Good stuff.

  • @justindorsey2084
    @justindorsey2084 3 місяці тому

    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  3 місяці тому +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!

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

    39:10 do { ... } while (0) is an old C trick for defining a multi-statement macro that syntactically sort of behaves from the outside like a function call. It's the nearest macro equivalent to an inline function definition.

    • @SXZ-dev
      @SXZ-dev 15 днів тому

      And you'd do that to prevent the compiler rearranging it right? So that the compiler keeps it all together? Sorry if it's a silly question haven't touched C in ages

    • @waltermundt
      @waltermundt 15 днів тому

      @SXZ-dev It's more of a safety thing for the user of a macro than an optimization measure but yes. Macros are dumb text substitution that happens before almost every other step in compilation. If you have a multi-statement macro without some trick and you call it in the middle of an expression, that macro splits the expression down the middle despite looking exactly like an ordinary function call. It's really hard to remember "oh I should only ever use this macro on a line of its own because it's going to barf a bunch of lines of code into the middle of wherever I use it". C is very permissive about what happens where (e.g. you can swap the array and index in brackets notation and it still works fine), so this regularly still compiles into something nonsensical.
      Enter the do-while trick. By putting that around the macro, it's now a contained single statement that has no return value and cannot be used in an expression. It's guaranteed not to compile if you use it in an if statement or other context where a value is expected. It generally plays nice with other weird C syntax things like using logical operator shortcutting as a shorthand for an if statement i.e. (x < 0) || doThing() instead of if (x < 0) doThing(). Since do-while-0 wrappers are optimized away entirely by the compiler there's no runtime cost to this change. This avoids so many difficult to diagnose problems that it's standard practice any time a macro definition can't otherwise fit into a single statement.

  • @jvizcode4845
    @jvizcode4845 3 місяці тому

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

    • @johnsmith8981
      @johnsmith8981 3 місяці тому

      How did you link to a ty search like that?

  • @Brombatti
    @Brombatti 3 місяці тому +1

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

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

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

  • @hroland
    @hroland 3 місяці тому

    Oh this is incredible, please make more!!

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

    Man you gotta link the playlist to the Nintendo ost that you were listening to! It’s so good

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

    my childhood game!

  • @purpasmart_4831
    @purpasmart_4831 3 місяці тому +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

  • @mattshu
    @mattshu 3 місяці тому

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

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

    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 ~.~

  • @smrt-e
    @smrt-e 11 днів тому

    The music was nice.

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

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

  • @fdwr
    @fdwr 3 місяці тому

    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.

  • @DrinkPetrolForJesus
    @DrinkPetrolForJesus 3 місяці тому

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

  • @jumpkut
    @jumpkut 2 місяці тому

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

  • @dannynoon013910
    @dannynoon013910 3 місяці тому +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

  • @trile2799
    @trile2799 2 місяці тому

    Please continue doing this z64 video series. Triple Like!

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

    i love the mysterious bg music to this

  • @alexanderzin
    @alexanderzin 3 місяці тому

    Subscribed in hope for more videos like this.

  • @rosen8757
    @rosen8757 3 місяці тому +2

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

    • @Digitalgems9000
      @Digitalgems9000 3 місяці тому

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

    • @rosen8757
      @rosen8757 3 місяці тому +2

      @@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 3 місяці тому

      @@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 3 місяці тому

      @@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 3 місяці тому

      @@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.

  • @nmnml5602
    @nmnml5602 3 місяці тому

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

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

    It is the best game ever made, i get goosebumps!!!

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

    "ZELDAZ" is probably a "magic number", it must be this exact value. If not, it is sure that the file is not valid.

  • @ganondalf8090
    @ganondalf8090 3 місяці тому +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 3 місяці тому +1

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

  • @MissingAFew
    @MissingAFew 2 місяці тому

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

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

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

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

    what is the song in the background ? 4:00
    Amazing video !

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

      Waterworld SNES soundtrack - Map. The playlist used is in the description. Cheers!

  • @wakizashilover
    @wakizashilover 3 місяці тому

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

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

    Oh this is so dope

  • @LuisaFalcone-t8h
    @LuisaFalcone-t8h 2 місяці тому

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

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

    Does the ocarinanotes struct maybe indicate that they dynamically generated the notes based on a midi input? So instead of manually mapping a c or d or e note to the controller buttons it automatically determined the buttons?

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

    Rode the algorithm all the way here!

  • @igorgiuseppe1862
    @igorgiuseppe1862 3 місяці тому

    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.

  • @valshaped
    @valshaped 3 місяці тому +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 3 місяці тому

      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 3 місяці тому +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 3 місяці тому +3

      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 3 місяці тому

      @@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 3 місяці тому +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

  • @EmberCitrine
    @EmberCitrine 13 днів тому

    Thinking about the glitches possible with this code, like within the first 30 seconds previewing the save file called for the title screen; I don't remember if I saw this glitch used in ocarina of time, but Twilight princess is set up the same way where it calls a separate save file for the title screen animation, and you can glitch yourself into playing that file and bring some data from it over to your own file.

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

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

    • @mzxrules
      @mzxrules 3 місяці тому +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.

  • @devfagundes
    @devfagundes 3 місяці тому

    What a nice video. Thanks

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

    38:55 look up do {...} while (0) in macros
    it's so the macro's expansion doesn't end in a semicolon

  • @Noodlezoup
    @Noodlezoup 3 місяці тому

    I would love to see you doing this on final fantasy 7

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

    OoT is my #1.