Skip to content

Commit

Permalink
make it safe, i hope
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Sep 20, 2023
1 parent cb8a345 commit 5e0d9c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/game_api/game_patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ void clear_cutscene_behavior()
}
}
}
// memory leak, ignore this, it's only temporary as proof of concept
state->entity_lookup->unknown1[2].ent_list = nullptr;
state->entity_lookup->unknown1[2].cap = 0;
// some bs, don't worry about it
state->entity_lookup->unknown1[3].size = 0;
state->entity_lookup->unknown3 = state->entity_lookup->unknown4;
}
Expand Down
13 changes: 6 additions & 7 deletions src/game_api/state_structs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,10 @@ struct EntityLookup
{
std::array<EntityList, 4> unknown1;

// is this vector?
// holds pointers to elements of the array above
// it's almost as static as the capacity is 5 and it can hold max 4 pointers
// in "empty" state it holds all 4 pointers
size_t unknown2;
size_t unknown3;
size_t unknown4;
// this is either very strange vector or something unrelated
// if this is vector, then it's just holds list of pointers to the elements from array above
// the result of the lookup would then be last element: (unknown3 - 1)
EntityList** unknown2; // always points to the first one?
EntityList** unknown3; // if lookup is not used, it's the same as unknown4
EntityList** unknown4; // capacity? points to nullptr after all the other pointers
};

0 comments on commit 5e0d9c5

Please sign in to comment.