Lua 5.3 didn't need an x86 emulator. But now, it has one regardless.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config_disks.lua 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. -- Uncomment this line if you're on OpenComputers/Kallisti.
  2. -- local filesystem = require("filesystem")
  3. local function disk_finder(fn)
  4. local tmpfn = nil
  5. local ptrmode = nil
  6. local f = nil
  7. return function(a, mode)
  8. if tmpfn == nil or not filesystem.exists(tmpfn) then
  9. ptrmode = nil
  10. end
  11. if ptrmode ~= mode then
  12. if f ~= nil then pcall(function() f:close() end) end
  13. tmpfn = nil
  14. for p1 in filesystem.list("/mnt") do
  15. local tfn = "/mnt/" .. p1 .. fn
  16. if filesystem.exists(tfn) then
  17. tmpfn = tfn
  18. end
  19. end
  20. if tmpfn ~= nil then
  21. f = io.open(tmpfn, mode)
  22. disk_init_data(f, a)
  23. f:seek("set", 0)
  24. ptrmode = mode
  25. else
  26. f = nil
  27. disk_init_data(nil, a)
  28. end
  29. end
  30. return f
  31. end
  32. end
  33. -- Lunatic86 will currently boot from the first floppy disk drive.
  34. -- Function: disk_init(filename or disk_finder, drive ID)
  35. -- 0x00 is A:, 0x01 is B:, 0x80 and later are hard drives.
  36. -- disk_finder(filename) will use OpenComputers to find
  37. -- /mnt/.../filename dynamically and use it as a floppy disk,
  38. -- potentially allowing for some degree of hotswapping.
  39. -- disk_init(disk_finder("disk.img"), 0x00)