Add target_header_load

This commit is contained in:
Alexander Batalov 2023-09-02 15:31:23 +03:00
parent 59c43590cc
commit ed7ffac816
2 changed files with 27 additions and 0 deletions

View File

@ -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()
{

View File

@ -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);