From ac1f4477ef81edcb74c79b4c23cb2839ed474304 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 24 Jul 2023 08:08:01 +0300 Subject: [PATCH] Add target_make_path --- src/mapper/mp_targt.cc | 26 ++++++++++++++++++++++++++ src/mapper/mp_targt.h | 1 + 2 files changed, 27 insertions(+) diff --git a/src/mapper/mp_targt.cc b/src/mapper/mp_targt.cc index 390fcb1..0bc7aed 100644 --- a/src/mapper/mp_targt.cc +++ b/src/mapper/mp_targt.cc @@ -1,7 +1,18 @@ #include "mapper/mp_targt.h" +#include + +#include "art.h" +#include "proto.h" + namespace fallout { +// 0x53F354 +static char default_target_path_base[] = "\\fallout2\\dev\\proto\\"; + +// 0x559CD0 +static char* target_path_base = default_target_path_base; + // 0x559DBC static bool tgt_overriden = false; @@ -17,6 +28,21 @@ bool target_overriden() return tgt_overriden; } +// 0x49B34C +void target_make_path(char* path, int pid) +{ + if (_cd_path_base[0] != '\0' && _cd_path_base[1] == ':') { + strncpy(path, _cd_path_base, 2); + strcat(path, target_path_base); + } else { + strcpy(path, target_path_base); + } + + if (pid != -1) { + strcat(path, artGetObjectTypeName(PID_TYPE(pid))); + } +} + // 0x49B424 int target_init() { diff --git a/src/mapper/mp_targt.h b/src/mapper/mp_targt.h index d70651c..1c0a782 100644 --- a/src/mapper/mp_targt.h +++ b/src/mapper/mp_targt.h @@ -5,6 +5,7 @@ namespace fallout { void target_override_protection(); bool target_overriden(); +void target_make_path(char* path, int pid); int target_init(); int target_exit();