Skip to content

Instantly share code, notes, and snippets.

@Velkon
Last active May 5, 2022 14:34
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Velkon/61602d0153aa33a0f3eece5a4ee887c7 to your computer and use it in GitHub Desktop.
Save Velkon/61602d0153aa33a0f3eece5a4ee887c7 to your computer and use it in GitHub Desktop.
local red = Color(255,0,0)
local green = Color(0,255,0)
local function log(color,s)
MsgC(color,s .. "\n")
end
function mdmp(out)
local files,_ = file.Find("*.mdmp","BASE_PATH")
if out then log(red,"Found " .. #files .. " files!") end
for k,v in pairs(files) do
local v = file.Read(v,"BASE_PATH")
if v:match("^MDMP") then
-- Found empty logs?
mdfile = v
if out then log(green,"Found Log, scanning...") end
break
end
end
if not mdfile then if out then log(red,"Could not find a mdmp with actual info.") end return false end
mdfile = string.Explode("\n",mdfile)
local mdmpinfo = {}
for k,v in pairs(mdfile) do
-- Yes I know there are way better ways to do this, it was written in 10 minutes ok
if v:match("driver: Driver Name: ") then
mdmpinfo["gfx"] = v:gsub("driver: Driver Name: ","")
if out then log(green,"|\t-> Found GPU: " .. mdmpinfo["gfx"]) end
continue
elseif v:match("totalPhysical Mb%(") then
mdmpinfo["ram"] = v:gsub("totalPhysical Mb%(",""):gsub("%)","")
if out then log(green,"|\t-> Found RAM size: " .. math.floor(mdmpinfo["ram"]) .. "Mb") end
continue
elseif v:match("Users\\") and not v:match("awesomium") then
-- You could also this if you wanted to creep kids out or something ( ???? )
local a = v:match("Users\\.+\\"):gsub("Users\\",""):gsub("\\.*$","")
mdmpinfo["user"] = a
if out then log(green,"|\t-> Found user name: " .. mdmpinfo["user"]) end
continue
elseif v:match("VendorId / DeviceId: ") then
local a = v:gsub("VendorId / DeviceId: ","")
mdmpinfo["gfx vid/did"] = a
if out then log(green,"|\t-> GPU VendorId / DeviceId: " .. a) end
continue
elseif v:match("^OS: ") then
mdmpinfo["os"] = v:gsub("OS: ","")
if out then log(green,"|\t-> OS Version: " .. mdmpinfo["os"]) end
continue
end
end
if out then log(green,"End of log.") end
mdfile = nil
return mdmpinfo
end
concommand.Add("mdmp",function() mdmp(true) --[[ output ]] end)
log(red,"Loaded mdmp.")
@60percentCaffeine
Copy link

Is there any way to get number of CPU threads?

@TuXEKRO
Copy link

TuXEKRO commented May 5, 2022

Looks like Facepunch has nailed it. Does not read files ending in .mdmp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment