[X] I have added a changelog entry about what my pull request accomplishes, or it is an internal change
Description
This PR fixes memory issues that occurred with savegames as well as a 64 savegame slot limit due to int32_t gf_param = gf_option & ((1 << 6) - 1); which was due to the bitflow operations in the gameflow. There is a second small commit to fix two small memory leaks in the gameflow as well.
The memory leak occurred if the number of savegame slots was over 16. Requestor's item_flags max value was 16 which was less than the default savegame amount in TR1X. Reworked much of the requestor code to account for this. Also reworked the item_texts to be safer.
The 64 slot limit was fixed by reworking the GAMEFLOW_OPTIONs to no longer use bit shifting. This PR introduces a new gameflow info struct that contains that information. It's a new global struct and changed the phasers, so they don't return. But it seemed necessary since some of the issue was only being able to return one value.
This will need heavily tested, but lmk if you think the code changes look good before I ask for testing help. I'm surprised we didn't have more issues reported because the memory was severely corrupted. Maybe it only really showed up badly when I started testing with a really high number of savegames.
Also, there is a memory leak in packer.c, but I was unable to fix it. The TEX_INFO *info = Memory_Alloc(sizeof(TEX_INFO)); are never freed, and there is some pointer to malloc'd pointer stuff going on in there.
Checklist
Description
This PR fixes memory issues that occurred with savegames as well as a 64 savegame slot limit due to
int32_t gf_param = gf_option & ((1 << 6) - 1);
which was due to the bitflow operations in the gameflow. There is a second small commit to fix two small memory leaks in the gameflow as well.The memory leak occurred if the number of savegame slots was over 16. Requestor's
item_flags
max value was 16 which was less than the default savegame amount in TR1X. Reworked much of the requestor code to account for this. Also reworked theitem_texts
to be safer.The 64 slot limit was fixed by reworking the
GAMEFLOW_OPTION
s to no longer use bit shifting. This PR introduces a new gameflow info struct that contains that information. It's a new global struct and changed the phasers, so they don't return. But it seemed necessary since some of the issue was only being able to return one value.This will need heavily tested, but lmk if you think the code changes look good before I ask for testing help. I'm surprised we didn't have more issues reported because the memory was severely corrupted. Maybe it only really showed up badly when I started testing with a really high number of savegames.
Also, there is a memory leak in
packer.c
, but I was unable to fix it. TheTEX_INFO *info = Memory_Alloc(sizeof(TEX_INFO));
are never freed, and there is some pointer to malloc'd pointer stuff going on in there.