Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Reload this Page Research: Memory allocation system

Notices
For all updates, view the main page.

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.



Reply
 
Thread Tools
  #1    
Old September 14th, 2010 (05:07 AM). Edited November 7th, 2010 by knizz.
knizz's Avatar
knizz
 
Join Date: Aug 2007
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
__________________
Firered IDA 6.5 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support
Reply With Quote
  #2    
Old October 16th, 2010 (06:30 AM).
knizz's Avatar
knizz
 
Join Date: Aug 2007
Update: I'm pretty sure that 08002B9C is "malloc", that 08002BB0 is "malloc_and_clear", and that 08002A08 is "free".
__________________
Firered IDA 6.5 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support
Reply With Quote
  #3    
Old October 23rd, 2010 (04:15 PM).
Full Metal's Avatar
Full Metal
C(++) Developer.
Community Supporter
 
Join Date: Jan 2008
Location: In my mind.
Age: 19
Gender: Male
Nature: Timid
Send a message via Windows Live Messenger to Full Metal
[jq]"malloc_and_clear"[/jq]
so, this would be...
free(ptr);
ptr = malloc(nSize);
??
__________________

★ full metal.

I like to push it,
and push it,
until my luck is over.
Reply With Quote
  #4    
Old October 23rd, 2010 (10:51 PM).
knizz's Avatar
knizz
 
Join Date: Aug 2007
Quote originally posted by Full Metal:
[jq]"malloc_and_clear"[/jq]
so, this would be...
free(ptr);
ptr = malloc(nSize);
??
No. Its more like
ptr=ptr2=malloc(size);
while(size--)*ptr2++=0;
return ptr;
__________________
Firered IDA 6.5 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are UTC -8. The time now is 03:32 AM.