--legacy flag is not reaching the case loaderargv = [.../program.exe | --legacy | --debug] Loaded 98 cases from .../bin/linux/cases.csv
cases.csv has 98 rows — that is the current-mode loader running. The legacy
loader prints Loaded N legacy cases from …, so LoadLegacyCasesFromCsv never ran.
The map looks unchanged for the same reason: the app is in normal mode end to end.
So this is not a map-drawing bug. Fix the flag first, then re-check the map.
Program.cs sets AppMode.Legacy after the widgets are built, so
SoundWindow's constructor already ran with Legacy == false.Program.cs step was never applied — argv is printed by pre-existing arg-parsing
code, which proves an arg parser exists but not that ours was added to it.SoundWindow still calls CaseDefinition.LoadCasesFromCsv(AppFile("cases.csv"))
instead of the AppMode version.program/ but files resolve
to program/bin/linux/ — cases_old.csv, map_old/, sound_old/ must be in
bin/linux/, not the repo root.Report back, don't fix yet:
Program.cs Main, in order, from the first line to
Application.Run(). Mark exactly where AppMode.Legacy is assigned, or state that it
is absent.SoundWindow constructor lines that load _allCases.ls -la bin/linux/ and report whether cases_old.csv, map_old/, sound_old/
exist there.AppMode.cs and RegionSound.cs are in the build command actually
used to produce bin/linux/program.exe (check the Makefile / build script, not just
the files on disk).Add these three log lines so the mode is never ambiguous again.
In Program.cs, immediately after the AppMode.Legacy assignment:
Console.WriteLine("AppMode.Legacy = " + AppMode.Legacy +
" cases=" + AppMode.CasesCsv);
In the SoundWindow constructor, as the first line:
Console.WriteLine("SoundWindow ctor: AppMode.Legacy = " + AppMode.Legacy);
In MapWindow.ShowCase, after _case is assigned:
Logger.Write("map", "ShowCase legacy=" + AppMode.Legacy +
" regions=" + _regions.Count);
AppMode.Legacy must be assigned before Application.Init() and before any
Builder / window / SoundWindow construction. If the existing parser handles
--debug, add --legacy to that same parser and move the whole parse block to the top
of Main, above Application.Init(). Do not add a second parser.
Target shape:
static void Main(string[] args)
{
Console.WriteLine("argv = [" + string.Join(" | ", args) + "]");
// --- flags first, before any UI construction ---
AppMode.Legacy = Array.IndexOf(args, "--legacy") >= 0;
// ... existing --debug handling stays here too ...
Console.WriteLine("AppMode.Legacy = " + AppMode.Legacy +
" cases=" + AppMode.CasesCsv);
Application.Init();
// ... existing window construction ...
Application.Run();
}
If Main already lives in a different file or class than expected, edit that one — find
it by searching for the argv = [ line that appears in the log.
SoundWindow uses AppModeThe constructor must read:
_allCases = AppMode.Legacy
? CaseDefinition.LoadLegacyCasesFromCsv(AppMode.CasesCsv)
: CaseDefinition.LoadCasesFromCsv(AppMode.CasesCsv);
If a literal "cases.csv" string remains anywhere in SoundWindow, replace it.
Then grep the whole repo for "cases.csv" and report every remaining hit — another
class may be loading the CSV independently.
SoundWindow.AppFile resolves next to the assembly, which is bin/linux/. If the build
copies cases.csv, map/, and sound/ there, make it copy cases_old.csv,
map_old/, and sound_old/ the same way. Update the Makefile / build script rather
than copying by hand, and say which file you changed.
Run:
mono ./bin/linux/program.exe --legacy --debug
Expected, in this order:
AppMode.Legacy = True cases=.../bin/linux/cases_old.csv SoundWindow ctor: AppMode.Legacy = True Loaded 28 legacy cases from .../bin/linux/cases_old.csv
Only once you see Loaded 28 legacy cases, select a case and check the log for:
[map] region 心音1: MAP100.png + SND100.wav [map] ... [map] N/7 regions active [map] ShowCase legacy=True regions=N
Report which of these appear. Then, and only then, we debug the drawing:
regions=0 → the region files aren't resolving; paste the region … map missing
lines.regions>0 but the map looks identical → the ShowCase branch from Step 9 of the
original task wasn't applied, or _map is being overwritten after it by a later
LoadMap(MapPathForView()) call. Paste the whole ShowCase method.DrawRegionMeters isn't being called from OnMapDrawn.AppMode.Legacy to true, by hardcoding
cases_old.csv, or by calling the legacy loader unconditionally.