fixes for 64 bit build

This commit is contained in:
aap
2020-05-16 14:34:51 +02:00
parent b21f49ad6b
commit c54d3ba2ab
4 changed files with 40 additions and 11 deletions

View File

@ -506,7 +506,7 @@ void CRunningScript::Init()
#ifdef USE_DEBUG_SCRIPT_LOADER
int open_script()
{
static int scriptToLoad = 0;
static int scriptToLoad = 1;
#ifdef _WIN32
if (GetAsyncKeyState('G') & 0x8000)

View File

@ -470,7 +470,7 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
uint32 uival = (uintptr)value;
uint32 fog;
switch(state){
case rwRENDERSTATETEXTURERASTER: SetRenderState(TEXTURERASTER, uival); return true;
case rwRENDERSTATETEXTURERASTER: SetRenderStatePtr(TEXTURERASTER, value); return true;
case rwRENDERSTATETEXTUREADDRESS: SetRenderState(TEXTUREADDRESS, uival); return true;
case rwRENDERSTATETEXTUREADDRESSU: SetRenderState(TEXTUREADDRESSU, uival); return true;
case rwRENDERSTATETEXTUREADDRESSV: SetRenderState(TEXTUREADDRESSV, uival); return true;

View File

@ -59,6 +59,16 @@ void FlushObrsPrintfs()
void *
RwMallocAlign(RwUInt32 size, RwUInt32 align)
{
#ifdef FIX_BUGS
uintptr ptralign = align-1;
void *mem = (void *)malloc(size + sizeof(uintptr) + ptralign);
ASSERT(mem != nil);
void *addr = (void *)((((uintptr)mem) + sizeof(uintptr) + ptralign) & ~ptralign);
ASSERT(addr != nil);
#else
void *mem = (void *)malloc(size + align);
ASSERT(mem != nil);
@ -66,6 +76,7 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align)
void *addr = (void *)((((uintptr)mem) + align) & ~(align - 1));
ASSERT(addr != nil);
#endif
*(((void **)addr) - 1) = mem;