feat(studio): integrate memcard persistence and headless controls
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good

Persist cartridge identity and slot configuration, add MemcardBoot and the MemcardBuffer SDK, and consume the runtime's negotiated memcard host controls with protected teardown.

Qualify save/reopen and version upgrades through distinct configured runtime processes. Include specs, examples, regression evidence and the consolidated discussion lesson.
This commit is contained in:
2026-10-30 11:01:02 +00:00
parent 3a3417eb44
commit 1d8b8c2101
110 changed files with 6502 additions and 85 deletions
@@ -11,7 +11,9 @@ public record PrometeuManifestDTO(
String language,
String stdlib,
String target,
List<DependencyDeclaration> dependencies) {
List<DependencyDeclaration> dependencies,
@JsonProperty("app_id") com.fasterxml.jackson.databind.JsonNode appId,
@JsonProperty("memcard_slots") com.fasterxml.jackson.databind.JsonNode memcardSlots) {
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
@JsonSubTypes({
@@ -10,5 +10,11 @@ public record PrometeuManifest(
String language,
int stdlib,
AppMode target,
ReadOnlyList<DependencyReference> dependencies) {
ReadOnlyList<DependencyReference> dependencies,
Long appId,
Integer memcardSlots) {
public PrometeuManifest(String name, String version, String language, int stdlib, AppMode target,
ReadOnlyList<DependencyReference> dependencies) {
this(name, version, language, stdlib, target, dependencies, null, null);
}
}
@@ -63,11 +63,29 @@ public final class PrometeuManifestUtils {
? FrontendRegistryService.getDefaultProvider().specification().getLanguageId()
: dto.language();
final var dependencies = DependencyResolver.resolveDependencies(mainProjectRootPathCanon, dto.dependencies(), issuesLocal);
final var appId = optionalInteger(dto.appId(), "app_id", 0, 0xffff_ffffL, issuesLocal);
final var slots = optionalInteger(dto.memcardSlots(), "memcard_slots", 1, 64, issuesLocal);
if (ReadOnlyCollection.isNotEmpty(issuesLocal)) {
issues.merge(issuesLocal);
return Optional.empty();
}
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), target, ReadOnlyList.wrap(dependencies)));
return Optional.of(new PrometeuManifest(dto.name(), dto.version(), language, stdlibMaybe.getAsInt(), target,
ReadOnlyList.wrap(dependencies), appId, slots == null ? null : slots.intValue()));
}
private static Long optionalInteger(com.fasterxml.jackson.databind.JsonNode value, String name,
long min, long max, BuildingIssueSink issues) {
if (value == null) return null;
if (!value.isIntegralNumber() || !value.canConvertToLong() || value.longValue() < min || value.longValue() > max) {
issues.report(b -> b.error(true).message("[DEPS]: '" + name + "' must be an integer in " + min + ".." + max));
return null;
}
return value.longValue();
}
public static Integer memcardSlots(Path manifestPath, BuildingIssueSink issues) {
Long slots = optionalInteger(read(manifestPath).memcardSlots(), "memcard_slots", 1, 64, issues);
return slots == null ? null : slots.intValue();
}
private static OptionalInt parseStdlib(