2022-04-11 18:47:26 +02:00
|
|
|
require("common.class")
|
2022-04-15 04:54:30 +02:00
|
|
|
require("common.filereader")
|
2022-04-11 18:47:26 +02:00
|
|
|
local Dim = require("common.dimensions")
|
|
|
|
local Version = require("common.version")
|
|
|
|
local Page = require("components.pager.page")
|
|
|
|
local ServiceField = require("titlescreen.fields.service.servicefield")
|
2022-04-15 04:54:30 +02:00
|
|
|
local ListField = require("titlescreen.fields.service.listfield")
|
|
|
|
local SelfTestField = require("titlescreen.fields.boot.selftestfield")
|
|
|
|
|
|
|
|
local function checkSkinConfig(obj)
|
|
|
|
local crewpath = "textures/crew/anim/" .. game.GetSkinSetting("single_idol")
|
|
|
|
if not IsDir(crewpath) then
|
|
|
|
return SelfTestStatusEnum.ERROR
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local networkStatus = SelfTestStatusEnum.IDLE
|
|
|
|
local function irHeardbeat(res)
|
|
|
|
if res.statusCode == IRData.States.Success then
|
|
|
|
networkStatus = SelfTestStatusEnum.OK
|
|
|
|
else
|
|
|
|
networkStatus = SelfTestStatusEnum.ERROR
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function checkNetwork(obj)
|
|
|
|
if not IRData.Active then
|
|
|
|
return SelfTestStatusEnum.PASS
|
|
|
|
end
|
|
|
|
|
|
|
|
IR.Heartbeat(irHeardbeat)
|
|
|
|
end
|
2022-04-11 18:47:26 +02:00
|
|
|
|
|
|
|
---@class BootPage: Page
|
|
|
|
local BootPage = {
|
|
|
|
__tostring = function() return "BootPage" end,
|
|
|
|
}
|
|
|
|
|
|
|
|
---Create a new BootPage instance
|
2022-04-12 23:45:28 +02:00
|
|
|
---@param o? table # initial parameters
|
2022-04-11 18:47:26 +02:00
|
|
|
---@return BootPage
|
|
|
|
function BootPage:new(o)
|
|
|
|
o = o or {}
|
|
|
|
|
2022-04-15 04:54:30 +02:00
|
|
|
local this = Inherit(self, o, Page)
|
2022-04-11 18:47:26 +02:00
|
|
|
|
2022-04-15 04:54:30 +02:00
|
|
|
this:addField(ServiceField:new{posX = 32, posY = 32, label = Version.getLongVersion(), value = ""})
|
|
|
|
this:addField(ServiceField:new{posX = 64, posY = 64, label = "UNNAMED SDVX CLONE STARTUP...", value = ""})
|
|
|
|
|
|
|
|
local valueOffX = 220
|
|
|
|
local list = ListField:new{posX = 64, posY = 96}
|
|
|
|
list:addField(SelfTestField:new{label = "MAIN I/O", VALUE_OFFSETX = valueOffX, status = SelfTestStatusEnum.OK})
|
|
|
|
list:addField(SelfTestField:new{label = "SKIN CONFIG", VALUE_OFFSETX = valueOffX, status = SelfTestStatusEnum.OK, callback = checkSkinConfig})
|
|
|
|
list:addField(SelfTestField:new{label = "IR NETWORK", VALUE_OFFSETX = valueOffX, status = SelfTestStatusEnum.ERROR, callback = checkNetwork})
|
|
|
|
this:addField(list)
|
|
|
|
|
|
|
|
return this
|
2022-04-11 18:47:26 +02:00
|
|
|
end
|
|
|
|
|
2022-04-12 23:45:28 +02:00
|
|
|
---@param deltaTime number # frametime in seconds
|
2022-04-11 18:47:26 +02:00
|
|
|
function BootPage:drawBackground(deltaTime)
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.FillColor(0, 0, 0)
|
|
|
|
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
|
|
|
|
gfx.Fill()
|
|
|
|
end
|
|
|
|
|
2022-04-15 04:54:30 +02:00
|
|
|
function BootPage:render(deltaTime)
|
|
|
|
Page.render(self, deltaTime)
|
|
|
|
|
|
|
|
local skinconfig = self.content[3].content[2] --this is hacktastic
|
|
|
|
|
|
|
|
local network = self.content[3].content[3] --this is also hacktastic
|
|
|
|
end
|
|
|
|
|
2022-04-11 18:47:26 +02:00
|
|
|
return BootPage
|