summaryrefslogtreecommitdiffstats
path: root/src/rw
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-16 16:09:13 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-16 16:09:13 +0200
commit1a42d62d3ab5ca683defc582a5127a5bc7e454fe (patch)
tree3773a6afe233e6530e58dbcf4b89ebee3bdaf923 /src/rw
parentgangs, script and replay fixes (diff)
parentFix audio use of number instead of enum for CAR_ACCEL (diff)
downloadre3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.tar
re3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.tar.gz
re3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.tar.bz2
re3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.tar.lz
re3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.tar.xz
re3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.tar.zst
re3-1a42d62d3ab5ca683defc582a5127a5bc7e454fe.zip
Diffstat (limited to 'src/rw')
-rw-r--r--src/rw/RwHelper.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 91916df3..a87874d7 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -60,6 +60,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);
@@ -67,6 +77,7 @@ RwMallocAlign(RwUInt32 size, RwUInt32 align)
void *addr = (void *)((((uintptr)mem) + align) & ~(align - 1));
ASSERT(addr != nil);
+#endif
*(((void **)addr) - 1) = mem;