Skip to content

Instantly share code, notes, and snippets.

@UAVXP
Forked from Velkon/Mdmp.lua
Created June 6, 2016 19:15
Show Gist options
  • Save UAVXP/9236f5c62bb6bdfd69c96be1a13ee22e to your computer and use it in GitHub Desktop.
Save UAVXP/9236f5c62bb6bdfd69c96be1a13ee22e to your computer and use it in GitHub Desktop.

Revisions

  1. @Velkon Velkon revised this gist May 26, 2016. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions Mdmp.lua
    Original file line number Diff line number Diff line change
    @@ -6,25 +6,24 @@ local function log(color,s)
    end

    function mdmp(out)
    log(red,"Finding files...")
    local files,_ = file.Find("*.mdmp","BASE_PATH")
    log(red,"Found " .. #files .. " files!")
    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
    log(green,"Found Log, scanning...")
    if out then log(green,"Found Log, scanning...") end
    break
    end
    end

    if not mdfile then log(red,"Could not find a mdmp with actual info.") return 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)

    mdmpinfo = {}
    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
    @@ -54,12 +53,14 @@ function mdmp(out)
    end
    end

    log(green,"End of log.")
    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.")
    log(red,"Loaded mdmp.")
  2. @Velkon Velkon created this gist May 26, 2016.
    65 changes: 65 additions & 0 deletions Mdmp.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,65 @@
    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)
    log(red,"Finding files...")
    local files,_ = file.Find("*.mdmp","BASE_PATH")
    log(red,"Found " .. #files .. " files!")

    for k,v in pairs(files) do
    local v = file.Read(v,"BASE_PATH")
    if v:match("^MDMP") then
    -- Found empty logs?
    mdfile = v
    log(green,"Found Log, scanning...")
    break
    end
    end

    if not mdfile then log(red,"Could not find a mdmp with actual info.") return end

    mdfile = string.Explode("\n",mdfile)

    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

    log(green,"End of log.")

    mdfile = nil

    end

    concommand.Add("mdmp",function() mdmp(true) --[[ output ]] end)

    log(red,"Loaded mdmp.")