Skip to content

Instantly share code, notes, and snippets.

@looterz
Forked from Velkon/Mdmp.lua
Created June 28, 2017 11:39
Show Gist options
  • Save looterz/cdcea13ee888562c2de4aa1064d0c4a5 to your computer and use it in GitHub Desktop.
Save looterz/cdcea13ee888562c2de4aa1064d0c4a5 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.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment