| 501 | //----------------------------------------------------------------------------- |
| 502 | |
| 503 | void Snapshot_SaveState(void) |
| 504 | { |
| 505 | LogFileOutput("Saving Save-State to %s\n", g_strSaveStatePathname.c_str()); |
| 506 | try |
| 507 | { |
| 508 | YamlSaveHelper yamlSaveHelper(g_strSaveStatePathname); |
| 509 | yamlSaveHelper.FileHdr(SS_FILE_VER); |
| 510 | |
| 511 | // Unit: Apple2 |
| 512 | { |
| 513 | yamlSaveHelper.UnitHdr(GetSnapshotUnitApple2Name(), UNIT_APPLE2_VER); |
| 514 | YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE); |
| 515 | |
| 516 | yamlSaveHelper.Save("%s: %s\n", SS_YAML_KEY_MODEL, GetApple2TypeAsString().c_str()); |
| 517 | CpuSaveSnapshot(yamlSaveHelper); |
| 518 | JoySaveSnapshot(yamlSaveHelper); |
| 519 | KeybSaveSnapshot(yamlSaveHelper); |
| 520 | SpkrSaveSnapshot(yamlSaveHelper); |
| 521 | GetVideo().VideoSaveSnapshot(yamlSaveHelper); |
| 522 | MemSaveSnapshot(yamlSaveHelper); |
| 523 | } |
| 524 | |
| 525 | // Unit: Aux slot |
| 526 | MemSaveSnapshotAux(yamlSaveHelper); |
| 527 | |
| 528 | // Unit: Slots |
| 529 | { |
| 530 | yamlSaveHelper.UnitHdr(GetSnapshotUnitSlotsName(), UNIT_SLOTS_VER); |
| 531 | YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE); |
| 532 | |
| 533 | GetCardMgr().SaveSnapshot(yamlSaveHelper); |
| 534 | } |
| 535 | |
| 536 | // Unit: Game I/O Connector |
| 537 | if (GetCopyProtectionDongleType() != DT_EMPTY) |
| 538 | { |
| 539 | yamlSaveHelper.UnitHdr(GetSnapshotUnitGameIOConnectorName(), UNIT_GAME_IO_CONNECTOR_VER); |
| 540 | YamlSaveHelper::Label unit(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE); |
| 541 | |
| 542 | CopyProtectionDongleSaveSnapshot(yamlSaveHelper); |
| 543 | } |
| 544 | |
| 545 | // Miscellaneous |
| 546 | if (MemHasNoSlotClock()) |
| 547 | { |
| 548 | yamlSaveHelper.UnitHdr(GetSnapshotUnitMiscName(), UNIT_MISC_VER); |
| 549 | YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE); |
| 550 | |
| 551 | NoSlotClockSaveSnapshot(yamlSaveHelper); |
| 552 | } |
| 553 | } |
| 554 | catch(const std::exception & szMessage) |
| 555 | { |
| 556 | GetFrame().FrameMessageBox( |
| 557 | szMessage.what(), |
| 558 | "Save State", |
| 559 | MB_ICONEXCLAMATION | MB_SETFOREGROUND); |
| 560 | } |
no test coverage detected