Dolphin 5.0 Stable Savestate Format This is a file made by me (Lobster Zelda) which shows everything that is saved in a savestate in Dolphin 5.0 Stable, along with the order that everything is saved in. Additionally, everything is indented to show inside which function each function was called (the body of each function or loop is one level more indented than the function call line or the loop declaration). The order and type of data saved shown in this file assumes that we are playing a Game Cube game with a gamecube controller plugged into port 1, we have a memory card inserted into slot A, we are using a raw memory card file (instead of a memory card directory), we are using the DSPHLE emulator engine, we are currently recording a movie (since this file is intended to help TASers debug savestates), and we are using the JIT Recompiler. Note: MARKER is just a number that is placed at the end of a section of related pieces of data. It serves to seperate pieces of data which are stored in different classes or namespaces, and makes sure the savestate isn't corrupted (specifically, it's equal to the uint 66). State::CompressAndDumpState() makes the header of the savestate, and State::DoState() makes the body of the savestate. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- START: CompressAndDumpState(): HEADER (6 char Game ID, size of state (or 0 if state is uncompressed), and time savestate was made) State::DoState(): 1. cookie (version (54) + COOKIE_BASE) (uint) 2. version_created_by (11"Dolphin 5.0") 3. MARKER - Version VideoBackendBase::DoState(): (in MainBase.cpp) 4. Software Flag (false) (boolean) VideoCommon_DoState(PointerWrap): 5. BP Memory (struct) 6. MARKER - BP Memory DoCPState: 7. g_main_cp_state.array_bases (int[16]) 8. g_main_cp_state.array_strides (int[16]) 9. g_main_cp_state.matrix_index_a (TMatrixIndexA) 10. g_main_cp_state.matrix_index_b (TMatrixIndexB) 11. g_main_cp_state.vtx_desc.HEX (unsigned long long) 12. g_main_cp_state.vtx_attr (VAT[8]) 13. MARKER - CP Memory (Note: when loading a state, CopyPreprocessCPStateFromMain() is called, and g_main_cp_state.bases_dirty is set to true) 14. xfmem (XFMemory struct) 15. MARKER - XF Memory 16. TextureMemory (byte[1,048,576]) 17. MARKER - texMem Fifo_DoState: 18. s_video_buffer (byte[2*1024*1024]) 19. Size of s_video_buffer_write_ptr in bytes (unsigned long long) 20. Size of s_vieo_buffer_read_ptr in bytes (unsigned long long) 21. s_skip_current_frame (boolean) 22. s_last_sync_gpu_tick (unsigned long long) 23. MARKER - Fifo CommandProcessor::DoState(PointerWrap): 24. m_CPStatus_Reg (UCPStatusReg Union) 25. m_CPCtrlReg (UCPControlReg Union) 26. m_CPClearReg (UCPClearReg Union) 27. m_bboxleft (u16) 28. m_bboxtop (u16) 29. m_bboxright (u16) 30. m_bboxbottom (u16) 31. m_tokenReg (u16) 32. fifo (SCPFifoStruct) 33. s_interrupt_set (atomic bool) 34. s_interrupt_waiting (atomic bool) 35. s_interrupt_token_waiting (atomic bool) 36. s_interrupt_finish_waiting (atomic bool) 37. MARKER - CommandProcessor PixelEngine::DoState(PointerWrap): 38. m_ZConf (UPEZConfReg Union) 39. m_AlphaConf (UPEAlphaConfReg Union) 40. m_DstAlphaConf (UPEDstAlphaConfReg Union) 41. m_AlphaModeConf (UPEAlphaModeConfigReg Union) 42. m_AlphaRead (UPEAlphaReadReg Union) 43. m_Control (UPECtrlReg Union) 44. s_signal_token_interrupt (atomic int) 45. s_signal_finish_interrupt (atomic int) 46. MARKER - PixelEngine PixelShaderManager::DoState(PointerWrap): 47. s_bFogRangeAdjustChanged (bool) 48. s_bViewPortChanged (bool) 49. constants (PixelShaderConstants struct) - NOTE: On load save state, Dirty() is called here 50. MARKER - PixelShaderManager VertexShaderManager::DoState(PointerWrap): 51. g_fProjectionMatrix (float[16]) 52. s_viewportCorrection (Matrix44 class) 53. s_viewRotationMatrix (Matrix33 class) 54. s_viewInvRotationMatrix (Matrix33 class) 55. s_fViewTranslationVector (float[3]) 56. s_fViewRotation (float[2]) 57. nTransformMatricesChanged (int[2]) 58. nNormalMatricesChanged (int[2]) 59. nPostTransformMatricesChanged (int[2]) 60. nLightsChanged (int[2]) 61. nMaterialsChanged (BitSet class) 62. bTexMatricesChanged (bool[2]) 63. bPosNormalMatrixChanged (bool) 64. bProjectionChanged (bool) 65. bViewportChanged (bool) 66. constants (VertexShaderConstants struct) - NOTE: On load save state, Dirty() is called here 67. MARKER - VertexShaderManager GeometryShaderManager::DoState(PointerWrap): 68. s_projection_changed (bool) 69. s_viewport_changed (bool) 70. constants (GeometryShaderConstants struct) - NOTE: On load save state, Dirty() is called here 71. MARKER - GeometryShaderManager VertexManagerBase::DoState(PointerWrap): 72. s_zslope (Slope struct) 73. g_vertex_manager->vDoState(PointerWrap) (Does a second call to VertexManagerBase::DoState() with different args - terminates on this 2nd pass). 74. MARKER - VertexManager BoundingBox::DoState(PointerWrap): 75. active (bool) 76. coord (u16[4]) 77. MARKER - BoundingBox 78. MARKER - VideoCommon 79. s_begin_field_args (unnamed struct with 4 ints) 80. MARKER - VideoBackendBase - NOTE: On load save state, m_invalid set to true, and VertexLoaderManager::MarkAllDirty() is called 81. MARKER - Wiimote PowerPC::DoState(PointerWrap): 82. ppcState (PowerPCState struct) - contains all general purpose registers, the stack pointer, pc, and any other parts of PC state. JitInterface::DoState(PointerWrap) - if using jit and loading a save state, calls jit->ClearCache() 83. MARKER - PowerPC CoreTiming::DoState(PointerWrap): 84. g_slicelength (int) 85. g_globalTimer (u64) 86. idledCycles (u64) 87. fakeDecStartValue (u32) 88. fakeDecStartTicks (u64) 89. g_fakeTBStartValue (u64) 90. g_fakeTBStartTicks (u64) 91. s_lastOCFactor (float) - NOTE: On load save state, g_lastOCFactor_inverted is set equal to 1.0/s_lastOCFactor here 92. MARKER - CoreTimingData 93. MoveEvents() - moves events from one queue to another 94. first (head of LinkedList of events) - each element is saved in order using EventDoState(), which stores time, userdata, and event type's name (check later) 95. MARKER - CoreTimingEvents 96. MARKER - CoreTiming HW::DoState(PointerWrap): Memory::DoState(PointerWrap): 97. m_pRAM (byte[32,000,000]) - Contains all RAM used by the game. 98. m_pL1Cache (byte[262,144]) 99. MARKER - Memory RAM 100. m_pFakeVMEM (byte[33,554,432]) 101. MARKER - Memory FakeVMEM 102. MARKER - Memory EXRAM 103. MARKER - Memory VideoInterface::DoState(PointerWrap): 104. m_VerticalTimingRegister (UVIVerticalTimingRegister Union) 105. m_DisplayCOntrolRegisters (UVIDisplayCOntrolRegister Union) 106. m_HTiming0 (UVIHorizontalTiming0 Union) 107. m_HTiming1 (UVIHorizontalTIming1 Union) 108. m_VBlankTimingOdd (UVIBlankTimingRegister Union) 109. m_VBlankTimingEven (UVIBlankTimingRegister Union) 110. m_BurstBlankingOdd (UVIBurstBlankingRegister Union) 111. m_BurstBlankingEven (UVIBurstBlankingRegister Union) 112. m_XFBInfoTop (UVIFBInfoRegister Union) 113. m_XFBInfoBottom (UVIFBInfoRegister Union) 114. m_3DFBInfoTop (UVIFBInfoRegister Union) 115. m_3DFBInfoBottom (VFIBInfoRegister Union) 116. m_InterruptRegister (UVIInterruptRegister[4] - an array of size 4 for a Union) 117. m_LatchRegister (UVILatchRegister[2] - an array of size 2 for a Union) 118. m_PictureConfiguration (PictureConfigurationRegister Union) 119. m_HorizontalScaling (UVIHorizontalScaling Union) 120. m_FilterCoefTables (SVIFilterCoefTables Struct) 121. m_UnkAARegister (u32) 122. m_Clock (u16) 123. m_DTVStatus (UVIDTVStatus Union) 124. m_FBWidth (UVIHorizontalStepping Union) 125. m_BorderHBlank (UVIBorderBlankRegister Union) 126. s_target_refresh_rate (u32) 127. s_ticks_last_line_start (u64) 128. s_half_line_count (u32) 129. s_half_line_of_next_si_poll (u32) 130. s_current_field (Enum type FieldType (0 or 1) ) 131. s_even_field_first_hl (u32) 132. s_odd_field_first_hl (u32) 133. s_even_field_last_hl (u32) 134. s_odd_field_last_hl (u32) 135. MARKER - VideoInterface SerialInterface::DoState(PointerWrap) Loops 4 times, with i taking on values 0 to 4 for each controller port: 136. g_Channel[i].m_InHi.Hex (u32) 137. g_Channel[i].m_InLo.Hex (u32) 138. g_Channel[i].m_Out.Hex (u32) 139. device->getDeviceType() (SIDevices - an enumerated type) SI_Device_GCController::DoState(PointerWrap): 140. m_Calibrated (bool) 141. m_Origin (SOrigin Struct - holds which buttons are pressed) 142. m_mode (byte) 143. m_TButtonComboStart (u64) 144. m_TButtonCombo (u64) 145. m_LastButtonCombo (EButtonCombo - enumerated type with 3 values) 146. g_Poll (USIPoll Union) 147. g_ComCSR (USIComCSR Union) 148. g_StatusReg (USIStatusReg Union) 149. g_EXIClockCount (USIEXIClockCount Union) 150. g_SIBuffer (byte[128]) 151. MARKER - SerialInterface ProcessorInterface::DoState(PointerWrap): 152. m_InterruptMask (u32) 153. m_InterruptCause (u32) 154. Fifo_CPUBase (u32) 155. Fifo_CPUEnd (u32) 156. Fifo_CPUWritePointer (u32) 157. m_Fifo_Reset (u32) 158. m_ResetCode (u32) 159. m_FlipperRev (u32) 160. m_Unknown (u32) 161. MARKER - ProcessorInterface DSP::DoState(PointerWrap): 162. g_ARAM.ptr (byte* - stores all audio RAM) 163. g_dspState (UDSPControl Union) 164. g_audioDMA (AudioDMA Struct) 165. g_arDMA (ARAM_DNA Struct) 166. g_ARAM_Info (ARAM_Info Union) 167. g_AR_MODE (u16) 168. g_AR_REFRESH (u16) 169. dsp_slice (int) 170. last_mmaddr (u32) 171. last_aram_dma_count (u32) 172. instant_dma (bool) dsp_emulator->DoState(PointerWrap) (in DSPHLE::DoState(PointerWrap)): 173. isHLE (boolean - will be true, since this is the setting we're using) 174. m_DSPControl (UDSPCOntrol Union) 175. m_dspState (DSPState Struct) 176. ucode_crc (int) 177. lastucode_crc (int) ucode->DoState(p) (UCodeInteface::DoState(PointerWrap)): 178. m_upload_setup_in_progress (bool) 179. m_next_ucode (NextUCodeInfo Struct) 180. m_next_ucode_steps (int) 181. m_needs_resume_mail (bool) lastucode->DoState(p) (UCodeInteface::DoState(PointerWrap)): 178. m_upload_setup_in_progress (bool) 179. m_next_ucode (NextUCodeInfo Struct) 180. m_next_ucode_steps (int) 181. m_needs_resume_mail (bool) CMailHandler::DoState(PointerWrap(): (NOTE: Right before this, a lot of sketchy deletes happen. Might want to look into this) 182. sz (int - num pieces of mail) For loop on each piece of mail: (NOTE: different code handles reading and writing... idk if this actually works, but I don't think it can cause desyncs...) 183. mail (u32) 184. interrupt (bool) 185. MARKER - DSP DVDInterface::DoState(PointerWrap): 186. s_DISR (UDISR Union) 187. s_DICVR (UDICVR Union) 188. s_DICMDBUF (UDICMDBUF[3] Union) 189. s_DIMAR (UDIMAR Union) 190. s_DILENGTH (UDILENGTH Union) 191. s_DICR (UDICR Union) 192. s_DIIMMBUF (UDIIMMBUF Union) 193. s_DICFG (UDICFG Union) 194. s_next_start (u32) 195. s_audio_position (u32) 196. s_next_length (u32) 197. s_error_code (u32) 198. s_disk_inside (bool) 199. s_stream (bool) 200. s_current_start (u32) 201. s_current_length (u32) 202. s_last_read_offset (u64) 203. s_last_read_time (u64) 204. s_stop_at_track_end (bool) DVDThread::DoState(PointerWrap): 205. s_dvd_buffer (vector) 206. s_time_read_started (u64) 207. s_dvd_success (bool) 208. s_dvd_offset (u64) 209. s_output_address (u32) 210. s_length (u32) 211. s_decrypt (bool) 212. s_reply_to_ios (bool) (NOTE: s_realtime_started_us and s_realtime_done_us aren't saved, so sys times can be rendered inaccurate via loading a save state) 213. MARKER - DVDInterface GPFifo::DoState(PointerWrap): 214. m_gatherPipe (byte[512]) 215. m_gatherPipeCount (u32) 216. MARKER - GPFifo ExpansionInterface::DoState(PointerWrap): For loop on each channel in g_Channels: channel->DoState(PointerWrap) (CEXIChannel::DoState(PointerWrap)): 217. m_status (UEXI_Status Union) 218. m_DMAMemoryAddress (u32) 219. m_DMALength (u32) 220. m_Control (UEXI_CONTROL Union) 221. m_ImmData (u32) For loop on each device in m_pDevices (3 total): 222. device->m_deviceType (TEXIDevices - enum (ex. memory card)) device->DoState(PointerWrap) (IEXIDevice::DoState(PointerWrap) (adds and moves devices around when not found and savestating - check this later) In my case, this would be CEXIMemoryCard::DoState(PointerWrap): 223. storeContents (bool, true while making a movie) 224. interruptSwitch (int) 225. m_bInterruptSet (bool) 226. command (int) 227. status (int) 228. m_uPosition (u32) 229. programming_buffer (byte[128]) 230. address (unsigned int) MemoryCard::DoState(PointerWrap): 231. card_index (int) 232. memory_card_size (u32) 233. m_memcard_data (byte[]) 234. card_index (int) 235. MARKER - ExpansionInterface AudioInterface::DoState(PointerWrap): 236. m_Control (AICR Union) 237. m_Volume (AIVR Union) 238. m_SampleCounter (u32) 239. m_interruptTiming (u32) 240. g_LastCPUTime (u64) 241. g_AISSampleRate (unsigned int) 242. g_AIDSampleRate (unsigned int) 243. g_CPUCyclesPerSample (u64) 244. MARKER - AudioInterface 245. MARKER - WIIHW 246. MARKER - HW Movie::DoState(PointerWrap): 247. g_currentFrame (u64) 248. s_currentByte (u64) 249. g_currentLagCount (u64) 250. g_currentInputCount (u64) 251. s_bPolled (bool) 252. s_tickCountAtLastInput (u64) 253. MARKER - Movie AVIDump::DoState(): sets s_last_frame equal to number of ticks from CoreTiming. Return name of version_created_by END: