• Stars
    star
    228
  • Rank 174,392 (Top 4 %)
  • Language
    C++
  • License
    Other
  • Created about 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast, modern, and feature-filled ComputerCraft emulator written in C++.

CraftOS-PC 2 Actions Status

A rewrite of CraftOS-PC (Classic) using C++ and a modified version of PUC Lua, as well as SDL for drawing.

Visit the website at https://www.craftos-pc.cc/ for more information, including documentation.

Screenfetch

Requirements for released builds

  • Supported operating systems:
    • Windows Vista x64 or later
    • macOS 10.15+
    • Ubuntu 18.04, 20.04, 21.04
    • Arch Linux with AUR helper
    • iOS 11.0+
    • Android 7.0+
  • Administrator privileges
  • 20-50 MB free space

Installing

Windows

  1. Download CraftOS-PC-Setup.exe from the latest release
  2. Follow the instructions in the setup program
  3. Open CraftOS-PC from the Start Menu

Mac

Homebrew Cask

$ brew tap MCJack123/CraftOSPC
$ brew install --cask craftos-pc
$ open /Applications/CraftOS-PC.app

Manual

  1. Download CraftOS-PC.dmg from the latest release
  2. Drag and drop into Applications (or not)
  3. Double-click CraftOS-PC(.app)

Linux

Ubuntu (PPA)

$ sudo add-apt-repository ppa:jackmacwindows/ppa
$ sudo apt update
$ sudo apt install craftos-pc
$ craftos

Fedora (COPR)

sudo dnf copr enable lemoonstar/CraftOS-PC
sudo dnf install craftos-pc

Fedora support is maintained by LeMoonStar. For any issues with the Fedora package itself, please contact them on their GitHub repo.

Arch Linux

Install the craftos-pc package using your chosen AUR helper (e.g. yay -S craftos-pc).

Other Linux

  1. Download CraftOS-PC.x86_64.AppImage from the latest release
  2. chmod a+x CraftOS-PC.x86-64.AppImage (may be needed on some distros)
  3. Double-click CraftOS-PC.x86-64.AppImage

iOS

Visit the App Store to download CraftOS-PC. Or you can join the TestFlight beta to get access to the latest versions before they're released.

Android

  1. Download CraftOS-PC.apk from the latest release
  2. Open the file and tap "Install"
  3. Open CraftOS-PC from the app drawer or home screen

v2.2: Where are my files?

CraftOS-PC v2.2 moves the save directory to be more appropriate for each platform. Your files are not gone; they're automatically moved over before launching if the old folder is still present. You can find the computer data files at these locations:

  • Windows: %appdata%\CraftOS-PC (C:\Users\<user>\AppData\Roaming\CraftOS-PC)
  • Mac: ~/Library/Application Support/CraftOS-PC
  • Linux: $XDG_DATA_HOME/craftos-pc or ~/.local/share/craftos-pc

Building

Requirements

  • CraftOS ROM package
  • Compiler supporting C++17
    • Linux: G++ 8.0+, make
    • Mac: Xcode 10.2+ CLI tools (xcode-select --install)
    • Windows: Visual Studio 2022
  • SDL 2.0.8+ (may work on older versions on non-Linux)
  • OpenSSL 1.1.1/3.x (for POCO)
  • POCO 1.5.0+: NetSSL & JSON libraries + dependencies
    • Foundation
    • Util
    • Crypto
    • XML
    • JSON
    • Net
    • NetSSL
      • On Windows, you'll need to modify the poco port to use OpenSSL. Simply open vcpkg\ports\poco\portfile.cmake, find ENABLE_NETSSL_WIN, and replace it with FORCE_OPENSSL. Then install as normal.
  • Windows: vcpkg

