forked from snes9xgit/snes9x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapshot.cpp
2341 lines (1992 loc) · 60.3 KB
/
snapshot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***********************************************************************************
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
(c) Copyright 1996 - 2002 Gary Henderson ([email protected]),
Jerremy Koot ([email protected])
(c) Copyright 2002 - 2004 Matthew Kendora
(c) Copyright 2002 - 2005 Peter Bortas ([email protected])
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
(c) Copyright 2001 - 2006 John Weidman ([email protected])
(c) Copyright 2002 - 2006 funkyass ([email protected]),
Kris Bleakley ([email protected])
(c) Copyright 2002 - 2010 Brad Jorsch ([email protected]),
Nach ([email protected]),
(c) Copyright 2002 - 2011 zones ([email protected])
(c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2016 BearOso,
OV2
(c) Copyright 2011 - 2016 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom,
zones
C4 x86 assembler and some C emulation code
(c) Copyright 2000 - 2003 _Demo_ ([email protected]),
Nach,
zsKnight ([email protected])
C4 C++ code
(c) Copyright 2003 - 2006 Brad Jorsch,
Nach
DSP-1 emulator code
(c) Copyright 1998 - 2006 _Demo_,
Andreas Naive ([email protected]),
Gary Henderson,
Ivar ([email protected]),
John Weidman,
Kris Bleakley,
Matthew Kendora,
Nach,
neviksti ([email protected])
DSP-2 emulator code
(c) Copyright 2003 John Weidman,
Kris Bleakley,
Lord Nightmare ([email protected]),
Matthew Kendora,
neviksti
DSP-3 emulator code
(c) Copyright 2003 - 2006 John Weidman,
Kris Bleakley,
Lancer,
z80 gaiden
DSP-4 emulator code
(c) Copyright 2004 - 2006 Dreamer Nom,
John Weidman,
Kris Bleakley,
Nach,
z80 gaiden
OBC1 emulator code
(c) Copyright 2001 - 2004 zsKnight,
pagefault ([email protected]),
Kris Bleakley
Ported from x86 assembler to C by sanmaiwashi
SPC7110 and RTC C++ emulator code used in 1.39-1.51
(c) Copyright 2002 Matthew Kendora with research by
zsKnight,
John Weidman,
Dark Force
SPC7110 and RTC C++ emulator code used in 1.52+
(c) Copyright 2009 byuu,
neviksti
S-DD1 C emulator code
(c) Copyright 2003 Brad Jorsch with research by
Andreas Naive,
John Weidman
S-RTC C emulator code
(c) Copyright 2001 - 2006 byuu,
John Weidman
ST010 C++ emulator code
(c) Copyright 2003 Feather,
John Weidman,
Kris Bleakley,
Matthew Kendora
Super FX x86 assembler emulator code
(c) Copyright 1998 - 2003 _Demo_,
pagefault,
zsKnight
Super FX C emulator code
(c) Copyright 1997 - 1999 Ivar,
Gary Henderson,
John Weidman
Sound emulator code used in 1.5-1.51
(c) Copyright 1998 - 2003 Brad Martin
(c) Copyright 1998 - 2006 Charles Bilyue'
Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green ([email protected])
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt ([email protected])
2xSaI filter
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
HQ2x, HQ3x, HQ4x filters
(c) Copyright 2003 Maxim Stepin ([email protected])
NTSC filter
(c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code
(c) Copyright 2004 - 2016 BearOso
Win32 GUI code
(c) Copyright 2003 - 2006 blip,
funkyass,
Matthew Kendora,
Nach,
nitsuja
(c) Copyright 2009 - 2016 OV2
Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2016 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in
individual files.
Snes9x homepage: http://www.snes9x.com/
Permission to use, copy, modify and/or distribute Snes9x in both binary
and source form, for non-commercial purposes, is hereby granted without
fee, providing that this license information and copyright notice appear
with all copies and any derived work.
This software is provided 'as-is', without any express or implied
warranty. In no event shall the authors be held liable for any damages
arising from the use of this software or it's derivatives.
Snes9x is freeware for PERSONAL USE only. Commercial users should
seek permission of the copyright holders first. Commercial use includes,
but is not limited to, charging money for Snes9x or software derived from
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
using Snes9x as a promotion for your commercial product.
The copyright holders request that bug fixes and improvements to the code
should be forwarded to them so everyone can benefit from the modifications
in future versions.
Super NES and Super Nintendo Entertainment System are trademarks of
Nintendo Co., Limited and its subsidiary companies.
***********************************************************************************/
#include <assert.h>
#include "snes9x.h"
#include "memmap.h"
#include "dma.h"
#include "apu/apu.h"
#include "fxinst.h"
#include "fxemu.h"
#include "sdd1.h"
#include "srtc.h"
#include "snapshot.h"
#include "controls.h"
#include "movie.h"
#include "display.h"
#include "language.h"
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
typedef struct
{
int offset;
int offset2;
int size;
int type;
uint16 debuted_in;
uint16 deleted_in;
const char *name;
} FreezeData;
enum
{
INT_V,
uint8_ARRAY_V,
uint16_ARRAY_V,
uint32_ARRAY_V,
uint8_INDIR_ARRAY_V,
uint16_INDIR_ARRAY_V,
uint32_INDIR_ARRAY_V,
POINTER_V
};
#define COUNT(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
#define Offset(field, structure) ((int) (((char *) (&(((structure) NULL)->field))) - ((char *) NULL)))
#define OFFSET(f) Offset(f, STRUCT *)
#define DUMMY(f) Offset(f, struct Obsolete *)
#define DELETED(f) (-1)
#define INT_ENTRY(save_version_introduced, field) \
{ \
OFFSET(field), \
0, \
sizeof(((STRUCT *) NULL)->field), \
INT_V, \
save_version_introduced, \
9999, \
#field \
}
#define ARRAY_ENTRY(save_version_introduced, field, count, elemType) \
{ \
OFFSET(field), \
0, \
count, \
elemType, \
save_version_introduced, \
9999, \
#field \
}
#define POINTER_ENTRY(save_version_introduced, field, relativeToField) \
{ \
OFFSET(field), \
OFFSET(relativeToField), \
4, \
POINTER_V, \
save_version_introduced, \
9999, \
#field \
}
#define OBSOLETE_INT_ENTRY(save_version_introduced, save_version_removed, field) \
{ \
DUMMY(field), \
0, \
sizeof(((struct Obsolete *) NULL)->field), \
INT_V, \
save_version_introduced, \
save_version_removed, \
#field \
}
#define OBSOLETE_ARRAY_ENTRY(save_version_introduced, save_version_removed, field, count, elemType) \
{ \
DUMMY(field), \
0, \
count, \
elemType, \
save_version_introduced, \
save_version_removed, \
#field \
}
#define OBSOLETE_POINTER_ENTRY(save_version_introduced, save_version_removed, field, relativeToField) \
{ \
DUMMY(field), \
DUMMY(relativeToField), \
4, \
POINTER_V, \
save_version_introduced, \
save_version_removed, \
#field \
}
#define DELETED_INT_ENTRY(save_version_introduced, save_version_removed, field, size) \
{ \
DELETED(field), \
0, \
size, \
INT_V, \
save_version_introduced, \
save_version_removed, \
#field \
}
#define DELETED_ARRAY_ENTRY(save_version_introduced, save_version_removed, field, count, elemType) \
{ \
DELETED(field), \
0, \
count, \
elemType, \
save_version_introduced, \
save_version_removed, \
#field \
}
#define DELETED_POINTER_ENTRY(save_version_introduced, save_version_removed, field, relativeToField) \
{ \
DELETED(field), \
DELETED(relativeToField), \
4, \
POINTER_V, \
save_version_introduced, \
save_version_removed, \
#field \
}
struct SDMASnapshot
{
struct SDMA dma[8];
};
struct SnapshotMovieInfo
{
uint32 MovieInputDataSize;
};
struct SnapshotScreenshotInfo
{
uint16 Width;
uint16 Height;
uint8 Interlaced;
uint8 Data[MAX_SNES_WIDTH * MAX_SNES_HEIGHT * 3];
};
static struct Obsolete
{
uint8 CPU_IRQActive;
} Obsolete;
#define STRUCT struct SCPUState
static FreezeData SnapCPU[] =
{
INT_ENTRY(6, Cycles),
INT_ENTRY(6, PrevCycles),
INT_ENTRY(6, V_Counter),
INT_ENTRY(6, Flags),
OBSOLETE_INT_ENTRY(6, 7, CPU_IRQActive),
INT_ENTRY(6, IRQPending),
INT_ENTRY(6, MemSpeed),
INT_ENTRY(6, MemSpeedx2),
INT_ENTRY(6, FastROMSpeed),
INT_ENTRY(6, InDMA),
INT_ENTRY(6, InHDMA),
INT_ENTRY(6, InDMAorHDMA),
INT_ENTRY(6, InWRAMDMAorHDMA),
INT_ENTRY(6, HDMARanInDMA),
INT_ENTRY(6, WhichEvent),
INT_ENTRY(6, NextEvent),
INT_ENTRY(6, WaitingForInterrupt),
DELETED_INT_ENTRY(6, 7, WaitAddress, 4),
DELETED_INT_ENTRY(6, 7, WaitCounter, 4),
DELETED_INT_ENTRY(6, 7, PBPCAtOpcodeStart, 4),
INT_ENTRY(7, NMILine),
INT_ENTRY(7, IRQLine),
INT_ENTRY(7, IRQTransition),
INT_ENTRY(7, IRQLastState),
INT_ENTRY(7, IRQExternal)
};
#undef STRUCT
#define STRUCT struct SRegisters
static FreezeData SnapRegisters[] =
{
INT_ENTRY(6, PB),
INT_ENTRY(6, DB),
INT_ENTRY(6, P.W),
INT_ENTRY(6, A.W),
INT_ENTRY(6, D.W),
INT_ENTRY(6, S.W),
INT_ENTRY(6, X.W),
INT_ENTRY(6, Y.W),
INT_ENTRY(6, PCw)
};
#undef STRUCT
#define STRUCT struct SPPU
static FreezeData SnapPPU[] =
{
INT_ENTRY(6, VMA.High),
INT_ENTRY(6, VMA.Increment),
INT_ENTRY(6, VMA.Address),
INT_ENTRY(6, VMA.Mask1),
INT_ENTRY(6, VMA.FullGraphicCount),
INT_ENTRY(6, VMA.Shift),
INT_ENTRY(6, WRAM),
#define O(N) \
INT_ENTRY(6, BG[N].SCBase), \
INT_ENTRY(6, BG[N].HOffset), \
INT_ENTRY(6, BG[N].VOffset), \
INT_ENTRY(6, BG[N].BGSize), \
INT_ENTRY(6, BG[N].NameBase), \
INT_ENTRY(6, BG[N].SCSize)
O(0), O(1), O(2), O(3),
#undef O
INT_ENTRY(6, BGMode),
INT_ENTRY(6, BG3Priority),
INT_ENTRY(6, CGFLIP),
INT_ENTRY(6, CGFLIPRead),
INT_ENTRY(6, CGADD),
ARRAY_ENTRY(6, CGDATA, 256, uint16_ARRAY_V),
#define O(N) \
INT_ENTRY(6, OBJ[N].HPos), \
INT_ENTRY(6, OBJ[N].VPos), \
INT_ENTRY(6, OBJ[N].HFlip), \
INT_ENTRY(6, OBJ[N].VFlip), \
INT_ENTRY(6, OBJ[N].Name), \
INT_ENTRY(6, OBJ[N].Priority), \
INT_ENTRY(6, OBJ[N].Palette), \
INT_ENTRY(6, OBJ[N].Size)
O( 0), O( 1), O( 2), O( 3), O( 4), O( 5), O( 6), O( 7),
O( 8), O( 9), O( 10), O( 11), O( 12), O( 13), O( 14), O( 15),
O( 16), O( 17), O( 18), O( 19), O( 20), O( 21), O( 22), O( 23),
O( 24), O( 25), O( 26), O( 27), O( 28), O( 29), O( 30), O( 31),
O( 32), O( 33), O( 34), O( 35), O( 36), O( 37), O( 38), O( 39),
O( 40), O( 41), O( 42), O( 43), O( 44), O( 45), O( 46), O( 47),
O( 48), O( 49), O( 50), O( 51), O( 52), O( 53), O( 54), O( 55),
O( 56), O( 57), O( 58), O( 59), O( 60), O( 61), O( 62), O( 63),
O( 64), O( 65), O( 66), O( 67), O( 68), O( 69), O( 70), O( 71),
O( 72), O( 73), O( 74), O( 75), O( 76), O( 77), O( 78), O( 79),
O( 80), O( 81), O( 82), O( 83), O( 84), O( 85), O( 86), O( 87),
O( 88), O( 89), O( 90), O( 91), O( 92), O( 93), O( 94), O( 95),
O( 96), O( 97), O( 98), O( 99), O(100), O(101), O(102), O(103),
O(104), O(105), O(106), O(107), O(108), O(109), O(110), O(111),
O(112), O(113), O(114), O(115), O(116), O(117), O(118), O(119),
O(120), O(121), O(122), O(123), O(124), O(125), O(126), O(127),
#undef O
INT_ENTRY(6, OBJThroughMain),
INT_ENTRY(6, OBJThroughSub),
INT_ENTRY(6, OBJAddition),
INT_ENTRY(6, OBJNameBase),
INT_ENTRY(6, OBJNameSelect),
INT_ENTRY(6, OBJSizeSelect),
INT_ENTRY(6, OAMAddr),
INT_ENTRY(6, SavedOAMAddr),
INT_ENTRY(6, OAMPriorityRotation),
INT_ENTRY(6, OAMFlip),
INT_ENTRY(6, OAMReadFlip),
INT_ENTRY(6, OAMTileAddress),
INT_ENTRY(6, OAMWriteRegister),
ARRAY_ENTRY(6, OAMData, 512 + 32, uint8_ARRAY_V),
INT_ENTRY(6, FirstSprite),
INT_ENTRY(6, LastSprite),
INT_ENTRY(6, HTimerEnabled),
INT_ENTRY(6, VTimerEnabled),
INT_ENTRY(6, HTimerPosition),
INT_ENTRY(6, VTimerPosition),
INT_ENTRY(6, IRQHBeamPos),
INT_ENTRY(6, IRQVBeamPos),
INT_ENTRY(6, HBeamFlip),
INT_ENTRY(6, VBeamFlip),
INT_ENTRY(6, HBeamPosLatched),
INT_ENTRY(6, VBeamPosLatched),
INT_ENTRY(6, GunHLatch),
INT_ENTRY(6, GunVLatch),
INT_ENTRY(6, HVBeamCounterLatched),
INT_ENTRY(6, Mode7HFlip),
INT_ENTRY(6, Mode7VFlip),
INT_ENTRY(6, Mode7Repeat),
INT_ENTRY(6, MatrixA),
INT_ENTRY(6, MatrixB),
INT_ENTRY(6, MatrixC),
INT_ENTRY(6, MatrixD),
INT_ENTRY(6, CentreX),
INT_ENTRY(6, CentreY),
INT_ENTRY(6, M7HOFS),
INT_ENTRY(6, M7VOFS),
INT_ENTRY(6, Mosaic),
INT_ENTRY(6, MosaicStart),
ARRAY_ENTRY(6, BGMosaic, 4, uint8_ARRAY_V),
INT_ENTRY(6, Window1Left),
INT_ENTRY(6, Window1Right),
INT_ENTRY(6, Window2Left),
INT_ENTRY(6, Window2Right),
INT_ENTRY(6, RecomputeClipWindows),
#define O(N) \
INT_ENTRY(6, ClipCounts[N]), \
INT_ENTRY(6, ClipWindowOverlapLogic[N]), \
INT_ENTRY(6, ClipWindow1Enable[N]), \
INT_ENTRY(6, ClipWindow2Enable[N]), \
INT_ENTRY(6, ClipWindow1Inside[N]), \
INT_ENTRY(6, ClipWindow2Inside[N])
O(0), O(1), O(2), O(3), O(4), O(5),
#undef O
INT_ENTRY(6, ForcedBlanking),
INT_ENTRY(6, FixedColourRed),
INT_ENTRY(6, FixedColourGreen),
INT_ENTRY(6, FixedColourBlue),
INT_ENTRY(6, Brightness),
INT_ENTRY(6, ScreenHeight),
INT_ENTRY(6, Need16x8Mulitply),
INT_ENTRY(6, BGnxOFSbyte),
INT_ENTRY(6, M7byte),
INT_ENTRY(6, HDMA),
INT_ENTRY(6, HDMAEnded),
INT_ENTRY(6, OpenBus1),
INT_ENTRY(6, OpenBus2)
};
#undef STRUCT
#define STRUCT struct SDMASnapshot
static FreezeData SnapDMA[] =
{
#define O(N) \
INT_ENTRY(6, dma[N].ReverseTransfer), \
INT_ENTRY(6, dma[N].HDMAIndirectAddressing), \
INT_ENTRY(6, dma[N].UnusedBit43x0), \
INT_ENTRY(6, dma[N].AAddressFixed), \
INT_ENTRY(6, dma[N].AAddressDecrement), \
INT_ENTRY(6, dma[N].TransferMode), \
INT_ENTRY(6, dma[N].BAddress), \
INT_ENTRY(6, dma[N].AAddress), \
INT_ENTRY(6, dma[N].ABank), \
INT_ENTRY(6, dma[N].DMACount_Or_HDMAIndirectAddress), \
INT_ENTRY(6, dma[N].IndirectBank), \
INT_ENTRY(6, dma[N].Address), \
INT_ENTRY(6, dma[N].Repeat), \
INT_ENTRY(6, dma[N].LineCount), \
INT_ENTRY(6, dma[N].UnknownByte), \
INT_ENTRY(6, dma[N].DoTransfer)
O(0), O(1), O(2), O(3), O(4), O(5), O(6), O(7)
#undef O
};
#undef STRUCT
#define STRUCT struct SControlSnapshot
static FreezeData SnapControls[] =
{
INT_ENTRY(6, ver),
ARRAY_ENTRY(6, port1_read_idx, 2, uint8_ARRAY_V),
ARRAY_ENTRY(6, dummy1, 4, uint8_ARRAY_V),
ARRAY_ENTRY(6, port2_read_idx, 2, uint8_ARRAY_V),
ARRAY_ENTRY(6, dummy2, 4, uint8_ARRAY_V),
ARRAY_ENTRY(6, mouse_speed, 2, uint8_ARRAY_V),
INT_ENTRY(6, justifier_select),
ARRAY_ENTRY(6, dummy3, 8, uint8_ARRAY_V),
INT_ENTRY(6, pad_read),
INT_ENTRY(6, pad_read_last),
ARRAY_ENTRY(6, internal, 60, uint8_ARRAY_V)
};
#undef STRUCT
#define STRUCT struct STimings
static FreezeData SnapTimings[] =
{
INT_ENTRY(6, H_Max_Master),
INT_ENTRY(6, H_Max),
INT_ENTRY(6, V_Max_Master),
INT_ENTRY(6, V_Max),
INT_ENTRY(6, HBlankStart),
INT_ENTRY(6, HBlankEnd),
INT_ENTRY(6, HDMAInit),
INT_ENTRY(6, HDMAStart),
INT_ENTRY(6, NMITriggerPos),
INT_ENTRY(6, WRAMRefreshPos),
INT_ENTRY(6, RenderPos),
INT_ENTRY(6, InterlaceField),
INT_ENTRY(6, DMACPUSync),
INT_ENTRY(6, NMIDMADelay),
INT_ENTRY(6, IRQPendCount),
INT_ENTRY(6, APUSpeedup),
INT_ENTRY(7, IRQTriggerCycles),
INT_ENTRY(7, APUAllowTimeOverflow)
};
#undef STRUCT
#define STRUCT struct FxRegs_s
static FreezeData SnapFX[] =
{
ARRAY_ENTRY(6, avReg, 16, uint32_ARRAY_V),
INT_ENTRY(6, vColorReg),
INT_ENTRY(6, vPlotOptionReg),
INT_ENTRY(6, vStatusReg),
INT_ENTRY(6, vPrgBankReg),
INT_ENTRY(6, vRomBankReg),
INT_ENTRY(6, vRamBankReg),
INT_ENTRY(6, vCacheBaseReg),
INT_ENTRY(6, vCacheFlags),
INT_ENTRY(6, vLastRamAdr),
POINTER_ENTRY(6, pvDreg, avRegAddr),
POINTER_ENTRY(6, pvSreg, avRegAddr),
INT_ENTRY(6, vRomBuffer),
INT_ENTRY(6, vPipe),
INT_ENTRY(6, vPipeAdr),
INT_ENTRY(6, vSign),
INT_ENTRY(6, vZero),
INT_ENTRY(6, vCarry),
INT_ENTRY(6, vOverflow),
INT_ENTRY(6, vErrorCode),
INT_ENTRY(6, vIllegalAddress),
INT_ENTRY(6, bBreakPoint),
INT_ENTRY(6, vBreakPoint),
INT_ENTRY(6, vStepPoint),
INT_ENTRY(6, nRamBanks),
INT_ENTRY(6, nRomBanks),
INT_ENTRY(6, vMode),
INT_ENTRY(6, vPrevMode),
POINTER_ENTRY(6, pvScreenBase, pvRam),
#define O(N) \
POINTER_ENTRY(6, apvScreen[N], pvRam)
O( 0), O( 1), O( 2), O( 3), O( 4), O( 5), O( 6), O( 7),
O( 8), O( 9), O( 10), O( 11), O( 12), O( 13), O( 14), O( 15),
O( 16), O( 17), O( 18), O( 19), O( 20), O( 21), O( 22), O( 23),
O( 24), O( 25), O( 26), O( 27), O( 28), O( 29), O( 30), O( 31),
#undef O
ARRAY_ENTRY(6, x, 32, uint32_ARRAY_V),
INT_ENTRY(6, vScreenHeight),
INT_ENTRY(6, vScreenRealHeight),
INT_ENTRY(6, vPrevScreenHeight),
INT_ENTRY(6, vScreenSize),
POINTER_ENTRY(6, pvRamBank, apvRamBank),
POINTER_ENTRY(6, pvRomBank, apvRomBank),
POINTER_ENTRY(6, pvPrgBank, apvRomBank),
#define O(N) \
POINTER_ENTRY(6, apvRamBank[N], pvRam)
O(0), O(1), O(2), O(3),
#undef O
INT_ENTRY(6, bCacheActive),
POINTER_ENTRY(6, pvCache, pvRegisters),
ARRAY_ENTRY(6, avCacheBackup, 512, uint8_ARRAY_V),
INT_ENTRY(6, vCounter),
INT_ENTRY(6, vInstCount),
INT_ENTRY(6, vSCBRDirty)
};
#undef STRUCT
#define STRUCT struct SSA1
static FreezeData SnapSA1[] =
{
DELETED_INT_ENTRY(6, 7, CPUExecuting, 1),
INT_ENTRY(6, ShiftedPB),
INT_ENTRY(6, ShiftedDB),
INT_ENTRY(6, Flags),
DELETED_INT_ENTRY(6, 7, IRQActive, 1),
DELETED_INT_ENTRY(6, 7, Waiting, 1),
INT_ENTRY(6, WaitingForInterrupt),
DELETED_INT_ENTRY(6, 7, WaitAddress, 4),
DELETED_INT_ENTRY(6, 7, WaitCounter, 4),
DELETED_INT_ENTRY(6, 7, PBPCAtOpcodeStart, 4),
DELETED_INT_ENTRY(6, 7, Executing, 1),
INT_ENTRY(6, overflow),
INT_ENTRY(6, in_char_dma),
INT_ENTRY(6, op1),
INT_ENTRY(6, op2),
INT_ENTRY(6, arithmetic_op),
INT_ENTRY(6, sum),
INT_ENTRY(6, VirtualBitmapFormat),
INT_ENTRY(6, variable_bit_pos),
INT_ENTRY(7, Cycles),
INT_ENTRY(7, PrevCycles),
INT_ENTRY(7, TimerIRQLastState),
INT_ENTRY(7, HTimerIRQPos),
INT_ENTRY(7, VTimerIRQPos),
INT_ENTRY(7, HCounter),
INT_ENTRY(7, VCounter),
INT_ENTRY(7, PrevHCounter),
INT_ENTRY(7, MemSpeed),
INT_ENTRY(7, MemSpeedx2)
};
#undef STRUCT
#define STRUCT struct SSA1Registers
static FreezeData SnapSA1Registers[] =
{
INT_ENTRY(6, PB),
INT_ENTRY(6, DB),
INT_ENTRY(6, P.W),
INT_ENTRY(6, A.W),
INT_ENTRY(6, D.W),
INT_ENTRY(6, S.W),
INT_ENTRY(6, X.W),
INT_ENTRY(6, Y.W),
INT_ENTRY(6, PCw)
};
#undef STRUCT
#define STRUCT struct SDSP1
static FreezeData SnapDSP1[] =
{
INT_ENTRY(6, waiting4command),
INT_ENTRY(6, first_parameter),
INT_ENTRY(6, command),
INT_ENTRY(6, in_count),
INT_ENTRY(6, in_index),
INT_ENTRY(6, out_count),
INT_ENTRY(6, out_index),
ARRAY_ENTRY(6, parameters, 512, uint8_ARRAY_V),
ARRAY_ENTRY(6, output, 512, uint8_ARRAY_V),
INT_ENTRY(6, CentreX),
INT_ENTRY(6, CentreY),
INT_ENTRY(6, VOffset),
INT_ENTRY(6, VPlane_C),
INT_ENTRY(6, VPlane_E),
INT_ENTRY(6, SinAas),
INT_ENTRY(6, CosAas),
INT_ENTRY(6, SinAzs),
INT_ENTRY(6, CosAzs),
INT_ENTRY(6, SinAZS),
INT_ENTRY(6, CosAZS),
INT_ENTRY(6, SecAZS_C1),
INT_ENTRY(6, SecAZS_E1),
INT_ENTRY(6, SecAZS_C2),
INT_ENTRY(6, SecAZS_E2),
INT_ENTRY(6, Nx),
INT_ENTRY(6, Ny),
INT_ENTRY(6, Nz),
INT_ENTRY(6, Gx),
INT_ENTRY(6, Gy),
INT_ENTRY(6, Gz),
INT_ENTRY(6, C_Les),
INT_ENTRY(6, E_Les),
INT_ENTRY(6, G_Les),
#define O(N) \
ARRAY_ENTRY(6, matrixA[N], 3, uint16_ARRAY_V), \
ARRAY_ENTRY(6, matrixB[N], 3, uint16_ARRAY_V), \
ARRAY_ENTRY(6, matrixC[N], 3, uint16_ARRAY_V)
O(0), O(1), O(2),
#undef O
INT_ENTRY(6, Op00Multiplicand),
INT_ENTRY(6, Op00Multiplier),
INT_ENTRY(6, Op00Result),
INT_ENTRY(6, Op20Multiplicand),
INT_ENTRY(6, Op20Multiplier),
INT_ENTRY(6, Op20Result),
INT_ENTRY(6, Op10Coefficient),
INT_ENTRY(6, Op10Exponent),
INT_ENTRY(6, Op10CoefficientR),
INT_ENTRY(6, Op10ExponentR),
INT_ENTRY(6, Op04Angle),
INT_ENTRY(6, Op04Radius),
INT_ENTRY(6, Op04Sin),
INT_ENTRY(6, Op04Cos),
INT_ENTRY(6, Op0CA),
INT_ENTRY(6, Op0CX1),
INT_ENTRY(6, Op0CY1),
INT_ENTRY(6, Op0CX2),
INT_ENTRY(6, Op0CY2),
INT_ENTRY(6, Op02FX),
INT_ENTRY(6, Op02FY),
INT_ENTRY(6, Op02FZ),
INT_ENTRY(6, Op02LFE),
INT_ENTRY(6, Op02LES),
INT_ENTRY(6, Op02AAS),
INT_ENTRY(6, Op02AZS),
INT_ENTRY(6, Op02VOF),
INT_ENTRY(6, Op02VVA),
INT_ENTRY(6, Op02CX),
INT_ENTRY(6, Op02CY),
INT_ENTRY(6, Op0AVS),
INT_ENTRY(6, Op0AA),
INT_ENTRY(6, Op0AB),
INT_ENTRY(6, Op0AC),
INT_ENTRY(6, Op0AD),
INT_ENTRY(6, Op06X),
INT_ENTRY(6, Op06Y),
INT_ENTRY(6, Op06Z),
INT_ENTRY(6, Op06H),
INT_ENTRY(6, Op06V),
INT_ENTRY(6, Op06M),
INT_ENTRY(6, Op01m),
INT_ENTRY(6, Op01Zr),
INT_ENTRY(6, Op01Xr),
INT_ENTRY(6, Op01Yr),
INT_ENTRY(6, Op11m),
INT_ENTRY(6, Op11Zr),
INT_ENTRY(6, Op11Xr),
INT_ENTRY(6, Op11Yr),
INT_ENTRY(6, Op21m),
INT_ENTRY(6, Op21Zr),
INT_ENTRY(6, Op21Xr),
INT_ENTRY(6, Op21Yr),
INT_ENTRY(6, Op0DX),
INT_ENTRY(6, Op0DY),
INT_ENTRY(6, Op0DZ),
INT_ENTRY(6, Op0DF),
INT_ENTRY(6, Op0DL),
INT_ENTRY(6, Op0DU),
INT_ENTRY(6, Op1DX),
INT_ENTRY(6, Op1DY),
INT_ENTRY(6, Op1DZ),
INT_ENTRY(6, Op1DF),
INT_ENTRY(6, Op1DL),
INT_ENTRY(6, Op1DU),
INT_ENTRY(6, Op2DX),
INT_ENTRY(6, Op2DY),
INT_ENTRY(6, Op2DZ),
INT_ENTRY(6, Op2DF),
INT_ENTRY(6, Op2DL),
INT_ENTRY(6, Op2DU),
INT_ENTRY(6, Op03F),
INT_ENTRY(6, Op03L),
INT_ENTRY(6, Op03U),
INT_ENTRY(6, Op03X),
INT_ENTRY(6, Op03Y),
INT_ENTRY(6, Op03Z),
INT_ENTRY(6, Op13F),
INT_ENTRY(6, Op13L),
INT_ENTRY(6, Op13U),
INT_ENTRY(6, Op13X),
INT_ENTRY(6, Op13Y),
INT_ENTRY(6, Op13Z),
INT_ENTRY(6, Op23F),
INT_ENTRY(6, Op23L),
INT_ENTRY(6, Op23U),
INT_ENTRY(6, Op23X),
INT_ENTRY(6, Op23Y),
INT_ENTRY(6, Op23Z),
INT_ENTRY(6, Op14Zr),
INT_ENTRY(6, Op14Xr),
INT_ENTRY(6, Op14Yr),
INT_ENTRY(6, Op14U),
INT_ENTRY(6, Op14F),
INT_ENTRY(6, Op14L),
INT_ENTRY(6, Op14Zrr),
INT_ENTRY(6, Op14Xrr),
INT_ENTRY(6, Op14Yrr),
INT_ENTRY(6, Op0EH),
INT_ENTRY(6, Op0EV),
INT_ENTRY(6, Op0EX),
INT_ENTRY(6, Op0EY),
INT_ENTRY(6, Op0BX),
INT_ENTRY(6, Op0BY),
INT_ENTRY(6, Op0BZ),
INT_ENTRY(6, Op0BS),
INT_ENTRY(6, Op1BX),
INT_ENTRY(6, Op1BY),
INT_ENTRY(6, Op1BZ),
INT_ENTRY(6, Op1BS),
INT_ENTRY(6, Op2BX),
INT_ENTRY(6, Op2BY),
INT_ENTRY(6, Op2BZ),
INT_ENTRY(6, Op2BS),
INT_ENTRY(6, Op28X),
INT_ENTRY(6, Op28Y),
INT_ENTRY(6, Op28Z),
INT_ENTRY(6, Op28R),
INT_ENTRY(6, Op1CX),
INT_ENTRY(6, Op1CY),
INT_ENTRY(6, Op1CZ),
INT_ENTRY(6, Op1CXBR),
INT_ENTRY(6, Op1CYBR),
INT_ENTRY(6, Op1CZBR),
INT_ENTRY(6, Op1CXAR),
INT_ENTRY(6, Op1CYAR),
INT_ENTRY(6, Op1CZAR),
INT_ENTRY(6, Op1CX1),
INT_ENTRY(6, Op1CY1),
INT_ENTRY(6, Op1CZ1),
INT_ENTRY(6, Op1CX2),
INT_ENTRY(6, Op1CY2),
INT_ENTRY(6, Op1CZ2),
INT_ENTRY(6, Op0FRamsize),
INT_ENTRY(6, Op0FPass),
INT_ENTRY(6, Op2FUnknown),
INT_ENTRY(6, Op2FSize),
INT_ENTRY(6, Op08X),
INT_ENTRY(6, Op08Y),
INT_ENTRY(6, Op08Z),
INT_ENTRY(6, Op08Ll),
INT_ENTRY(6, Op08Lh),
INT_ENTRY(6, Op18X),
INT_ENTRY(6, Op18Y),
INT_ENTRY(6, Op18Z),
INT_ENTRY(6, Op18R),
INT_ENTRY(6, Op18D),
INT_ENTRY(6, Op38X),
INT_ENTRY(6, Op38Y),
INT_ENTRY(6, Op38Z),
INT_ENTRY(6, Op38R),
INT_ENTRY(6, Op38D)
};
#undef STRUCT
#define STRUCT struct SDSP2
static FreezeData SnapDSP2[] =
{
INT_ENTRY(6, waiting4command),
INT_ENTRY(6, command),
INT_ENTRY(6, in_count),
INT_ENTRY(6, in_index),
INT_ENTRY(6, out_count),
INT_ENTRY(6, out_index),
ARRAY_ENTRY(6, parameters, 512, uint8_ARRAY_V),
ARRAY_ENTRY(6, output, 512, uint8_ARRAY_V),
INT_ENTRY(6, Op05HasLen),
INT_ENTRY(6, Op05Len),
INT_ENTRY(6, Op05Transparent),
INT_ENTRY(6, Op06HasLen),
INT_ENTRY(6, Op06Len),
INT_ENTRY(6, Op09Word1),
INT_ENTRY(6, Op09Word2),
INT_ENTRY(6, Op0DHasLen),
INT_ENTRY(6, Op0DOutLen),
INT_ENTRY(6, Op0DInLen)
};
#undef STRUCT
#define STRUCT struct SDSP4
static FreezeData SnapDSP4[] =
{
INT_ENTRY(6, waiting4command),
INT_ENTRY(6, half_command),
INT_ENTRY(6, command),
INT_ENTRY(6, in_count),
INT_ENTRY(6, in_index),
INT_ENTRY(6, out_count),
INT_ENTRY(6, out_index),
ARRAY_ENTRY(6, parameters, 512, uint8_ARRAY_V),
ARRAY_ENTRY(6, output, 512, uint8_ARRAY_V),
INT_ENTRY(6, byte),
INT_ENTRY(6, address),
INT_ENTRY(6, Logic),
INT_ENTRY(6, lcv),
INT_ENTRY(6, distance),
INT_ENTRY(6, raster),
INT_ENTRY(6, segments),
INT_ENTRY(6, world_x),
INT_ENTRY(6, world_y),
INT_ENTRY(6, world_dx),
INT_ENTRY(6, world_dy),
INT_ENTRY(6, world_ddx),
INT_ENTRY(6, world_ddy),
INT_ENTRY(6, world_xenv),
INT_ENTRY(6, world_yofs),
INT_ENTRY(6, view_x1),
INT_ENTRY(6, view_y1),
INT_ENTRY(6, view_x2),
INT_ENTRY(6, view_y2),
INT_ENTRY(6, view_dx),
INT_ENTRY(6, view_dy),
INT_ENTRY(6, view_xofs1),
INT_ENTRY(6, view_yofs1),
INT_ENTRY(6, view_xofs2),
INT_ENTRY(6, view_yofs2),
INT_ENTRY(6, view_yofsenv),
INT_ENTRY(6, view_turnoff_x),
INT_ENTRY(6, view_turnoff_dx),
INT_ENTRY(6, viewport_cx),
INT_ENTRY(6, viewport_cy),
INT_ENTRY(6, viewport_left),
INT_ENTRY(6, viewport_right),
INT_ENTRY(6, viewport_top),
INT_ENTRY(6, viewport_bottom),
INT_ENTRY(6, sprite_x),
INT_ENTRY(6, sprite_y),
INT_ENTRY(6, sprite_attr),
INT_ENTRY(6, sprite_size),
INT_ENTRY(6, sprite_clipy),
INT_ENTRY(6, sprite_count),
#define O(N) \
ARRAY_ENTRY(6, poly_clipLf[N], 2, uint16_ARRAY_V), \
ARRAY_ENTRY(6, poly_clipRt[N], 2, uint16_ARRAY_V), \
ARRAY_ENTRY(6, poly_ptr[N], 2, uint16_ARRAY_V), \
ARRAY_ENTRY(6, poly_raster[N], 2, uint16_ARRAY_V), \
ARRAY_ENTRY(6, poly_top[N], 2, uint16_ARRAY_V), \
ARRAY_ENTRY(6, poly_bottom[N], 2, uint16_ARRAY_V), \
ARRAY_ENTRY(6, poly_cx[N], 2, uint16_ARRAY_V)
O(0), O(1),