From 25a3de62e7b67227727c8f347b8cbd9aebb7131a Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 2 Sep 2023 17:05:26 +0300 Subject: [PATCH] Add target_ptr --- src/mapper/mp_targt.cc | 14 ++++++++++++++ src/mapper/mp_targt.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/mapper/mp_targt.cc b/src/mapper/mp_targt.cc index 6d4ba60..d920c71 100644 --- a/src/mapper/mp_targt.cc +++ b/src/mapper/mp_targt.cc @@ -214,6 +214,20 @@ int target_find_free_subnode(TargetSubNode** subnode_ptr) return 0; } +// 0x49BD00 +int target_ptr(int pid, TargetSubNode** subnode_ptr) +{ + TargetNode* node = targetlist.tail; + while (node != NULL) { + if (node->subnode.field_0 == pid) { + *subnode_ptr = &(node->subnode); + return 0; + } + } + + return target_load(pid, subnode_ptr); +} + // 0x49BD98 int pick_rot() { diff --git a/src/mapper/mp_targt.h b/src/mapper/mp_targt.h index d85b20f..e169605 100644 --- a/src/mapper/mp_targt.h +++ b/src/mapper/mp_targt.h @@ -55,6 +55,7 @@ int target_header_save(); int target_header_load(); int target_load(int pid, TargetSubNode** subnode_ptr); int target_find_free_subnode(TargetSubNode** subnode_ptr); +int target_ptr(int pid, TargetSubNode** subnode_ptr); int pick_rot(); int target_pick_global_var(int* value_ptr); int target_pick_map_var(int* value_ptr);