Ascii Sector Wiki
Register
Advertisement

Tiny mod for ASCII Sector 0.7.2 that redecorates the Galaxy ship's interior a bit to make it look friendlier. No gameplay change i.e. ship won't get faster or anything, it's just how the ship looks inside. Savegames remain valid.

I only actually tested it with Linux (64 bit), because I don't have anything else. Save the code to a file, mark it as executable and run it in ASCII Sector's top directory. The script makes backups of all files it changes, still, no guarantees.

I did include all necessary data for MacOS, Windows and Linux (32-bit), too. I'm fairly confident the changes themselves are ok, there are only 3 bytes to be patched in the binary after all, and data/4.shp is identical on all platforms. The tricky part for Win and Mac users will be to get this bash script to run. On Win you'll appearently need to install the "Windows Subsystem for Linux"? Does this include 'stat', 'cp' and 'dd', too? Mac can run bash, it seems, but I have no clue where the files 'asciisec' and 'data/4.shp' are located, so the script might not find them. Any feedback is welcome.

#!/bin/bash -e
test $# = 0 ||exec cat <<\EOF
 Patches ASCII Sector 0.7.2 to make the Galaxy ship's interior design a bit more
 cozy. :-)							--JR03/2019

 The Galaxy with cargo expansion has a lonely table crammed in at the end of a
 long, narrow corridor. Who'd want to sit there, this looks uncomfortable. And
 who'd walk this far from the cockpit? And there are no plants, that's unhealty!
 Execute this script to patch the ship's layout: one of the 3 bedrooms is moved,
 making better use of available space and adding a nice, friendly sitting corner
 with a window. And the cockpit gets a wide panorama pane. The un-cargo-expanded
 Galaxy has the same changes, plus the 3rd bedroom is quite luxurious.

 The total ship space doesn't change, that would be unrealistic: of course we
 can't expand sideways into the engines. And of course the Galaxy's performance
 parameters (speed, cargo space, etc.) don't change at all, that would be
 cheating. This is just cosmetics to make my favorite ship look more cozy.
 Old savegames remain valid.

 Unfortunately ASCII Sector is programmed sloppily, much of the ships is
 hardcoded instead of properly putting it in the ships' data files. This means
 we have to patch the main asciisec binary, which means this patch is specific
 to the 0.7.2 version of the binary. And it means I might have messed up and
 some other ship is affected, too, because it shares some cargo expansion code
 with the Galaxy? It's not easy if all you have is 38 MB worth of disassembly.
 I tested the other ships, but I might have missed something.

 I did include data for Windows and MacOS, however I don't have either of them,
 so I DID NOT TEST THIS PATCH ON WIN OR MAC AT ALL! I've read that it's possible
 to run bash scripts on Win and Mac. On Win you'll appearently need to install
 the "Windows Subsystem for Linux" first? Does this include 'stat', 'cp' and
 'dd', too? Mac can run bash, it seems, but I have no clue where the files
 'asciisec' and 'data/4.shp' 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

# ASCII Sector *.shp files only contain ships' basic layouts, changes due to
# cargo expansions etc. are unfortunately hardcoded in the binary. For the
# Galaxy, the code puts a table with chair in the SW corner. My new design calls
# for a bed instead.
# Version 0.7.2, Windows, 32 bit
ALT  3019197 asciisec.exe
 151522 B1
#151547 0F
 15156C B1
 151591 0F
# Version 0.7.2, MacOS, 64 bit
ALT  4706344 MacOS/asciisec
 1B7797 B1
#1B77C2 0F
 1B77ED B1
 1B7818 0F
# Version 0.7.2, Linux, 32 bit
ALT  2896892 asciisec
 18FBD2 B1
#18FBF7 0F
 18FC1C B1
 18FC41 0F
# Version 0.7.2, Linux, 64 bit
FILE 3576144 asciisec
 1F8017 B1 # 4F=table -> B1=bed
#1F803A 0F # 0F=white -> 0F=white
 1F805D B1 # 7C=chair -> B1=bed
 1F8080 0F # 06=brown -> 0F=white

