add item pickup patch

This commit is contained in:
Martin Michelsen
2024-12-07 17:29:10 -08:00
parent 3424d6481b
commit 4b3dcbb6f4
28 changed files with 656 additions and 20 deletions
+4 -4
View File
@@ -2745,7 +2745,7 @@ static void on_10(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
// base address for loading the file.
send_function_call(
c,
s->function_code_index->name_to_function.at("ReadMemoryWord"),
s->function_code_index->name_to_function.at("ReadMemoryWordGC"),
{{"address", 0x80000034}}); // ArenaHigh from GC globals
}
break;
@@ -2927,7 +2927,7 @@ static void send_dol_file_chunk(shared_ptr<Client> c, uint32_t start_addr) {
string data_to_send = c->loading_dol_file->data.substr(offset, bytes_to_send);
auto s = c->require_server_state();
auto fn = s->function_code_index->name_to_function.at("WriteMemory");
auto fn = s->function_code_index->name_to_function.at("WriteMemoryGC");
unordered_map<string, uint32_t> label_writes(
{{"dest_addr", start_addr}, {"size", bytes_to_send}});
send_function_call(c, fn, label_writes, data_to_send.data(), data_to_send.size());
@@ -2946,10 +2946,10 @@ static void on_B3(shared_ptr<Client> c, uint16_t, uint32_t flag, string& data) {
c->function_call_response_queue.pop_front();
} else if (c->loading_dol_file.get()) {
auto called_fn = s->function_code_index->index_to_function.at(flag);
if (called_fn->short_name == "ReadMemoryWord") {
if (called_fn->short_name == "ReadMemoryWordGC") {
c->dol_base_addr = (cmd.return_value - c->loading_dol_file->data.size()) & (~3);
send_dol_file_chunk(c, c->dol_base_addr);
} else if (called_fn->short_name == "WriteMemory") {
} else if (called_fn->short_name == "WriteMemoryGC") {
if (cmd.return_value >= c->dol_base_addr + c->loading_dol_file->data.size()) {
auto fn = s->function_code_index->name_to_function.at("RunDOL");
unordered_map<string, uint32_t> label_writes({{"dol_base_ptr", c->dol_base_addr}});