From 7439d81454c2fdfe179751df716a36963cc37cad Mon Sep 17 00:00:00 2001 From: Xawotihs Date: Sat, 9 Oct 2010 10:36:42 +0000 Subject: [PATCH] Work around issue 457, not fully fixed. --- JGE/src/hge/hgeparticle.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/JGE/src/hge/hgeparticle.cpp b/JGE/src/hge/hgeparticle.cpp index 893ec617b..5acc34224 100644 --- a/JGE/src/hge/hgeparticle.cpp +++ b/JGE/src/hge/hgeparticle.cpp @@ -64,8 +64,14 @@ hgeParticleSystem::hgeParticleSystem(const char *filename, JQuad *sprite) //memcpy(&info, psi, sizeof(hgeParticleSystemInfo)); //hge->Resource_Free(psi); - fileSys->ReadFile(&info, sizeof(hgeParticleSystemInfo)); - fileSys->CloseFile(); + // Skip reading the pointer as it may be larger than 4 bytes in the structure + void *dummyPointer; + fileSys->ReadFile(&dummyPointer, 4); + // we're actually trying to read more than the file size now, but it's no problem. + // Note that this fix is only to avoid the largest problems, filling a structure + // by directly reading a file, is really a bad idea ... + fileSys->ReadFile(&(info.nEmission), sizeof(hgeParticleSystemInfo)); + fileSys->CloseFile(); info.sprite=sprite; // info.fGravityMin *= 100;