Skip to content

Commit

Permalink
Updated README, changed build_header.py to ignore fixed ports. Fixed …
Browse files Browse the repository at this point in the history
…a few ports for TrimUI.
  • Loading branch information
kloptops committed Apr 1, 2024
1 parent d9fc675 commit edf9587
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This name must not clash with any other existing ports.

### New Port Structure:

Ports are now contained within the `port` top level directory, each port has its own sub-directory named after the port itself. Each port must adhere to the `portname` rules stated above. Each port must have a `port.json`, `screenshot.{jpg,png}`, `README.md`, a port script and a port directory. It may optionally include a `cover.{jpg,png}`.
Ports are now contained within the `port` top level directory, each port has its own sub-directory named after the port itself. Each port must adhere to the `portname` rules stated above. Each port must have a `port.json`, `screenshot.{jpg,png}`, `README.md`, a port script and a port directory. It may optionally include a `cover.{jpg,png}` and a `gameinfo.xml`.

The script should have capital letters (like `Port Name.sh`) and must end in `.sh`, the port directory should be the same as the containing directory. Some legacy ports have different names, new ports won't be accepted unless they follow the new convention.

Expand All @@ -73,6 +73,7 @@ A port directory might look like the following:
- README.md
- screenshot.jpg
- cover.jpg
- gameinfo.xml
- Port Name.sh
- portname/
- <portfiles here>
Expand Down Expand Up @@ -121,7 +122,11 @@ Example from 2048.
"image": {},
"rtr": true,
"runtime": null,
"reqs": []
"reqs": [],
"arch": [
"aarch64",
"armhf"
]
}
}
```
Expand All @@ -132,6 +137,7 @@ Example from 2048.
- [x] Load port data
- [x] Check port has reqired files
- [ ] Check for common errors in ports.
- [ ] Check for gameinfo.xml errors.
- [x] Check if port clashes with other ports
- [x] Run port.spec before zipping port
- [x] Create portname.zip only if port is changed
Expand Down
2 changes: 1 addition & 1 deletion ports/stardewvalley/StardewValley.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ln -sfv "$gamedir/savedata" ~/.config/StardewValley
export MONOGAME_PATCH="$gamedir/dlls/StardewPatches.dll"
export MONO_PATH="$gamedir/dlls":"$gamedir"
export PATH="$monodir/bin":"$PATH"
export LD_LIBRARY_PATH="$gamedir/libs"
export LD_LIBRARY_PATH="$gamedir/libs:$LD_LIBRARY_PATH"

# Delete older GL4ES installs...
rm -f $gamedir/libs/libGL.so.1 $gamedir/libs/libEGL.so.1
Expand Down
2 changes: 1 addition & 1 deletion ports/supertuxkart/SuperTuxKart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export SUPERTUXKART_ASSETS_DIR="$GAMEDIR/data/"
echo "Starting game." > $CUR_TTY

$GPTOKEYB "supertuxkart" -c supertuxkart.gptk textinput &
LD_LIBRARY_PATH="$PWD/libs" $TASKSET ./supertuxkart 2>&1 | $ESUDO tee -a ./log.txt
LD_LIBRARY_PATH="$PWD/libs:$LD_LIBRARY_PATH" $TASKSET ./supertuxkart 2>&1 | $ESUDO tee -a ./log.txt

$ESUDO kill -9 $(pidof gptokeyb)
unset LD_LIBRARY_PATH
Expand Down
20 changes: 16 additions & 4 deletions tools/build_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def load_headers(header_file):
header_data = fh.read()

header_map = {}
headers_fixed = set()

for block in header_data.split(HEADER_OLD):
if block.strip() == '':
Expand All @@ -56,9 +57,12 @@ def load_headers(header_file):
header_data, footer_data = block.split(HEADER_NEW, 1)
header_map[header_data.strip()] = footer_data.strip()

print(json.dumps(header_map, indent=4))
if footer_data.strip() != '':
headers_fixed.add(footer_data.strip())

return header_map
# print(json.dumps(header_map, indent=4))

return header_map, headers_fixed


def save_headers(header_file, header_map):
Expand All @@ -79,9 +83,10 @@ def main(argv):
hash_cache = HashCache(CACHE_FILE)

if HEADER_MAP.is_file():
header_map = load_headers(HEADER_MAP)
header_map, headers_fixed = load_headers(HEADER_MAP)
else:
header_map = {}
headers_fixed = set()

seen_headers = {}
script_data = {}
Expand All @@ -94,7 +99,7 @@ def main(argv):
script_text = script_file.read_text()

if '$controlfolder/control.txt' not in script_text:
print(f"check {script_file}\n")
print(f"[ BAD ] {script_file}")
continue

header_text, body_text = script_text.split('$controlfolder/control.txt', 1)
Expand All @@ -105,6 +110,13 @@ def main(argv):

header_text = re.sub(r'\n#\s+PORTMASTER:[^\n]*\n', '\n', header_text, re.I|re.MULTILINE)

if header_text.strip() in headers_fixed:
if '-q' not in argv:
print(f"[ OK ] {script_file}")
continue

print(f"[REPLACE] {script_file}")

seen_headers.setdefault(header_text, [])
header_map.setdefault(header_text.strip(), '')
script_data[script_file] = [header_text.rstrip(), body_text.lstrip()]
Expand Down
26 changes: 15 additions & 11 deletions tools/build_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@

ROOT_DIR = Path('.')

CACHE_FILE = ROOT_DIR / '.hash_cache'
RELEASE_DIR = ROOT_DIR / 'releases'
RUNTIMES_DIR = ROOT_DIR / 'runtimes'
CACHE_FILE = ROOT_DIR / '.hash_cache'
RELEASE_DIR = ROOT_DIR / 'releases'
RUNTIMES_DIR = ROOT_DIR / 'runtimes'
MANIFEST_FILE = RELEASE_DIR / 'manifest.json'
STATUS_FILE = RELEASE_DIR / 'ports_status.json'
PORTS_DIR = ROOT_DIR / 'ports'
STATUS_FILE = RELEASE_DIR / 'ports_status.json'
PORTS_DIR = ROOT_DIR / 'ports'

SPLIT_IMAGES = True

GITHUB_RUN = (ROOT_DIR / '.github_check').is_file()

Expand Down Expand Up @@ -944,7 +946,8 @@ def generate_ports_json(all_ports, port_status, old_manifest, new_manifest):
)

## Jank :|
build_new_images_zip(old_manifest, new_manifest, port_status)
if SPLIT_IMAGES:
build_new_images_zip(old_manifest, new_manifest, port_status)

utils = []

Expand All @@ -954,13 +957,14 @@ def generate_ports_json(all_ports, port_status, old_manifest, new_manifest):
utils.append(RELEASE_DIR / 'gameinfo.zip')
utils.append(RELEASE_DIR / 'images.zip')

for img_id in range(1000):
image_xxx_zip = f"images.{img_id:03d}.zip"
if SPLIT_IMAGES:
for img_id in range(1000):
image_xxx_zip = f"images.{img_id:03d}.zip"

if image_xxx_zip not in new_manifest:
break
if image_xxx_zip not in new_manifest:
break

utils.append(RELEASE_DIR / image_xxx_zip)
utils.append(RELEASE_DIR / image_xxx_zip)

runtimes_map = {}

Expand Down

0 comments on commit edf9587

Please sign in to comment.