mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 23:59:59 -04:00
Read low_end_gpu's and shader_carry's off words the same in the low-end mode and in make_game.py as in the game's other readers.
The review of the commit that taught nx2navi.ini's readers off, false and no found three readers it left behind. cfg.c lowend_of reads low_end_gpu through raw_get, which skips switch_word, and still took anything but "0" as on: with "low_end_gpu = off" cfg_get, cfg_bool and the menu said off while cfg_low_end_active() was 1, so the mode's defaults and its LOWEND_ONLY keys stayed in effect, and F-7's check, which now accepts the word, logged nothing. lowend_of now takes the value through switch_of as cfg_bool does: 0 and the off words are off, anything else set is on (an environment value "0 ; x" stays on, as cfg_bool reads it). tools/make_game.py read the file on its own too: shader_carry took only "0" as off and kept a comment in the value, so with "shader_carry = off" or "shader_carry = 0 ; note" an update skipped the full shader preparation and left the shaders to a game that no longer carries them over; guest_opt_ini took low_end_gpu as on for anything but "" and "0". shader_carry now reads the switch as the game does (the environment wins over the file and is taken as written, the file's last line with a value wins, a comment after a blank is cut unless the value is in double quotes, make_game.py ini_choice, and 0, off, false and no in any case are off); guest_opt_ini keeps its cut and takes the same words as off. tests/cfg_parse_check gains a lowend case (low_end_gpu = Off, = 0 ; note and = yes from the file, FALSE and "0 ; x" from the environment; two of them fail on the old lowend_of), and launcher_test's MakeGameTest two tests of shader_carry's and guest_opt_ini's reading, which fail on the old make_game.py. cfg_rows_check reports 0 problems, and the -Wall compile of cfg.c shows no warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,8 @@ for what it links with. What the readers get and what the log says about the val
|
||||
it is part of the value; at most 16 lines, then a count;
|
||||
- switches written as words (cfg.c switch_word, cfg_bool): false, off and no in any case read as 0 and true, on and
|
||||
yes as 1 through cfg_get, cfg_bool and cfg_int, from the file and from the environment, with no line about them;
|
||||
the low-end mode's switch (cfg.c lowend_of, read apart from cfg_get) takes the same words, so "low_end_gpu = off"
|
||||
leaves the mode and its keys off;
|
||||
- values outside their rows' sets (cfg.c check_value): a 0|1 switch with another value, a number outside its range, a
|
||||
word that is none of the menu's choices, each named with its line; none for a file whose values fit, nor for a list
|
||||
with numbers in it (the menu's presets); at most 16 lines, then a count;
|
||||
@@ -185,6 +187,17 @@ def main():
|
||||
'a file with 601 keys: one line at load from line 513 on', out)
|
||||
check(rc == 0 and len(set_lines) == 1 and 'VK_PRESENT is not kept' in set_lines[0],
|
||||
'two menu changes past a full table: one line', out)
|
||||
# the low-end mode's switch, read apart from cfg_get (cfg.c lowend_of): the same words as cfg_bool, from the file
|
||||
# and from the environment; the mode is decided once per process, so each value is its own run
|
||||
for text, extra, want in (
|
||||
('low_end_gpu = Off\n', None, "low_end 0 bool 0 mesh_emulation '(unset)'"),
|
||||
('low_end_gpu = 0 ; note\n', None, "low_end 0 bool 0 mesh_emulation '(unset)'"),
|
||||
('low_end_gpu = yes\n', None, "low_end 1 bool 1 mesh_emulation '1'"),
|
||||
('; nothing\n', {'NX2NAVI_LOW_END_GPU': 'FALSE'}, "low_end 0 bool 0 mesh_emulation '(unset)'"),
|
||||
('; nothing\n', {'NX2NAVI_LOW_END_GPU': '0 ; x'}, "low_end 1 bool 1 mesh_emulation '1'")):
|
||||
rc, out = run(exe, env, 'lowend', text, work, extra)
|
||||
what = text.strip() if extra is None else f"the environment's {extra['NX2NAVI_LOW_END_GPU']!r}"
|
||||
check(rc == 0 and f'got: {want}' in out, f'low end: {what}: {want}', out)
|
||||
rc, out = run(exe, env, 'norow', CLEAN, work, {'NX2NAVI_NO_ROW_CHECK': 'abc'})
|
||||
check(rc == 0 and 'got: cfg_int 0 cfg_double 0' in out, 'cfg_int of a set, unparsable key without a row: 0', out)
|
||||
print(f'cfg_parse_check: {"FAILED" if bad else "ok"}')
|
||||
|
||||
Reference in New Issue
Block a user