beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
223 stars 102 forks source link

Add `Platform.AvailableRAM` #1640

Open sprunk opened 3 months ago

sprunk commented 3 months ago

Add RAM to https://github.com/beyond-all-reason/spring/blob/BAR105/rts/Lua/LuaConstPlatform.cpp

User story: this fragile hax https://github.com/beyond-all-reason/Beyond-All-Reason/blob/master/luaintro/Addons/main.lua#L63-L66 (there's also a lot of other terrible string parsing hax above the RAM line but afaict things like Platform.glVendor, Platform.glslVersion and Platform.glRenderer all already exist)

sprunk commented 2 months ago

Probably extract these two snippets to a function that returns a pair of optional ints (ram, pagefile), and then use that in the existing place and whatever place adds that info to Lua. https://github.com/beyond-all-reason/spring/blob/42822a44058dba5409ddd9db414e2c8ea6f217d4/rts/System/Platform/Misc.cpp#L435-L437 https://github.com/beyond-all-reason/spring/blob/42822a44058dba5409ddd9db414e2c8ea6f217d4/rts/System/Platform/Win/WinVersion.cpp#L328-L332