Jump to content


Member Since 24 Jul 2016
Offline Last Active Feb 24 2020 07:50 AM

Topics I've Started

CraftOS-EFI: ComputerCraft Operating System for UEFI

28 January 2020 - 06:01 AM

DISCLAIMER: v0.1 does not support running on real hardware. I am actively working to fix this bug, but it may be a while until I can figure this out.

Introducing CraftOS-EFI, the worst ComputerCraft emulator that is its own operating system (or something). It runs under a native UEFI environment, so you can pretty much just boot straight into CraftOS without loading any other operating system.

Note that this is different from my main emulation project, CraftOS-PC, which is a fork from the same parent code base but has way more features than this.

Here's a screenshot:
Posted Image

Version v0.1:
  • Does not include HTTP support
  • Does not support Ctrl/Alt keys (don't open edit.lua!)
  • May not support background colors?
  • Works in QEMU using OVMF EFI image
  • Is very slow (at least in a VM)
  • Must be run from the EFI shell (included in compiled image)
You can download the latest version from https://github.com/M...releases/latest. Each release includes the raw EFI image that you can put on your EFI System Partition, as well as an image file that you can boot a VM from or flash to a USB drive. You can run the image in the QEMU emulator using an OVMF image, see the Ubuntu Wiki page for more info.

CraftOS-PC 2: A small & speedy ComputerCraft emulator written in native code

07 August 2019 - 06:50 AM

Posted Image
Current Version: v2.2.5
After completing CraftOS-PC and using it for a while, I noticed that it runs relatively slowly compared to other real terminals. I also didn't like that it was tied to the JVM, which can use up quite a bit of my system's resources. (I'm also more on the new side when it comes to Java programming.) I started to ponder the idea of writing a ComputerCraft interpreter entirely in C. I first wrote a proof-of-concept called LinuxCC that used an ncurses terminal and ran in the root of the hard drive. After discovering how easy it was to write (not without ending up adding some C++ into the mix), I decided to bring it to a full product as a successor to the original CraftOS-PC. CraftOS-PC 2 uses the original Lua 5.1 API and SDL to create a terminal that runs CraftOS quickly while eliminating many of the bugs in LuaJ that plagued CraftOS. I've designed CraftOS-PC 2 to emulate ComputerCraft as close as possible.
Posted Image
CraftOS-PC 2's features:
  • Emulates an advanced computer with touch support, or a standard computer
  • Full support of ComputerCraft's API
  • Full support of CraftOS-PC Classic's API, including:
  • periphemu API for attaching peripherals (monitor, printer, speaker)
  • mounter API for mounting local drives inside ComputerCraft
  • Terminal graphics mode for direct pixel writing
  • config API for adjusting the internal ComputerCraft configuration
  • Resizable terminals
  • HTTP server support
In addition, I've added some new features exclusive to CraftOS-PC 2:
  • Screenshot & GIF recording support (thanks for the idea, SquidDev)
  • 256-color graphics mode support
  • Debugger featuring GDB-style commands and profiler
  • More features soon?
I have also ported features from other ComputerCraft extensions:
  • CC: Tweaked: WebSocket support
  • CC: Tweaked: Native IO API
  • CCEmuX: Multiple computer support
  • CCEmuX: modem peripheral
The main selling point of CraftOS-PC 2 is its speed. CraftOS-PC 2 is up to 2x faster than CraftOS-PC Classic and 90% faster than CCEmuX[1]. It boots to the CraftOS shell immediately. And it's light on system resources: it only uses between 10~30 MB of memory while running, while CraftOS-PC Classic and CCEmuX both use over 100 MB of memory at startup. Since CraftOS-PC 2 doesn't have to rely on a JVM or intermediate bytecode, it can run much faster than its Java-based competitors. Lastly, CraftOS-PC 2 only takes up about 7 MB of space on disk, which is very lightweight compared to CraftOS-PC Classic's JAR size of 20 MB.
You can download the latest version of CraftOS-PC 2 on the official website or on GitHub. I have included both Windows and Mac builds in the release; Ubuntu users can install craftos-pc from the official PPA (ppa:jackmacwindows/ppa).
CraftOS-PC 2 is licensed under the MIT license: see LICENSE in the repository for more information.
[1]Based on SciMark test results on CraftOS-PC Classic, CCEmuX, and CraftOS-PC 2 (results here). Benchmarks performed on an Intel Core i5 system clocked at 3.7 GHz with 16 GB RAM installed; running on Windows 10 1903 with no apps running. Synthetic benchmarks may not accurately represent actual performance gain.

TAR archive/unarchive library/program for CraftOS

02 August 2019 - 05:52 AM

I'm working on a project involving the use of TAR files (hint: it's a port of a popular Linux utility) and I figured I'd share the library I wrote to interact with TAR archives. It can read & write Unix Standard TAR (UStar) and read original TAR. I've also added permission modification if running under CCKernel2. You can either load the file as an API, or you can run the file directly, in which case it will work similarly to the GNU tar command. Running it under the shell will also provide the ability to use gzipped archives with the -z flag; this is provided by a ComputerCraft fork of the LibDeflate library by SafeteeWow. Here's the API reference:
API reference
You can use many of the switches from *nix tar on the command line, including `tar -xzf file.tar.gz` and `tar -cvf file.tar file1 file2 file3` just like on real machines. I've gotten rid of the switches that either a ) don't make sense on ComputerCraft, or b ) don't work at all on CraftOS, but much of the core functionality still works.

You can download it from the GitHub gist, which includes tar.lua + LibDeflate.lua. Note that this is BETA SOFTWARE and some functionality may be missing or buggy. I did not put it on pastebin yet since it doesn't support multiple files or keep revision history, though I might later without LibDeflate if I ever complete the CLI interface and add error checking.

CCKernel2: An Advanced Kernel for ComputerCraft

31 May 2019 - 03:43 AM

After many months of work, my custom CraftOS kernel, CCKernel2, is ready for a beta release. CCKernel2 adds to and extends standard CraftOS 1.8 to provide more control over the operating system, including:
  • Cooperative multitasking through coroutines
  • Native IPC calls
  • Process signaling
  • Built-in debugger
  • Multi-user system
  • File permissions
  • Device files (/dev)
  • Eight virtual terminals
  • Built-in logger
  • Unix-style file hierarchy
  • `os.loadAPI` resolution paths
  • Process I/O pipes
  • systemd-based init program
  • GUI setup program
  • Plenty of new commands relating to CCKernel2
  • Extensive kernel API
Here's a quick demo of some of the features: https://youtu.be/Z4Kfyn7Z-KI.


The source code can be found on GitHub, and the API reference for all added and changed functions can be found in the documentation. You can install CCKernel2 with this command:
pastebin run yY9StxvU
CCKernel2 requires CraftOS 1.8 or later, and is optimized for CraftOS-PC (but is not required).

Some applications of CCKernel2 (included at demos/ in the repository):
  • HTTP server running in the background (requires CraftOS-PC)
  • Remote shell server (server requires CraftOS-PC, client can run on any recent CraftOS but requires http_whitelist=*): Demo
I'm planning on building a full GUI OS based off of CCKernel2 in the future, using the multitasking to run multiple apps at once. I also want to write an extended shell that functions more like bash, but I ran into some roadblocks and decided to focus on polishing CCKernel2 before writing the new shell.
If you find any bugs, please submit a new issue on GitHub.