-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.proto
202 lines (160 loc) · 4.69 KB
/
save.proto
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
syntax = "proto2";
package Rnes;
message CpuState {
// 6502 registers
optional uint32 a = 1;
optional uint32 x = 2;
optional uint32 y = 3;
// Program counter
optional uint32 pc = 4;
// stack pointer
optional uint32 sp = 5;
// processor status register
optional uint32 status = 6;
// cycle count
optional uint64 cycle = 7;
}
message PulseState {
optional bool primary = 1;
// length logic
optional uint32 lengthCounter = 2;
// envelope logic
optional uint32 envelope = 3;
optional uint32 envelopeDivider = 4;
optional bool resetEnvelopeAndDivider = 5;
// sweep logic
optional bool resetSweepDivider = 6;
optional uint32 sweepDivider = 7;
// current sample
optional uint32 currentSample = 8;
// timer
optional uint32 timerDivider = 9 ;
// sequencer offset
optional uint32 sequencerOffset = 10;
}
message TriangleState {
// length logic
optional uint32 lengthCounter = 1;
// linear counter logic
optional bool linearCounterHalt = 2;
optional uint32 linearCounter = 3;
// current sample
optional uint32 currentSample = 4;
// timer
optional uint32 timerDivider = 5;
// sequencer offset
optional uint32 sequencerOffset = 6;
}
message NoiseState {
// length logic
optional uint32 lengthCounter = 1;
// noise shift register
optional uint32 shiftRegister = 2;
// envelope logic
optional uint32 envelope = 3;
optional uint32 envelopeDivider = 4;
optional bool resetEnvelopeAndDivider = 5;
// current sample
optional uint32 currentSample = 6;
// timer
optional uint32 timerDivider = 7;
}
message ApuState {
// Apu register file.
repeated uint32 reg = 1;
optional uint32 sampleRate = 2;
optional uint32 fourFrameCount = 3;
optional uint32 fiveFrameCount = 4;
optional uint32 frameDivider = 5;
optional uint32 step = 6;
optional uint32 halfTimerDivider = 7;
optional uint32 samplerDivider = 8;
optional float clksPerSample = 9;
optional float currentSampleClk = 10;
optional uint32 nextSampleCountdown = 11;
// Child units.
optional PulseState pulseA = 20;
optional PulseState pulseB = 21;
optional TriangleState triangle = 22;
optional NoiseState noise = 23;
}
message PpuState {
optional uint64 cycle = 1;
optional uint64 frame = 2;
repeated uint32 regs = 3;
message SpriteState {
optional uint32 yCoordMinus1 = 1;
optional uint32 tileIndex = 2;
optional uint32 attr = 3;
optional uint32 xCoord = 4;
}
repeated SpriteState spriteRam = 4;
optional uint32 vramToggle = 5;
optional uint32 vramFineXScroll = 6;
optional uint32 vramCurrentAddr = 7;
optional uint32 vramTempAddr = 8;
optional uint32 vramMachineAddr = 9;
optional uint32 vramReadLatch = 10;
optional uint32 scrollingMachineState = 11;
optional uint32 xScrollOrigin = 12;
optional uint32 yScrollOrigin = 13;
}
message MmcState {
message MmcNoneState {}
message Mmc1State {
optional uint32 controlReg = 1;
optional uint32 chr0Bank = 2;
optional uint32 chr1Bank = 3;
optional uint32 prgBank = 4;
optional uint32 shiftRegister = 5;
}
message Mmc3State {
optional uint32 bankSelectReg = 1;
optional uint32 mirrorReg = 2;
optional uint32 prgRamReg = 3;
optional bytes bankRegister = 4;
optional uint32 irqReloadReg = 5;
optional uint32 irqCounterReg = 6;
optional bool irqEnabled = 7;
optional bool irqPending = 8;
}
optional MmcNoneState mmcNone = 1;
optional Mmc1State mmc1 = 2;
optional Mmc3State mmc3 = 3;
}
message ControllerState {
optional uint32 control = 1;
optional uint32 shiftReg = 2;
}
message CpuMemoryState {
optional bytes cpuSram = 1;
optional bytes prgSram = 2;
}
message VideoMemoryState {
optional bytes patternTableMemory = 1;
optional bytes nameTableMemory = 2;
optional bytes paletteMemory = 3;
}
message DmaState {
optional bool spriteDmaMode = 1;
optional uint32 spriteDmaCycle = 2;
optional uint32 spriteDmaSourceAddr = 3;
}
message SaveState {
// date??
optional string saveDate = 1;
optional uint64 gameTime = 2;
// Dma state
optional DmaState dma = 7;
// 6502 state
optional CpuState cpu = 8;
// Audio state
optional ApuState apu = 9;
// PPU state
optional PpuState ppu = 10;
// Controller state.
optional ControllerState controller = 11;
// SRAM state.
optional CpuMemoryState cpuMem = 12;
optional VideoMemoryState vidMem = 13;
}