From b4a876200b7fe782d5168f7f27ef6d00a84e3e23 Mon Sep 17 00:00:00 2001 From: itaskaev2 <165683571+itaskaev2@users.noreply.github.com> Date: Sun, 8 Nov 2026 15:45:50 +0100 Subject: [PATCH] Link the game's manifest and icon as a .res written in Python when lld links, so no build path goes through windres. windres (binutils) opens its files and starts its preprocessor through the system's ANSI code page. A build or user folder whose name holds a character outside that code page (Victor with an accent on a Cyrillic Windows, a Japanese user name, a folder named with a full-width colon) failed the Compile step with "Invalid argument" or "Cannot create temporary file". make_game.py now writes runtime/nx2navi.rc's two resources as a .res file itself (resource_file) and hands it to lld, which builds the resource section from it and opens paths as Unicode. The resources come out as windres made them: the manifest as 24/1, the icon's images as RT_ICON 1..7 and their group as RT_GROUP_ICON 1, US English. Without lld the windres path stays. Co-Authored-By: Claude Opus 5.5 --- tools/make_game.py | 51 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/tools/make_game.py b/tools/make_game.py index 56204170..5ec74030 100644 --- a/tools/make_game.py +++ b/tools/make_game.py @@ -1001,8 +1001,46 @@ def windres_command(msys, rco): *(f'--preprocessor-arg={a}' for a in pp), '-O', 'coff', '-i', 'nx2navi.rc', '-o', str(rco)] -def compile_resources(msys, rt, obj, env): - """runtime/nx2navi.rc into obj/nx2navi_rc.o: the manifest of the game's exe (per-monitor DPI awareness, so the +RC_LINE = re.compile(r'(\d+)\s+(24|ICON)\s+"([^"]+)"') + + +def resource_file(rt): + """runtime/nx2navi.rc as a .res file (the format Windows' resource compiler writes): the manifest as resource 24, + the icon's images as RT_ICON 1..n and their directory as RT_GROUP_ICON, US English as windres gives them. lld + takes a .res among its inputs and builds the exe's resource section from it. + + Python writes it, so no tool opens a path by the system's ANSI code page: windres does (binutils), and a build + folder or a user folder whose name holds a character outside that code page (C:\\Users\\Víctor on a Cyrillic or a + Japanese Windows, D:\\Games\\Zelda:Ocarina) failed with "Invalid argument" or "Cannot create temporary file".""" + def resource(typ, name, data, flags): + head = struct.pack('