Skip to content

Commit

Permalink
add script to compile bridge controller (#470)
Browse files Browse the repository at this point in the history
* add script to compile bridge controller

* make script executable, handle case-sensitive file names, quote folders containing spaces

---------

Co-authored-by: memo <memo33@users.noreply.github.com>
  • Loading branch information
jflann and memo33 committed Mar 21, 2024
1 parent c4861f0 commit 1da1cd2
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 3 deletions.
67 changes: 67 additions & 0 deletions Controller/Bridge Controller/RULConfig.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Syntax:
#
# Lines starting with # are interpreted as comments.
#
# 'File' denotes the name of the target file. The path is interpreted
# relative to the location of the RULConfig.txt file.
#
# 'TGI' and 'Compressed' are self-explanatory.
#
# 'Source' specifies the source that is used to build a RUL file.
# If multiple source files are specified, these will be concatenated
# preserving their order. Note that the source files must explicitly
# end with a newline in this case, unless the next file starts with
# a comment anyway. Paths are interpreted relative to the source
# directory passed to the BuildRULs utility.
#
# -memo
#
#############################################################

File: NetworkAddonMod_Bridge_Controller.dat

# Road
TGI: 0x0A5BCF4B 0xAA5BCF57 0x00001000
Compressed: 1
Source: 00001000.rul

# Rail
TGI: 0x0A5BCF4B 0xAA5BCF57 0x00001001
Compressed: 1
Source: 00001001.rul

# Street
TGI: 0x0A5BCF4B 0xAA5BCF57 0x00001003
Compressed: 1
Source: 00001003.rul

# Avenue
TGI: 0x0A5BCF4B 0xAA5BCF57 0x00001006
Compressed: 1
Source: 00001006.rul

# Light Rail
TGI: 0x0A5BCF4B 0xAA5BCF57 0x00001008
Compressed: 1
Source: 00001008.rul

# Monorail
TGI: 0x0A5BCF4B 0xAA5BCF57 0x00001009
Compressed: 1
Source: 00001009.rul

# One Way Road
TGI: 0x0A5BCF4B 0xAA5BCF57 0x0000100A
Compressed: 1
Source: 0000100a.rul

# Dirt Road
TGI: 0x0A5BCF4B 0xAA5BCF57 0x0000100B
Compressed: 1
Source: 0000100b.rul

# Ground Highway
TGI: 0x0A5BCF4B 0xAA5BCF57 0x0000100C
Compressed: 1
Source: 0000100c.rul
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ A script is provided to compile a full set of NAM controllers for release. Run

The compiled controllers are located at `./target/controllers/`.

### Compiling INRULs
### Compiling INRULs & Bridge Controller

Get the Java utility [BuildRULs](https://www.dropbox.com/s/ckwhy11xxaz3z1q/BuildRULs_01.zip?dl=0) and run the command

java -jar /path/to/.../BuildRULs.jar -f Controller/INRULs/ Controller/INRULs/

and/or

java -jar /path/to/.../BuildRULs.jar -f "Controller/Bridge Controller/" "Controller/Bridge Controller/"

with the path to the `BuildRULs.jar` file replaced by the one on your system.
This creates or updates the files

Expand All @@ -90,12 +94,19 @@ This creates or updates the files
├── NetworkAddonMod_TurningLanes_Avenues_Plugin_INRULs.dat
└── NetworkAddonMod_Lite_INRULs.dat

A script is provided to compile a full set of INRULs for release. Run it from the project root with:
or

┐ Controller/
└─┐ Bridge Controller/
└── NetworkAddonMod_Bridge_Controller.dat

Scripts are provided to compile a full set of INRULs and bridge controller for release. Run them from the project root with:

./src/scripts/compile-release-inruls.sh

The compiled INRUL files are located at `./target/controllers/`.
./src/scripts/compile-release-bridge-controller.sh

The compiled files are located at `./target/controllers/`.

### Compiling Metarules

Expand Down
39 changes: 39 additions & 0 deletions src/scripts/compile-release-bridge-controller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# This script compiles all bridge rul files for inclusion in the installer.
#
# ./src/scripts/compile-release-bridge-controller.sh
#
# The compiled bridge controller is located at `./target/controllers/`.

set -e

if [ ! -e "Controller" ]
then
echo "Call this script from the root directory of the Network-Addon-Mod repository."
exit 1
fi

PROJECT_ROOT="$(pwd)"
TEMP="target/controllers/temp"
mkdir -p "$TEMP"

BUILDRULS_ARCHIVE="target/BuildRULs_01.zip"
BUILDRULS_URL="https://www.dropbox.com/s/ckwhy11xxaz3z1q/BuildRULs_01.zip?dl=1"

if [ ! -e "$BUILDRULS_ARCHIVE" ]
then
# download compiler if it does not yet exist
curl -L "$BUILDRULS_URL" > "$BUILDRULS_ARCHIVE"
fi
unzip -d "$TEMP" "$BUILDRULS_ARCHIVE"

# build bridge controller
(cd "$TEMP/BuildRULs_01" && java -jar BuildRULs.jar -f "$PROJECT_ROOT/Controller/Bridge Controller/" "$PROJECT_ROOT/Controller/Bridge Controller/")

# copy to target
DESTDIR="target/controllers/"
mkdir -p "$DESTDIR"
cp -p "$PROJECT_ROOT/Controller/Bridge Controller/NetworkAddonMod_Bridge_Controller.dat" "$DESTDIR"

rm -rf "$TEMP"

0 comments on commit 1da1cd2

Please sign in to comment.