-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement EGG::Heap #156
Implement EGG::Heap #156
Conversation
@@ -11,6 +11,8 @@ namespace Host { | |||
/// @brief The main entry point for the program. | |||
/// @addr{0x80008EF0} | |||
int KSystem::main(int argc, char **argv) { | |||
EGG::Heap::initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to match base game. Can you elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function call must happen before any allocations can be made. Otherwise, the current heap is set to nullptr, and the program segfaults.
In the base game, RKSystem::main
calls RKSystem::initialize
, which calls RKSystem::initMemory
. initMemory
is the function responsible for calling EGG::Heap::initialize
and creating heaps out of the arenas. However, the base game also doesn't handle options until much later. For context, see 8000a8f0, and examine where it gets called from RKSystem::initialize
- it's after.
Rather than overhaul the option parsing code (which we will need to do later), I instead opt for the simpler approach of just initializing memory immediately in KSystem::main
.
a35527f
to
4243d23
Compare
Function addresses still need to be added, but the heaps are in a usable state. Closes #2.