Skip to content

Commit

Permalink
Fix x64 issues
Browse files Browse the repository at this point in the history
Thanks to Im-Dex.
xrParticles problem:
Im-dex/xray-162@8da28e5

Collision detection issue:
Im-dex/xray-162@cd40b56
  • Loading branch information
Xottab-DUTY committed Aug 13, 2017
1 parent 011430b commit c8eae93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/xrParticles/particle_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ struct ParticleEffect
particles_allocated = max_particles;

real_ptr = xr_malloc(sizeof(Particle) * (max_particles + 1));
particles = (Particle*)((DWORD)real_ptr + (64 - ((DWORD)real_ptr & 63)));

particles = (Particle*)((uintptr_t)real_ptr + (64 - ((uintptr_t)real_ptr & 63)));
//particles = static_cast<Particle*>(real_ptr);

// Msg( "Allocated %u bytes (%u particles) with base address 0x%p" , max_particles * sizeof( Particle ) ,
// max_particles , particles );
}
Expand Down Expand Up @@ -58,7 +61,7 @@ struct ParticleEffect
return max_particles;
}

Particle* new_particles = (Particle*)((DWORD)new_real_ptr + (64 - ((DWORD)new_real_ptr & 63)));
Particle* new_particles = (Particle*)((uintptr_t)new_real_ptr + (64 - ((uintptr_t)new_real_ptr & 63)));
// Msg( "Re-allocated %u bytes (%u particles) with base address 0x%p" , max_count * sizeof( Particle ) ,
// max_count , new_particles );

Expand Down
3 changes: 2 additions & 1 deletion src/xrPhysics/tri-colliderknoopc/dTriColliderCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ extern xr_vector<flags8> gl_cl_tries_state;
// extern xr_vector<int>::iterator I,E,B ;

#define CONTACT(Ptr, Stride) ((dContactGeom*)(((char*)Ptr) + (Stride)))
#define SURFACE(Ptr, Stride) ((dSurfaceParameters*)(((char*)Ptr) + (Stride - sizeof(dSurfaceParameters))))
//#define SURFACE(Ptr, Stride) ((dSurfaceParameters*)(((char*)Ptr) + (Stride - sizeof(dSurfaceParameters))))
#define SURFACE(Ptr, Stride) ((dSurfaceParameters*) (((char*)Ptr) + (Stride - offsetof(dContact, geom) + offsetof(dContact, surface))))
#define NUMC_MASK (0xffff)

#define M_SIN_PI_3 REAL(0.8660254037844386467637231707529362)
Expand Down

0 comments on commit c8eae93

Please sign in to comment.