2026-09-11 23:23:20 +02:00
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
Rewrite AetherDb over AetheriaStores and CultRecordRef
Cut 8b. AetherDb.Open composes GameData/Aetheria.cc through
AetheriaStores.Open, read-only unless clear-boss-hulls runs with apply;
save attaches GameData/run.cc when present and reads the SavedGame global.
- census, factions, station-fit, hardpoint-fit, loadout, settings,
settings-dump and clear-boss-hulls read references through the null-safe
Get(ref) and compare identity by record key (RefOf, from TryGetHandle).
Their output formats are unchanged so Cut 9 can compare them with the
Cut 0 captures.
- clear-boss-hulls lands every cleared faction in one Commit.
- The help line lists every command.
- Deleted: doctor, migrate-products, AetherDb.Save(), and
OpenWithNameFiles. The last was Cut 9's delete, but it needs the removed
multi-file store, and NameFile now routes to the catalog.
- FindRoot looks for Aetheria.Shared.csproj; AetherDB.msgpack leaves in
Cut 9.
It compiles. It cannot run until Cut 9 writes Aetheria.cc, so the pre-cut
captures do not apply to this cut.
Builds: Aetheria.Shared, AetherDb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:05:14 +02:00
|
|
|
using GameCult.Caching;
|
2026-09-11 23:23:20 +02:00
|
|
|
|
Rewrite AetherDb over AetheriaStores and CultRecordRef
Cut 8b. AetherDb.Open composes GameData/Aetheria.cc through
AetheriaStores.Open, read-only unless clear-boss-hulls runs with apply;
save attaches GameData/run.cc when present and reads the SavedGame global.
- census, factions, station-fit, hardpoint-fit, loadout, settings,
settings-dump and clear-boss-hulls read references through the null-safe
Get(ref) and compare identity by record key (RefOf, from TryGetHandle).
Their output formats are unchanged so Cut 9 can compare them with the
Cut 0 captures.
- clear-boss-hulls lands every cleared faction in one Commit.
- The help line lists every command.
- Deleted: doctor, migrate-products, AetherDb.Save(), and
OpenWithNameFiles. The last was Cut 9's delete, but it needs the removed
multi-file store, and NameFile now routes to the catalog.
- FindRoot looks for Aetheria.Shared.csproj; AetherDB.msgpack leaves in
Cut 9.
It compiles. It cannot run until Cut 9 writes Aetheria.cc, so the pre-cut
captures do not apply to this cut.
Builds: Aetheria.Shared, AetherDb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:05:14 +02:00
|
|
|
// Opens GameData/Aetheria.cc through AetheriaStores, the game's own store composition. The catalog attaches read-only
|
|
|
|
|
// unless a command writes it, so a command that only reads cannot write.
|
2026-09-11 23:23:20 +02:00
|
|
|
public sealed class AetherDb
|
|
|
|
|
{
|
|
|
|
|
public string Root { get; }
|
|
|
|
|
public CultCache Cache { get; }
|
|
|
|
|
|
Rewrite AetherDb over AetheriaStores and CultRecordRef
Cut 8b. AetherDb.Open composes GameData/Aetheria.cc through
AetheriaStores.Open, read-only unless clear-boss-hulls runs with apply;
save attaches GameData/run.cc when present and reads the SavedGame global.
- census, factions, station-fit, hardpoint-fit, loadout, settings,
settings-dump and clear-boss-hulls read references through the null-safe
Get(ref) and compare identity by record key (RefOf, from TryGetHandle).
Their output formats are unchanged so Cut 9 can compare them with the
Cut 0 captures.
- clear-boss-hulls lands every cleared faction in one Commit.
- The help line lists every command.
- Deleted: doctor, migrate-products, AetherDb.Save(), and
OpenWithNameFiles. The last was Cut 9's delete, but it needs the removed
multi-file store, and NameFile now routes to the catalog.
- FindRoot looks for Aetheria.Shared.csproj; AetherDB.msgpack leaves in
Cut 9.
It compiles. It cannot run until Cut 9 writes Aetheria.cc, so the pre-cut
captures do not apply to this cut.
Builds: Aetheria.Shared, AetherDb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:05:14 +02:00
|
|
|
private AetherDb(string root, bool catalogWritable, bool withRun)
|
2026-09-11 23:23:20 +02:00
|
|
|
{
|
|
|
|
|
Root = root;
|
|
|
|
|
var gameData = Path.Combine(root, "GameData");
|
Rewrite AetherDb over AetheriaStores and CultRecordRef
Cut 8b. AetherDb.Open composes GameData/Aetheria.cc through
AetheriaStores.Open, read-only unless clear-boss-hulls runs with apply;
save attaches GameData/run.cc when present and reads the SavedGame global.
- census, factions, station-fit, hardpoint-fit, loadout, settings,
settings-dump and clear-boss-hulls read references through the null-safe
Get(ref) and compare identity by record key (RefOf, from TryGetHandle).
Their output formats are unchanged so Cut 9 can compare them with the
Cut 0 captures.
- clear-boss-hulls lands every cleared faction in one Commit.
- The help line lists every command.
- Deleted: doctor, migrate-products, AetherDb.Save(), and
OpenWithNameFiles. The last was Cut 9's delete, but it needs the removed
multi-file store, and NameFile now routes to the catalog.
- FindRoot looks for Aetheria.Shared.csproj; AetherDB.msgpack leaves in
Cut 9.
It compiles. It cannot run until Cut 9 writes Aetheria.cc, so the pre-cut
captures do not apply to this cut.
Builds: Aetheria.Shared, AetherDb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:05:14 +02:00
|
|
|
Cache = AetheriaStores.Open(
|
|
|
|
|
Path.Combine(gameData, "Aetheria.cc"),
|
|
|
|
|
runPath: withRun ? Path.Combine(gameData, "run.cc") : null,
|
|
|
|
|
catalogWritable: catalogWritable);
|
2026-09-11 23:23:20 +02:00
|
|
|
}
|
|
|
|
|
|
2026-10-10 06:53:03 +02:00
|
|
|
// With no root given, walks up from the working directory to the game folder: the first folder whose GameData holds Aetheria.cc
|
Rewrite AetherDb over AetheriaStores and CultRecordRef
Cut 8b. AetherDb.Open composes GameData/Aetheria.cc through
AetheriaStores.Open, read-only unless clear-boss-hulls runs with apply;
save attaches GameData/run.cc when present and reads the SavedGame global.
- census, factions, station-fit, hardpoint-fit, loadout, settings,
settings-dump and clear-boss-hulls read references through the null-safe
Get(ref) and compare identity by record key (RefOf, from TryGetHandle).
Their output formats are unchanged so Cut 9 can compare them with the
Cut 0 captures.
- clear-boss-hulls lands every cleared faction in one Commit.
- The help line lists every command.
- Deleted: doctor, migrate-products, AetherDb.Save(), and
OpenWithNameFiles. The last was Cut 9's delete, but it needs the removed
multi-file store, and NameFile now routes to the catalog.
- FindRoot looks for Aetheria.Shared.csproj; AetherDB.msgpack leaves in
Cut 9.
It compiles. It cannot run until Cut 9 writes Aetheria.cc, so the pre-cut
captures do not apply to this cut.
Builds: Aetheria.Shared, AetherDb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:05:14 +02:00
|
|
|
public static AetherDb Open(bool catalogWritable = false, bool withRun = false, string root = null) =>
|
|
|
|
|
new AetherDb(root ?? FindRoot(), catalogWritable, withRun);
|
Clear dangling boss hull links, and stop the tool writing on read
Eight factions pointed at one boss hull GUID that no longer resolves,
shared wreckage from the database loss. PlaceFactionsMain gives a boss zone
to every faction carrying a BossHull, so each dangling link claimed a
chokepoint that could never spawn a boss.
AetherDb.Open no longer registers the name file store. CultCache subscribes
Add to a store EntryAdded, MultiFileBackingStore.PullAll re-emits what it
loads, and Add pushes to that type store, whose Push writes a file: opening
the cache rewrote all twelve name files, 4.4 MB, on every command. They were
byte identical, and it only surfaced as an error because Unity had one of
them memory mapped. Name files now load only on request, and the scope doc
records the underlying smell.
Adds commands: factions, clear-boss-hulls, save, loadout (runs the real
LoadoutGenerator against every hull), hardpoint-fit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 02:05:33 +02:00
|
|
|
|
Rewrite AetherDb over AetheriaStores and CultRecordRef
Cut 8b. AetherDb.Open composes GameData/Aetheria.cc through
AetheriaStores.Open, read-only unless clear-boss-hulls runs with apply;
save attaches GameData/run.cc when present and reads the SavedGame global.
- census, factions, station-fit, hardpoint-fit, loadout, settings,
settings-dump and clear-boss-hulls read references through the null-safe
Get(ref) and compare identity by record key (RefOf, from TryGetHandle).
Their output formats are unchanged so Cut 9 can compare them with the
Cut 0 captures.
- clear-boss-hulls lands every cleared faction in one Commit.
- The help line lists every command.
- Deleted: doctor, migrate-products, AetherDb.Save(), and
OpenWithNameFiles. The last was Cut 9's delete, but it needs the removed
multi-file store, and NameFile now routes to the catalog.
- FindRoot looks for Aetheria.Shared.csproj; AetherDB.msgpack leaves in
Cut 9.
It compiles. It cannot run until Cut 9 writes Aetheria.cc, so the pre-cut
captures do not apply to this cut.
Builds: Aetheria.Shared, AetherDb.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:05:14 +02:00
|
|
|
public static string FindRoot()
|
2026-09-11 23:23:20 +02:00
|
|
|
{
|
|
|
|
|
for (var dir = new DirectoryInfo(Environment.CurrentDirectory); dir != null; dir = dir.Parent)
|
2026-10-10 06:53:03 +02:00
|
|
|
if (File.Exists(Path.Combine(dir.FullName, "GameData", "Aetheria.cc")))
|
2026-09-11 23:23:20 +02:00
|
|
|
return dir.FullName;
|
2026-10-10 06:53:03 +02:00
|
|
|
throw new DirectoryNotFoundException("Run from a folder whose GameData holds Aetheria.cc.");
|
2026-09-11 23:23:20 +02:00
|
|
|
}
|
|
|
|
|
}
|