diff --git a/src/mapper/mp_targt.cc b/src/mapper/mp_targt.cc index 7d7799b..c5f1cff 100644 --- a/src/mapper/mp_targt.cc +++ b/src/mapper/mp_targt.cc @@ -107,6 +107,32 @@ int target_header_save() return 0; } +// 0x49B4E8 +int target_header_load() +{ + char path[COMPAT_MAX_PATH]; + FILE* stream; + + target_make_path(path, -1); + strcat(path, TARGET_DAT); + + stream = fopen(path, "rb"); + if (stream == NULL) { + return -1; + } + + if (fread(&targetlist, sizeof(targetlist), 1, stream) != 1) { + // FIXME: Leaking `stream`. + return -1; + } + + targetlist.field_0 = 0; + targetlist.field_4 = 0; + + fclose(stream); + return 0; +} + // 0x49BD98 int pick_rot() { diff --git a/src/mapper/mp_targt.h b/src/mapper/mp_targt.h index 1fd3d19..af47cc9 100644 --- a/src/mapper/mp_targt.h +++ b/src/mapper/mp_targt.h @@ -9,6 +9,7 @@ void target_make_path(char* path, int pid); int target_init(); int target_exit(); int target_header_save(); +int target_header_load(); int pick_rot(); int target_pick_global_var(int* value_ptr); int target_pick_map_var(int* value_ptr);