Skip to content

CraftOS-PC v2.2

Choose a tag to compare

@MCJack123 MCJack123 released this 15 Dec 07:34
· 1296 commits to master since this release

CraftOS-PC v2.2 is the biggest update for CraftOS-PC since its launch, introducing a brand new debugger, a revamped plugin API, and lots of bug fixes.

If you are currently running CCEmuX, I have written a small utility that will automatically migrate your CCEmuX data to CraftOS-PC. You can find it with the downloads below.

Also, if you haven't noticed I launched a dedicated website for CraftOS-PC at https://www.craftos-pc.cc. This site contains the latest download links as well as documentation for all of the new features in CraftOS-PC. If you haven't taken a look, go check it out!

These are the changes since the v2.2 pre-release:

  • Added F12 hotkey to copy screenshot to clipboard (Windows & Mac only)
    • Calling term.screenshot("clipboard") will have the same effect
  • Fixed default IO handles (stdin/out/err)
  • Changed _HOST variable to more accurately represent ComputerCraft
  • Fixed delete.lua
  • wget.lua no longer requires a file name (CC:T behavior)
  • Added register_termQueueProvider capability, which recieves the address of the void termQueueProvider(Computer *comp, const char *(*callback)(lua_State*, void*), void* data) function

In addition, here are all of the changes since v2.1.3:

  • Added new debugger peripheral
    • Opens in separate window
    • Four tabs available
      • Debugger: GDB-style debugging terminal
      • Call Stack: Visual backtrace viewer, shows files
      • Profiler: Measures function call count & time
      • Console: Allows printing debug messages outside of the main terminal
    • Computer can be paused with debugger.break(), debug.debug(), or Ctrl-T in debugger
    • See the documentation for more information
  • Added breakpoints
    • Can be set with debugger.setBreakpoint(file, line) or debug.setbreakpoint(file, line)
    • Does not require debugger to be attached
      • When no debugger is available, lua.lua is executed
  • Fixed #1 ("attempt to yield across metamethod/C-call boundary" when using pcall)
    • Tracebacks/errors now function normally
    • This was accomplished with a patch that allows yielding across pcall's in Lua 5.1.0
      • Thanks to EveryOS for sharing the patch and for sending me a fixed version for 5.1.5
  • Moved per-user save directory to more platform-appropriate locations
    • Windows: %appdata\CraftOS-PC
    • Mac: ~/Library/Application Support/CraftOS-PC
    • Linux: $XDG_DATA_HOME/craftos-pc (usually ~/.local/share/craftos-pc)
    • Data will be migrated when running CraftOS-PC v2.2 for the first time
  • Added brand-new plugin API
    • Plugins should now provide a plugin_info function
    • This function pushes a table with the API version and requested capabilities onto the Lua stack
    • Capabilities are requested by adding a callback function for a function in CraftOS-PC
    • These callbacks will recieve the requested function as Lua userdata as the first value on the stack
    • Available capabilities in v2.2:
      • register_getLibrary: Recieves the address of the library_t * getLibrary(std::string name) function
      • register_registerPeripheral: Recieves the address of the void registerPeripheral(std::string name, peripheral_init initializer) function
      • register_addMount: Recieves the address of the bool addMount(Computer * comp, const char * real_path, const char * comp_path, bool read_only) function
  • Added new config options
    • vanilla: Set to true to disable all CraftOS-PC features
    • initialComputer: The first computer that starts when opening CraftOS-PC
  • Added periphemu.names() which returns a list of all available peripherals (unsorted)
  • Added term.drawPixels(x, y, lines) which draws a table of lines at a position
    • Each line can either be a string or a table of individual pixels
  • Fixed debug.sethook, debug.gethook
  • debug.debug() now functions the same as hitting a breakpoint
  • Added hooks for errors, coroutine resumptions and yields
    • Running catch error in the debugger will pause execution when an error occurs
    • Errors are logged to stdout if the logErrors config option is enabled
  • Fixed a bug when creating directories
  • Fixed timers with <= 0 length
  • Fixed printing extended characters in the console
  • Rewrote implementation of the modem peripheral
    • Tables and strings are now properly copied
    • Fixed rednet API
  • Replaced Lua plugin loader with custom loader
  • Made SDL_mixer an optional dependency
  • Fixed many more bugs

If you need help using CraftOS-PC, I'm available on the ComputerCraft Discord server as @JackMacWindows#9776. Feel free to ping me if you need anything.

This version has been re-released to fix a critical bug in the debugger.
The Mac build for this version has been pulled due to missing libraries. Please download v2.2.1 or later on Mac.