mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
C-CON: fix 'readgamearray' and 'resizearray' on Windows.
We must not use Xrealloc(), since gamearrays are now allocated with Xaligned_alloc(). NOTE: I did not check all potential problematic cases, only those to get LNGA3 up and running. git-svn-id: https://svn.eduke32.com/eduke32@4735 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
108a4022fa
commit
205b8a7677
3 changed files with 9 additions and 6 deletions
|
@ -4461,8 +4461,9 @@ finish_qsprintf:
|
|||
int32_t *tmpar = Xmalloc(numbytes);
|
||||
kread(fil, tmpar, numbytes);
|
||||
#endif
|
||||
aGameArrays[j].plValues = (intptr_t *)Xrealloc(
|
||||
aGameArrays[j].plValues, numelts * GAR_ELTSZ);
|
||||
Baligned_free(aGameArrays[j].plValues);
|
||||
aGameArrays[j].plValues = (intptr_t *)Xaligned_alloc(
|
||||
ACTOR_VAR_ALIGNMENT, numelts * GAR_ELTSZ);
|
||||
aGameArrays[j].size = numelts;
|
||||
#ifdef BITNESS64
|
||||
for (int32_t i=0; i<numelts; i++)
|
||||
|
@ -4521,7 +4522,8 @@ finish_qsprintf:
|
|||
if (asize > 0)
|
||||
{
|
||||
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);*/
|
||||
aGameArrays[j].plValues = (intptr_t *)Xrealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize);
|
||||
Baligned_free(aGameArrays[j].plValues);
|
||||
aGameArrays[j].plValues = (intptr_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, GAR_ELTSZ * asize);
|
||||
aGameArrays[j].size = asize;
|
||||
}
|
||||
continue;
|
||||
|
|
|
@ -30,9 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
#define _gamevars_c_
|
||||
|
||||
#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t))
|
||||
#define ACTOR_VAR_ALIGNMENT 16
|
||||
|
||||
#ifdef LUNATIC
|
||||
int32_t g_noResetVars;
|
||||
LUNATIC_CB void (*A_ResetVars)(int32_t iActor);
|
||||
|
|
|
@ -50,6 +50,10 @@ enum GamevarFlags_t {
|
|||
|
||||
#if !defined LUNATIC
|
||||
|
||||
// Alignments for per-player and per-across variables.
|
||||
#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t))
|
||||
#define ACTOR_VAR_ALIGNMENT 16
|
||||
|
||||
# define MAXGAMEARRAYS (MAXGAMEVARS>>2) // must be lower than MAXGAMEVARS
|
||||
# define MAXARRAYLABEL MAXVARLABEL
|
||||
|
||||
|
|
Loading…
Reference in a new issue