From caf28a728609c6d37ae5f1e56491b36ec8ae794e Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 2 Sep 2023 17:07:43 +0300 Subject: [PATCH] Add target_tid_ptr --- src/mapper/mp_targt.cc | 18 ++++++++++++++++++ src/mapper/mp_targt.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/mapper/mp_targt.cc b/src/mapper/mp_targt.cc index d920c71..c9da5ff 100644 --- a/src/mapper/mp_targt.cc +++ b/src/mapper/mp_targt.cc @@ -228,6 +228,24 @@ int target_ptr(int pid, TargetSubNode** subnode_ptr) return target_load(pid, subnode_ptr); } +// 0x49BD38 +int target_tid_ptr(int pid, int tid, TargetSubNode** subnode_ptr) +{ + TargetSubNode* subnode; + if (target_ptr(pid, &subnode) == -1) { + return -1; + } + + while (subnode != NULL) { + if (subnode->field_4 == tid) { + *subnode_ptr = subnode; + return 0; + } + } + + return -1; +} + // 0x49BD98 int pick_rot() { diff --git a/src/mapper/mp_targt.h b/src/mapper/mp_targt.h index e169605..1c830c8 100644 --- a/src/mapper/mp_targt.h +++ b/src/mapper/mp_targt.h @@ -56,6 +56,7 @@ 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 target_tid_ptr(int pid, int tid, TargetSubNode** subnode_ptr); int pick_rot(); int target_pick_global_var(int* value_ptr); int target_pick_map_var(int* value_ptr);