• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Research: Memory allocation system

knizz

  • 192
    Posts
    17
    Years
    • Seen Oct 28, 2020
    Game Freak removed all debug-strings from the final game except those for malloc/free. I found out that allocated blocks have this format:

    0x00 / Halfword / Flag / 01 00 = used, 00 00 = unused
    0x02 / Halfword / Magic-number / Always A3 A3
    0x04 / Word / Idk but not a pointer, probably the size of the data
    0x08 / Word / Pointer to the previous block
    0x0C / Word / Pointer to the next block
    0x10 / Depends / Data
     
    Last edited:
    [jq]"malloc_and_clear"[/jq]
    so, this would be...
    free(ptr);
    ptr = malloc(nSize);
    ??
     
    Back
    Top