aoineko-fr / MSXgl

The MSX Game Library in C language
113 stars 9 forks source link

Bug in memory.c #40

Closed artrag closed 4 months ago

artrag commented 4 months ago

There is a bug in: void Mem_DynamicAlloc(u16 size) The bug is here: struct MemChunkHeader newChunk = (struct MemChunkHeader*)(chunk + needSize); // New free sub-chunk chunk has to be converted to u16 or you allocate 4 times more bytes. This is the fix

struct SptChunkHeader newChunk = (struct SptChunkHeader)(((u16)chunk) + needSize); // New free sub-chunk

aoineko-fr commented 4 months ago

This compatibility issue with SDCC 4.4.0 is fixed in the next MSXgl version. Thank you for pointing that out.