summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-16 14:34:51 +0200
committeraap <aap@papnet.eu>2020-05-16 14:34:51 +0200
commitc54d3ba2ab218b9545e784abaf39b4054d3de4bc (patch)
treee9801a3f0afbae2bf9dbb3a93fe6b3790e1e1dfc
parentb21f49ad6b2c3f7a22690254321776a0b15c2fed (diff)
fixes for 64 bit build
-rw-r--r--premake5.lua36
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/fakerw/fake.cpp2
-rw-r--r--src/rw/RwHelper.cpp11
4 files changed, 40 insertions, 11 deletions
diff --git a/premake5.lua b/premake5.lua
index 64b12d3a..c8494884 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -23,6 +23,22 @@ else
Librw = os.getenv("LIBRW") or "librw"
end
+function getsys(a)
+ if a == 'windows' then
+ return 'win'
+ end
+ return a
+end
+
+function getarch(a)
+ if a == 'x86_64' then
+ return 'amd64'
+ elseif a == 'ARM' then
+ return 'arm'
+ end
+ return a
+end
+
workspace "re3"
language "C++"
configurations { "Debug", "Release" }
@@ -40,6 +56,8 @@ workspace "re3"
filter { "system:linux" }
platforms {
"linux-x86-librw_gl3_glfw-oal",
+ "linux-amd64-librw_gl3_glfw-oal",
+ "linux-arm-librw_gl3_glfw-oal",
}
filter "configurations:Debug"
@@ -58,6 +76,12 @@ workspace "re3"
filter { "platforms:*x86*" }
architecture "x86"
+ filter { "platforms:*amd64*" }
+ architecture "amd64"
+
+ filter { "platforms:*arm*" }
+ architecture "ARM"
+
filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" }
if(not _OPTIONS["with-librw"]) then
@@ -68,17 +92,12 @@ workspace "re3"
defines { "RW_GL3" }
includedirs { path.join(_OPTIONS["glfwdir"], "include") }
includedirs { path.join(_OPTIONS["glewdir"], "include") }
-
- filter "platforms:win*librw_gl3_glfw*"
- defines { "GLEW_STATIC" }
if(not _OPTIONS["with-librw"]) then
- libdirs { path.join(Librw, "lib/win-x86-gl3/%{cfg.buildcfg}") }
+ libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
end
- filter "platforms:linux*librw_gl3_glfw*"
- if(not _OPTIONS["with-librw"]) then
- libdirs { path.join(Librw, "lib/linux-x86-gl3/%{cfg.buildcfg}") }
- end
+ filter "platforms:win*librw_gl3_glfw*"
+ defines { "GLEW_STATIC" }
filter {}
@@ -181,7 +200,6 @@ project "re3"
targetextension ".exe"
filter "platforms:linux*"
- targetextension ".elf"
defines { "OPENAL" }
links { "openal", "mpg123", "sndfile", "pthread" }
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 357436c6..631ca436 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -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)
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 50d12b2f..71646020 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -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;
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 5026e2c8..191fc7ab 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -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;