Optional

  • libpng 1.6 & png++ 0.2.7+
    • Can be disabled with --without-png, will save as BMP instead
  • libwebp
    • Can be disabled with --without-webp, will disable WebP support (useWebP option will always be off)
  • libharu/libhpdf
    • Can be disabled with --without-hpdf, --with-html or --with-txt
  • ncurses or PDCurses
    • Can be disabled with --without-ncurses, will disable CLI support
  • SDL_mixer 2.0+
    • Can be disabled with --without-sdl_mixer, will disable audio disc and speaker support
    • For MP3 support, libmpg123 is required
    • For FLAC support, libFLAC is required
    • For SF2 support, SDL_mixer must be built manually with fluidsynth support (or with the fluidsynth feature in vcpkg since July 9, 2021)
  • The path to the ROM package can be changed with --prefix=<path>, which will store the ROM at <path>/share/craftos
  • Standalone builds can be enabled with --with-standalone-rom=<fs_standalone.cpp>, with <fs_standalone.cpp> referring to the path to the packed standalone ROM file.
    • The latest packed ROM can be downloaded as an artifact from the latest CI build, found by following the top link here.

You can get all of these dependencies with:

  • Windows: vcpkg --feature-flags=manifests install --triplet x64-windows inside the repository directory
    • Visual Studio will do this for you automatically (as long as vcpkg integration is installed)
  • Windows (manual): vcpkg install sdl2:x64-windows sdl2-mixer[dynamic-load,libflac,mpg123,libmodplug,libvorbis,opusfile,fluidsynth]:x64-windows pngpp:x64-windows libwebp:x64-windows libharu:x64-windows poco[netssl]:x64-windows dirent:x64-windows pdcurses:x64-windows
  • Mac (Homebrew): brew install sdl2 sdl2_mixer png++ webp libharu poco ncurses; git clone https://github.com/MCJack123/craftos2-rom
  • Ubuntu: sudo apt install git build-essential libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev; git clone https://github.com/MCJack123/craftos2-rom
  • Arch Linux: sudo pacman -S sdl2 sdl2_mixer png++ libwebp libharu poco ncurses

Windows artifact builds

Builds of each commit are automatically uploaded for Windows in the Actions tab. These builds are provided to allow Windows users to test new features without having to build the entire solution and dependencies. Note that these files are just the raw executable. You must drop the file into a pre-existing CraftOS-PC install directory for it to work properly. Depending on changes made in the latest version, you may also have to download the latest ROM. You can download the latest file directly here.

Old nightly builds, as well as Android betas, are available on the website.

Instructions

Windows

  1. Download Visual Studio 2019 if not already installed
  2. git submodule update --init --recursive
  3. Open CraftOS-PC 2.sln with VS
  4. Build solution
  5. Copy all files from the ROM into the same directory as the new executable (ex. craftos2\x64\Release)
  6. Run solution

The solution has a few different build configurations:

  • Debug: for debugging, no optimization
  • Release: standard Windows application build with optimization (same as installed CraftOS-PC.exe)
  • ReleaseC: same as Release but with console support (same as installed CraftOS-PC_console.exe)
  • ReleaseStandalone: same as Release but builds a standalone build; requires fs_standalone.cpp to be present in src

Mac

  1. Open a new Terminal window
  2. cd to the cloned repository
  3. git submodule update --init --recursive
  4. make -C craftos2-lua macosx
  5. ./configure
  6. make macapp
  7. Open the repository in a new Finder window
  8. Right click on CraftOS-PC.app => Show Package Contents
  9. Open Contents -> Resources
  10. Copy the ROM package inside
  11. Run CraftOS-PC.app

Linux (or Mac as non-app binary)

  1. Open a new terminal
  2. cd to the cloned repository
  3. git submodule update --init --recursive
  4. make -C craftos2-lua linux
  5. ./configure
  6. make
  7. sudo mkdir /usr/local/share/craftos
  8. Copy the ComputerCraft ROM into /usr/local/share/craftos/
  9. ./craftos

FAQ

Why is the ComputerCraft ROM/BIOS not included with the source?

