splash.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. --The BIOS Post Screen !
  2. local Config = love.filesystem.read("build.json")
  3. local json = require("Engine.JSON")
  4. Config = json:decode(Config)
  5. local events = require("Engine.events")
  6. local coreg = require("Engine.coreg")
  7. local Handled, Devkits = ... --It has been passed by the BIOS :)
  8. local BIOS = Handled.BIOS
  9. local GPU = Handled.GPU
  10. local CPU = Handled.CPU
  11. local fs = Handled.HDD
  12. local _LIKO_Version, _LIKO_Old = BIOS.getVersion()
  13. if _LIKO_Old then
  14. love.filesystem.write(".version",tostring(_LIKO_Version)) --Update the .version file
  15. end
  16. local sw,sh = GPU.screenSize()
  17. local function loadImage(name)
  18. return GPU.image(love.filesystem.read("/BIOS/Splash/"..name..".lk12"))
  19. end
  20. local function loadImagedata(name)
  21. return GPU.imagedata(love.filesystem.read("/BIOS/Splash/"..name..".lk12"))
  22. end
  23. --POST Screen--
  24. --ASSETS--
  25. local corner = loadImage("corner")
  26. local likologo = loadImage("likologo")
  27. local Patterns = {}
  28. for i=1,17 do
  29. print("p-"..i)
  30. Patterns[i] = loadImagedata("p-"..i)
  31. end
  32. local ptimer = 0
  33. local pflag = false
  34. GPU.palt(0,false)
  35. GPU.palt(5,true)
  36. local cx = math.floor((sw-32)/2)
  37. local cy = math.floor((sh-32)/2)
  38. for event,dt,b,c,e,f in CPU.pullEvent do
  39. if event == "update" then
  40. ptimer = ptimer + dt*32*(pflag and -1 or 1)
  41. if ptimer <= 0 and pflag then break end
  42. if ptimer >= 25 and not pflag then
  43. pflag = true
  44. end
  45. GPU.clear(0)
  46. GPU.patternFill(Patterns[math.floor(math.min(ptimer,16))+1])
  47. GPU.rect(0,0,sw,sh,false,5)
  48. likologo:draw(cx,cy,0,2,2)
  49. corner:draw(0,0, 0, 1,1)
  50. corner:draw(sw,0, 0, -1,1)
  51. corner:draw(sw,sh, 0, -1,-1)
  52. corner:draw(0,sh, 0, 1,-1)
  53. GPU.patternFill()
  54. end
  55. end
  56. GPU.palt()
  57. GPU.color(7) GPU.clear(0)
  58. CPU.sleep(1)
  59. --Boot into GameDiskOS
  60. fs.drive("GameDiskOS") --Switch to the C drive.
  61. CPU.clearEStack() --Remove any events made while booting.
  62. local bootchunk, err = fs.load("/boot.lua")
  63. if not bootchunk then error(err or "") end --Must be replaced with an error screen.
  64. local coglob = coreg:sandbox(bootchunk)
  65. local co = coroutine.create(bootchunk)
  66. local HandledAPIS = BIOS.HandledAPIS()
  67. coroutine.yield("echo",HandledAPIS)
  68. coreg:setCoroutine(co,coglob) --Switch to boot.lua coroutine