Skip to content

Commit

Permalink
Now displays RAM/ROM size in KB and B
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Jul 16, 2024
1 parent 7b08c91 commit 671ddd5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/wire/stools/cpu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,20 @@ if CLIENT then
panel:AddControl("Slider", {Label = "RAM size", Command = "wire_cpu_customram", Min = 0, Max = 1024}),
panel:AddControl("Slider", {Label = "ROM size", Command = "wire_cpu_customrom", Min = 0, Max = 1024}),
}
local function formatPageSizeString(pages)
if pages >= 8 then
return string.format("KB %g",pages/8) -- padding with spaces won't help because the font isn't monospaced

Check warning on line 210 in lua/wire/stools/cpu.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
else
return string.format(" B %g",pages*128)

Check warning on line 212 in lua/wire/stools/cpu.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
end
end
customMemPanel[2].OnValueChanged = function(self,pages)
self:SetText("RAM size "..formatPageSizeString(pages))

Check warning on line 216 in lua/wire/stools/cpu.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
end
customMemPanel[3].OnValueChanged = function(self,pages)
self:SetText("ROM size "..formatPageSizeString(pages))

Check warning on line 219 in lua/wire/stools/cpu.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
end

local memoryModel = GetConVar("wire_cpu_memorymodel")
function memPanel:OnSelect(index, value, data)
if data.wire_cpu_memorymodel == "custom" then
Expand Down

0 comments on commit 671ddd5

Please sign in to comment.