Ascii Sector Wiki
Advertisement

Patch for ASCII Sector 0.7.2 that fixes miniscule bugs in two planets/bases' map data.

  • Acorn has a strange unwalkable bit of ground.
  • Alasdair Mor has an unreachable spot where mission-relevant NPCs might spawn.

For details see affected bases' pages and description at start of patch itself. Savegames remain valid.

Only tested with Linux; in theory it should work on Win and Mac, too, if you manage to get a bash script to run. Save the code to a file, mark it as executable and run it in ASCII Sector's top directory. The script makes backups of files it changes, still, no guarantees. Feedback welcome.

#!/bin/bash -e
test $# = 0 ||exec cat <<\EOF
 Patches two bugs in the planet/base maps of ASCII Sector 0.7.2.     --JR03/2021

 The Acorn research facility has one strange spot in the middle of the left edge
 where, even though it looks like plain ground, you can't walk. ->Fixed.

 A grain field on Alasdair Mor has an unreachable patch with a tree, yet NPCs
 can spawn there, even mission-relevant ones. If that happens, you'd need to
 launch and land again to complete your mission. ->Walkable path added.

 Old savegames remain valid. Only tested on Linux, because that's all I have.
 However we only touch data files, which are identical on Win and Mac, so patch
 should work there just the same if you can somehow manage this bash script to
 run. On Win you'd appearently need to install the "Windows Subsystem for Linux"
 first? Does this include 'stat', 'cp' and 'dd', too? Mac can run bash, I've
 read, but I have no clue where the data files are located, so the script will
 likely not find them. Feedback is welcome.

 On Linux, as far as I can tell, everything is fine. The script does some basic
 checking and backs up the files before changing. Still, use at your own risk.
EOF

unset ALT FILE
while read ADDR DATA; do
	test -n "$ADDR" -a "${ADDR#\#}" = "$ADDR" ||continue #skip comment
	set -- $DATA
	# ALT/FILE lines declare (expected) sizes and names of files following
	# data lines apply to. ALTs are optional alternative patches for the
	# concluding FILE i.e. 0-∞ ALTs + 1 FILE form a group from which exactly
	# 1 patch must apply. If ALTs aren't followed by their own data lines
	# then those of the following ALTs or the final FILE are used.
	# ALTs/FILEs can't have comments, file names might include a '#'.
	if [ "$ADDR" = ALT -o "$ADDR" = FILE ]; then
		SIZE="$1"; shift
		# We only 'stat' file size, change to 'cksum' if needed.
		if [ ! -f "$*" ] || [ "$(stat -c%s "$*")" != "$SIZE" ]; then
			# No match
			if [ "$ADDR" = FILE -a -z "$ALT" ]; then
				echo "Error: No suitable '$*'. Aborted!" >&2
				exit 1
			fi
			test "$ALT" = open ||unset FILE #end of data
			test "$ADDR" = FILE &&unset ALT #end of group
			continue
		fi
		# Match
		if [ -n "$ALT" ]; then
			echo "Error: '$*' ambiguous. Aborted!" >&2
			exit 1
		fi
		FILE="$*" #expecting data
		test "$ADDR" = ALT &&ALT=open #group matched
		if [ ! -w "$FILE" ]; then
			echo "Error: Can't write '$FILE'. Aborted!" >&2
			exit 1
		fi
		if [ -e "$FILE.bak" ]; then
			echo "Backup '$FILE.bak' already exists. Bailing out!" >&2
			exit 1
		fi
		cp -av "$FILE" "$FILE.bak"
	else
		test -n "$FILE" ||continue #data doesn't apply, skip
		test "$ALT" = open &&ALT=applying
		for DATA; do
			test "${DATA#\#}" = "$DATA" ||break #skip comment
			echo -ne "\\x$DATA"
		done | dd seek=$((0x$ADDR)) bs=1 of="$FILE" conv=notrunc status=none
	fi
done <<\EOF

# Acorn. We actually only change 1 byte, but need to patch a lot more only to
# keep Ascii Sector's silly data file encryption intact.
ALT  19842 Resources/data/38.bas
FILE 19842 data/38.bas
# Room map
3EE0 C2 74 A5 34 CD D1 E2 B9 DE 1B 44 0F B3 A9 87 13 B2 25 22 E9 F6 61 0F 04
3EF8 16 55 05 A5 6B 6A 7D 0E 86 57 4E 16 AA FE BB 3B 1A 37 A7 49 44 02 E1 D6
3F10 7C F5 30 29 5A B8 8E 4B 03 D0 2B A8 8D 1C 28 6B F7 A3 9A 76 DD FE 4D 3B
3F28 0A C8 FC 64 32 74 D3 59 27 3F 73 29 1E 96 BE C5 7A

# Alasdair Mor. Actual path in grain field is 11 bytes long.
ALT  23170 Resources/data/45.bas
FILE 23170 data/45.bas
# Char map
0A55 DE 6D 63 5A 3C 44 68 59 84 09 85 2D D2 FD 03 FF 1B 1A 83 6D 94 B8 C0 55
0A6D AE E6 E4 DE C0 64 56 92 57 20 5F 63 72 25 26 D5 3E DE 74 3C CB 5B 06 2F
0A85 47 A4 9D 23 BE B4 8D 31 03 7B 67 89 CB 85 AA 48 E3 CC 5F 86 5D CA DB 15
0A9D C2 EF 43 55 BC E9 E3 7C E1 AD E1 83 A5 B6 93 EE 6E 2D F1 C9 0D 85

EOF
echo "Done."
Advertisement