ComputerCraft and its assets are licensed under a copyleft license that requires anything using its code to be under the same license. Since I want CraftOS-PC 2 to remain under only the MIT license, I will not be distributing any original ComputerCraft files with the CraftOS-PC 2 source. You can still aquire the ROM separately.

Why did you choose C++?

Since the original ComputerCraft code is written in Java, it may seem like a better idea to create an emulator based on the original mod code. But I found that using native C++ lets the emulator run much better than if it was in Java.

1. It runs much faster One of the biggest issues I had with CraftOS-PC Classic was that it ran too slow. The Java VM adds much overhead to the program which, frankly, is unnecessary. As a native program, CraftOS-PC 2 runs 2x faster than CraftOS-Classic. The barebones nature of native code allows this speed boost to exist.

2. It uses less memory Another problem with CraftOS-PC Classic was that it used much more memory than necessary. At startup, CraftOS-PC Classic used well over 150 MB of memory, which could grow to nearly a gigabyte with extensive use. CraftOS-PC 2 only uses 40 MB at startup on Mac (10 on Windows!), and under my testing has never gone over 100 MB. This is due to C++'s manual memory management and the absence of the entire JVM.

3. It's the language Lua's written in Using the same language that Lua uses guarantees compatibility with the base API. LuaJ has many known issues that can hinder development and cause much confusion while writing programs. Writing CraftOS-PC 2 using liblua guarantees that Lua will behave as it should.

4. It doesn't rely on any single platform I wanted to keep CraftOS-PC Classic's wide compatibility in CraftOS-PC 2. Using other languages such as C# or Swift are platform-dependent and are not guaranteed to work on any platform. C++ is a basic language that's always present and maintains a portable library that works on all platforms. I've moved all platform-specific code into the platform_*.cpp files so the rest of the code can remain as independent as possible.

More Repositories

1

DashBot-3.0

Geometry Dash bot to play & finish levels - Now training much faster!
C++
51
star
2

cc-tstl-template

Template project for ComputerCraft programs written in TypeScript.
TypeScript
48
star
3

sanjuuni

Converts images and videos into a format that can be displayed in ComputerCraft.
C++
32
star
4

UnkrawerterGBA

A tool to rip music from Gameboy Advance games that use the Krawall sound engine.
C++
31
star
5

CraftOSOS

ComputerCraft as a full, bootable x86 PC operating system.
C
30
star
6

ArduinoADB

ADB to USB keyboard converter using an Arduino Uno or compatible clone
C++
30
star
7

AUKit

AUKit: Audio decoding and processing framework for ComputerCraft
Lua
28
star
8

PrimeUI

A collection of UI component primitives for ComputerCraft.
Lua
25
star
9

craftos-efi

CraftOS never needed a UEFI port, but now it has one.
C
22
star
10

PerformanceMeter

A Beat Saber mod that displays a graph at the end of a level showing how your energy bar or score percentage changed over the duration of the level.
C#
21
star
11

ghaction-Generate-Release-Hashes

A GitHub action to automatically generate a list of hashes for a release.
JavaScript
14
star
12

lunatic86

x86 emulator in Lua (ported to CraftOS-PC)
Lua
14
star
13

vscode-craftos-pc

JavaScript
12
star
14

cash

ComputerCraft Advanced Shell - A Bourne-compatible shell for CraftOS
Lua
12
star
15

CC-Archive

Various archiving/compression programs and libraries for ComputerCraft
Lua
10
star
16

ASCIIJump

A clone of Geometry Dash in plain text. 3DS version included.
C++
10
star
17

iRCON

Minecraft server RCON client for iOS/macOS
Swift
9
star
18

Luz

An extremely light Lua compression algorithm.
Lua
9
star
19

pico-icsp-programmer

ICSP programmer for PIC18FxxQxx family devices on Raspberry Pi Pico
C++
9
star
20

remote.craftos-pc.cc

Remote connection between VS Code and CraftOS-PC
Lua
9
star
21

sanjuuni-ui

