Add RmlUI night-stadium launcher and shared theme (by Codex)

This commit is contained in:
Codex committed 2026-10-18 13:30:24 +02:00
1 parent 00f522c1f3
commit 8aa849e9fa
32 files changed
+1841 -917

No files matched your search

+7 -2
View File
@@ -14,7 +14,11 @@ def validate(directory, windows):
documents = {'README.md', 'LICENSE', 'THIRD_PARTY_NOTICES.md', 'ACKNOWLEDGEMENTS.md', 'CONTRIBUTING.md'}
licenses = {'README.md', 'LGPL-2.1.txt', 'Nuked-OPL3-notices.txt', 'LZMA-SDK.txt', 'SDL2-HIDAPI-BSD.txt',
'SDL2-HIDAPI-options.txt', 'SDL2-HIDAPI-original.txt', 'SDL2-yuv2rgb.txt',
'SDL2.txt', 'miniz-source-notices.txt', 'miniz.txt', 'nativefiledialog-extended.txt'}
'SDL2.txt', 'miniz-source-notices.txt', 'miniz.txt', 'nativefiledialog-extended.txt',
'RmlUi.txt', 'RmlUi-containers.txt', 'RmlUi-fonts.txt', 'RmlUi-Khronos.txt',
'FreeType.txt', 'FreeType-FTL.txt', 'FreeType-BDF.txt', 'FreeType-PCF.txt', 'FreeType-zlib.txt'}
launcher_assets = {'assets/launcher/' + name for name in
('launcher.rml', 'theme.rcss', 'stadium.tga', 'LatoLatin-Regular.ttf', 'LatoLatin-Bold.ttf')}
present = set()
for file in directory.rglob('*'):
if not file.is_file():
@@ -22,6 +26,7 @@ def validate(directory, windows):
relative = file.relative_to(directory)
present.add(relative.as_posix())
allowed = (len(relative.parts) == 1 and file.name in products | documents)
allowed |= relative.as_posix() in launcher_assets
allowed |= len(relative.parts) == 3 and relative.parts[:2] == ('docs', 'licenses') and file.name in licenses
allowed |= (len(relative.parts) >= 2 and relative.parts[0] == 'docs' and
'licenses' not in relative.parts and file.suffix in {'.md', '.txt', '.csv'} and
@@ -35,7 +40,7 @@ def validate(directory, windows):
r'concrt\d+|ucrtbase|api-ms-win-(?:crt|core)-[a-z0-9-]+)\.dll', file.name, re.I)))
if not allowed:
raise RuntimeError('Unexpected package entry: ' + relative.as_posix())
required = products | documents | {'docs/licenses/' + name for name in licenses}
required = products | documents | launcher_assets | {'docs/licenses/' + name for name in licenses}
required.add('docs/release/0.1/RELEASE_NOTES.md')
if required - present:
raise RuntimeError('Missing package entries: ' + ', '.join(sorted(required - present)))
+26 -2
View File
@@ -16,6 +16,8 @@ COMPONENTS = {
'miniz': ('3.0.2', 'https://github.com/richgel999/miniz', ['miniz.c', 'miniz.h', 'LICENSE']),
'lzma_sdk': ('24.09', 'https://github.com/ip7z/7zip', ['C/7zDec.c', 'C/7z.h', 'DOC/License.txt']),
'nfd': ('v1.2.1', 'https://github.com/btzy/nativefiledialog-extended', ['CMakeLists.txt', 'src/nfd_cocoa.m', 'LICENSE']),
'rmlui': ('6.3', 'https://github.com/mikke89/RmlUi', ['CMakeLists.txt', 'Include/RmlUi/Core.h', 'LICENSE.txt']),
'freetype': ('VER-2-13-3', 'https://github.com/freetype/freetype', ['CMakeLists.txt', 'include/ft2build.h', 'LICENSE.TXT']),
}
# Verified against the archive SHA256 pinned in CMakeLists.txt. These are free
# dependency source files, not game data. Refuse modified archive-cache inputs.
@@ -32,6 +34,26 @@ def git(directory, *arguments):
return subprocess.check_output(['git', '-C', str(directory), *arguments])
def unbuilt_submodules(component, staged):
"""Only FreeType's unused make/autotools logging dependency is omitted.
The pinned CMake font-engine target does not compile dlg. Every other
submodule, or a changed revision, still needs explicit source packaging.
"""
excluded = {}
for record in staged.split(b'\0'):
if not record.startswith(b'160000 '):
continue
metadata, path = record.split(b'\t', 1)
commit = metadata.split()[1].decode()
name = path.decode()
if (component != 'freetype' or name != 'subprojects/dlg' or
commit != '72dfcc858c040c54a6a0b88fcb7e70ee186d3167'):
raise RuntimeError('Dependency submodules require explicit packaging: ' + component)
excluded[name] = commit
return excluded
def copy_files(source, destination, files, required=False, materialized_links=None):
"""Copy only the explicit source inventory, materializing internal links.
@@ -164,15 +186,16 @@ def main():
if not dependencies.get(name) or not all((directory / marker).is_file() for marker in markers):
raise RuntimeError('Actual dependency source unavailable: ' + name)
commit = None
excluded = {}
if (directory / '.git').exists():
commit = git(directory, 'rev-parse', 'HEAD').decode().strip()
tag = git(directory, 'rev-parse', reference + '^{commit}').decode().strip()
if commit != tag or git(directory, 'status', '--porcelain', '--untracked-files=no').strip():
raise RuntimeError('Dependency differs from its pinned source: ' + name)
if git(directory, 'ls-files', '--stage').find(b'160000 ') != -1:
raise RuntimeError('Dependency submodules require explicit packaging: ' + name)
excluded = unbuilt_submodules(name, git(directory, 'ls-files', '--stage', '-z'))
if commit:
files = [Path(p.decode('utf-8')) for p in git(directory, 'ls-files', '-z').split(b'\0') if p]
files = [p for p in files if p.as_posix() not in excluded]
if name == 'lzma_sdk':
files = [p for p in files if p.parts[0] == 'C' or p == Path('DOC/License.txt')]
else:
@@ -188,6 +211,7 @@ def main():
materialized_links=dependency_links)
manifest['dependencies'][name] = {'upstream': url, 'reference': reference,
'commit': commit, 'files': hashes,
'unbuilt_submodules': excluded,
'materialized_links': dependency_links}
initial_cache.append('set(FETCHCONTENT_SOURCE_DIR_' + name.upper() +
' "${CMAKE_CURRENT_LIST_DIR}/dependencies/' + name + '" CACHE PATH "" FORCE)')
+11 -1
View File
@@ -7,6 +7,7 @@ from __future__ import annotations
import argparse
import dataclasses
import hashlib
import json
from pathlib import Path, PurePosixPath
import re
@@ -40,6 +41,11 @@ PRIVATE_DOCUMENTS = {
}
SOURCE_SUFFIXES = {".cpp", ".hpp", ".h", ".c", ".inc"}
SKIP_DIRECTORIES = {".git", "__pycache__", ".cache", "_deps", "node_modules"}
# Exact independently generated launcher artwork, not imported game material.
# Keep prior reviewed hashes if an asset is intentionally revised in history.
PROJECT_ARTWORK = {
"assets/launcher/stadium.tga": {"08f82783a357d5b0722f3737de54844150bc14d98036845f1aaee3211608e1c8"},
}
LEGACY_SYMBOLS = re.compile(
r"(?<![A-Za-z0-9])(?:" + "FUN" + r"_?[0-9a-f]{4,8}|" + "DAT" +
@@ -156,7 +162,7 @@ def path_findings(name: str) -> list[Finding]:
result = []
if path.is_absolute() or ".." in parts:
result.append(Finding(name, 0, "unsafe-path"))
if path.suffix.lower() in ASSET_SUFFIXES:
if path.suffix.lower() in ASSET_SUFFIXES and name not in PROJECT_ARTWORK:
result.append(Finding(name, 0, "binary-or-game-asset"))
if path.name in PRIVATE_DOCUMENTS or any(parts[:len(p)] == p for p in PRIVATE_PREFIXES):
result.append(Finding(name, 0, "private-material-path"))
@@ -167,6 +173,10 @@ def path_findings(name: str) -> list[Finding]:
def scan_blob(name: str, blob: bytes) -> list[Finding]:
result = path_findings(name)
if name in PROJECT_ARTWORK:
if hashlib.sha256(blob).hexdigest() not in PROJECT_ARTWORK[name]:
result.append(Finding(name, 0, "unreviewed-project-artwork"))
return result
if len(blob) > 2_000_000:
result.append(Finding(name, 0, "oversized-source-file"))
if b"\0" in blob:
+9
View File
@@ -4,6 +4,7 @@
"""Synthetic checks for the source-distribution guard; no game input is used."""
import contextlib
import hashlib
import io
import json
from pathlib import Path
@@ -17,6 +18,14 @@ import check_public_tree as guard
class BlobChecks(unittest.TestCase):
def test_only_exact_reviewed_project_artwork_is_accepted(self):
name = "assets/launcher/synthetic.tga"
payload = b"synthetic\0pixels"
with mock.patch.dict(guard.PROJECT_ARTWORK, {name: {hashlib.sha256(payload).hexdigest()}}):
self.assertEqual(guard.scan_blob(name, payload), [])
self.assertIn("unreviewed-project-artwork", {f.rule for f in guard.scan_blob(name, payload+b"changed")})
self.assertIn("binary-content", {f.rule for f in guard.scan_blob(name, payload)})
def rules(self, name, text):
return {finding.rule for finding in guard.scan_blob(name, text.encode())}