| 347 | //--- |
| 348 | |
| 349 | static 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 | |
| 391 | static void Snapshot_LoadState_v2(void) |
| 392 | { |
no test coverage detected