GUI frontend for sanjuuni
C++
9
star
22

craftos2-rom

ROM package for CraftOS-PC 2
Lua
9
star
23

craftos

A desktop port of CraftOS from the popular Minecraft mod ComputerCraft.
Lua
8
star
24

Herobrine

Herobrine demo for ComputerCraft
Lua
8
star
25

CCKernel2

A kernel for ComputerCraft written in Lua.
Lua
7
star
26

craftos3-lua

Lua VM & runtime written in Swift
Swift
6
star
27

DDImager

A dd GUI frontend for macOS.
Swift
6
star
28

tracc

An XM module tracker for ComputerCraft/CraftOS-PC.
Lua
6
star
29

craftos2-lua

Lua fork for CraftOS-PC 2
C
5
star
30

PSG

My attempt at designing a programmable sound generator board.
HTML
5
star
31

CCKit

A UI library for ComputerCraft that is designed similar to UIKit.
Lua
5
star
32

CraftOS-Pi

A port of CraftOS-PC for bare metal Raspberry Pi
C++
5
star
33

craftos-esp

A port of CraftOS-PC for ESP32-S3.
C
5
star
34

craftos-native

CraftOS-PC as a native C/Ncurses program
C
4
star
35

CraftOS-PC

Website for CraftOS-PC
JavaScript
4
star
36

ticesnd

Sound library + card over USB for TI-84+ CE
C
4
star
37

DOOM-CC

C++
4
star
38

craftos-pico

ComputerCraft emulator for the Raspberry Pi Pico
C++
4
star
39

apt-lua

Full port of APT/dpkg to ComputerCraft
Lua
4
star
40

ASICraft

A mod for CC:Tweaked that adds acceleration cards for various encoding, decoding, and transformation routines.
Java
3
star
41

FTPCC

RFC 959-compliant FTP client/server for ComputerCraft, written in MoonScript
Lua
3
star
42

discordcc

Discord client for ComputerCraft (abandoned)
Lua
3
star
43

CraftOS-DOS

ComputerCraft running on MS-DOS/FreeDOS
Lua
3
star
44

danspack

Packs a program and virtual filesystem into an executable Lua file, with DEFLATE-ANS for compression.
Lua
3
star
45

ccfs

FUSE filesystem for ComputerCraft using the CraftOS-PC raw mode protocol over WebSockets.
C++
3
star
46

HomebrewManager

A homebrew package installer for Nintendo 3DS.
C
2
star
47

craftos2-plugins

Various plugins for CraftOS-PC.
C++
2
star
48

CCWinX

An X11-like window server for CraftOS-PC, focusing on CCKernel2 support (but not required).
Lua
2
star
49

SDL3-Swift

Swift wrapper library for SDL3
Swift
2
star
50

LuaDS

A collection of data structures written in Lua.
Lua
2
star
51

WWDC-2017-Clock

My entry for the WWDC 2017 Scholarship.
Swift
1
star
52

LinuxCC

A ComputerCraft environment for Linux.
C++
1
star
53

DashBot-2.0

An AI that learns how to play Geometry Dash
C++
1
star
54

Base-Tracker

An iOS app that allows you to easily keep track of a baseball game.
Swift
1
star
55

inqswheel

An encryptor program based on Vsauce's Inq cipher wheel.
C++
1
star
56

C---Console

C++
1
star
57

craftos2-release-resources

Resource files for automated CraftOS-PC releases
C
1
star
58

libitunesdb2

An iPod library (iTunesDB) parser that supports the latest DB format
C++
1
star
59

craftos2-turtle

Turtle emulation plugin for CraftOS-PC
C
1
star
60

FixThoseLights

Fixes the blinking E in the Beat Saber logo with a light tap. Or just mutes it.
C#
1
star
61

har

A hierarchial archive format supporting deduplication, encryption, and xzip.
C++
1
star
62

8S1A

An 8-bit CPU created in Minecraft.
1
star