MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / ParseUnit

Function ParseUnit

source/SaveState.cpp:349–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347//---
348
349static void ParseUnit(void)
350{
351 yamlHelper.GetMapStartEvent();
352
353 YamlLoadHelper yamlLoadHelper(yamlHelper);
354
355 std::string unit = yamlLoadHelper.LoadString(SS_YAML_KEY_TYPE);
356 UINT unitVersion = yamlLoadHelper.LoadUint(SS_YAML_KEY_VERSION);
357
358 if (!yamlLoadHelper.GetSubMap(std::string(SS_YAML_KEY_STATE)))
359 throw std::runtime_error(SS_YAML_KEY_UNIT ": Expected sub-map name: " SS_YAML_KEY_STATE);
360
361 if (unit == GetSnapshotUnitApple2Name())
362 {
363 ParseUnitApple2(yamlLoadHelper, unitVersion);
364
365 if (unitVersion < 6) MemInsertNoSlotClock(); // NSC always inserted
366 else MemRemoveNoSlotClock(); // NSC only add if there's a misc unit
367 }
368 else if (unit == MemGetSnapshotUnitAuxSlotName())
369 {
370 MemLoadSnapshotAux(yamlLoadHelper, unitVersion);
371 }
372 else if (unit == GetSnapshotUnitSlotsName())
373 {
374 ParseSlots(yamlLoadHelper, unitVersion);
375 }
376 else if (unit == GetSnapshotUnitGameIOConnectorName())
377 {
378 CopyProtectionDongleLoadSnapshot(yamlLoadHelper, unitVersion, UNIT_GAME_IO_CONNECTOR_VER);
379 }
380 else if (unit == GetSnapshotUnitMiscName())
381 {
382 // NB. could extend for other misc devices - see how ParseSlots() calls GetMapNextSlotNumber()
383 NoSlotClockLoadSnapshot(yamlLoadHelper);
384 }
385 else
386 {
387 throw std::runtime_error(SS_YAML_KEY_UNIT ": Unknown type: " + unit);
388 }
389}
390
391static void Snapshot_LoadState_v2(void)
392{

Callers 1

Snapshot_LoadState_v2Function · 0.85

Calls 11

ParseUnitApple2Function · 0.85
MemInsertNoSlotClockFunction · 0.85
MemRemoveNoSlotClockFunction · 0.85
MemLoadSnapshotAuxFunction · 0.85
ParseSlotsFunction · 0.85
NoSlotClockLoadSnapshotFunction · 0.85
GetMapStartEventMethod · 0.80
LoadStringMethod · 0.80
LoadUintMethod · 0.80
GetSubMapMethod · 0.45

Tested by

no test coverage detected