diff --git a/README.md b/README.md new file mode 100644 index 0000000..9d2a6ed --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# templeos-slipstream + +Slipstream tool for the TempleOS Standard ISO image + +![templeos-slipstream](https://raw.githubusercontent.com/alec3660/templeos-slipstream/refs/heads/master/screenshot.png? "templeos-slipstream") + +- Appends your ISO.C file to the TempleOS Standard ISO +- Adds a CDirEntry in `/Home` for a `Once.HC` file that automatically mounts your ISO.C file, changes dirs, and `#include`s your `Run.HC` on startup. + +This allows you to create slipstreamed TempleOS ISO files that are as close to "pure" as possible, without having to rebuild the distro. + +# Usage + +`templeos-slipstream TempleOS.ISO MySlipstream.ISO.C output.iso` diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..836e630 Binary files /dev/null and b/screenshot.png differ diff --git a/templeos-slipstream b/templeos-slipstream new file mode 100755 index 0000000..81183fe --- /dev/null +++ b/templeos-slipstream @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +import errno +import hashlib +import os +import struct +import sys + +base_image_file = "" +base_image_hash = "5d0fc944e5d89c155c0fc17c148646715bc1db6fa5750c0b913772cfec19ba26" +slipstream_file = "" +output_file = "" + + +def round_up(x, y): + return x if x % y == 0 else x + y - x % y + + +def got_error(e): + print("Error: code " + str(e)) + sys.exit(e) + + +def make_slipstream_iso(): + output_size = ( + round_up( + os.path.getsize(base_image_file) + os.path.getsize(slipstream_file), 2048 + ) + + 2048 + ) + print(str(output_size)) + # Zero the output file + res = os.system( + 'dd if=/dev/zero of="' + output_file + '" bs=' + str(output_size) + " count=1" + ) + if res: + got_error(res) + # Write TempleOS.ISO data to the beginning of output file + res = os.system( + 'dd if="' + base_image_file + '" of="' + output_file + '" conv=notrunc' + ) + if res: + got_error(res) + # Patch RedSea partition size to 0xffffffffffffff + f = open(output_file, "rb+") + f.seek(0xB010) + f.write(struct.pack("