mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2025-10-30 08:02:29 +00:00
Misc fixes (#39)
* Fixes * Fix OoB * Use calloc instead of malloc for initializing the overlays
This commit is contained in:
parent
ec7e81b45d
commit
6ceb171571
2 changed files with 7 additions and 2 deletions
|
|
@ -143,9 +143,9 @@ extern "C" void unload_overlays(int32_t ram_addr, uint32_t size) {
|
|||
}
|
||||
|
||||
void init_overlays() {
|
||||
section_addresses = (int32_t *)malloc(sections_info.total_num_sections * sizeof(int32_t));
|
||||
section_addresses = (int32_t *)calloc(sections_info.total_num_sections, sizeof(int32_t));
|
||||
|
||||
for (size_t section_index = 0; section_index < sections_info.total_num_sections; section_index++) {
|
||||
for (size_t section_index = 0; section_index < sections_info.num_code_sections; section_index++) {
|
||||
section_addresses[sections_info.code_sections[section_index].index] = sections_info.code_sections[section_index].ram_addr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "recomp.h"
|
||||
#include "sections.h"
|
||||
#include "overlays.hpp"
|
||||
#include "ultramodern/ultramodern.hpp"
|
||||
|
||||
static SectionTableEntry* code_sections = nullptr;
|
||||
|
||||
|
|
@ -14,5 +15,9 @@ void recomp::register_patch_section(SectionTableEntry* sections) {
|
|||
}
|
||||
|
||||
void recomp::load_patch_functions() {
|
||||
if (code_sections == nullptr) {
|
||||
debug_printf("[Patch] No patch section was registered\n");
|
||||
return;
|
||||
}
|
||||
load_special_overlay(code_sections[0], code_sections[0].ram_addr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue