@@ -159,9 +159,6 @@ Amiga::getOption(Opt option) const
159159        case  Opt::AMIGA_VSYNC:           return  (i64 )config.vsync ;
160160        case  Opt::AMIGA_SPEED_BOOST:     return  (i64 )config.speedBoost ;
161161        case  Opt::AMIGA_RUN_AHEAD:       return  (i64 )config.runAhead ;
162-         case  Opt::AMIGA_SNAP_AUTO:       return  (i64 )config.autoSnapshots ;
163-         case  Opt::AMIGA_SNAP_DELAY:      return  (i64 )config.snapshotDelay ;
164-         case  Opt::AMIGA_SNAP_COMPRESSOR: return  (i64 )config.snapshotCompressor ;
165162        case  Opt::AMIGA_WS_COMPRESSION:  return  (i64 )config.compressWorkspaces ;
166163
167164        default :
@@ -209,25 +206,7 @@ Amiga::checkOption(Opt opt, i64 value)
209206                throw  AppError (Fault::OPT_INV_ARG, " -7...7" 
210207            }
211208            return ;
212-             
213-         case  Opt::AMIGA_SNAP_AUTO:
214-             
215-             return ;
216-             
217-         case  Opt::AMIGA_SNAP_DELAY:
218-             
219-             if  (value < 10  || value > 3600 ) {
220-                 throw  AppError (Fault::OPT_INV_ARG, " 10...3600" 
221-             }
222-             return ;
223-             
224-         case  Opt::AMIGA_SNAP_COMPRESSOR:
225-             
226-             if  (!CompressorEnum::isValid (value)) {
227-                 throw  AppError (Fault::OPT_INV_ARG, CompressorEnum::keyList ());
228-             }
229-             return ;
230-             
209+ 
231210        case  Opt::AMIGA_WS_COMPRESSION:
232211
233212            return ;
@@ -275,23 +254,6 @@ Amiga::setOption(Opt option, i64 value)
275254
276255            config.runAhead  = isize (value);
277256            return ;
278-             
279-         case  Opt::AMIGA_SNAP_AUTO:
280-             
281-             config.autoSnapshots  = bool (value);
282-             scheduleNextSnpEvent ();
283-             return ;
284-             
285-         case  Opt::AMIGA_SNAP_DELAY:
286-             
287-             config.snapshotDelay  = isize (value);
288-             scheduleNextSnpEvent ();
289-             return ;
290-             
291-         case  Opt::AMIGA_SNAP_COMPRESSOR:
292-             
293-             config.snapshotCompressor  = Compressor (value);
294-             return ;
295257
296258        case  Opt::AMIGA_WS_COMPRESSION:
297259
@@ -1149,9 +1111,39 @@ Amiga::takeSnapshot()
11491111    return  result;
11501112}
11511113
1114+ MediaFile *
1115+ Amiga::takeSnapshot (Compressor compressor, isize delay, bool  repeat)
1116+ {
1117+     if  (delay != 0 ) {
1118+ 
1119+         i64  payload = (i64 )compressor << 24  | repeat << 16  | delay;
1120+         agnus.scheduleRel <SLOT_SNP>(Amiga::sec (delay), SNP_TAKE, payload);
1121+         return  nullptr ;
1122+     }
1123+ 
1124+     //  Take the snapshot
1125+     Snapshot *result = new  Snapshot (*this );
1126+ 
1127+     //  Compress the snapshot if requested
1128+     result->compress (compressor);
1129+ 
1130+     return  result;
1131+ }
1132+ 
11521133void 
11531134Amiga::serviceSnpEvent (EventID eventId)
11541135{
1136+     //  Ignore the run-ahead instance
1137+     if  (objid != 0 ) { agnus.cancel <SLOT_SNP>(); return ; }
1138+ 
1139+     //  Take snapshot and hand it over to the GUI
1140+     auto  *snapshot = takeSnapshot (Compressor (agnus.data [SLOT_SNP] >> 24 ));
1141+     msgQueue.put ( Message { .type  = Msg::SNAPSHOT_TAKEN, .snapshot  = { snapshot } } );
1142+ 
1143+     //  Schedule the next event
1144+     scheduleNextSnpEvent ();
1145+ 
1146+     /* 
11551147    // Check for the main instance (ignore the run-ahead instance) 
11561148    if (objid == 0) { 
11571149
@@ -1161,16 +1153,17 @@ Amiga::serviceSnpEvent(EventID eventId)
11611153
11621154    // Schedule the next event 
11631155    scheduleNextSnpEvent(); 
1156+     */  
11641157}
11651158
11661159void 
11671160Amiga::scheduleNextSnpEvent ()
11681161{
1169-     auto  snapshots  = emulator. get (Opt::AMIGA_SNAP_AUTO );
1170-     auto  delay = emulator. get (Opt::AMIGA_SNAP_DELAY );
1162+     auto  repeat  = bool (agnus. data [SLOT_SNP] >>  16  &  0xFF );
1163+     auto  delay = double (agnus. data [SLOT_SNP] &  0xFFFF );
11711164
1172-     if  (snapshots ) {
1173-         agnus.scheduleRel <SLOT_SNP>(SEC ( double ( delay)) , SNP_TAKE);
1165+     if  (repeat ) {
1166+         agnus.scheduleRel <SLOT_SNP>(Amiga::sec ( delay), SNP_TAKE, agnus. data [SLOT_SNP] );
11741167    } else  {
11751168        agnus.cancel <SLOT_SNP>();
11761169    }
@@ -1185,13 +1178,8 @@ Amiga::loadSnapshot(const fs::path &path)
11851178void 
11861179Amiga::loadSnapshot (const  MediaFile &file)
11871180{
1188-     const  Snapshot &snapshot = dynamic_cast <const  Snapshot &>(file);
1189-     loadSnapshot (snapshot);
1190- }
1181+     const  Snapshot &snap = dynamic_cast <const  Snapshot &>(file);
11911182
1192- void 
1193- Amiga::loadSnapshot (const  Snapshot &snap)
1194- {
11951183    //  Make a copy so we can modify the snapshot
11961184    Snapshot snapshot (snap);
11971185
0 commit comments