diff --git a/tests/launcher_test.py b/tests/launcher_test.py index 907d75b2..7695910f 100644 --- a/tests/launcher_test.py +++ b/tests/launcher_test.py @@ -3116,6 +3116,9 @@ class MakeGameTest(Tmp): (out / 'exefs' / name).write_bytes(b'x') (lift / 'layout.json').write_text(json.dumps([{'name': 'main'}])) text = self.mg.modules_c(lift, out, gen).read_text(encoding='utf-8') + import check_content + self.assertIn(check_content.GENERATED_MARKER, text.splitlines()[0]) + self.assertIn('generated from game code', check_content.problems_for(gen / 'modules.c')) # refused in a commit for half in ('\\ud83e', '\\ud842'): # the first surrogate halves of the two characters self.assertNotIn(half, text.lower()) want = 'const char rt_default_exefs[] = "' + str(out / 'exefs').replace('\\', '\\\\') + '";' diff --git a/tools/make_game.py b/tools/make_game.py index 1f79a317..21e77255 100644 --- a/tools/make_game.py +++ b/tools/make_game.py @@ -98,6 +98,7 @@ sys.path.insert(0, str(KIT / 'tools')) import nup # noqa: E402 import mod_files # noqa: E402 import prompt_art # noqa: E402 +from check_content import GENERATED_MARKER # noqa: E402 TITLE_ID = 0x0400486024DEC000 MAIN_BUILD_ID = 'e0f3ccfaf50065ae4ea01eb5aeb13b1a' # main of game 1.1.1 @@ -642,8 +643,12 @@ def c_string(text): def modules_c(lift, out, gen): + """gen/modules.c: the lifted modules' table, the ExeFS's sha256 and this install's folders. It carries + GENERATED_MARKER, which tools/check_content.py refuses in a commit: it is derived from the game and names the + player's paths.""" layout = json.loads((lift / 'layout.json').read_text(encoding='utf-8')) - L = ['#include "dispatch.h"', '#include "host.h"', '#include "layout.h"', ''] + L = [f'/* {GENERATED_MARKER}: module table, written by tools/make_game.py modules_c. Do not edit or commit. */', + '#include "dispatch.h"', '#include "host.h"', '#include "layout.h"', ''] for m in layout: n = m['name'] L += [f'extern const uint64_t {n}_fn_addrs[];', f'extern const GuestFn {n}_fn_ptrs[];',