feat(studio): integrate memcard persistence and headless controls
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:
+3
-1
@@ -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({
|
||||
|
||||
+7
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-1
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user