# Redecorate the Galaxy ship itself. Unfortunately, to keep the file's
# encryption intact, we need to patch a lot more bytes than we actually change.
ALT  2980 Resources/data/4.shp
FILE 2980 data/4.shp
# Char map
003D 5C C7 D5 91 52 97 71 2E 15 3C BA CA F4 75 A9 CB B5 22 3F 0B 1F 1C 15 0F
0055 42 4E A4 1F C7 9A 37 B8 24 74 A0 79 A0 28 74 5D 3D
0067 8D DD B5 80 26 0B 0B AF CF 25 EE 5F 5F 97 8E FA AC 34 C5 08 3C 1D D0 75
007F C6 7F 15 B2 4B 02 A0 CA 59 91 7A 8D 6C B2 F1 60 E5 67 56 45 4C 4E 73 14
0097 50 CF F0 92 CC CF CA A9 9A 8D 4F 08 CF 0F 04 E7 E5 ED B4 C1 65 65 2B 0B
00AF 5C 6C 91 20 EC D0 B1 63 D9 B7 C3 5A 20 C1 34 7D 4F 33 E5 82 91 11 AA DB
00C7 3E 0B 8B 9B 96 CC E4 45 A2 CB BA F9 45 AD 95 F3 0B D4 2F E8 17 BE E0 49
00DF CD DC 0A 4E F2 65 C9 D4 6B B1 96 CC E4 45 A2 CB BA 94 B9 91 DF 01 61 04
00F7 D8 65
0125 50 63 D9 DD ED EF E0 5A EC 25 E2 A8 0F 25 88 CF 73 81 4B E1 A0 8B AD A7
013D 8B B5 99 45 06 3F CE 5B 7A 35 1C 06 89 E5 43 78 BD 18
0150 70 D7 57 FC 45 37 37 BA F0 27 87 B3 04 75 3A E9 1A 8C 2B 21 95 69 8A 3E
0168 50 C7 F9 F1 BF D6 FA E3 29 07 6D BA 44 3F 97 D8 61 D6 6A F1 D7 64 80 9D
0180 EA 17 C0 96 DE 05 1C D9 3E 98 D6 17 5E D8 C7 98 1D 89 68 A5 D1 02 EB 4E
0198 83 5A AC C2 BD 84 84 5A 60 72 22 5F BF 6B 09 CD 5B F7 39 59 E3 B9 22 DA
01B0 4E A1 CC 4E 91 0C 4E 22 EE A2 42 CC BA EF B3 83 15 17 29 9F 16 17 2F 8C
01C8 F8 FB 79 39 7F F1 B7 CE 77 AA A6 F1 A7 4F 71 1A AC A5 7F E3 C3 6B AD 46
01E0 9D 85 9E 5A 82 E0 F9 93 B1 26 12 C8 85 63 95 65 73 D6
01F5 AF 98 CD 4C 8F 1D 21 27 12 C8 58 C6 36 9D AD 99 7F D1 7D 6E BF CD 7E 11
020D 8F F2 30 EE 01 59 50 E8 06 0B 2A 19 6A 81 E5 45 49 04 B5 BF 53 EF E4 15
0225 BE 40 B7 B4 28 4C 4E 9C 7E 3D 8A DC C1 A4 74 C8 2F 90 0A 3E 39 88 90 EC
023D 0A 77 0B C8 3D AC EE 20 E3 01 B0 FA E7 56 F3 7E E0 C0 ED FA 7A FC D6 B1
0255 03 07 5A 4B 9B 88 52 11 84 62 EE C5 97 B2 35 D3 5A 40 2C BF A3 14 91 49
026D AC 6C E8 E7 9F 65 63 47 65 80 9C 68 DE AA 69 9D 26 47 A0 BE B2 D2 0F 83
0285 60 BA 67 4E A8 42 98 94 FC 3B 23 1E E7 B6 29 6C 09 A2 84 B1 2D 55 EF B6
029D 24 65 73 0C 69 5A B5 7C D1 4F 2F 06 A2 FF CA 2D 91 8E 29 EF 88 27 6D E0
02B5 36 C8 83 A3 D8 4B 9C 1C DE 04 37 D4 4B E3 60 6F 64 18 1C 27 E8 49 99 B1
02CD 41 96 E4 87 54 73 DA C8 9E C2 15 A1 B9 C9 37 5B 66 29 5A AA B7 19 3E 7E
02E5 B2 7E CE EF 84 FF
# Color map
03B6 EA 79 BC D6 92 02 F9 46 29 41 10 2A E4 3D 18 EB AC 98 54 7D FF FD 75 C6
03CE 49 2F 8E 5D AE BA 9E 8A 28 74 5D 3D 3D 8D B0 9D DB 66 48 DB A1 61
04AF DB 70 47 0A BE 42 D8 1A 0E 43 CC 3B 51 18
04BE DF D7 64 50 D4 F9 2E D7 28 B7 E1 9E AA 22 80 7D EF 61 2E F5 7C F4 F2 EE
04D6 1D E6 C9 5F 26 B9 4A
051F D2 5A 70 3D A5 04 14 20 6D 00 A7 94 92 BF E7 F3 54 0F 24 F9 15 58 49 8E
0537 7A 14 BD 46 1E E8 01 AD 5C 9F 28 83 05 6B 8F F7 0A 5B 15 64 E1 36 2D C2
054F 0D 6C 87 76 4A 45 73 CF BF 1F E7 48 B1 F8 44 BC 8F 46 B8 41 3D B3 B1 40
0567 5D 8C F9 9F 8B E9 67 54 F6 77 8A 30 AD B3 3C F9 BE 5F 01 A6 73 E8 23 05
057F 4E 7F 4E F6 AF 10 68 E2 DF 73 58 97 4B 67 73 CF C6 CF 88 67 08 83 E0 40
0597 05
0599 94 BF E5 33 67 D8 C2 47 FE 5E 73 62 8B E8 51 88 B5 89 83 D8 47 B7 13 67
05B1 B4 4D B6 C3 67 F6 77 8D 78 21 DF D9 87
05BF 41 B2 2B FC B1 73 48 ED F9 80 8B A5 99 17 B1 6A 5A
05D1 81 3F B3 7C D7 64 F9 CD C8 98 C2 BC 78 F6 D4 D9 83 F7 E5 27 BA 0D 08 69
05E9 C0 C7 4C F5 7B F0 15 B7 91 72 00 BE B3 C7 A2 F5 08 1A BF 6E 87 02 C5 A7
0601 DD DB AB A0 94 22 08 CC 79 67 D6 60 3F 62 F8 DA 50 D4 B6 8B 49 B8 A4 7D
0619 46 8D 04 F6 BE E1 86 48 93 7B 24 DC 6C D2 F0 6C 95 E0 EB 12 72 29 BB 55
0631 05 CB 5A F9 42 25 44 05 07 09 E7 71 20 8D 1D 0D FB 6C DB BF A9 2D 0F D0
0649 81 7C 0E E2 BF 66 E9 A5 A7 74 54 20 23 CF 7A 80
065A 7D E0 E2 E2 55 20
0661 D4 6B C4 59 DB F7 A4 6C D7 BF B8 DD D8 D5 E2 F3 C5 FA 39 84 58 82 9F 41
0679 D2 69 4B 1F E7 F9 D4 6B C4 59 DB F7 A4 6C D7 BF B8 DD D8 D5 E2 FB 7E 47
0691 64 AD AB 4A 77 D3 4B CD BE FF 86 B8 06 D8 C9 FC 20 73 C6 BC 7D E3 2D 64
06A9 A8 E0 1A 50 38 91 F1 97 8E 09 0A B9 84 27 F3 5E 07 96 35 6E AC F8 40 7C
06C1 1A D7 3C E8 D9 D2 CC 68 BF C8 52 F3 87 30
# Room map
091C 40 86 C0 33 E2 5C 26 11 B3 D9 94 40 D9 B8 05 C4 17 98 CB 1C 3D B0 6D 06
0934 92 B8 2F 79 5D 34 FB E2 49 3C 52 22 BB BB C8 77 1B 25 17 87 25 23 8D 91
094C 66 0C 39 8D 56 15 D6 BA FB 8F E9 7E
0959 B6 6E 2E 91 95 17 FE 0C 8F EC 08 17 C7 E6 1F 78 3F 1B CB C3 AB 80 A3 7D
0971 CF 09 DB 7B BE 74 B9 14 42 95 4E BB 77 0E 65 E5 1C 3F 35 76 99 96 37 42
0989 A9 53 2B 85
098E BF 88 02 B5 38 C3 BB 5C B9 C5 18 AD B2 F8 4F ED 4E B2 FC E8 A2 FD 2C 48
09A6 23 0C 45 75 85 00 7E CF 2D E3 91 AC D9 7D 6D 8F BD A0 77 F6
09D5 F9 E5 55 CB 6E FB F4 7E B2 E9 27 C7 0E 50 6B 86 03 6B AE 1A 82 11 48 42
09ED 7B 4F 9B 08 24 85 01 69 97 37 42 74 AA 76 BF 0A ED E7 FF 64 3F E7 73 6B
0A05 CA 7B D7 57 58 62 AB 05 60 25 A8 D9 24 B5 4E C1 CB 06 B5 06 3B 46 AA B8
0A1D 2D C2 2C A3 4E 37 D7 D4 66 C0 84 AE BD F7 6A 58 B7 7C 88 71 C7 D1 00 16
0A35 05 31 9E EF E6 8F E0 15 3C 23 37 8E 7E 7F AF 5F 0B B2 0B 2C B1 F4 1A D0
0A4D E0 DD 73 2E 45 BA 99 52 34 AA 7E 67 BA 2E 5B A1 5A ED AE D8 57 FC 3D F6
0A65 B1 D9 CF 80 5D E3 53 00 2C 1F F8 ED 8C 33 2E 8F C6 E8 A6 39 49 33 45 D1
0A7D 68 3C 2C FD C7 50 14 48 4F EF DD 20 34 6F 54 6B 7D 29 16 43 92 0E 4E EE
0A95 E0 CF 89 4B 18 28 6D 6B 67 67 E7 C9 0B 44 9D DC E2 54 9A D1 F5 62 87 2A
0AAD 13 73 35 7D 4C 36

EOF
echo "Done."
Advertisement