From 10be5fa2a4b3290d159b88f22410a24f36a63122 Mon Sep 17 00:00:00 2001 From: Pirulax Date: Fri, 18 Jun 2021 02:44:38 +0200 Subject: [PATCH 1/2] Add TotalPhysicalMemory to dxGetStatus --- Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp index 51f5c04b7ed..d27f07639d1 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp @@ -9,10 +9,14 @@ * *****************************************************************************/ + #include "StdInc.h" #include "CLuaDefs.h" #include "lua/CLuaFunctionParser.h" +#include +#include + #define MIN_CLIENT_REQ_DXSETRENDERTARGET_CALL_RESTRICTIONS "1.3.0-9.04431" extern bool g_bAllowAspectRatioAdjustment; @@ -1705,6 +1709,11 @@ int CLuaDrawingDefs::DxGetStatus(lua_State* luaVM) lua_pushstring(luaVM, "SettingHighDetailPeds"); lua_pushboolean(luaVM, dxStatus.settings.bHighDetailPeds); lua_settable(luaVM, -3); + + lua_pushstring(luaVM, "TotalPhysicalMemory"); + lua_pushnumber(luaVM, (lua_Number)(SharedUtil::GetWMITotalPhysicalMemory() / 1024 / 1024)); + lua_settable(luaVM, -3); + return 1; } else From 9774a879d4afa74267c3047176f08dc2ac2bda85 Mon Sep 17 00:00:00 2001 From: Pirulax Date: Tue, 3 Aug 2021 00:53:02 +0200 Subject: [PATCH 2/2] Cast GetWMITotalPhysicalMemory to lua_Number before division Co-authored-by: Marek Kulik --- Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp index d27f07639d1..cab7288a8b8 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp @@ -1711,7 +1711,7 @@ int CLuaDrawingDefs::DxGetStatus(lua_State* luaVM) lua_settable(luaVM, -3); lua_pushstring(luaVM, "TotalPhysicalMemory"); - lua_pushnumber(luaVM, (lua_Number)(SharedUtil::GetWMITotalPhysicalMemory() / 1024 / 1024)); + lua_pushnumber(luaVM, static_cast(SharedUtil::GetWMITotalPhysicalMemory()) / 1024.0 / 1024.0); lua_settable(luaVM, -3); return 1;