Added some more patch functionality, added recomp namespace

This commit is contained in:
Mr-Wiseguy
2023-11-24 17:10:21 -05:00
parent 3b06ad52f0
commit ec23ef02fd
18 changed files with 628 additions and 230 deletions
-13
View File
@@ -101,16 +101,3 @@ extern "C" void osMotorStart_recomp(uint8_t* rdram, recomp_context* ctx) {
extern "C" void osMotorStop_recomp(uint8_t* rdram, recomp_context* ctx) {
;
}
#include "../patches/input.h"
extern "C" void recomp_get_item_inputs(uint8_t* rdram, recomp_context* ctx) {
RecompInputs* inputs = _arg<0, RecompInputs*>(rdram, ctx);
if (input_callbacks.get_input) {
u16 buttons;
input_callbacks.get_input(&buttons, &inputs->x, &inputs->y);
// TODO remap the inputs for items here
inputs->buttons = buttons;
}
}
+11
View File
@@ -35,6 +35,13 @@ void load_overlay(size_t section_table_index, int32_t ram) {
section_addresses[section.index] = ram;
}
void load_special_overlay(const SectionTableEntry& section, int32_t ram) {
for (size_t function_index = 0; function_index < section.num_funcs; function_index++) {
const FuncEntry& func = section.funcs[function_index];
func_map[ram + func.offset] = func.func;
}
}
extern "C" {
int32_t section_addresses[num_sections];
@@ -128,6 +135,8 @@ extern "C" void unload_overlays(int32_t ram_addr, uint32_t size) {
}
}
void load_patch_functions();
void init_overlays() {
for (size_t section_index = 0; section_index < num_code_sections; section_index++) {
section_addresses[section_table[section_index].index] = section_table[section_index].ram_addr;
@@ -139,6 +148,8 @@ void init_overlays() {
return a.rom_addr < b.rom_addr;
}
);
load_patch_functions();
}
extern "C" recomp_func_t * get_function(int32_t addr) {
+11
View File
@@ -0,0 +1,11 @@
#include <unordered_map>
#include <algorithm>
#include <vector>
#include "recomp.h"
#include "../RecompiledPatches/recomp_overlays.inl"
void load_special_overlay(const SectionTableEntry& section, int32_t ram);
void load_patch_functions() {
load_special_overlay(section_table[0], section_table[0].ram_addr);
}