From 4b4e3432cde2493d6d9bdd8cd3da559ae57e6a16 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 9 Aug 2020 21:20:42 -0700 Subject: [PATCH 01/12] SaveState: Split Do() into a separate header. --- CMakeLists.txt | 2 + Common/ChunkFile.cpp | 63 +-- Common/ChunkFile.h | 464 +-------------------- Common/ChunkFileDo.h | 415 ++++++++++++++++++ Common/Common.vcxproj | 3 +- Common/Common.vcxproj.filters | 3 +- Common/FixedSizeQueue.h | 10 +- Common/ThreadSafeList.h | 2 +- Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 7 +- Core/CoreTiming.cpp | 33 +- Core/CwCheat.cpp | 3 +- Core/Dialog/PSPDialog.cpp | 27 +- Core/Dialog/PSPGamedataInstallDialog.cpp | 23 +- Core/Dialog/PSPMsgDialog.cpp | 15 +- Core/Dialog/PSPNetconfDialog.cpp | 9 +- Core/Dialog/PSPOskDialog.cpp | 15 +- Core/Dialog/PSPSaveDialog.cpp | 16 +- Core/Dialog/PSPScreenshotDialog.cpp | 5 +- Core/Dialog/SavedataParam.cpp | 33 +- Core/FileSystems/DirectoryFileSystem.cpp | 25 +- Core/FileSystems/FileSystem.cpp | 25 +- Core/FileSystems/ISOFileSystem.cpp | 37 +- Core/FileSystems/MetaFileSystem.cpp | 7 +- Core/FileSystems/VirtualDiscFileSystem.cpp | 39 +- Core/Font/PGF.cpp | 39 +- Core/HLE/HLE.cpp | 12 +- Core/HLE/HLEHelperThread.cpp | 5 +- Core/HLE/ThreadQueueList.h | 8 +- Core/HLE/__sceAudio.cpp | 11 +- Core/HLE/proAdhoc.cpp | 34 ++ Core/HLE/proAdhoc.h | 36 +- Core/HLE/sceAtrac.cpp | 71 ++-- Core/HLE/sceAudio.cpp | 19 +- Core/HLE/sceAudiocodec.cpp | 13 +- Core/HLE/sceCcc.cpp | 11 +- Core/HLE/sceCtrl.cpp | 29 +- Core/HLE/sceDisplay.cpp | 57 +-- Core/HLE/sceDmac.cpp | 3 +- Core/HLE/sceFont.cpp | 77 ++-- Core/HLE/sceGe.cpp | 19 +- Core/HLE/sceHeap.cpp | 11 +- Core/HLE/sceImpose.cpp | 11 +- Core/HLE/sceIo.cpp | 65 +-- Core/HLE/sceJpeg.cpp | 8 +- Core/HLE/sceKernel.cpp | 17 +- Core/HLE/sceKernelAlarm.cpp | 9 +- Core/HLE/sceKernelEventFlag.cpp | 11 +- Core/HLE/sceKernelHeap.cpp | 15 +- Core/HLE/sceKernelInterrupt.cpp | 23 +- Core/HLE/sceKernelMbx.cpp | 9 +- Core/HLE/sceKernelMemory.cpp | 55 +-- Core/HLE/sceKernelModule.cpp | 37 +- Core/HLE/sceKernelMsgPipe.cpp | 17 +- Core/HLE/sceKernelMutex.cpp | 19 +- Core/HLE/sceKernelSemaphore.cpp | 11 +- Core/HLE/sceKernelThread.cpp | 135 +++--- Core/HLE/sceKernelTime.cpp | 5 +- Core/HLE/sceKernelVTimer.cpp | 13 +- Core/HLE/sceMp3.cpp | 43 +- Core/HLE/sceMp4.cpp | 3 +- Core/HLE/sceMpeg.cpp | 81 ++-- Core/HLE/sceNet.cpp | 53 ++- Core/HLE/sceNet.h | 23 +- Core/HLE/sceNetAdhoc.cpp | 21 +- Core/HLE/scePower.cpp | 11 +- Core/HLE/scePsmf.cpp | 133 +++--- Core/HLE/sceRtc.cpp | 3 +- Core/HLE/sceSas.cpp | 5 +- Core/HLE/sceSsl.cpp | 12 +- Core/HLE/sceUmd.cpp | 23 +- Core/HLE/sceUsb.cpp | 9 +- Core/HLE/sceUsbCam.cpp | 3 +- Core/HLE/sceUsbGps.cpp | 3 +- Core/HLE/sceUsbMic.cpp | 13 +- Core/HLE/sceUtility.cpp | 9 +- Core/HLE/sceVaudio.cpp | 3 +- Core/HW/AsyncIOManager.cpp | 7 +- Core/HW/AsyncIOManager.h | 6 +- Core/HW/BufferQueue.cpp | 34 ++ Core/HW/BufferQueue.h | 15 +- Core/HW/MediaEngine.cpp | 31 +- Core/HW/MemoryStick.cpp | 11 +- Core/HW/MpegDemux.cpp | 15 +- Core/HW/SasAudio.cpp | 123 +++--- Core/HW/SimpleAudioDec.cpp | 37 +- Core/MIPS/ARM/ArmJit.cpp | 7 +- Core/MIPS/ARM64/Arm64Jit.cpp | 7 +- Core/MIPS/IR/IRFrontend.cpp | 5 +- Core/MIPS/JitCommon/JitCommon.cpp | 5 +- Core/MIPS/MIPS.cpp | 37 +- Core/MIPS/MIPS/MipsJit.cpp | 4 +- Core/MIPS/x86/Jit.cpp | 5 +- Core/MemMap.cpp | 13 +- Core/Reporting.cpp | 3 +- Core/SaveState.cpp | 5 +- Core/Util/BlockAllocator.cpp | 19 +- Core/Util/PPGeDraw.cpp | 55 +-- GPU/Common/PostShader.h | 2 +- GPU/GPUCommon.cpp | 25 +- GPU/GPUState.cpp | 61 +-- UWP/CoreUWP/CoreUWP.vcxproj | 1 + UWP/CoreUWP/CoreUWP.vcxproj.filters | 3 + android/jni/Android.mk | 1 + libretro/Makefile.common | 1 + 105 files changed, 1630 insertions(+), 1556 deletions(-) create mode 100644 Common/ChunkFileDo.h create mode 100644 Core/HW/BufferQueue.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a2a6987e01..d616ca6ebf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1687,6 +1687,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/HW/SimpleAudioDec.h Core/HW/AsyncIOManager.cpp Core/HW/AsyncIOManager.h + Core/HW/BufferQueue.cpp + Core/HW/BufferQueue.h Core/HW/Camera.cpp Core/HW/Camera.h Core/HW/MediaEngine.cpp diff --git a/Common/ChunkFile.cpp b/Common/ChunkFile.cpp index 8954de5c45..229c96aaff 100644 --- a/Common/ChunkFile.cpp +++ b/Common/ChunkFile.cpp @@ -20,6 +20,7 @@ #include #include "ChunkFile.h" +#include "ChunkFileDo.h" #include "StringUtils.h" PointerWrapSection PointerWrap::Section(const char *title, int ver) { @@ -42,7 +43,7 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver) foundVersion = 0; } } else { - Do(foundVersion); + Do(*this, foundVersion); } if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) { @@ -95,43 +96,43 @@ void PointerWrap::DoVoid(void *data, int size) { (*ptr) += size; } -void PointerWrap::Do(std::string &x) { +void Do(PointerWrap &p, std::string &x) { int stringLen = (int)x.length() + 1; - Do(stringLen); + Do(p, stringLen); - switch (mode) { - case MODE_READ: x = (char*)*ptr; break; - case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; - case MODE_MEASURE: break; - case MODE_VERIFY: _dbg_assert_msg_(!strcmp(x.c_str(), (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char*)*ptr, ptr); break; + switch (p.mode) { + case PointerWrap::MODE_READ: x = (char*)*p.ptr; break; + case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break; + case PointerWrap::MODE_MEASURE: break; + case PointerWrap::MODE_VERIFY: _dbg_assert_msg_(!strcmp(x.c_str(), (char*)*p.ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char *)*p.ptr, p.ptr); break; } - (*ptr) += stringLen; + (*p.ptr) += stringLen; } -void PointerWrap::Do(std::wstring &x) { +void Do(PointerWrap &p, std::wstring &x) { int stringLen = sizeof(wchar_t)*((int)x.length() + 1); - Do(stringLen); + Do(p, stringLen); - switch (mode) { - case MODE_READ: x = (wchar_t*)*ptr; break; - case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; - case MODE_MEASURE: break; - case MODE_VERIFY: _dbg_assert_msg_(x == (wchar_t*)*ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; + switch (p.mode) { + case PointerWrap::MODE_READ: x = (wchar_t*)*p.ptr; break; + case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break; + case PointerWrap::MODE_MEASURE: break; + case PointerWrap::MODE_VERIFY: _dbg_assert_msg_(x == (wchar_t*)*p.ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*p.ptr, p.ptr); break; } - (*ptr) += stringLen; + (*p.ptr) += stringLen; } -void PointerWrap::Do(std::u16string &x) { +void Do(PointerWrap &p, std::u16string &x) { int stringLen = sizeof(char16_t) * ((int)x.length() + 1); - Do(stringLen); + Do(p, stringLen); - switch (mode) { - case MODE_READ: x = (char16_t*)*ptr; break; - case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; - case MODE_MEASURE: break; - case MODE_VERIFY: _dbg_assert_msg_(x == (char16_t*)*ptr, "Savestate verification failure: (at %p).\n", x.c_str()); break; + switch (p.mode) { + case PointerWrap::MODE_READ: x = (char16_t*)*p.ptr; break; + case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break; + case PointerWrap::MODE_MEASURE: break; + case PointerWrap::MODE_VERIFY: _dbg_assert_msg_(x == (char16_t*)*p.ptr, "Savestate verification failure: (at %p).\n", x.c_str()); break; } - (*ptr) += stringLen; + (*p.ptr) += stringLen; } struct standard_tm { @@ -146,31 +147,31 @@ struct standard_tm { int tm_isdst; }; -void PointerWrap::Do(tm &t) { +void Do(PointerWrap &p, tm &t) { // We savestate this separately because some platforms use extra data at the end. // However, old files may have the native tm in them. // Since the first value in the struct is 0-59, we save a funny value and check for it. // If our funny value ('tm' 0x1337) exists, it's a new version savestate. int funnyValue = 0x13376D74; - if (ExpectVoid(&funnyValue, sizeof(funnyValue))) { + if (p.ExpectVoid(&funnyValue, sizeof(funnyValue))) { standard_tm stm; - if (mode == MODE_READ) { + if (p.mode == PointerWrap::MODE_READ) { // Null out the extra members, e.g. tm_gmtoff or tm_zone. memset(&t, 0, sizeof(t)); } else { memcpy(&stm, &t, sizeof(stm)); } - DoVoid((void *)&stm, sizeof(stm)); + p.DoVoid((void *)&stm, sizeof(stm)); memcpy(&t, &stm, sizeof(stm)); } else { - DoVoid((void *)&t, sizeof(t)); + p.DoVoid((void *)&t, sizeof(t)); } } void PointerWrap::DoMarker(const char *prevName, u32 arbitraryNumber) { u32 cookie = arbitraryNumber; - Do(cookie); + Do(*this, cookie); if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) { _assert_msg_(false, "Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); SetError(ERROR_FAILURE); diff --git a/Common/ChunkFile.h b/Common/ChunkFile.h index e8a41901c5..67ef6f0e21 100644 --- a/Common/ChunkFile.h +++ b/Common/ChunkFile.h @@ -76,44 +76,6 @@ private: // Wrapper class class PointerWrap { -private: - // This makes it a compile error if you forget to define DoState() on non-POD. - // Which also can be a problem, for example struct tm is non-POD on linux, for whatever reason... -#ifdef _MSC_VER - template::value, bool isPointer = std::is_pointer::value> -#else - template::value> -#endif - struct DoHelper - { - static void DoArray(PointerWrap *p, T *x, int count) - { - for (int i = 0; i < count; ++i) - p->Do(x[i]); - } - - static void Do(PointerWrap *p, T &x) - { - p->DoClass(x); - } - }; - - template - struct DoHelper - { - static void DoArray(PointerWrap *p, T *x, int count) - { - p->DoVoid((void *)x, sizeof(T) * count); - } - - static void Do(PointerWrap *p, T &x) - { - p->DoVoid((void *)&x, sizeof(x)); - } - }; - - const char *firstBadSectionTitle_ = nullptr; - public: enum Mode { MODE_READ = 1, // load @@ -132,7 +94,6 @@ public: Mode mode; Error error = ERROR_NONE; -public: PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {} PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {} @@ -155,430 +116,11 @@ public: // Same as DoVoid, except doesn't advance pointer if it doesn't match on read. bool ExpectVoid(void *data, int size); void DoVoid(void *data, int size); - - template - void Do(std::map &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { - if (it->second != NULL) - delete it->second; - } - } - T *dv = NULL; - DoMap(x, dv); - } - - template - void Do(std::map &x) - { - T dv = T(); - DoMap(x, dv); - } - - template - void Do(std::unordered_map &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { - if (it->second != NULL) - delete it->second; - } - } - T *dv = NULL; - DoMap(x, dv); - } - - template - void Do(std::unordered_map &x) - { - T dv = T(); - DoMap(x, dv); - } - - template - void DoMap(M &x, typename M::mapped_type &default_val) - { - unsigned int number = (unsigned int)x.size(); - Do(number); - switch (mode) { - case MODE_READ: - { - x.clear(); - while (number > 0) - { - typename M::key_type first = typename M::key_type(); - Do(first); - typename M::mapped_type second = default_val; - Do(second); - x[first] = second; - --number; - } - } - break; - case MODE_WRITE: - case MODE_MEASURE: - case MODE_VERIFY: - { - typename M::iterator itr = x.begin(); - while (number > 0) - { - typename M::key_type first = itr->first; - Do(first); - Do(itr->second); - --number; - ++itr; - } - } - break; - } - } - - template - void Do(std::multimap &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { - if (it->second != NULL) - delete it->second; - } - } - T *dv = NULL; - DoMultimap(x, dv); - } - - template - void Do(std::multimap &x) - { - T dv = T(); - DoMultimap(x, dv); - } - - template - void Do(std::unordered_multimap &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { - if (it->second != NULL) - delete it->second; - } - } - T *dv = NULL; - DoMultimap(x, dv); - } - - template - void Do(std::unordered_multimap &x) - { - T dv = T(); - DoMultimap(x, dv); - } - - template - void DoMultimap(M &x, typename M::mapped_type &default_val) - { - unsigned int number = (unsigned int)x.size(); - Do(number); - switch (mode) { - case MODE_READ: - { - x.clear(); - while (number > 0) - { - typename M::key_type first = typename M::key_type(); - Do(first); - typename M::mapped_type second = default_val; - Do(second); - x.insert(std::make_pair(first, second)); - --number; - } - } - break; - case MODE_WRITE: - case MODE_MEASURE: - case MODE_VERIFY: - { - typename M::iterator itr = x.begin(); - while (number > 0) - { - Do(itr->first); - Do(itr->second); - --number; - ++itr; - } - } - break; - } - } - - // Store vectors. - template - void Do(std::vector &x) - { - T *dv = NULL; - DoVector(x, dv); - } - - template - void Do(std::vector &x) - { - T dv = T(); - DoVector(x, dv); - } - - template - void Do(std::vector &x, T &default_val) - { - DoVector(x, default_val); - } - - template - void DoVector(std::vector &x, T &default_val) - { - u32 vec_size = (u32)x.size(); - Do(vec_size); - x.resize(vec_size, default_val); - if (vec_size > 0) - DoArray(&x[0], vec_size); - } - - // Store deques. - template - void Do(std::deque &x) - { - T *dv = NULL; - DoDeque(x, dv); - } - - template - void Do(std::deque &x) - { - T dv = T(); - DoDeque(x, dv); - } - - template - void DoDeque(std::deque &x, T &default_val) - { - u32 deq_size = (u32)x.size(); - Do(deq_size); - x.resize(deq_size, default_val); - u32 i; - for(i = 0; i < deq_size; i++) - Do(x[i]); - } - - // Store STL lists. - template - void Do(std::list &x) - { - T *dv = NULL; - Do(x, dv); - } - - template - void Do(std::list &x) - { - T dv = T(); - DoList(x, dv); - } - - template - void Do(std::list &x, T &default_val) - { - DoList(x, default_val); - } - - template - void DoList(std::list &x, T &default_val) - { - u32 list_size = (u32)x.size(); - Do(list_size); - x.resize(list_size, default_val); - - typename std::list::iterator itr, end; - for (itr = x.begin(), end = x.end(); itr != end; ++itr) - Do(*itr); - } - - // Store STL sets. - template - void Do(std::set &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { - if (*it != NULL) - delete *it; - } - } - DoSet(x); - } - - template - void Do(std::set &x) - { - DoSet(x); - } - - template - void DoSet(std::set &x) - { - unsigned int number = (unsigned int)x.size(); - Do(number); - - switch (mode) - { - case MODE_READ: - { - x.clear(); - while (number-- > 0) - { - T it = T(); - Do(it); - x.insert(it); - } - } - break; - case MODE_WRITE: - case MODE_MEASURE: - case MODE_VERIFY: - { - typename std::set::iterator itr = x.begin(); - while (number-- > 0) - Do(*itr++); - } - break; - - default: - ERROR_LOG(SAVESTATE, "Savestate error: invalid mode %d.", mode); - } - } - - // Store strings. - void Do(std::string &x); - void Do(std::wstring &x); // DEPRECATED, do not save wstrings - void Do(std::u16string &x); - - void Do(tm &t); - - template - void Do(swap_struct_t &x) { - T v = x.swap(); - Do(v); - x = v; - } - - template - void DoClass(T &x) { - x.DoState(*this); - } - - template - void DoClass(T *&x) { - if (mode == MODE_READ) - { - if (x != NULL) - delete x; - x = new T(); - } - x->DoState(*this); - } - - template - void DoArray(T *x, int count) { - DoHelper::DoArray(this, x, count); - } - - template - void Do(T &x) { - DoHelper::Do(this, x); - } - - template - void DoPointer(T* &x, T*const base) { - // pointers can be more than 2^31 apart, but you're using this function wrong if you need that much range - s32 offset = x - base; - Do(offset); - if (mode == MODE_READ) - x = base + offset; - } - - template* (*TNew)(), void (*TFree)(LinkedListItem*), void (*TDo)(PointerWrap&, T*)> - void DoLinkedList(LinkedListItem*& list_start, LinkedListItem** list_end=0) - { - LinkedListItem* list_cur = list_start; - LinkedListItem* prev = 0; - - while (true) - { - u8 shouldExist = (list_cur ? 1 : 0); - Do(shouldExist); - if (shouldExist == 1) - { - LinkedListItem* cur = list_cur ? list_cur : TNew(); - TDo(*this, (T*)cur); - if (!list_cur) - { - if (mode == MODE_READ) - { - cur->next = 0; - list_cur = cur; - if (prev) - prev->next = cur; - else - list_start = cur; - } - else - { - TFree(cur); - continue; - } - } - } - else - { - if (shouldExist != 0) - { - WARN_LOG(SAVESTATE, "Savestate failure: incorrect item marker %d", shouldExist); - SetError(ERROR_FAILURE); - } - if (mode == MODE_READ) - { - if (prev) - prev->next = 0; - if (list_end) - *list_end = prev; - if (list_cur) - { - if (list_start == list_cur) - list_start = 0; - do - { - LinkedListItem* next = list_cur->next; - TFree(list_cur); - list_cur = next; - } - while (list_cur); - } - } - break; - } - prev = list_cur; - list_cur = list_cur->next; - } - } void DoMarker(const char *prevName, u32 arbitraryNumber = 0x42); + +private: + const char *firstBadSectionTitle_ = nullptr; }; class CChunkFileReader diff --git a/Common/ChunkFileDo.h b/Common/ChunkFileDo.h new file mode 100644 index 0000000000..3849248295 --- /dev/null +++ b/Common/ChunkFileDo.h @@ -0,0 +1,415 @@ +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// Templates for save state serialization. See ChunkFile.h. +#include "Common/ChunkFile.h" + +void Do(PointerWrap &p, std::string &x); +void Do(PointerWrap &p, std::wstring &x); // DEPRECATED, do not save wstrings +void Do(PointerWrap &p, std::u16string &x); + +void Do(PointerWrap &p, tm &t); + +// Don't use DoHelper_ directly. Just use Do(). + +// This makes it a compile error if you forget to define DoState() on non-POD. +// Which also can be a problem, for example struct tm is non-POD on linux, for whatever reason... +#ifdef _MSC_VER +template::value, bool isPointer = std::is_pointer::value> +#else +template::value> +#endif +struct DoHelper_ { + static void DoArray(PointerWrap &p, T *x, int count) { + for (int i = 0; i < count; ++i) + Do(p, x[i]); + } + + static void DoThing(PointerWrap &p, T &x) { + DoClass(p, x); + } +}; + +template +struct DoHelper_ { + static void DoArray(PointerWrap &p, T *x, int count) { + p.DoVoid((void *)x, sizeof(T) * count); + } + + static void DoThing(PointerWrap &p, T &x) { + p.DoVoid((void *)&x, sizeof(x)); + } +}; + +template +void DoClass(PointerWrap &p, T &x) { + x.DoState(p); +} + +template +void DoClass(PointerWrap &p, T *&x) { + if (p.mode == PointerWrap::MODE_READ) { + if (x != nullptr) + delete x; + x = new T(); + } + x->DoState(p); +} + +template +void DoArray(PointerWrap &p, T *x, int count) { + DoHelper_::DoArray(p, x, count); +} + +template +void Do(PointerWrap &p, T &x) { + DoHelper_::DoThing(p, x); +} + +template +void DoMap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { + unsigned int number = (unsigned int)x.size(); + Do(p, number); + switch (p.mode) { + case PointerWrap::MODE_READ: + { + x.clear(); + while (number > 0) { + typename M::key_type first = typename M::key_type(); + Do(p, first); + typename M::mapped_type second = default_val; + Do(p, second); + x[first] = second; + --number; + } + } + break; + case PointerWrap::MODE_WRITE: + case PointerWrap::MODE_MEASURE: + case PointerWrap::MODE_VERIFY: + { + typename M::iterator itr = x.begin(); + while (number > 0) { + typename M::key_type first = itr->first; + Do(p, first); + Do(p, itr->second); + --number; + ++itr; + } + } + break; + } +} + +template +void Do(PointerWrap &p, std::map &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::map &x) { + T dv = T(); + DoMap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_map &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_map &x) { + T dv = T(); + DoMap(p, x, dv); +} + +template +void DoMultimap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { + unsigned int number = (unsigned int)x.size(); + Do(p, number); + switch (p.mode) { + case PointerWrap::MODE_READ: + { + x.clear(); + while (number > 0) { + typename M::key_type first = typename M::key_type(); + Do(p, first); + typename M::mapped_type second = default_val; + Do(p, second); + x.insert(std::make_pair(first, second)); + --number; + } + } + break; + case PointerWrap::MODE_WRITE: + case PointerWrap::MODE_MEASURE: + case PointerWrap::MODE_VERIFY: + { + typename M::iterator itr = x.begin(); + while (number > 0) { + Do(p, itr->first); + Do(p, itr->second); + --number; + ++itr; + } + } + break; + } +} + +template +void Do(PointerWrap &p, std::multimap &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMultimap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::multimap &x) { + T dv = T(); + DoMultimap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_multimap &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMultimap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_multimap &x) { + T dv = T(); + DoMultimap(p, x, dv); +} + +template +void DoVector(PointerWrap &p, std::vector &x, T &default_val) { + u32 vec_size = (u32)x.size(); + Do(p, vec_size); + x.resize(vec_size, default_val); + if (vec_size > 0) + DoArray(p, &x[0], vec_size); +} + +template +void Do(PointerWrap &p, std::vector &x) { + T *dv = nullptr; + DoVector(p, x, dv); +} + +template +void Do(PointerWrap &p, std::vector &x) { + T dv = T(); + DoVector(p, x, dv); +} + +template +void Do(PointerWrap &p, std::vector &x, T &default_val) { + DoVector(p, x, default_val); +} + +template +void DoDeque(PointerWrap &p, std::deque &x, T &default_val) { + u32 deq_size = (u32)x.size(); + Do(p, deq_size); + x.resize(deq_size, default_val); + u32 i; + for (i = 0; i < deq_size; i++) + Do(p, x[i]); +} + +template +void Do(PointerWrap &p, std::deque &x) { + T *dv = nullptr; + DoDeque(p, x, dv); +} + +template +void Do(PointerWrap &p, std::deque &x) { + T dv = T(); + DoDeque(p, x, dv); +} + +template +void DoList(PointerWrap &p, std::list &x, T &default_val) { + u32 list_size = (u32)x.size(); + Do(p, list_size); + x.resize(list_size, default_val); + + typename std::list::iterator itr, end; + for (itr = x.begin(), end = x.end(); itr != end; ++itr) + Do(p, *itr); +} + +template +void Do(PointerWrap &p, std::list &x) { + T *dv = nullptr; + Do(p, x, dv); +} + +template +void Do(PointerWrap &p, std::list &x) { + T dv = T(); + DoList(p, x, dv); +} + +template +void Do(PointerWrap &p, std::list &x, T &default_val) { + DoList(p, x, default_val); +} + +template +void DoSet(PointerWrap &p, std::set &x) { + unsigned int number = (unsigned int)x.size(); + Do(p, number); + + switch (p.mode) { + case PointerWrap::MODE_READ: + { + x.clear(); + while (number-- > 0) { + T it = T(); + Do(p, it); + x.insert(it); + } + } + break; + case PointerWrap::MODE_WRITE: + case PointerWrap::MODE_MEASURE: + case PointerWrap::MODE_VERIFY: + { + typename std::set::iterator itr = x.begin(); + while (number-- > 0) + Do(p, *itr++); + } + break; + + default: + ERROR_LOG(SAVESTATE, "Savestate error: invalid mode %d.", p.mode); + } +} + +// Store STL sets. +template +void Do(PointerWrap &p, std::set &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (*it != nullptr) + delete *it; + } + } + DoSet(p, x); +} + +template +void Do(PointerWrap &p, std::set &x) { + DoSet(p, x); +} + +template +void Do(PointerWrap &p, swap_struct_t &x) { + T v = x.swap(); + Do(p, v); + x = v; +} + +template +void DoPointer(PointerWrap &p, T *&x, T *const base) { + // pointers can be more than 2^31 apart, but you're using this function wrong if you need that much range + s32 offset = x - base; + Do(p, offset); + if (p.mode == PointerWrap::MODE_READ) + x = base + offset; +} + +template *(*TNew)(), void (*TFree)(LinkedListItem *), void (*TDo)(PointerWrap &, T *)> +void DoLinkedList(PointerWrap &p, LinkedListItem *&list_start, LinkedListItem **list_end = nullptr) { + LinkedListItem *list_cur = list_start; + LinkedListItem *prev = nullptr; + + while (true) { + u8 shouldExist = (list_cur ? 1 : 0); + Do(p, shouldExist); + if (shouldExist == 1) { + LinkedListItem *cur = list_cur ? list_cur : TNew(); + TDo(p, (T *)cur); + if (!list_cur) { + if (p.mode == PointerWrap::MODE_READ) { + cur->next = 0; + list_cur = cur; + if (prev) + prev->next = cur; + else + list_start = cur; + } else { + TFree(cur); + continue; + } + } + } else { + if (shouldExist != 0) { + WARN_LOG(SAVESTATE, "Savestate failure: incorrect item marker %d", shouldExist); + p.SetError(p.ERROR_FAILURE); + } + if (p.mode == PointerWrap::MODE_READ) { + if (prev) + prev->next = nullptr; + if (list_end) + *list_end = prev; + if (list_cur) { + if (list_start == list_cur) + list_start = nullptr; + do { + LinkedListItem *next = list_cur->next; + TFree(list_cur); + list_cur = next; + } while (list_cur); + } + } + break; + } + prev = list_cur; + list_cur = list_cur->next; + } +} diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 6486c530e7..c54bc30238 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -354,6 +354,7 @@ + @@ -524,4 +525,4 @@ - + \ No newline at end of file diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index c49d67d6af..a19ee2e281 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -76,6 +76,7 @@ + @@ -155,4 +156,4 @@ {c14d66ef-5f7c-4565-975a-72774e7ccfb9} - + \ No newline at end of file diff --git a/Common/FixedSizeQueue.h b/Common/FixedSizeQueue.h index d59555f7d8..03ebf5c41f 100644 --- a/Common/FixedSizeQueue.h +++ b/Common/FixedSizeQueue.h @@ -147,16 +147,16 @@ public: void DoState(PointerWrap &p) { int size = N; - p.Do(size); + Do(p, size); if (size != N) { ERROR_LOG(COMMON, "Savestate failure: Incompatible queue size."); return; } - p.DoArray(storage_, N); - p.Do(head_); - p.Do(tail_); - p.Do(count_); + DoArray(p, storage_, N); + Do(p, head_); + Do(p, tail_); + Do(p, count_); p.DoMarker("FixedSizeQueue"); } diff --git a/Common/ThreadSafeList.h b/Common/ThreadSafeList.h index 37389286ba..9697438bb9 100644 --- a/Common/ThreadSafeList.h +++ b/Common/ThreadSafeList.h @@ -75,7 +75,7 @@ public: void DoState(PointerWrap &p) { std::lock_guard guard(lock); - p.Do(list); + Do(p, list); } private: diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index baf1d89505..d690042fb9 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -388,6 +388,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index a5460b6d4f..1a63c8b4a2 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -748,13 +748,16 @@ Core - + Util Core + + HW + @@ -1396,7 +1399,7 @@ Core - + Util diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index a269455161..8c49a4c15c 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -23,6 +23,8 @@ #include "base/logging.h" #include "profiler/profiler.h" +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/MsgHandler.h" #include "Core/CoreTiming.h" #include "Core/Core.h" @@ -31,7 +33,6 @@ #include "Core/HLE/sceDisplay.h" #include "Core/MIPS/MIPS.h" #include "Core/Reporting.h" -#include "Common/ChunkFile.h" static const int initialHz = 222000000; int CPU_HZ = 222000000; @@ -671,14 +672,14 @@ std::string GetScheduledEventsSummary() { void Event_DoState(PointerWrap &p, BaseEvent *ev) { // There may be padding, so do each one individually. - p.Do(ev->time); - p.Do(ev->userdata); - p.Do(ev->type); + Do(p, ev->time); + Do(p, ev->userdata); + Do(p, ev->type); } void Event_DoStateOld(PointerWrap &p, BaseEvent *ev) { - p.Do(*ev); + Do(p, *ev); } void DoState(PointerWrap &p) @@ -690,26 +691,26 @@ void DoState(PointerWrap &p) return; int n = (int) event_types.size(); - p.Do(n); + Do(p, n); // These (should) be filled in later by the modules. event_types.resize(n, EventType(AntiCrashCallback, "INVALID EVENT")); if (s >= 3) { - p.DoLinkedList(first, (Event **) NULL); - p.DoLinkedList(tsFirst, &tsLast); + DoLinkedList(p, first, (Event **) NULL); + DoLinkedList(p, tsFirst, &tsLast); } else { - p.DoLinkedList(first, (Event **) NULL); - p.DoLinkedList(tsFirst, &tsLast); + DoLinkedList(p, first, (Event **) NULL); + DoLinkedList(p, tsFirst, &tsLast); } - p.Do(CPU_HZ); - p.Do(slicelength); - p.Do(globalTimer); - p.Do(idledCycles); + Do(p, CPU_HZ); + Do(p, slicelength); + Do(p, globalTimer); + Do(p, idledCycles); if (s >= 2) { - p.Do(lastGlobalTimeTicks); - p.Do(lastGlobalTimeUs); + Do(p, lastGlobalTimeTicks); + Do(p, lastGlobalTimeUs); } else { lastGlobalTimeTicks = 0; lastGlobalTimeUs = 0; diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 3b8e643097..1fb4a4623e 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -5,6 +5,7 @@ #include "i18n/i18n.h" #include "Common/StringUtils.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/FileUtil.h" #include "Core/CoreTiming.h" #include "Core/CoreParameter.h" @@ -304,7 +305,7 @@ void __CheatDoState(PointerWrap &p) { return; } - p.Do(CheatEvent); + Do(p, CheatEvent); CoreTiming::RestoreRegisterEvent(CheatEvent, "CheatEvent", &hleCheat); if (s < 2) { diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index f77682848c..4d7eda334a 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -18,6 +18,7 @@ #include "i18n/i18n.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/StringUtils.h" #include "Core/CoreTiming.h" #include "Core/HLE/sceCtrl.h" @@ -137,26 +138,26 @@ void PSPDialog::DoState(PointerWrap &p) if (!s) return; - p.Do(status); - p.Do(lastButtons); - p.Do(buttons); - p.Do(fadeTimer); - p.Do(isFading); - p.Do(fadeIn); - p.Do(fadeValue); + Do(p, status); + Do(p, lastButtons); + Do(p, buttons); + Do(p, fadeTimer); + Do(p, isFading); + Do(p, fadeIn); + Do(p, fadeValue); // I don't think we should save these two... Let's just ignore them for now for compat. int okButtonImg = 0; - p.Do(okButtonImg); + Do(p, okButtonImg); int cancelButtonImg = 0; - p.Do(cancelButtonImg); + Do(p, cancelButtonImg); - p.Do(okButtonFlag); - p.Do(cancelButtonFlag); + Do(p, okButtonFlag); + Do(p, cancelButtonFlag); if (s >= 2) { - p.Do(pendingStatus); - p.Do(pendingStatusTicks); + Do(p, pendingStatus); + Do(p, pendingStatusTicks); } else { pendingStatusTicks = 0; } diff --git a/Core/Dialog/PSPGamedataInstallDialog.cpp b/Core/Dialog/PSPGamedataInstallDialog.cpp index 5210914309..e8b239982d 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.cpp +++ b/Core/Dialog/PSPGamedataInstallDialog.cpp @@ -18,6 +18,7 @@ #include #include "Common/Common.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/ELF/ParamSFO.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" @@ -260,25 +261,25 @@ void PSPGamedataInstallDialog::DoState(PointerWrap &p) { // This was included in version 1 and higher. PSPDialog::DoState(p); - p.Do(request); + Do(p, request); // This was included in version 2 and higher, but for BC reasons we use 3+. if (s >= 3) { - p.Do(param.ptr); - p.Do(inFileNames); - p.Do(numFiles); - p.Do(readFiles); - p.Do(allFilesSize); - p.Do(allReadSize); - p.Do(progressValue); + Do(p, param.ptr); + Do(p, inFileNames); + Do(p, numFiles); + Do(p, readFiles); + Do(p, allFilesSize); + Do(p, allReadSize); + Do(p, progressValue); } else { param.ptr = 0; } if (s >= 4) { - p.Do(currentInputFile); - p.Do(currentInputBytesLeft); - p.Do(currentOutputFile); + Do(p, currentInputFile); + Do(p, currentInputBytesLeft); + Do(p, currentOutputFile); } else { currentInputFile = 0; currentInputBytesLeft = 0; diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index 7ddd1f8a73..b655dd6300 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -16,14 +16,15 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" +#include "Common/StringUtils.h" #include "Core/Dialog/PSPMsgDialog.h" #include "Core/Dialog/PSPSaveDialog.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" -#include "Common/ChunkFile.h" -#include "Common/StringUtils.h" #include "i18n/i18n.h" #include "util/text/utf8.h" @@ -378,11 +379,11 @@ void PSPMsgDialog::DoState(PointerWrap &p) if (!s) return; - p.Do(flag); - p.Do(messageDialog); - p.Do(messageDialogAddr); - p.DoArray(msgText, sizeof(msgText)); - p.Do(yesnoChoice); + Do(p, flag); + Do(p, messageDialog); + Do(p, messageDialogAddr); + DoArray(p, msgText, sizeof(msgText)); + Do(p, yesnoChoice); // We don't save state this, you'll just have to scroll down again. if (p.mode == p.MODE_READ) { diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index 998f5745cf..4a77d37a8c 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -15,15 +15,16 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "PSPNetconfDialog.h" -#include "ChunkFile.h" +#include "i18n/i18n.h" +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Config.h" +#include "Core/Dialog/PSPNetconfDialog.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/sceNetAdhoc.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" #include "Core/HLE/sceUtility.h" -#include "i18n/i18n.h" #define NETCONF_CONNECT_APNET 0 #define NETCONF_STATUS_APNET 1 @@ -140,5 +141,5 @@ void PSPNetconfDialog::DoState(PointerWrap &p) { if (!s) return; - p.Do(request); + Do(p, request); } diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 3041cae300..4cec09e0c2 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -21,6 +21,7 @@ #include "math/math_util.h" #include "util/text/utf8.h" +#include "Common/ChunkFileDo.h" #include "Core/Dialog/PSPOskDialog.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" @@ -1135,17 +1136,17 @@ void PSPOskDialog::DoState(PointerWrap &p) if (!s) return; - p.Do(oskParams); - p.Do(oskDesc); - p.Do(oskIntext); - p.Do(oskOuttext); - p.Do(selectedChar); + Do(p, oskParams); + Do(p, oskDesc); + Do(p, oskIntext); + Do(p, oskOuttext); + Do(p, selectedChar); if (s >= 2) { - p.Do(inputChars); + Do(p, inputChars); } else { // Discard the wstring. std::wstring wstr; - p.Do(wstr); + Do(p, wstr); } // Don't need to save state native status or value. } diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 3c99d75203..190e6c41cd 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -25,7 +25,7 @@ #include "thread/threadutil.h" #include "Common/ChunkFile.h" - +#include "Common/ChunkFileDo.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" @@ -1140,20 +1140,20 @@ void PSPSaveDialog::DoState(PointerWrap &p) { return; } - p.Do(display); + Do(p, display); param.DoState(p); - p.Do(request); + Do(p, request); // Just reset it. bool hasParam = param.GetPspParam() != NULL; - p.Do(hasParam); + Do(p, hasParam); if (hasParam) { param.SetPspParam(&request); } - p.Do(requestAddr); - p.Do(currentSelectedSave); - p.Do(yesnoChoice); + Do(p, requestAddr); + Do(p, currentSelectedSave); + Do(p, yesnoChoice); if (s > 2) { - p.Do(ioThreadStatus); + Do(p, ioThreadStatus); } else { ioThreadStatus = SAVEIO_NONE; } diff --git a/Core/Dialog/PSPScreenshotDialog.cpp b/Core/Dialog/PSPScreenshotDialog.cpp index cb3abf9a71..2d5c847828 100644 --- a/Core/Dialog/PSPScreenshotDialog.cpp +++ b/Core/Dialog/PSPScreenshotDialog.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Dialog/PSPDialog.h" #include "Core/Dialog/PSPScreenshotDialog.h" #include "Core/HLE/sceKernel.h" @@ -123,8 +124,8 @@ void PSPScreenshotDialog::DoState(PointerWrap &p) { if (!s) return; - p.Do(mode); + Do(p, mode); if (s >= 2) { - p.Do(params_); + Do(p, params_); } } diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 484bb6e910..32374e98cf 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -18,6 +18,7 @@ #include "i18n/i18n.h" #include "base/logging.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/StringUtils.h" #include "Core/Config.h" #include "Core/Host.h" @@ -153,23 +154,23 @@ void SaveFileInfo::DoState(PointerWrap &p) if (!s) return; - p.Do(size); - p.Do(saveName); - p.Do(idx); + Do(p, size); + Do(p, saveName); + Do(p, idx); - p.DoArray(title, sizeof(title)); - p.DoArray(saveTitle, sizeof(saveTitle)); - p.DoArray(saveDetail, sizeof(saveDetail)); + DoArray(p, title, sizeof(title)); + DoArray(p, saveTitle, sizeof(saveTitle)); + DoArray(p, saveDetail, sizeof(saveDetail)); - p.Do(modif_time); + Do(p, modif_time); if (s <= 1) { u32 textureData; int textureWidth; int textureHeight; - p.Do(textureData); - p.Do(textureWidth); - p.Do(textureHeight); + Do(p, textureData); + Do(p, textureWidth); + Do(p, textureHeight); if (textureData != 0) { // Must be MODE_READ. @@ -178,7 +179,7 @@ void SaveFileInfo::DoState(PointerWrap &p) } } else { bool hasTexture = texture != NULL; - p.Do(hasTexture); + Do(p, hasTexture); if (hasTexture) { if (p.mode == p.MODE_READ) { delete texture; @@ -1725,9 +1726,9 @@ void SavedataParam::DoState(PointerWrap &p) return; // pspParam is handled in PSPSaveDialog. - p.Do(selectedSave); - p.Do(saveDataListCount); - p.Do(saveNameListDataCount); + Do(p, selectedSave); + Do(p, saveDataListCount); + Do(p, saveNameListDataCount); if (p.mode == p.MODE_READ) { if (saveDataList != NULL) @@ -1735,13 +1736,13 @@ void SavedataParam::DoState(PointerWrap &p) if (saveDataListCount != 0) { saveDataList = new SaveFileInfo[saveDataListCount]; - p.DoArray(saveDataList, saveDataListCount); + DoArray(p, saveDataList, saveDataListCount); } else saveDataList = NULL; } else - p.DoArray(saveDataList, saveDataListCount); + DoArray(p, saveDataList, saveDataListCount); } int SavedataParam::GetSaveCryptMode(SceUtilitySavedataParam* param, const std::string &saveDirName) diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 1e38103ff2..b32f8cc1af 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -24,6 +24,7 @@ #include "i18n/i18n.h" #include "util/text/utf8.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/FileUtil.h" #include "Core/FileSystems/DirectoryFileSystem.h" #include "Core/FileSystems/ISOFileSystem.h" @@ -976,41 +977,41 @@ void DirectoryFileSystem::DoState(PointerWrap &p) { // s64 current truncate position (v2+ only) u32 num = (u32) entries.size(); - p.Do(num); + Do(p, num); if (p.mode == p.MODE_READ) { CloseAll(); u32 key; OpenFileEntry entry; for (u32 i = 0; i < num; i++) { - p.Do(key); - p.Do(entry.guestFilename); - p.Do(entry.access); + Do(p, key); + Do(p, entry.guestFilename); + Do(p, entry.access); u32 err; if (!entry.hFile.Open(basePath,entry.guestFilename,entry.access, err)) { ERROR_LOG(FILESYS, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str()); continue; } u32 position; - p.Do(position); + Do(p, position); if (position != entry.hFile.Seek(position, FILEMOVE_BEGIN)) { ERROR_LOG(FILESYS, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str()); continue; } if (s >= 2) { - p.Do(entry.hFile.needsTrunc_); + Do(p, entry.hFile.needsTrunc_); } entries[key] = entry; } } else { for (auto iter = entries.begin(); iter != entries.end(); ++iter) { u32 key = iter->first; - p.Do(key); - p.Do(iter->second.guestFilename); - p.Do(iter->second.access); + Do(p, key); + Do(p, iter->second.guestFilename); + Do(p, iter->second.access); u32 position = (u32)iter->second.hFile.Seek(0, FILEMOVE_CURRENT); - p.Do(position); - p.Do(iter->second.hFile.needsTrunc_); + Do(p, position); + Do(p, iter->second.hFile.needsTrunc_); } } } @@ -1186,7 +1187,7 @@ void VFSFileSystem::DoState(PointerWrap &p) { return; u32 num = (u32) entries.size(); - p.Do(num); + Do(p, num); if (num != 0) { p.SetError(p.ERROR_WARNING); diff --git a/Core/FileSystems/FileSystem.cpp b/Core/FileSystems/FileSystem.cpp index b2130e2eda..7fae8183e7 100644 --- a/Core/FileSystems/FileSystem.cpp +++ b/Core/FileSystems/FileSystem.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/FileSystems/FileSystem.h" void PSPFileInfo::DoState(PointerWrap &p) { @@ -23,17 +24,17 @@ void PSPFileInfo::DoState(PointerWrap &p) { if (!s) return; - p.Do(name); - p.Do(size); - p.Do(access); - p.Do(exists); - p.Do(type); - p.Do(atime); - p.Do(ctime); - p.Do(mtime); - p.Do(isOnSectorSystem); - p.Do(startSector); - p.Do(numSectors); - p.Do(sectorSize); + Do(p, name); + Do(p, size); + Do(p, access); + Do(p, exists); + Do(p, type); + Do(p, atime); + Do(p, ctime); + Do(p, mtime); + Do(p, isOnSectorSystem); + Do(p, startSector); + Do(p, numSectors); + Do(p, sectorSize); } diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index b0461ba014..7ead5c5e4d 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -23,6 +23,7 @@ #include "Common/Common.h" #include "Common/CommonTypes.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/FileSystems/ISOFileSystem.h" #include "Core/HLE/sceKernel.h" #include "Core/MemMap.h" @@ -710,7 +711,7 @@ void ISOFileSystem::DoState(PointerWrap &p) { return; int n = (int) entries.size(); - p.Do(n); + Do(p, n); if (p.mode == p.MODE_READ) { entries.clear(); @@ -718,18 +719,18 @@ void ISOFileSystem::DoState(PointerWrap &p) { u32 fd = 0; OpenFileEntry of; - p.Do(fd); - p.Do(of.seekPos); - p.Do(of.isRawSector); - p.Do(of.isBlockSectorMode); - p.Do(of.sectorStart); - p.Do(of.openSize); + Do(p, fd); + Do(p, of.seekPos); + Do(p, of.isRawSector); + Do(p, of.isBlockSectorMode); + Do(p, of.sectorStart); + Do(p, of.openSize); bool hasFile = false; - p.Do(hasFile); + Do(p, hasFile); if (hasFile) { std::string path; - p.Do(path); + Do(p, path); of.file = GetFromPath(path); } else { of.file = NULL; @@ -740,24 +741,24 @@ void ISOFileSystem::DoState(PointerWrap &p) { } else { for (EntryMap::iterator it = entries.begin(), end = entries.end(); it != end; ++it) { OpenFileEntry &of = it->second; - p.Do(it->first); - p.Do(of.seekPos); - p.Do(of.isRawSector); - p.Do(of.isBlockSectorMode); - p.Do(of.sectorStart); - p.Do(of.openSize); + Do(p, it->first); + Do(p, of.seekPos); + Do(p, of.isRawSector); + Do(p, of.isBlockSectorMode); + Do(p, of.sectorStart); + Do(p, of.openSize); bool hasFile = of.file != NULL; - p.Do(hasFile); + Do(p, hasFile); if (hasFile) { std::string path = EntryFullPath(of.file); - p.Do(path); + Do(p, path); } } } if (s >= 2) { - p.Do(lastReadBlock_); + Do(p, lastReadBlock_); } else { lastReadBlock_ = 0; } diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 3b6d487e9f..b40a336243 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -19,6 +19,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/StringUtils.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HLE/sceKernelThread.h" @@ -641,13 +642,13 @@ void MetaFileSystem::DoState(PointerWrap &p) if (!s) return; - p.Do(current); + Do(p, current); // Save/load per-thread current directory map - p.Do(currentDir); + Do(p, currentDir); u32 n = (u32) fileSystems.size(); - p.Do(n); + Do(p, n); bool skipPfat0 = false; if (n != (u32) fileSystems.size()) { diff --git a/Core/FileSystems/VirtualDiscFileSystem.cpp b/Core/FileSystems/VirtualDiscFileSystem.cpp index 81ecbeef57..974823415d 100644 --- a/Core/FileSystems/VirtualDiscFileSystem.cpp +++ b/Core/FileSystems/VirtualDiscFileSystem.cpp @@ -20,6 +20,7 @@ #include "Common/FileUtil.h" #include "Common/StringUtils.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/FileSystems/VirtualDiscFileSystem.h" #include "Core/FileSystems/ISOFileSystem.h" #include "Core/HLE/sceKernel.h" @@ -167,18 +168,18 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p) int fileListSize = (int)fileList.size(); int entryCount = (int)entries.size(); - p.Do(fileListSize); - p.Do(entryCount); - p.Do(currentBlockIndex); + Do(p, fileListSize); + Do(p, entryCount); + Do(p, currentBlockIndex); FileListEntry dummy = {""}; fileList.resize(fileListSize, dummy); for (int i = 0; i < fileListSize; i++) { - p.Do(fileList[i].fileName); - p.Do(fileList[i].firstBlock); - p.Do(fileList[i].totalSize); + Do(p, fileList[i].fileName); + Do(p, fileList[i].firstBlock); + Do(p, fileList[i].totalSize); } if (p.mode == p.MODE_READ) @@ -190,12 +191,12 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p) u32 fd = 0; OpenFileEntry of; - p.Do(fd); - p.Do(of.fileIndex); - p.Do(of.type); - p.Do(of.curOffset); - p.Do(of.startOffset); - p.Do(of.size); + Do(p, fd); + Do(p, of.fileIndex); + Do(p, of.type); + Do(p, of.curOffset); + Do(p, of.startOffset); + Do(p, of.size); // open file if (of.type != VFILETYPE_ISO) { @@ -222,17 +223,17 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p) { OpenFileEntry &of = it->second; - p.Do(it->first); - p.Do(of.fileIndex); - p.Do(of.type); - p.Do(of.curOffset); - p.Do(of.startOffset); - p.Do(of.size); + Do(p, it->first); + Do(p, of.fileIndex); + Do(p, of.type); + Do(p, of.curOffset); + Do(p, of.startOffset); + Do(p, of.size); } } if (s >= 2) { - p.Do(lastReadBlock_); + Do(p, lastReadBlock_); } else { lastReadBlock_ = 0; } diff --git a/Core/Font/PGF.cpp b/Core/Font/PGF.cpp index 2383736a94..074688676f 100644 --- a/Core/Font/PGF.cpp +++ b/Core/Font/PGF.cpp @@ -22,6 +22,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMap.h" #include "Core/Reporting.h" #include "Core/Font/PGF.h" @@ -128,12 +129,12 @@ void PGF::DoState(PointerWrap &p) { if (!s) return; - p.Do(header); - p.Do(rev3extra); + Do(p, header); + Do(p, rev3extra); // Don't savestate size_t directly, 32-bit and 64-bit are different. u32 fontDataSizeTemp = (u32)fontDataSize; - p.Do(fontDataSizeTemp); + Do(p, fontDataSizeTemp); fontDataSize = (size_t)fontDataSizeTemp; if (p.mode == p.MODE_READ) { if (fontData) { @@ -141,39 +142,39 @@ void PGF::DoState(PointerWrap &p) { } if (fontDataSize) { fontData = new u8[fontDataSize]; - p.DoArray(fontData, (int)fontDataSize); + DoArray(p, fontData, (int)fontDataSize); } } else if (fontDataSize) { - p.DoArray(fontData, (int)fontDataSize); + DoArray(p, fontData, (int)fontDataSize); } - p.Do(fileName); + Do(p, fileName); - p.DoArray(dimensionTable, ARRAY_SIZE(dimensionTable)); - p.DoArray(xAdjustTable, ARRAY_SIZE(xAdjustTable)); - p.DoArray(yAdjustTable, ARRAY_SIZE(yAdjustTable)); - p.DoArray(advanceTable, ARRAY_SIZE(advanceTable)); - p.DoArray(charmapCompressionTable1, ARRAY_SIZE(charmapCompressionTable1)); - p.DoArray(charmapCompressionTable2, ARRAY_SIZE(charmapCompressionTable2)); + DoArray(p, dimensionTable, ARRAY_SIZE(dimensionTable)); + DoArray(p, xAdjustTable, ARRAY_SIZE(xAdjustTable)); + DoArray(p, yAdjustTable, ARRAY_SIZE(yAdjustTable)); + DoArray(p, advanceTable, ARRAY_SIZE(advanceTable)); + DoArray(p, charmapCompressionTable1, ARRAY_SIZE(charmapCompressionTable1)); + DoArray(p, charmapCompressionTable2, ARRAY_SIZE(charmapCompressionTable2)); - p.Do(charmap_compr); - p.Do(charmap); + Do(p, charmap_compr); + Do(p, charmap); if (s == 1) { std::vector oldGlyphs; - p.Do(oldGlyphs); + Do(p, oldGlyphs); glyphs.resize(oldGlyphs.size()); for (size_t i = 0; i < oldGlyphs.size(); ++i) { glyphs[i] = oldGlyphs[i]; } - p.Do(oldGlyphs); + Do(p, oldGlyphs); shadowGlyphs.resize(oldGlyphs.size()); for (size_t i = 0; i < oldGlyphs.size(); ++i) { shadowGlyphs[i] = oldGlyphs[i]; } } else { - p.Do(glyphs); - p.Do(shadowGlyphs); + Do(p, glyphs); + Do(p, shadowGlyphs); } - p.Do(firstGlyph); + Do(p, firstGlyph); } bool PGF::ReadPtr(const u8 *ptr, size_t dataSize) { diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index d12ba73955..6a731ef340 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -24,13 +24,13 @@ #include "base/timeutil.h" #include "profiler/profiler.h" +#include "Common/ChunkFileDo.h" #include "Core/Config.h" +#include "Core/Core.h" #include "Core/CoreTiming.h" +#include "Core/Host.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" - -#include "Core/Core.h" -#include "Core/Host.h" #include "Core/System.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSCodeUtils.h" @@ -128,19 +128,19 @@ void HLEDoState(PointerWrap &p) { // Can't be inside a syscall, reset this so errors aren't misleading. latestSyscall = nullptr; - p.Do(delayedResultEvent); + Do(p, delayedResultEvent); CoreTiming::RestoreRegisterEvent(delayedResultEvent, "HLEDelayedResult", hleDelayResultFinish); if (s >= 2) { int actions = (int)mipsCallActions.size(); - p.Do(actions); + Do(p, actions); if (actions != (int)mipsCallActions.size()) { mipsCallActions.resize(actions); } for (auto &action : mipsCallActions) { int actionTypeID = action != nullptr ? action->actionTypeID : -1; - p.Do(actionTypeID); + Do(p, actionTypeID); if (actionTypeID != -1) { if (p.mode == p.MODE_READ) action = __KernelCreateAction(actionTypeID); diff --git a/Core/HLE/HLEHelperThread.cpp b/Core/HLE/HLEHelperThread.cpp index 36f9166813..c84be0feca 100644 --- a/Core/HLE/HLEHelperThread.cpp +++ b/Core/HLE/HLEHelperThread.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/HLE.h" @@ -73,8 +74,8 @@ void HLEHelperThread::DoState(PointerWrap &p) { return; } - p.Do(id_); - p.Do(entry_); + Do(p, id_); + Do(p, entry_); } void HLEHelperThread::Start(u32 a0, u32 a1) { diff --git a/Core/HLE/ThreadQueueList.h b/Core/HLE/ThreadQueueList.h index dbb46d1818..e08b9c07a5 100644 --- a/Core/HLE/ThreadQueueList.h +++ b/Core/HLE/ThreadQueueList.h @@ -184,7 +184,7 @@ struct ThreadQueueList { return; int numQueues = NUM_QUEUES; - p.Do(numQueues); + Do(p, numQueues); if (numQueues != NUM_QUEUES) { p.SetError(p.ERROR_FAILURE); ERROR_LOG(SCEKERNEL, "Savestate loading error: invalid data"); @@ -197,9 +197,9 @@ struct ThreadQueueList { for (int i = 0; i < NUM_QUEUES; ++i) { Queue *cur = &queues[i]; int size = cur->size(); - p.Do(size); + Do(p, size); int capacity = cur->capacity; - p.Do(capacity); + Do(p, capacity); if (capacity == 0) continue; @@ -211,7 +211,7 @@ struct ThreadQueueList { } if (size != 0) - p.DoArray(&cur->data[cur->first], size); + DoArray(p, &cur->data[cur->first], size); } } diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index e462a94efd..c938c09929 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -20,6 +20,7 @@ #include "Common/CommonTypes.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/FixedSizeQueue.h" #ifdef _M_SSE @@ -130,14 +131,14 @@ void __AudioDoState(PointerWrap &p) { if (!s) return; - p.Do(eventAudioUpdate); + Do(p, eventAudioUpdate); CoreTiming::RestoreRegisterEvent(eventAudioUpdate, "AudioUpdate", &hleAudioUpdate); - p.Do(eventHostAudioUpdate); + Do(p, eventHostAudioUpdate); CoreTiming::RestoreRegisterEvent(eventHostAudioUpdate, "AudioUpdateHost", &hleHostAudioUpdate); - p.Do(mixFrequency); + Do(p, mixFrequency); if (s >= 2) { - p.Do(srcFrequency); + Do(p, srcFrequency); } else { // Assume that it was actually the SRC channel frequency. srcFrequency = mixFrequency; @@ -156,7 +157,7 @@ void __AudioDoState(PointerWrap &p) { } int chanCount = ARRAY_SIZE(chans); - p.Do(chanCount); + Do(p, chanCount); if (chanCount != ARRAY_SIZE(chans)) { ERROR_LOG(SCEAUDIO, "Savestate failure: different number of audio channels."); diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 32cfdc15d2..6e22b3801f 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -33,6 +33,7 @@ #include #include "util/text/parsers.h" #include "thread/threadutil.h" +#include "Common/ChunkFileDo.h" #include "Core/Core.h" #include "Core/Host.h" #include "Core/HLE/sceKernelInterrupt.h" @@ -980,6 +981,24 @@ void clearPeerList(SceNetAdhocMatchingContext * context) peerlock.unlock(); } +void AfterMatchingMipsCall::DoState(PointerWrap & p) { + auto s = p.Section("AfterMatchingMipsCall", 1, 4); + if (!s) + return; + if (s >= 1) { + Do(p, EventID); + } else { + EventID = -1; + } + if (s >= 4) { + Do(p, contextID); + Do(p, bufAddr); + } else { + contextID = -1; + bufAddr = 0; + } +} + // It seems After Actions being called in reverse order of Mipscall order (ie. MipsCall order of ACCEPT(6)->ESTABLISH(7) getting AfterAction order of ESTABLISH(7)->ACCEPT(6) void AfterMatchingMipsCall::run(MipsCall &call) { if (context == NULL) { @@ -1021,6 +1040,21 @@ bool IsMatchingInCallback(SceNetAdhocMatchingContext* context) { return inCB; } +void AfterAdhocMipsCall::DoState(PointerWrap & p) { + auto s = p.Section("AfterAdhocMipsCall", 1, 4); + if (!s) + return; + if (s >= 3) { + Do(p, HandlerID); + Do(p, EventID); + Do(p, argsAddr); + } else { + HandlerID = -1; + EventID = -1; + argsAddr = 0; + } +} + void AfterAdhocMipsCall::run(MipsCall& call) { u32 v0 = currentMIPS->r[MIPS_REG_V0]; if (__IsInInterrupt()) ERROR_LOG(SCENET, "AfterAdhocMipsCall::run [ID=%i][Event=%d] is Returning Inside an Interrupt!", HandlerID, EventID); diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index c7d32c5010..b84a13de6d 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -792,21 +792,7 @@ class AfterAdhocMipsCall : public PSPAction { public: AfterAdhocMipsCall() {} static PSPAction* Create() { return new AfterAdhocMipsCall(); } - void DoState(PointerWrap& p) override { - auto s = p.Section("AfterAdhocMipsCall", 1, 4); - if (!s) - return; - if (s >= 3) { - p.Do(HandlerID); - p.Do(EventID); - p.Do(argsAddr); - } - else { - HandlerID = -1; - EventID = -1; - argsAddr = 0; - } - } + void DoState(PointerWrap& p) override; void run(MipsCall& call) override; void SetData(int handlerID, int eventId, u32_le argsAddr); @@ -820,25 +806,7 @@ class AfterMatchingMipsCall : public PSPAction { public: AfterMatchingMipsCall() {} static PSPAction *Create() { return new AfterMatchingMipsCall(); } - void DoState(PointerWrap &p) override { - auto s = p.Section("AfterMatchingMipsCall", 1, 4); - if (!s) - return; - if (s >= 1) { - p.Do(EventID); - } - else { - EventID = -1; - } - if (s >= 4) { - p.Do(contextID); - p.Do(bufAddr); - } - else { - contextID = -1; - bufAddr = 0; - } - } + void DoState(PointerWrap &p) override; void run(MipsCall &call) override; void SetData(int ContextID, int eventId, u32_le BufAddr); diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index bef952a7e8..fb54546fdb 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -17,6 +17,8 @@ #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" @@ -27,7 +29,6 @@ #include "Core/Debugger/Breakpoints.h" #include "Core/HW/MediaEngine.h" #include "Core/HW/BufferQueue.h" -#include "Common/ChunkFile.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceUtility.h" @@ -236,65 +237,65 @@ struct Atrac { if (!s) return; - p.Do(channels_); - p.Do(outputChannels_); + Do(p, channels_); + Do(p, outputChannels_); if (s >= 5) { - p.Do(jointStereo_); + Do(p, jointStereo_); } - p.Do(atracID_); - p.Do(first_); - p.Do(bufferMaxSize_); - p.Do(codecType_); + Do(p, atracID_); + Do(p, first_); + Do(p, bufferMaxSize_); + Do(p, codecType_); - p.Do(currentSample_); - p.Do(endSample_); - p.Do(firstSampleOffset_); + Do(p, currentSample_); + Do(p, endSample_); + Do(p, firstSampleOffset_); if (s >= 3) { - p.Do(dataOff_); + Do(p, dataOff_); } else { dataOff_ = firstSampleOffset_; } u32 hasDataBuf = dataBuf_ != nullptr; - p.Do(hasDataBuf); + Do(p, hasDataBuf); if (hasDataBuf) { if (p.mode == p.MODE_READ) { if (dataBuf_) delete [] dataBuf_; dataBuf_ = new u8[first_.filesize]; } - p.DoArray(dataBuf_, first_.filesize); + DoArray(p, dataBuf_, first_.filesize); } - p.Do(second_); + Do(p, second_); - p.Do(decodePos_); + Do(p, decodePos_); if (s < 9) { u32 oldDecodeEnd = 0; - p.Do(oldDecodeEnd); + Do(p, oldDecodeEnd); } if (s >= 4) { - p.Do(bufferPos_); + Do(p, bufferPos_); } else { bufferPos_ = decodePos_; } - p.Do(bitrate_); - p.Do(bytesPerFrame_); + Do(p, bitrate_); + Do(p, bytesPerFrame_); - p.Do(loopinfo_); + Do(p, loopinfo_); if (s < 9) { int oldLoopInfoNum = 42; - p.Do(oldLoopInfoNum); + Do(p, oldLoopInfoNum); } - p.Do(loopStartSample_); - p.Do(loopEndSample_); - p.Do(loopNum_); + Do(p, loopStartSample_); + Do(p, loopEndSample_); + Do(p, loopNum_); - p.Do(context_); + Do(p, context_); if (s >= 6) { - p.Do(bufferState_); + Do(p, bufferState_); } else { if (dataBuf_ == nullptr) { bufferState_ = ATRAC_STATUS_NO_DATA; @@ -304,14 +305,14 @@ struct Atrac { } if (s >= 7) { - p.Do(ignoreDataBuf_); + Do(p, ignoreDataBuf_); } else { ignoreDataBuf_ = false; } if (s >= 9) { - p.Do(bufferValidBytes_); - p.Do(bufferHeaderSize_); + Do(p, bufferValidBytes_); + Do(p, bufferHeaderSize_); } else { bufferHeaderSize_ = dataOff_; bufferValidBytes_ = std::min(first_.size - dataOff_, StreamBufferEnd() - dataOff_); @@ -333,7 +334,7 @@ struct Atrac { if (s >= 2 && s < 9) { bool oldResetBuffer = false; - p.Do(oldResetBuffer); + Do(p, oldResetBuffer); } } @@ -645,18 +646,18 @@ void __AtracDoState(PointerWrap &p) { if (!s) return; - p.Do(atracInited); + Do(p, atracInited); for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) { bool valid = atracIDs[i] != NULL; - p.Do(valid); + Do(p, valid); if (valid) { - p.Do(atracIDs[i]); + Do(p, atracIDs[i]); } else { delete atracIDs[i]; atracIDs[i] = NULL; } } - p.DoArray(atracIDTypes, PSP_NUM_ATRAC_IDS); + DoArray(p, atracIDTypes, PSP_NUM_ATRAC_IDS); } void __AtracShutdown() { diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index f75b66604c..ba7ca82b62 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MIPS/MIPS.h" #include "Core/Host.h" #include "Core/CoreTiming.h" @@ -40,16 +41,16 @@ void AudioChannel::DoState(PointerWrap &p) if (!s) return; - p.Do(reserved); - p.Do(sampleAddress); - p.Do(sampleCount); - p.Do(leftVolume); - p.Do(rightVolume); - p.Do(format); - p.Do(waitingThreads); + Do(p, reserved); + Do(p, sampleAddress); + Do(p, sampleCount); + Do(p, leftVolume); + Do(p, rightVolume); + Do(p, format); + Do(p, waitingThreads); if (s >= 2) { - p.Do(defaultRoutingMode); - p.Do(defaultRoutingVolMode); + Do(p, defaultRoutingMode); + Do(p, defaultRoutingVolMode); } sampleQueue.DoState(p); } diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index 83d70dc343..509d35c50f 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -15,13 +15,14 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceAudiocodec.h" #include "Core/MemMap.h" #include "Core/Reporting.h" #include "Core/HW/SimpleAudioDec.h" -#include "Common/ChunkFile.h" // Following kaien_fr's sample code https://github.com/hrydgard/ppsspp/issues/5620#issuecomment-37086024 // Should probably store the EDRAM get/release status somewhere within here, etc. @@ -171,7 +172,7 @@ void __sceAudiocodecDoState(PointerWrap &p){ } int count = (int)audioList.size(); - p.Do(count); + Do(p, count); if (count > 0) { if (p.mode == PointerWrap::MODE_READ) { @@ -182,8 +183,8 @@ void __sceAudiocodecDoState(PointerWrap &p){ auto ctxPtr_ = new u32[count]; // These sizeof(pointers) are wrong, but kept to avoid breaking on old saves. // They're not used in new savestates. - p.DoArray(codec_, s >= 2 ? count : (int)ARRAY_SIZE(codec_)); - p.DoArray(ctxPtr_, s >= 2 ? count : (int)ARRAY_SIZE(ctxPtr_)); + DoArray(p, codec_, s >= 2 ? count : (int)ARRAY_SIZE(codec_)); + DoArray(p, ctxPtr_, s >= 2 ? count : (int)ARRAY_SIZE(ctxPtr_)); for (int i = 0; i < count; i++) { auto decoder = new SimpleAudio(codec_[i]); decoder->SetCtxPtr(ctxPtr_[i]); @@ -205,8 +206,8 @@ void __sceAudiocodecDoState(PointerWrap &p){ ctxPtr_[i] = decoder->GetCtxPtr(); i++; } - p.DoArray(codec_, count); - p.DoArray(ctxPtr_, count); + DoArray(p, codec_, count); + DoArray(p, ctxPtr_, count); delete[] codec_; delete[] ctxPtr_; } diff --git a/Core/HLE/sceCcc.cpp b/Core/HLE/sceCcc.cpp index 71cbfa6e40..7040a5f329 100644 --- a/Core/HLE/sceCcc.cpp +++ b/Core/HLE/sceCcc.cpp @@ -20,6 +20,7 @@ #include "util/text/shiftjis.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Debugger/Breakpoints.h" #include "Core/MemMap.h" #include "Core/HLE/HLE.h" @@ -55,11 +56,11 @@ void __CccDoState(PointerWrap &p) if (!s) return; - p.Do(errorUTF8); - p.Do(errorUTF16); - p.Do(errorSJIS); - p.Do(ucs2jisTable); - p.Do(jis2ucsTable); + Do(p, errorUTF8); + Do(p, errorUTF16); + Do(p, errorSJIS); + Do(p, ucs2jisTable); + Do(p, jis2ucsTable); } static u32 __CccUCStoJIS(u32 c, u32 alt) diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index 8bad0e193a..28957509b2 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -18,13 +18,14 @@ #include #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Replay.h" -#include "Common/ChunkFile.h" #include "Core/Util/AudioFormat.h" // for clamp_u8 #include "Core/HLE/sceCtrl.h" #include "Core/HLE/sceDisplay.h" @@ -350,33 +351,33 @@ void __CtrlDoState(PointerWrap &p) if (!s) return; - p.Do(analogEnabled); - p.Do(ctrlLatchBufs); - p.Do(ctrlOldButtons); + Do(p, analogEnabled); + Do(p, ctrlLatchBufs); + Do(p, ctrlOldButtons); p.DoVoid(ctrlBufs, sizeof(ctrlBufs)); if (s <= 2) { CtrlData dummy = {0}; - p.Do(dummy); + Do(p, dummy); } - p.Do(ctrlBuf); - p.Do(ctrlBufRead); - p.Do(latch); + Do(p, ctrlBuf); + Do(p, ctrlBufRead); + Do(p, latch); if (s == 1) { dialogBtnMake = 0; } else { - p.Do(dialogBtnMake); + Do(p, dialogBtnMake); } - p.Do(ctrlIdleReset); - p.Do(ctrlIdleBack); + Do(p, ctrlIdleReset); + Do(p, ctrlIdleBack); - p.Do(ctrlCycle); + Do(p, ctrlCycle); SceUID dv = 0; - p.Do(waitingThreads, dv); + Do(p, waitingThreads, dv); - p.Do(ctrlTimer); + Do(p, ctrlTimer); CoreTiming::RestoreRegisterEvent(ctrlTimer, "CtrlSampleTimer", __CtrlTimerUpdate); } diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 305339d86c..1e30c5112a 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -37,6 +37,7 @@ #include "gfx_es2/gpu_features.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Config.h" #include "Core/CoreTiming.h" #include "Core/CoreParameter.h" @@ -77,8 +78,8 @@ struct WaitVBlankInfo { if (!s) return; - p.Do(threadID); - p.Do(vcountUnblock); + Do(p, threadID); + Do(p, vcountUnblock); } }; @@ -261,42 +262,42 @@ void __DisplayDoState(PointerWrap &p) { if (!s) return; - p.Do(framebuf); - p.Do(latchedFramebuf); - p.Do(framebufIsLatched); - p.Do(frameStartTicks); - p.Do(vCount); + Do(p, framebuf); + Do(p, latchedFramebuf); + Do(p, framebufIsLatched); + Do(p, frameStartTicks); + Do(p, vCount); if (s <= 2) { double oldHCountBase; - p.Do(oldHCountBase); + Do(p, oldHCountBase); hCountBase = (int) oldHCountBase; } else { - p.Do(hCountBase); + Do(p, hCountBase); } - p.Do(isVblank); - p.Do(hasSetMode); - p.Do(mode); - p.Do(resumeMode); - p.Do(holdMode); + Do(p, isVblank); + Do(p, hasSetMode); + Do(p, mode); + Do(p, resumeMode); + Do(p, holdMode); if (s >= 4) { - p.Do(brightnessLevel); + Do(p, brightnessLevel); } - p.Do(width); - p.Do(height); + Do(p, width); + Do(p, height); WaitVBlankInfo wvi(0); - p.Do(vblankWaitingThreads, wvi); - p.Do(vblankPausedWaits); + Do(p, vblankWaitingThreads, wvi); + Do(p, vblankPausedWaits); - p.Do(enterVblankEvent); + Do(p, enterVblankEvent); CoreTiming::RestoreRegisterEvent(enterVblankEvent, "EnterVBlank", &hleEnterVblank); - p.Do(leaveVblankEvent); + Do(p, leaveVblankEvent); CoreTiming::RestoreRegisterEvent(leaveVblankEvent, "LeaveVBlank", &hleLeaveVblank); - p.Do(afterFlipEvent); + Do(p, afterFlipEvent); CoreTiming::RestoreRegisterEvent(afterFlipEvent, "AfterFlip", &hleAfterFlip); if (s >= 5) { - p.Do(lagSyncEvent); - p.Do(lagSyncScheduled); + Do(p, lagSyncEvent); + Do(p, lagSyncScheduled); CoreTiming::RestoreRegisterEvent(lagSyncEvent, "LagSync", &hleLagSync); lastLagSync = real_time_now(); if (lagSyncScheduled != g_Config.bForceLagSync) { @@ -307,7 +308,7 @@ void __DisplayDoState(PointerWrap &p) { ScheduleLagSync(); } - p.Do(gstate); + Do(p, gstate); // TODO: GPU stuff is really not the responsibility of sceDisplay. // Display just displays the buffers the GPU has drawn, they are really completely distinct. @@ -321,7 +322,7 @@ void __DisplayDoState(PointerWrap &p) { } if (s < 6) { GPUStatistics_v0 oldStats; - p.Do(oldStats); + Do(p, oldStats); } if (s < 7) { @@ -329,8 +330,8 @@ void __DisplayDoState(PointerWrap &p) { lastFlipCycles = now; nextFlipCycles = now; } else { - p.Do(lastFlipCycles); - p.Do(nextFlipCycles); + Do(p, lastFlipCycles); + Do(p, nextFlipCycles); } gpu->DoState(p); diff --git a/Core/HLE/sceDmac.cpp b/Core/HLE/sceDmac.cpp index da48432e8b..9290cc4d76 100644 --- a/Core/HLE/sceDmac.cpp +++ b/Core/HLE/sceDmac.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" @@ -40,7 +41,7 @@ void __DmacDoState(PointerWrap &p) { return; } - p.Do(dmacMemcpyDeadline); + Do(p, dmacMemcpyDeadline); } static int __DmacMemcpy(u32 dst, u32 src, u32 size) { diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index c742134ecd..605beda7da 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -8,6 +8,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceFont.h" @@ -221,12 +222,12 @@ public: if (!s) return; - p.Do(pgf_); - p.Do(style_); + Do(p, pgf_); + Do(p, style_); if (s < 2) { valid_ = true; } else { - p.Do(valid_); + Do(p, valid_); } } @@ -317,29 +318,29 @@ public: return; int numInternalFonts = (int)internalFonts.size(); - p.Do(numInternalFonts); + Do(p, numInternalFonts); if (numInternalFonts != (int)internalFonts.size()) { ERROR_LOG(SCEFONT, "Unable to load state: different internal font count."); p.SetError(p.ERROR_FAILURE); return; } - p.Do(fontLibID_); + Do(p, fontLibID_); int internalFont = GetInternalFontIndex(font_); - p.Do(internalFont); + Do(p, internalFont); if (internalFont == -1) { - p.Do(font_); + Do(p, font_); } else if (p.mode == p.MODE_READ) { font_ = internalFonts[internalFont]; } - p.Do(handle_); + Do(p, handle_); if (s >= 2) { - p.Do(open_); + Do(p, open_); } else { open_ = fontLibID_ != (u32)-1; } if (s >= 3) { - p.Do(mode_); + Do(p, mode_); } else { mode_ = FONT_OPEN_INTERNAL_FULL; } @@ -363,9 +364,9 @@ public: if (!s) return; - p.Do(fontLibID_); + Do(p, fontLibID_); if (s >= 2) { - p.Do(errorCodePtr_); + Do(p, errorCodePtr_); } else { errorCodePtr_ = 0; } @@ -387,7 +388,7 @@ public: if (!s) return; - p.Do(fontLibID_); + Do(p, fontLibID_); } void run(MipsCall &call) override; void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; } @@ -405,9 +406,9 @@ public: if (!s) return; - p.Do(fontLibID_); - p.Do(fontHandle_); - p.Do(fontIndex_); + Do(p, fontLibID_); + Do(p, fontHandle_); + Do(p, fontIndex_); } void run(MipsCall &call) override; void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; } @@ -428,7 +429,7 @@ public: if (!s) return; - p.Do(fontLibID_); + Do(p, fontLibID_); } void run(MipsCall &call) override; void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; } @@ -446,8 +447,8 @@ public: if (!s) return; - p.Do(fontLibID_); - p.Do(charInfo_); + Do(p, fontLibID_); + Do(p, charInfo_); } void run(MipsCall &call) override; void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; } @@ -662,23 +663,23 @@ public: if (!s) return; - p.Do(fonts_); - p.Do(isfontopen_); - p.Do(params_); - p.Do(fontHRes_); - p.Do(fontVRes_); - p.Do(fileFontHandle_); - p.Do(handle_); - p.Do(altCharCode_); + Do(p, fonts_); + Do(p, isfontopen_); + Do(p, params_); + Do(p, fontHRes_); + Do(p, fontVRes_); + Do(p, fileFontHandle_); + Do(p, handle_); + Do(p, altCharCode_); if (s >= 2) { - p.Do(nfl_); + Do(p, nfl_); } else { nfl_ = 0; } if (s >= 3) { - p.Do(openAllocatedAddresses_); - p.Do(charInfoBitmapAddress_); + Do(p, openAllocatedAddresses_); + Do(p, charInfoBitmapAddress_); } else { openAllocatedAddresses_.resize(params_.numFonts); charInfoBitmapAddress_ = 0; @@ -917,20 +918,20 @@ void __FontDoState(PointerWrap &p) { __LoadInternalFonts(); - p.Do(fontLibList); - p.Do(fontLibMap); - p.Do(fontMap); + Do(p, fontLibList); + Do(p, fontLibMap); + Do(p, fontMap); - p.Do(actionPostAllocCallback); + Do(p, actionPostAllocCallback); __KernelRestoreActionType(actionPostAllocCallback, PostAllocCallback::Create); - p.Do(actionPostOpenCallback); + Do(p, actionPostOpenCallback); __KernelRestoreActionType(actionPostOpenCallback, PostOpenCallback::Create); if (s >= 2) { - p.Do(actionPostOpenAllocCallback); + Do(p, actionPostOpenAllocCallback); __KernelRestoreActionType(actionPostOpenAllocCallback, PostOpenAllocCallback::Create); - p.Do(actionPostCharInfoAllocCallback); + Do(p, actionPostCharInfoAllocCallback); __KernelRestoreActionType(actionPostCharInfoAllocCallback, PostCharInfoAllocCallback::Create); - p.Do(actionPostCharInfoFreeCallback); + Do(p, actionPostCharInfoFreeCallback); __KernelRestoreActionType(actionPostCharInfoFreeCallback, PostCharInfoFreeCallback::Create); } else { useAllocCallbacks = false; diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 1af22c00de..625fa1b3d0 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -20,6 +20,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/ThreadSafeList.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" @@ -219,14 +220,14 @@ void __GeDoState(PointerWrap &p) { if (!s) return; - p.DoArray(ge_callback_data, ARRAY_SIZE(ge_callback_data)); - p.DoArray(ge_used_callbacks, ARRAY_SIZE(ge_used_callbacks)); + DoArray(p, ge_callback_data, ARRAY_SIZE(ge_callback_data)); + DoArray(p, ge_used_callbacks, ARRAY_SIZE(ge_used_callbacks)); if (s >= 2) { - p.Do(ge_pending_cb); + Do(p, ge_pending_cb); } else { std::list old; - p.Do(old); + Do(p, old); ge_pending_cb.clear(); for (auto it = old.begin(), end = old.end(); it != end; ++it) { GeInterruptData intrdata = {it->listid, it->pc}; @@ -235,15 +236,15 @@ void __GeDoState(PointerWrap &p) { } } - p.Do(geSyncEvent); + Do(p, geSyncEvent); CoreTiming::RestoreRegisterEvent(geSyncEvent, "GeSyncEvent", &__GeExecuteSync); - p.Do(geInterruptEvent); + Do(p, geInterruptEvent); CoreTiming::RestoreRegisterEvent(geInterruptEvent, "GeInterruptEvent", &__GeExecuteInterrupt); - p.Do(geCycleEvent); + Do(p, geCycleEvent); CoreTiming::RestoreRegisterEvent(geCycleEvent, "GeCycleEvent", &__GeCheckCycles); - p.Do(listWaitingThreads); - p.Do(drawWaitingThreads); + Do(p, listWaitingThreads); + Do(p, drawWaitingThreads); // Everything else is done in sceDisplay. } diff --git a/Core/HLE/sceHeap.cpp b/Core/HLE/sceHeap.cpp index 72873edbbd..61bf921012 100644 --- a/Core/HLE/sceHeap.cpp +++ b/Core/HLE/sceHeap.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMap.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" @@ -34,10 +35,10 @@ struct Heap { BlockAllocator alloc; void DoState (PointerWrap &p) { - p.Do(size); - p.Do(address); - p.Do(fromtop); - p.Do(alloc); + Do(p, size); + Do(p, address); + Do(p, fromtop); + Do(p, alloc); } }; @@ -57,7 +58,7 @@ void __HeapDoState(PointerWrap &p) { return; if (s >= 2) { - p.Do(heapList); + Do(p, heapList); } } diff --git a/Core/HLE/sceImpose.cpp b/Core/HLE/sceImpose.cpp index 9ef9af254a..8a3b60fec0 100644 --- a/Core/HLE/sceImpose.cpp +++ b/Core/HLE/sceImpose.cpp @@ -15,6 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceImpose.h" @@ -22,7 +24,6 @@ #include "Core/MIPS/MIPS.h" #include "Core/Config.h" #include "Core/MemMap.h" -#include "Common/ChunkFile.h" const int PSP_UMD_POPUP_DISABLE = 0; const int PSP_UMD_POPUP_ENABLE = 1; @@ -50,10 +51,10 @@ void __ImposeDoState(PointerWrap &p) if (!s) return; - p.Do(language); - p.Do(buttonValue); - p.Do(umdPopup); - p.Do(backlightOffTime); + Do(p, language); + Do(p, buttonValue); + Do(p, umdPopup); + Do(p, backlightOffTime); } static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr) diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 49d14f0c36..93d9adb3ec 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -22,6 +22,7 @@ #include "thread/threadutil.h" #include "profiler/profiler.h" +#include "Common/ChunkFileDo.h" #include "Core/Core.h" #include "Core/Config.h" #include "Core/ConfigValues.h" @@ -227,22 +228,22 @@ public: if (!s) return; - p.Do(fullpath); - p.Do(handle); - p.Do(callbackID); - p.Do(callbackArg); - p.Do(asyncResult); - p.Do(hasAsyncResult); - p.Do(pendingAsyncResult); - p.Do(sectorBlockMode); - p.Do(closePending); - p.Do(info); - p.Do(openMode); + Do(p, fullpath); + Do(p, handle); + Do(p, callbackID); + Do(p, callbackArg); + Do(p, asyncResult); + Do(p, hasAsyncResult); + Do(p, pendingAsyncResult); + Do(p, sectorBlockMode); + Do(p, closePending); + Do(p, info); + Do(p, openMode); - p.Do(npdrm); - p.Do(pgd_offset); + Do(p, npdrm); + Do(p, pgd_offset); bool hasPGD = pgdInfo != NULL; - p.Do(hasPGD); + Do(p, hasPGD); if (hasPGD) { if (p.mode == p.MODE_READ) { pgdInfo = (PGD_DESC*) malloc(sizeof(PGD_DESC)); @@ -253,11 +254,11 @@ public: } } - p.Do(waitingThreads); + Do(p, waitingThreads); if (s >= 2) { - p.Do(waitingSyncThreads); + Do(p, waitingSyncThreads); } - p.Do(pausedWaits); + Do(p, pausedWaits); } std::string fullpath; @@ -670,10 +671,10 @@ void __IoDoState(PointerWrap &p) { return; ioManager.DoState(p); - p.DoArray(fds, ARRAY_SIZE(fds)); - p.Do(asyncNotifyEvent); + DoArray(p, fds, ARRAY_SIZE(fds)); + Do(p, asyncNotifyEvent); CoreTiming::RestoreRegisterEvent(asyncNotifyEvent, "IoAsyncNotify", __IoAsyncNotify); - p.Do(syncNotifyEvent); + Do(p, syncNotifyEvent); CoreTiming::RestoreRegisterEvent(syncNotifyEvent, "IoSyncNotify", __IoSyncNotify); if (s < 2) { std::set legacy; @@ -681,22 +682,22 @@ void __IoDoState(PointerWrap &p) { memStickFatCallbacks.clear(); // Convert from set to vector. - p.Do(legacy); + Do(p, legacy); for (SceUID id : legacy) { memStickCallbacks.push_back(id); } - p.Do(legacy); + Do(p, legacy); for (SceUID id : legacy) { memStickFatCallbacks.push_back(id); } } else { - p.Do(memStickCallbacks); - p.Do(memStickFatCallbacks); + Do(p, memStickCallbacks); + Do(p, memStickFatCallbacks); } if (s >= 3) { - p.Do(lastMemStickState); - p.Do(lastMemStickFatState); + Do(p, lastMemStickState); + Do(p, lastMemStickFatState); } for (int i = 0; i < PSP_COUNT_FDS; ++i) { @@ -710,11 +711,11 @@ void __IoDoState(PointerWrap &p) { if (s >= 4) { p.DoVoid(&asyncParams[i], (int)sizeof(IoAsyncParams)); bool hasThread = asyncThreads[i] != nullptr; - p.Do(hasThread); + Do(p, hasThread); if (hasThread) { if (p.GetMode() == p.MODE_READ) clearThread(); - p.DoClass(asyncThreads[i]); + DoClass(p, asyncThreads[i]); } else if (!hasThread) { clearThread(); } @@ -726,7 +727,7 @@ void __IoDoState(PointerWrap &p) { } if (s >= 5) { - p.Do(asyncDefaultPriority); + Do(p, asyncDefaultPriority); } else { asyncDefaultPriority = -1; } @@ -2244,12 +2245,12 @@ public: if (!s) return; - p.Do(name); - p.Do(index); + Do(p, name); + Do(p, index); // TODO: Is this the right way for it to wake up? int count = (int) listing.size(); - p.Do(count); + Do(p, count); listing.resize(count); for (int i = 0; i < count; ++i) { listing[i].DoState(p); diff --git a/Core/HLE/sceJpeg.cpp b/Core/HLE/sceJpeg.cpp index f532233203..feb0c0ea58 100644 --- a/Core/HLE/sceJpeg.cpp +++ b/Core/HLE/sceJpeg.cpp @@ -15,10 +15,12 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "ext/jpge/jpgd.h" #include "Common/Common.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceJpeg.h" @@ -33,8 +35,6 @@ #include "ext/xxhash.h" #endif -#include - static int mjpegWidth, mjpegHeight; void __JpegInit() { @@ -47,8 +47,8 @@ void __JpegDoState(PointerWrap &p) { if (!s) return; - p.Do(mjpegWidth); - p.Do(mjpegHeight); + Do(p, mjpegWidth); + Do(p, mjpegHeight); } static int getWidthHeight(int width, int height) { diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index f03eb5f8c3..30fe5dc999 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -15,6 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFileDo.h" +#include "Common/LogManager.h" #include "Core/Core.h" #include "Core/Config.h" #include "Core/CwCheat.h" @@ -26,7 +28,6 @@ #include "Core/MIPS/MIPSInt.h" #include "Core/MIPS/JitCommon/JitCommon.h" -#include "Common/LogManager.h" #include "Core/FileSystems/FileSystem.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/PSPLoaders.h" @@ -217,11 +218,11 @@ void __KernelDoState(PointerWrap &p) if (!s) return; - p.Do(kernelRunning); + Do(p, kernelRunning); kernelObjects.DoState(p); if (s >= 2) - p.Do(registeredExitCbId); + Do(p, registeredExitCbId); } { @@ -542,7 +543,7 @@ void KernelObjectPool::DoState(PointerWrap &p) { return; int _maxCount = maxCount; - p.Do(_maxCount); + Do(p, _maxCount); if (_maxCount != maxCount) { p.SetError(p.ERROR_FAILURE); @@ -555,15 +556,15 @@ void KernelObjectPool::DoState(PointerWrap &p) { kernelObjects.Clear(); } - p.Do(nextID); - p.DoArray(occupied, maxCount); + Do(p, nextID); + DoArray(p, occupied, maxCount); for (int i = 0; i < maxCount; ++i) { if (!occupied[i]) continue; int type; if (p.mode == p.MODE_READ) { - p.Do(type); + Do(p, type); pool[i] = CreateByIDType(type); // Already logged an error. @@ -573,7 +574,7 @@ void KernelObjectPool::DoState(PointerWrap &p) { pool[i]->uid = i + handleOffset; } else { type = pool[i]->GetIDType(); - p.Do(type); + Do(p, type); } pool[i]->DoState(p); if (p.error >= p.ERROR_FAILURE) diff --git a/Core/HLE/sceKernelAlarm.cpp b/Core/HLE/sceKernelAlarm.cpp index edce430446..94cd258f96 100644 --- a/Core/HLE/sceKernelAlarm.cpp +++ b/Core/HLE/sceKernelAlarm.cpp @@ -15,13 +15,14 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelAlarm.h" #include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/HLE.h" #include "Core/CoreTiming.h" #include "Core/MemMap.h" -#include "Common/ChunkFile.h" #include const int NATIVEALARM_SIZE = 20; @@ -50,7 +51,7 @@ struct PSPAlarm : public KernelObject { if (!s) return; - p.Do(alm); + Do(p, alm); } NativeAlarm alm; @@ -136,8 +137,8 @@ void __KernelAlarmDoState(PointerWrap &p) if (!s) return; - p.Do(alarmTimer); - p.Do(triggeredAlarm); + Do(p, alarmTimer); + Do(p, triggeredAlarm); CoreTiming::RestoreRegisterEvent(alarmTimer, "Alarm", __KernelTriggerAlarm); } diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index 0dde6fb966..db79bd4f62 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -15,12 +15,13 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" -#include "Common/ChunkFile.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelThread.h" @@ -73,10 +74,10 @@ public: if (!s) return; - p.Do(nef); + Do(p, nef); EventFlagTh eft = { 0 }; - p.Do(waitingThreads, eft); - p.Do(pausedWaits); + Do(p, waitingThreads, eft); + Do(p, pausedWaits); } NativeEventFlag nef; @@ -121,7 +122,7 @@ void __KernelEventFlagDoState(PointerWrap &p) { if (!s) return; - p.Do(eventFlagWaitTimer); + Do(p, eventFlagWaitTimer); CoreTiming::RestoreRegisterEvent(eventFlagWaitTimer, "EventFlagTimeout", __KernelEventFlagTimeout); } diff --git a/Core/HLE/sceKernelHeap.cpp b/Core/HLE/sceKernelHeap.cpp index 36581f1e15..e73f9f60c6 100644 --- a/Core/HLE/sceKernelHeap.cpp +++ b/Core/HLE/sceKernelHeap.cpp @@ -1,6 +1,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernel.h" @@ -27,13 +28,13 @@ struct Heap : public KernelObject { static const char *GetStaticTypeName() { return "Heap"; } void DoState(PointerWrap &p) override { - p.Do(uid); - p.Do(partitionId); - p.Do(size); - p.Do(flags); - p.Do(address); - p.Do(name); - p.Do(alloc); + Do(p, uid); + Do(p, partitionId); + Do(p, size); + Do(p, flags); + Do(p, address); + Do(p, name); + Do(p, alloc); } }; diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index 7e3fab221d..d065fcce14 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -19,12 +19,13 @@ #include #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" -#include "Common/ChunkFile.h" #include "Core/Debugger/Breakpoints.h" #include "Core/HLE/sceKernel.h" @@ -59,7 +60,7 @@ public: if (!s) return; - p.Do(savedCpu); + Do(p, savedCpu); } PSPThreadContext savedCpu; @@ -213,8 +214,8 @@ void IntrHandler::DoState(PointerWrap &p) if (!s) return; - p.Do(intrNumber); - p.Do(subIntrHandlers); + Do(p, intrNumber); + Do(p, subIntrHandlers); } void PendingInterrupt::DoState(PointerWrap &p) @@ -223,8 +224,8 @@ void PendingInterrupt::DoState(PointerWrap &p) if (!s) return; - p.Do(intr); - p.Do(subintr); + Do(p, intr); + Do(p, subintr); } void __InterruptsInit() @@ -244,7 +245,7 @@ void __InterruptsDoState(PointerWrap &p) return; int numInterrupts = PSP_NUMBER_INTERRUPTS; - p.Do(numInterrupts); + Do(p, numInterrupts); if (numInterrupts != PSP_NUMBER_INTERRUPTS) { p.SetError(p.ERROR_FAILURE); @@ -254,10 +255,10 @@ void __InterruptsDoState(PointerWrap &p) intState.DoState(p); PendingInterrupt pi(0, 0); - p.Do(pendingInterrupts, pi); - p.Do(interruptsEnabled); - p.Do(inInterrupt); - p.Do(threadBeforeInterrupt); + Do(p, pendingInterrupts, pi); + Do(p, interruptsEnabled); + Do(p, inInterrupt); + Do(p, threadBeforeInterrupt); } void __InterruptsDoStateLate(PointerWrap &p) diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index 38dd9687f0..e881363b7b 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -18,6 +18,7 @@ #include #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/sceKernelMbx.h" @@ -166,10 +167,10 @@ struct Mbx : public KernelObject if (!s) return; - p.Do(nmb); + Do(p, nmb); MbxWaitingThread mwt = {0}; - p.Do(waitingThreads, mwt); - p.Do(pausedWaits); + Do(p, waitingThreads, mwt); + Do(p, pausedWaits); } NativeMbx nmb; @@ -194,7 +195,7 @@ void __KernelMbxDoState(PointerWrap &p) if (!s) return; - p.Do(mbxWaitTimer); + Do(p, mbxWaitTimer); CoreTiming::RestoreRegisterEvent(mbxWaitTimer, "MbxTimeout", __KernelMbxTimeout); } diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 50792c39ff..73e53538df 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -21,6 +21,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/System.h" @@ -130,16 +131,16 @@ struct FPL : public KernelObject if (!s) return; - p.Do(nf); + Do(p, nf); if (p.mode == p.MODE_READ) blocks = new bool[nf.numBlocks]; - p.DoArray(blocks, nf.numBlocks); - p.Do(address); - p.Do(alignedSize); - p.Do(nextBlock); + DoArray(p, blocks, nf.numBlocks); + Do(p, address); + Do(p, alignedSize); + Do(p, nextBlock); FplWaitingThread dv = {0}; - p.Do(waitingThreads, dv); - p.Do(pausedWaits); + Do(p, waitingThreads, dv); + Do(p, pausedWaits); } NativeFPL nf; @@ -392,15 +393,15 @@ struct VPL : public KernelObject return; } - p.Do(nv); - p.Do(address); + Do(p, nv); + Do(p, address); VplWaitingThread dv = {0}; - p.Do(waitingThreads, dv); + Do(p, waitingThreads, dv); alloc.DoState(p); - p.Do(pausedWaits); + Do(p, pausedWaits); if (s >= 2) { - p.Do(header); + Do(p, header); } } @@ -456,16 +457,16 @@ void __KernelMemoryDoState(PointerWrap &p) kernelMemory.DoState(p); userMemory.DoState(p); - p.Do(vplWaitTimer); + Do(p, vplWaitTimer); CoreTiming::RestoreRegisterEvent(vplWaitTimer, "VplTimeout", __KernelVplTimeout); - p.Do(fplWaitTimer); + Do(p, fplWaitTimer); CoreTiming::RestoreRegisterEvent(fplWaitTimer, "FplTimeout", __KernelFplTimeout); - p.Do(flags_); - p.Do(sdkVersion_); - p.Do(compilerVersion_); - p.DoArray(tlsplUsedIndexes, ARRAY_SIZE(tlsplUsedIndexes)); + Do(p, flags_); + Do(p, sdkVersion_); + Do(p, compilerVersion_); + DoArray(p, tlsplUsedIndexes, ARRAY_SIZE(tlsplUsedIndexes)); if (s >= 2) { - p.Do(tlsplThreadEndChecks); + Do(p, tlsplThreadEndChecks); } } @@ -949,8 +950,8 @@ public: if (!s) return; - p.Do(address); - p.DoArray(name, sizeof(name)); + Do(p, address); + DoArray(p, name, sizeof(name)); } u32 address; @@ -1886,15 +1887,15 @@ struct TLSPL : public KernelObject if (!s) return; - p.Do(ntls); - p.Do(address); + Do(p, ntls); + Do(p, address); if (s >= 2) - p.Do(alignment); + Do(p, alignment); else alignment = 4; - p.Do(waitingThreads); - p.Do(next); - p.Do(usage); + Do(p, waitingThreads); + Do(p, next); + Do(p, usage); } NativeTlspl ntls; diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 576c65c245..fe51c77699 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -23,6 +23,7 @@ #include "base/stringutil.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/FileUtil.h" #include "Common/StringUtils.h" #include "Core/Config.h" @@ -265,14 +266,14 @@ public: if (!s) return; - p.Do(nm); - p.Do(memoryBlockAddr); - p.Do(memoryBlockSize); - p.Do(isFake); + Do(p, nm); + Do(p, memoryBlockAddr); + Do(p, memoryBlockSize); + Do(p, isFake); if (s < 2) { bool isStarted = false; - p.Do(isStarted); + Do(p, isStarted); if (isStarted) nm.status = MODULE_STATUS_STARTED; else @@ -280,24 +281,24 @@ public: } if (s >= 3) { - p.Do(textStart); - p.Do(textEnd); + Do(p, textStart); + Do(p, textEnd); } if (s >= 4) { - p.Do(libstub); - p.Do(libstubend); + Do(p, libstub); + Do(p, libstubend); } ModuleWaitingThread mwt = {0}; - p.Do(waitingThreads, mwt); + Do(p, waitingThreads, mwt); FuncSymbolExport fsx = {{0}}; - p.Do(exportedFuncs, fsx); + Do(p, exportedFuncs, fsx); FuncSymbolImport fsi = {{0}}; - p.Do(importedFuncs, fsi); + Do(p, importedFuncs, fsi); VarSymbolExport vsx = {{0}}; - p.Do(exportedVars, vsx); + Do(p, exportedVars, vsx); VarSymbolImport vsi = {{0}}; - p.Do(importedVars, vsi); + Do(p, importedVars, vsi); if (p.mode == p.MODE_READ) { // On load state, we re-examine in case our syscall ids changed. @@ -437,8 +438,8 @@ public: if (!s) return; - p.Do(moduleID_); - p.Do(retValAddr); + Do(p, moduleID_); + Do(p, retValAddr); } static PSPAction *Create() { return new AfterModuleEntryCall; @@ -498,11 +499,11 @@ void __KernelModuleDoState(PointerWrap &p) if (!s) return; - p.Do(actionAfterModule); + Do(p, actionAfterModule); __KernelRestoreActionType(actionAfterModule, AfterModuleEntryCall::Create); if (s >= 2) { - p.Do(loadedModules); + Do(p, loadedModules); } if (p.mode == p.MODE_READ) { diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 543afbb3fe..67d0c58e86 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -17,6 +17,8 @@ #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Reporting.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" @@ -27,7 +29,6 @@ #include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/KernelWaitHelpers.h" -#include "Common/ChunkFile.h" #define SCE_KERNEL_MPA_THFIFO_S 0x0000 #define SCE_KERNEL_MPA_THPRI_S 0x0100 @@ -278,13 +279,13 @@ struct MsgPipe : public KernelObject if (!s) return; - p.Do(nmp); + Do(p, nmp); MsgPipeWaitingThread mpwt1 = {0}, mpwt2 = {0}; - p.Do(sendWaitingThreads, mpwt1); - p.Do(receiveWaitingThreads, mpwt2); - p.Do(pausedSendWaits); - p.Do(pausedReceiveWaits); - p.Do(buffer); + Do(p, sendWaitingThreads, mpwt1); + Do(p, receiveWaitingThreads, mpwt2); + Do(p, pausedSendWaits); + Do(p, pausedReceiveWaits); + Do(p, buffer); } NativeMsgPipe nmp; @@ -662,7 +663,7 @@ void __KernelMsgPipeDoState(PointerWrap &p) if (!s) return; - p.Do(waitTimer); + Do(p, waitTimer); CoreTiming::RestoreRegisterEvent(waitTimer, "MsgPipeTimeout", __KernelMsgPipeTimeout); } diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index fe958ade6d..cafc38d289 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -19,6 +19,7 @@ #include #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" @@ -77,10 +78,10 @@ struct PSPMutex : public KernelObject if (!s) return; - p.Do(nm); + Do(p, nm); SceUID dv = 0; - p.Do(waitingThreads, dv); - p.Do(pausedWaits); + Do(p, waitingThreads, dv); + Do(p, pausedWaits); } NativeMutex nm; @@ -143,10 +144,10 @@ struct LwMutex : public KernelObject if (!s) return; - p.Do(nm); + Do(p, nm); SceUID dv = 0; - p.Do(waitingThreads, dv); - p.Do(pausedWaits); + Do(p, waitingThreads, dv); + Do(p, pausedWaits); } NativeLwMutex nm; @@ -182,11 +183,11 @@ void __KernelMutexDoState(PointerWrap &p) if (!s) return; - p.Do(mutexWaitTimer); + Do(p, mutexWaitTimer); CoreTiming::RestoreRegisterEvent(mutexWaitTimer, "MutexTimeout", __KernelMutexTimeout); - p.Do(lwMutexWaitTimer); + Do(p, lwMutexWaitTimer); CoreTiming::RestoreRegisterEvent(lwMutexWaitTimer, "LwMutexTimeout", __KernelLwMutexTimeout); - p.Do(mutexHeldLocks); + Do(p, mutexHeldLocks); } KernelObject *__KernelMutexObject() diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index fe2f3c6c96..0f81cc43c4 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -16,12 +16,13 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" -#include "Common/ChunkFile.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/sceKernelSemaphore.h" @@ -69,10 +70,10 @@ struct PSPSemaphore : public KernelObject { if (!s) return; - p.Do(ns); + Do(p, ns); SceUID dv = 0; - p.Do(waitingThreads, dv); - p.Do(pausedWaits); + Do(p, waitingThreads, dv); + Do(p, pausedWaits); } NativeSemaphore ns; @@ -98,7 +99,7 @@ void __KernelSemaDoState(PointerWrap &p) if (!s) return; - p.Do(semaWaitTimer); + Do(p, semaWaitTimer); CoreTiming::RestoreRegisterEvent(semaWaitTimer, "SemaphoreTimeout", __KernelSemaTimeout); } diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 29c256b3db..9ff2fcb8d3 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -24,6 +24,8 @@ #include "base/logging.h" #include "Common/LogManager.h" +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/CommonTypes.h" #include "Core/HLE/HLE.h" #include "Core/HLE/HLETables.h" @@ -36,7 +38,6 @@ #include "Core/MemMapHelpers.h" #include "Core/MIPS/JitCommon/JitCommon.h" #include "Core/Reporting.h" -#include "Common/ChunkFile.h" #include "Core/HLE/sceAudio.h" #include "Core/HLE/sceKernel.h" @@ -162,14 +163,14 @@ public: if (!s) return; - p.Do(nc); + Do(p, nc); // Saved values were moved to mips call, ignoring here. u32 legacySaved = 0; - p.Do(legacySaved); - p.Do(legacySaved); - p.Do(legacySaved); - p.Do(legacySaved); - p.Do(legacySaved); + Do(p, legacySaved); + Do(p, legacySaved); + Do(p, legacySaved); + Do(p, legacySaved); + Do(p, legacySaved); } NativeCallback nc; @@ -281,8 +282,8 @@ public: if (!s) return; - p.Do(calls_); - p.Do(idGen_); + Do(p, calls_); + Do(p, idGen_); } private: @@ -312,18 +313,18 @@ public: if (!s) return; - p.Do(threadID); - p.Do(status); - p.Do(waitType); - p.Do(waitID); - p.Do(waitInfo); - p.Do(isProcessingCallbacks); - p.Do(currentCallbackId); + Do(p, threadID); + Do(p, status); + Do(p, waitType); + Do(p, waitID); + Do(p, waitInfo); + Do(p, isProcessingCallbacks); + Do(p, currentCallbackId); int chainedActionType = 0; if (chainedAction != NULL) chainedActionType = chainedAction->actionTypeID; - p.Do(chainedActionType); + Do(p, chainedActionType); if (chainedActionType != 0) { @@ -367,7 +368,7 @@ public: if (!s) return; - p.Do(cbId); + Do(p, cbId); } SceUID cbId; @@ -532,15 +533,15 @@ public: if (!s) return; - p.Do(nt); - p.Do(waitInfo); - p.Do(moduleId); - p.Do(isProcessingCallbacks); - p.Do(currentMipscallId); - p.Do(currentCallbackId); + Do(p, nt); + Do(p, waitInfo); + Do(p, moduleId); + Do(p, isProcessingCallbacks); + Do(p, currentMipscallId); + Do(p, currentCallbackId); // TODO: If we want to "version" a DoState method here, we can just use minVer = 0. - p.Do(context); + Do(p, context); if (s <= 3) { @@ -561,16 +562,16 @@ public: if (s <= 4) std::swap(context.hi, context.lo); - p.Do(callbacks); + Do(p, callbacks); - p.Do(pendingMipsCalls); - p.Do(pushedStacks); - p.Do(currentStack); + Do(p, pendingMipsCalls); + Do(p, pushedStacks); + Do(p, currentStack); if (s >= 2) { - p.Do(waitingThreads); - p.Do(pausedWaits); + Do(p, waitingThreads); + Do(p, pausedWaits); } } @@ -695,26 +696,26 @@ void MipsCall::DoState(PointerWrap &p) if (!s) return; - p.Do(entryPoint); - p.Do(cbId); - p.DoArray(args, ARRAY_SIZE(args)); - p.Do(numArgs); + Do(p, entryPoint); + Do(p, cbId); + DoArray(p, args, ARRAY_SIZE(args)); + Do(p, numArgs); // No longer used. u32 legacySavedIdRegister = 0; - p.Do(legacySavedIdRegister); + Do(p, legacySavedIdRegister); u32 legacySavedRa = 0; - p.Do(legacySavedRa); - p.Do(savedPc); - p.Do(savedV0); - p.Do(savedV1); - p.Do(tag); - p.Do(savedId); - p.Do(reschedAfter); + Do(p, legacySavedRa); + Do(p, savedPc); + Do(p, savedV0); + Do(p, savedV1); + Do(p, tag); + Do(p, savedId); + Do(p, reschedAfter); int actionTypeID = 0; if (doAfter != NULL) actionTypeID = doAfter->actionTypeID; - p.Do(actionTypeID); + Do(p, actionTypeID); if (actionTypeID != 0) { if (p.mode == p.MODE_READ) @@ -970,48 +971,48 @@ void __KernelThreadingDoState(PointerWrap &p) if (!s) return; - p.Do(g_inCbCount); - p.Do(currentCallbackThreadID); - p.Do(readyCallbacksCount); - p.Do(idleThreadHackAddr); - p.Do(threadReturnHackAddr); - p.Do(cbReturnHackAddr); - p.Do(intReturnHackAddr); - p.Do(extendReturnHackAddr); - p.Do(moduleReturnHackAddr); + Do(p, g_inCbCount); + Do(p, currentCallbackThreadID); + Do(p, readyCallbacksCount); + Do(p, idleThreadHackAddr); + Do(p, threadReturnHackAddr); + Do(p, cbReturnHackAddr); + Do(p, intReturnHackAddr); + Do(p, extendReturnHackAddr); + Do(p, moduleReturnHackAddr); if (s >= 4) { - p.Do(hleReturnHackAddr); + Do(p, hleReturnHackAddr); } else { hleReturnHackAddr = 0; } - p.Do(currentThread); + Do(p, currentThread); SceUID dv = 0; - p.Do(threadqueue, dv); - p.DoArray(threadIdleID, ARRAY_SIZE(threadIdleID)); - p.Do(dispatchEnabled); + Do(p, threadqueue, dv); + DoArray(p, threadIdleID, ARRAY_SIZE(threadIdleID)); + Do(p, dispatchEnabled); - p.Do(threadReadyQueue); + Do(p, threadReadyQueue); - p.Do(eventScheduledWakeup); + Do(p, eventScheduledWakeup); CoreTiming::RestoreRegisterEvent(eventScheduledWakeup, "ScheduledWakeup", &hleScheduledWakeup); - p.Do(eventThreadEndTimeout); + Do(p, eventThreadEndTimeout); CoreTiming::RestoreRegisterEvent(eventThreadEndTimeout, "ThreadEndTimeout", &hleThreadEndTimeout); - p.Do(actionAfterMipsCall); + Do(p, actionAfterMipsCall); __KernelRestoreActionType(actionAfterMipsCall, ActionAfterMipsCall::Create); - p.Do(actionAfterCallback); + Do(p, actionAfterCallback); __KernelRestoreActionType(actionAfterCallback, ActionAfterCallback::Create); - p.Do(pausedDelays); + Do(p, pausedDelays); __SetCurrentThread(kernelObjects.GetFast(currentThread), currentThread, __KernelGetThreadName(currentThread)); lastSwitchCycles = CoreTiming::GetTicks(); if (s >= 2) - p.Do(threadEventHandlers); + Do(p, threadEventHandlers); if (s >= 3) - p.Do(pendingDeleteThreads); + Do(p, pendingDeleteThreads); } void __KernelThreadingDoStateLate(PointerWrap &p) @@ -3672,7 +3673,7 @@ struct ThreadEventHandler : public KernelObject { if (!s) return; - p.Do(nteh); + Do(p, nteh); } NativeThreadEventHandler nteh; diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index 2e16ba9237..64b454f7e4 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -24,6 +24,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/CoreTiming.h" #include "Core/HLE/HLE.h" #include "Core/HLE/sceKernel.h" @@ -48,10 +49,10 @@ void __KernelTimeDoState(PointerWrap &p) return; if (s < 2) { - p.Do(start_time); + Do(p, start_time); } else { u64 t = start_time; - p.Do(t); + Do(p, t); start_time = (time_t)t; } } diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index 7b5a272358..3a3d4e2be0 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -16,6 +16,8 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" @@ -24,7 +26,6 @@ #include "Core/HLE/sceKernelMemory.h" #include "Core/HLE/sceKernelVTimer.h" #include "Core/HLE/HLE.h" -#include "Common/ChunkFile.h" static int vtimerTimer = -1; static SceUID runningVTimer = 0; @@ -54,10 +55,10 @@ struct VTimer : public KernelObject { if (!s) return; - p.Do(nvt); + Do(p, nvt); if (s < 2) { u32 memoryPtr; - p.Do(memoryPtr); + Do(p, memoryPtr); } } @@ -192,12 +193,12 @@ void __KernelVTimerDoState(PointerWrap &p) { if (!s) return; - p.Do(vtimerTimer); - p.Do(vtimers); + Do(p, vtimerTimer); + Do(p, vtimers); CoreTiming::RestoreRegisterEvent(vtimerTimer, "VTimer", __KernelTriggerVTimer); if (s >= 2) - p.Do(runningVTimer); + Do(p, runningVTimer); else runningVTimer = 0; } diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 3dab28d418..b94b06dcb2 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -18,6 +18,7 @@ #include #include +#include "Common/ChunkFileDo.h" #include "Core/Config.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" @@ -70,24 +71,24 @@ public: if (!s) return; - p.Do(mp3StreamStart); - p.Do(mp3StreamEnd); - p.Do(mp3Buf); - p.Do(mp3BufSize); - p.Do(mp3PcmBuf); - p.Do(mp3PcmBufSize); - p.Do(readPosition); - p.Do(bufferRead); - p.Do(bufferWrite); - p.Do(bufferAvailable); - p.Do(mp3DecodedBytes); - p.Do(mp3LoopNum); - p.Do(mp3MaxSamples); - p.Do(mp3SumDecodedSamples); - p.Do(mp3Channels); - p.Do(mp3Bitrate); - p.Do(mp3SamplingRate); - p.Do(mp3Version); + Do(p, mp3StreamStart); + Do(p, mp3StreamEnd); + Do(p, mp3Buf); + Do(p, mp3BufSize); + Do(p, mp3PcmBuf); + Do(p, mp3PcmBufSize); + Do(p, readPosition); + Do(p, bufferRead); + Do(p, bufferWrite); + Do(p, bufferAvailable); + Do(p, mp3DecodedBytes); + Do(p, mp3LoopNum); + Do(p, mp3MaxSamples); + Do(p, mp3SumDecodedSamples); + Do(p, mp3Channels); + Do(p, mp3Bitrate); + Do(p, mp3SamplingRate); + Do(p, mp3Version); }; }; @@ -114,10 +115,10 @@ void __Mp3DoState(PointerWrap &p) { return; if (s >= 2) { - p.Do(mp3Map); + Do(p, mp3Map); } else { std::map mp3Map_old; - p.Do(mp3Map_old); // read old map + Do(p, mp3Map_old); // read old map for (auto it = mp3Map_old.begin(), end = mp3Map_old.end(); it != end; ++it) { auto mp3 = new AuCtx; u32 id = it->first; @@ -147,7 +148,7 @@ void __Mp3DoState(PointerWrap &p) { } if (s >= 3) { - p.Do(resourceInited); + Do(p, resourceInited); } else { // Previous behavior acted as if it was already inited. resourceInited = true; diff --git a/Core/HLE/sceMp4.cpp b/Core/HLE/sceMp4.cpp index ca2c3d3e11..0bbf4edaa8 100644 --- a/Core/HLE/sceMp4.cpp +++ b/Core/HLE/sceMp4.cpp @@ -17,6 +17,7 @@ #include +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/Reporting.h" @@ -43,7 +44,7 @@ void __AACDoState(PointerWrap &p) { if (!s) return; - p.Do(aacMap); + Do(p, aacMap); } static u32 sceMp4Init() diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 37a3ae9ede..8a79a786f2 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -20,6 +20,7 @@ #include #include +#include "Common/ChunkFileDo.h" #include "Common/Swap.h" #include "Core/HLE/sceMpeg.h" #include "Core/HLE/sceKernelModule.h" @@ -176,35 +177,35 @@ struct MpegContext { if (!s) return; - p.DoArray(mpegheader, 2048); - p.Do(defaultFrameWidth); - p.Do(videoFrameCount); - p.Do(audioFrameCount); - p.Do(endOfAudioReached); - p.Do(endOfVideoReached); - p.Do(videoPixelMode); - p.Do(mpegMagic); - p.Do(mpegVersion); - p.Do(mpegRawVersion); - p.Do(mpegOffset); - p.Do(mpegStreamSize); - p.Do(mpegFirstTimestamp); - p.Do(mpegLastTimestamp); - p.Do(mpegFirstDate); - p.Do(mpegLastDate); - p.Do(mpegRingbufferAddr); - p.DoArray(esBuffers, MPEG_DATA_ES_BUFFERS); - p.Do(avc); - p.Do(avcRegistered); - p.Do(atracRegistered); - p.Do(pcmRegistered); - p.Do(dataRegistered); - p.Do(ignoreAtrac); - p.Do(ignorePcm); - p.Do(ignoreAvc); - p.Do(isAnalyzed); - p.Do(streamMap); - p.DoClass(mediaengine); + DoArray(p, mpegheader, 2048); + Do(p, defaultFrameWidth); + Do(p, videoFrameCount); + Do(p, audioFrameCount); + Do(p, endOfAudioReached); + Do(p, endOfVideoReached); + Do(p, videoPixelMode); + Do(p, mpegMagic); + Do(p, mpegVersion); + Do(p, mpegRawVersion); + Do(p, mpegOffset); + Do(p, mpegStreamSize); + Do(p, mpegFirstTimestamp); + Do(p, mpegLastTimestamp); + Do(p, mpegFirstDate); + Do(p, mpegLastDate); + Do(p, mpegRingbufferAddr); + DoArray(p, esBuffers, MPEG_DATA_ES_BUFFERS); + Do(p, avc); + Do(p, avcRegistered); + Do(p, atracRegistered); + Do(p, pcmRegistered); + Do(p, dataRegistered); + Do(p, ignoreAtrac); + Do(p, ignorePcm); + Do(p, ignoreAvc); + Do(p, isAnalyzed); + Do(p, streamMap); + DoClass(p, mediaengine); ringbufferNeedsReverse = s < 2; } @@ -365,7 +366,7 @@ public: if (!s) return; - p.Do(ringAddr_); + Do(p, ringAddr_); } void run(MipsCall &call) override; private: @@ -392,20 +393,20 @@ void __MpegDoState(PointerWrap &p) { if (s < 2) { int oldLastMpeg = -1; bool oldIsMpegAnalyzed = false; - p.Do(oldLastMpeg); - p.Do(streamIdGen); - p.Do(oldIsMpegAnalyzed); + Do(p, oldLastMpeg); + Do(p, streamIdGen); + Do(p, oldIsMpegAnalyzed); // Let's assume the oldest version. mpegLibVersion = 0x0101; } else { - p.Do(streamIdGen); - p.Do(mpegLibVersion); + Do(p, streamIdGen); + Do(p, mpegLibVersion); } - p.Do(isMpegInit); - p.Do(actionPostPut); + Do(p, isMpegInit); + Do(p, actionPostPut); __KernelRestoreActionType(actionPostPut, PostPutAction::Create); - p.Do(mpegMap); + Do(p, mpegMap); } void __MpegShutdown() { @@ -1054,8 +1055,8 @@ void __VideoPmpDoState(PointerWrap &p){ return; } - p.Do(pmp_videoSource); - p.Do(pmp_nBlocks); + Do(p, pmp_videoSource); + Do(p, pmp_nBlocks); if (p.mode == PointerWrap::MODE_READ){ // for loadstate, we will reinitialize the pmp codec __VideoPmpShutdown(); diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index f307275835..e3936c4841 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -26,6 +26,7 @@ #include "util/text/parsers.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernelMemory.h" @@ -73,6 +74,28 @@ u32 Net_Term(); int NetApctl_Term(); void NetApctl_InitInfo(); +void AfterApctlMipsCall::DoState(PointerWrap & p) { + auto s = p.Section("AfterApctlMipsCall", 1, 1); + if (!s) + return; + // Just in case there are "s" corruption in the future where s.ver is a negative number + if (s >= 1) { + Do(p, handlerID); + Do(p, oldState); + Do(p, newState); + Do(p, event); + Do(p, error); + Do(p, argsAddr); + } else { + handlerID = -1; + oldState = 0; + newState = 0; + event = 0; + error = 0; + argsAddr = 0; + } +} + void AfterApctlMipsCall::run(MipsCall& call) { u32 v0 = currentMIPS->r[MIPS_REG_V0]; DEBUG_LOG(SCENET, "AfterApctlMipsCall::run [ID=%i][OldState=%d][NewState=%d][Event=%d][Error=%d][ArgsPtr=%08x] [cbId: %u][retV0: %08x]", handlerID, oldState, newState, event, error, argsAddr, call.cbId, v0); @@ -221,34 +244,34 @@ void __NetDoState(PointerWrap &p) { auto cur_netInetInited = netInetInited; auto cur_netApctlInited = netApctlInited; - p.Do(netInited); - p.Do(netInetInited); - p.Do(netApctlInited); - p.Do(apctlHandlers); - p.Do(netMallocStat); + Do(p, netInited); + Do(p, netInetInited); + Do(p, netApctlInited); + Do(p, apctlHandlers); + Do(p, netMallocStat); if (s < 2) { netDropRate = 0; netDropDuration = 0; } else { - p.Do(netDropRate); - p.Do(netDropDuration); + Do(p, netDropRate); + Do(p, netDropDuration); } if (s < 3) { netPoolAddr = 0; netThread1Addr = 0; netThread2Addr = 0; } else { - p.Do(netPoolAddr); - p.Do(netThread1Addr); - p.Do(netThread2Addr); + Do(p, netPoolAddr); + Do(p, netThread1Addr); + Do(p, netThread2Addr); } if (s >= 4) { - p.Do(netApctlState); - p.Do(netApctlInfo); - p.Do(actionAfterApctlMipsCall); + Do(p, netApctlState); + Do(p, netApctlInfo); + Do(p, actionAfterApctlMipsCall); __KernelRestoreActionType(actionAfterApctlMipsCall, AfterApctlMipsCall::Create); - p.Do(apctlThreadHackAddr); - p.Do(apctlThreadID); + Do(p, apctlThreadHackAddr); + Do(p, apctlThreadID); } else { actionAfterApctlMipsCall = -1; diff --git a/Core/HLE/sceNet.h b/Core/HLE/sceNet.h index 1ca82af0d5..73f4566eb9 100644 --- a/Core/HLE/sceNet.h +++ b/Core/HLE/sceNet.h @@ -204,28 +204,7 @@ class AfterApctlMipsCall : public PSPAction { public: AfterApctlMipsCall() {} static PSPAction* Create() { return new AfterApctlMipsCall(); } - void DoState(PointerWrap& p) override { - auto s = p.Section("AfterApctlMipsCall", 1, 1); - if (!s) - return; - // Just in case there are "s" corruption in the future where s.ver is a negative number - if (s >= 1) { - p.Do(handlerID); - p.Do(oldState); - p.Do(newState); - p.Do(event); - p.Do(error); - p.Do(argsAddr); - } - else { - handlerID = -1; - oldState = 0; - newState = 0; - event = 0; - error = 0; - argsAddr = 0; - } - } + void DoState(PointerWrap& p) override; void run(MipsCall& call) override; void SetData(int HandlerID, int OldState, int NewState, int Event, int Error, u32_le ArgsAddr); diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 87f7075025..54562f0dd2 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -29,6 +29,7 @@ #include "Core/Host.h" #include "Core/MemMapHelpers.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MIPS/MIPSCodeUtils.h" #include "Core/Util/PortManager.h" @@ -119,34 +120,34 @@ void __NetAdhocDoState(PointerWrap &p) { auto cur_netAdhocctlInited = netAdhocctlInited; auto cur_netAdhocMatchingInited = netAdhocMatchingInited; - p.Do(netAdhocInited); - p.Do(netAdhocctlInited); - p.Do(netAdhocMatchingInited); - p.Do(adhocctlHandlers); + Do(p, netAdhocInited); + Do(p, netAdhocctlInited); + Do(p, netAdhocMatchingInited); + Do(p, adhocctlHandlers); if (s >= 2) { - p.Do(actionAfterMatchingMipsCall); + Do(p, actionAfterMatchingMipsCall); __KernelRestoreActionType(actionAfterMatchingMipsCall, AfterMatchingMipsCall::Create); - p.Do(dummyThreadHackAddr); + Do(p, dummyThreadHackAddr); } else { actionAfterMatchingMipsCall = -1; dummyThreadHackAddr = 0; } if (s >= 3) { - p.Do(actionAfterAdhocMipsCall); + Do(p, actionAfterAdhocMipsCall); __KernelRestoreActionType(actionAfterAdhocMipsCall, AfterAdhocMipsCall::Create); - p.Do(matchingThreadHackAddr); + Do(p, matchingThreadHackAddr); } else { actionAfterAdhocMipsCall = -1; matchingThreadHackAddr = 0; } if (s >= 4) { - p.Do(threadAdhocID); - p.Do(matchingThreads); + Do(p, threadAdhocID); + Do(p, matchingThreads); } else { threadAdhocID = 0; diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index b4fe3b0925..610e21234f 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -17,6 +17,7 @@ #include #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/CoreTiming.h" @@ -132,8 +133,8 @@ void __PowerDoState(PointerWrap &p) { return; if (s >= 2) { - p.Do(RealpllFreq); - p.Do(RealbusFreq); + Do(p, RealpllFreq); + Do(p, RealbusFreq); if (RealpllFreq < 1000000) RealpllFreq = PowerPllMhzToHz(RealpllFreq); @@ -151,9 +152,9 @@ void __PowerDoState(PointerWrap &p) { pllFreq = RealpllFreq; busFreq = RealbusFreq; } - p.DoArray(powerCbSlots, ARRAY_SIZE(powerCbSlots)); - p.Do(volatileMemLocked); - p.Do(volatileWaitingThreads); + DoArray(p, powerCbSlots, ARRAY_SIZE(powerCbSlots)); + Do(p, volatileMemLocked); + Do(p, volatileWaitingThreads); } static int scePowerGetBatteryLifePercent() { diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index f89fa524dd..74c4f7242a 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/System.h" @@ -334,13 +335,13 @@ public: if (!s) return; - p.Do(type_); - p.Do(channel_); + Do(p, type_); + Do(p, channel_); if (s >= 2) { - p.Do(videoWidth_); - p.Do(videoHeight_); - p.Do(audioChannels_); - p.Do(audioFrequency_); + Do(p, videoWidth_); + Do(p, videoHeight_); + Do(p, audioChannels_); + Do(p, audioFrequency_); } } @@ -440,38 +441,38 @@ void Psmf::DoState(PointerWrap &p) { if (!s) return; - p.Do(magic); - p.Do(version); - p.Do(streamOffset); - p.Do(streamSize); - p.Do(headerOffset); - p.Do(streamDataTotalSize); - p.Do(presentationStartTime); - p.Do(presentationEndTime); - p.Do(streamDataNextBlockSize); - p.Do(streamDataNextInnerBlockSize); - p.Do(numStreams); + Do(p, magic); + Do(p, version); + Do(p, streamOffset); + Do(p, streamSize); + Do(p, headerOffset); + Do(p, streamDataTotalSize); + Do(p, presentationStartTime); + Do(p, presentationEndTime); + Do(p, streamDataNextBlockSize); + Do(p, streamDataNextInnerBlockSize); + Do(p, numStreams); - p.Do(currentStreamNum); + Do(p, currentStreamNum); int legacyStreamNums = 0; - p.Do(legacyStreamNums); - p.Do(legacyStreamNums); + Do(p, legacyStreamNums); + Do(p, legacyStreamNums); - p.Do(EPMapOffset); - p.Do(EPMapEntriesNum); - p.Do(videoWidth); - p.Do(videoHeight); - p.Do(audioChannels); - p.Do(audioFrequency); + Do(p, EPMapOffset); + Do(p, EPMapEntriesNum); + Do(p, videoWidth); + Do(p, videoHeight); + Do(p, audioChannels); + Do(p, audioFrequency); if (s >= 2) { - p.Do(EPMap); + Do(p, EPMap); } - p.Do(streamMap); + Do(p, streamMap); if (s >= 3) { - p.Do(currentStreamType); - p.Do(currentStreamChannel); + Do(p, currentStreamType); + Do(p, currentStreamChannel); } else { currentStreamType = -1; currentStreamChannel = -1; @@ -488,65 +489,65 @@ void PsmfPlayer::DoState(PointerWrap &p) { if (!s) return; - p.Do(videoCodec); - p.Do(videoStreamNum); - p.Do(audioCodec); - p.Do(audioStreamNum); - p.Do(playMode); - p.Do(playSpeed); + Do(p, videoCodec); + Do(p, videoStreamNum); + Do(p, audioCodec); + Do(p, audioStreamNum); + Do(p, playMode); + Do(p, playSpeed); - p.Do(displayBuffer); - p.Do(displayBufferSize); - p.Do(playbackThreadPriority); + Do(p, displayBuffer); + Do(p, displayBufferSize); + Do(p, playbackThreadPriority); int oldMaxAheadTimestamp = 0; - p.Do(oldMaxAheadTimestamp); + Do(p, oldMaxAheadTimestamp); if (s >= 4) { - p.Do(totalDurationTimestamp); + Do(p, totalDurationTimestamp); } else { long oldTimestamp; - p.Do(oldTimestamp); + Do(p, oldTimestamp); totalDurationTimestamp = oldTimestamp; } if (s >= 2) { - p.Do(totalVideoStreams); - p.Do(totalAudioStreams); - p.Do(playerVersion); + Do(p, totalVideoStreams); + Do(p, totalAudioStreams); + Do(p, playerVersion); } else { totalVideoStreams = 1; totalAudioStreams = 1; playerVersion = PSMF_PLAYER_VERSION_FULL; } if (s >= 3) { - p.Do(videoStep); + Do(p, videoStep); } else { videoStep = 0; } if (s >= 4) { - p.Do(warmUp); + Do(p, warmUp); } else { warmUp = 10000; } if (s >= 5) { - p.Do(seekDestTimeStamp); + Do(p, seekDestTimeStamp); } else { seekDestTimeStamp = 0; } - p.DoClass(mediaengine); - p.Do(filehandle); - p.Do(fileoffset); - p.Do(readSize); - p.Do(streamSize); + DoClass(p, mediaengine); + Do(p, filehandle); + Do(p, fileoffset); + Do(p, readSize); + Do(p, streamSize); - p.Do(status); + Do(p, status); if (s >= 4) { - p.Do(psmfPlayerAtracAu); + Do(p, psmfPlayerAtracAu); } - p.Do(psmfPlayerAvcAu); + Do(p, psmfPlayerAvcAu); if (s >= 7) { bool hasFinishThread = finishThread != nullptr; - p.Do(hasFinishThread); + Do(p, hasFinishThread); if (hasFinishThread) { - p.Do(finishThread); + Do(p, finishThread); } else { if (finishThread) finishThread->Forget(); @@ -554,7 +555,7 @@ void PsmfPlayer::DoState(PointerWrap &p) { finishThread = nullptr; } } else if (s >= 6) { - p.Do(finishThread); + Do(p, finishThread); } else { if (finishThread) finishThread->Forget(); @@ -563,8 +564,8 @@ void PsmfPlayer::DoState(PointerWrap &p) { } if (s >= 8) { - p.Do(videoWidth); - p.Do(videoHeight); + Do(p, videoWidth); + Do(p, videoHeight); } } @@ -679,7 +680,7 @@ void __PsmfDoState(PointerWrap &p) { if (!s) return; - p.Do(psmfMap); + Do(p, psmfMap); } void __PsmfPlayerDoState(PointerWrap &p) { @@ -687,11 +688,11 @@ void __PsmfPlayerDoState(PointerWrap &p) { if (!s) return; - p.Do(psmfPlayerMap); - p.Do(videoPixelMode); - p.Do(videoLoopStatus); + Do(p, psmfPlayerMap); + Do(p, videoPixelMode); + Do(p, videoLoopStatus); if (s >= 2) { - p.Do(psmfPlayerLibVersion); + Do(p, psmfPlayerLibVersion); } else { // Assume the latest, which is what we were emulating before. psmfPlayerLibVersion = 0x06060010; diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 75e9e3ef3b..eb19ce95b2 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -27,6 +27,7 @@ #include "base/timeutil.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" @@ -167,7 +168,7 @@ void __RtcDoState(PointerWrap &p) if (!s) return; - p.Do(rtcBaseTime); + Do(p, rtcBaseTime); // Update the precalc, pointless to savestate this as it's just based on the other value. RtcUpdateBaseTicks(); } diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 778708e65d..0e5f95f65e 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -35,6 +35,7 @@ #include "base/basictypes.h" #include "profiler/profiler.h" #include "thread/threadutil.h" +#include "Common/ChunkFileDo.h" #include "Common/Log.h" #include "Core/Config.h" #include "Core/CoreTiming.h" @@ -204,10 +205,10 @@ void __SasDoState(PointerWrap &p) { __SasDrain(); } - p.DoClass(sas); + DoClass(p, sas); if (s >= 2) { - p.Do(sasMixEvent); + Do(p, sasMixEvent); } else { sasMixEvent = -1; __SasDisableThread(); diff --git a/Core/HLE/sceSsl.cpp b/Core/HLE/sceSsl.cpp index 2fa138cb78..65efc6cde4 100644 --- a/Core/HLE/sceSsl.cpp +++ b/Core/HLE/sceSsl.cpp @@ -15,11 +15,11 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MemMap.h" -#include "Common/ChunkFile.h" - #include "Core/HLE/sceSsl.h" #define ERROR_SSL_NOT_INIT 0x80435001; @@ -44,9 +44,9 @@ void __SslDoState(PointerWrap &p) if (!s) return; - p.Do(isSslInit); - p.Do(maxMemSize); - p.Do(currentMemSize); + Do(p, isSslInit); + Do(p, maxMemSize); + Do(p, currentMemSize); } static int sceSslInit(int heapSize) @@ -127,4 +127,4 @@ const HLEFunction sceSsl[] = void Register_sceSsl() { RegisterModule("sceSsl", ARRAY_SIZE(sceSsl), sceSsl); -} \ No newline at end of file +} diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index a93fa7f977..12c8a53a1b 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -20,6 +20,7 @@ #include "file/file_util.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Loaders.h" #include "Core/MemMap.h" #include "Core/System.h" @@ -87,26 +88,26 @@ void __UmdDoState(PointerWrap &p) if (!s) return; - p.Do(umdActivated); - p.Do(umdStatus); - p.Do(umdErrorStat); - p.Do(driveCBId); - p.Do(umdStatTimeoutEvent); + Do(p, umdActivated); + Do(p, umdStatus); + Do(p, umdErrorStat); + Do(p, driveCBId); + Do(p, umdStatTimeoutEvent); CoreTiming::RestoreRegisterEvent(umdStatTimeoutEvent, "UmdTimeout", __UmdStatTimeout); - p.Do(umdStatChangeEvent); + Do(p, umdStatChangeEvent); CoreTiming::RestoreRegisterEvent(umdStatChangeEvent, "UmdChange", __UmdStatChange); - p.Do(umdWaitingThreads); - p.Do(umdPausedWaits); + Do(p, umdWaitingThreads); + Do(p, umdPausedWaits); if (s > 1) { - p.Do(UMDReplacePermit); + Do(p, UMDReplacePermit); if (UMDReplacePermit) host->UpdateUI(); } if (s > 2) { - p.Do(umdInsertChangeEvent); + Do(p, umdInsertChangeEvent); CoreTiming::RestoreRegisterEvent(umdInsertChangeEvent, "UmdInsertChange", __UmdInsertChange); - p.Do(UMDInserted); + Do(p, UMDInserted); } else UMDInserted = true; diff --git a/Core/HLE/sceUsb.cpp b/Core/HLE/sceUsb.cpp index c29ef6e6b2..6300be0118 100644 --- a/Core/HLE/sceUsb.cpp +++ b/Core/HLE/sceUsb.cpp @@ -16,11 +16,12 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "base/NativeApp.h" +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" -#include "Common/ChunkFile.h" #include "Core/HLE/sceUsb.h" // TODO: Map by driver name @@ -53,13 +54,13 @@ void __UsbDoState(PointerWrap &p) return; if (s >= 2) { - p.Do(usbStarted); - p.Do(usbConnected); + Do(p, usbStarted); + Do(p, usbConnected); } else { usbStarted = false; usbConnected = true; } - p.Do(usbActivated); + Do(p, usbActivated); } static int sceUsbStart(const char* driverName, u32 argsSize, u32 argsPtr) { diff --git a/Core/HLE/sceUsbCam.cpp b/Core/HLE/sceUsbCam.cpp index a5c4653335..751952dbb9 100644 --- a/Core/HLE/sceUsbCam.cpp +++ b/Core/HLE/sceUsbCam.cpp @@ -21,6 +21,7 @@ #include "base/NativeApp.h" #include "ppsspp_config.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/sceUsbCam.h" #include "Core/HLE/sceUsbMic.h" @@ -62,7 +63,7 @@ void __UsbCamDoState(PointerWrap &p) { return; } - p.Do(*config); + Do(p, *config); if (config->mode == Camera::Mode::Video) { // stillImage? TBD Camera::stopCapture(); Camera::startCapture(); diff --git a/Core/HLE/sceUsbGps.cpp b/Core/HLE/sceUsbGps.cpp index 05b16e5b3d..b7e1be9902 100644 --- a/Core/HLE/sceUsbGps.cpp +++ b/Core/HLE/sceUsbGps.cpp @@ -17,6 +17,7 @@ #include "base/NativeApp.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceUsbGps.h" @@ -40,7 +41,7 @@ void __UsbGpsDoState(PointerWrap &p) { if (!s) return; - p.Do(gpsStatus); + Do(p, gpsStatus); } void __UsbGpsShutdown() { diff --git a/Core/HLE/sceUsbMic.cpp b/Core/HLE/sceUsbMic.cpp index 788529e679..9f165ed064 100644 --- a/Core/HLE/sceUsbMic.cpp +++ b/Core/HLE/sceUsbMic.cpp @@ -19,6 +19,7 @@ #include "base/NativeApp.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernelThread.h" @@ -122,12 +123,12 @@ void __UsbMicDoState(PointerWrap &p) { if (!s) { return; } - p.Do(numNeedSamples); - p.Do(waitingThreads); - p.Do(isNeedInput); - p.Do(curSampleRate); - p.Do(curChannels); - p.Do(micState); + Do(p, numNeedSamples); + Do(p, waitingThreads); + Do(p, isNeedInput); + Do(p, curSampleRate); + Do(p, curChannels); + Do(p, micState); // Maybe also need to save the state of audioBuf. if (waitingThreads.size() != 0 && p.mode == PointerWrap::MODE_READ) { u64 waitTimeus = (waitingThreads[0].needSize - Microphone::availableAudioBufSize()) * 1000000 / 2 / waitingThreads[0].sampleRate; diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 4838013dc4..d1a13e1fc2 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -21,6 +21,7 @@ #include "file/ini_file.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" @@ -153,8 +154,8 @@ void __UtilityDoState(PointerWrap &p) { return; } - p.Do(currentDialogType); - p.Do(currentDialogActive); + Do(p, currentDialogType); + Do(p, currentDialogActive); saveDialog.DoState(p); msgDialog.DoState(p); oskDialog.DoState(p); @@ -163,10 +164,10 @@ void __UtilityDoState(PointerWrap &p) { gamedataInstallDialog.DoState(p); if (s >= 2) { - p.Do(currentlyLoadedModules); + Do(p, currentlyLoadedModules); } else { std::set oldModules; - p.Do(oldModules); + Do(p, oldModules); for (auto it = oldModules.begin(), end = oldModules.end(); it != end; ++it) { currentlyLoadedModules[*it] = 0; } diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index e3749d0680..de617a78b4 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" @@ -36,7 +37,7 @@ void __VaudioDoState(PointerWrap &p) { if (!s) return; - p.Do(vaudioReserved); + Do(p, vaudioReserved); } static u32 sceVaudioChReserve(int sampleCount, int freq, int format) { diff --git a/Core/HW/AsyncIOManager.cpp b/Core/HW/AsyncIOManager.cpp index b2a99805e4..98a15f5c48 100644 --- a/Core/HW/AsyncIOManager.cpp +++ b/Core/HW/AsyncIOManager.cpp @@ -19,6 +19,7 @@ #include #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MIPS/MIPS.h" #include "Core/Reporting.h" #include "Core/System.h" @@ -153,12 +154,12 @@ void AsyncIOManager::DoState(PointerWrap &p) { SyncThread(); std::lock_guard guard(resultsLock_); - p.Do(resultsPending_); + Do(p, resultsPending_); if (s >= 2) { - p.Do(results_); + Do(p, results_); } else { std::map oldResults; - p.Do(oldResults); + Do(p, oldResults); for (auto it = oldResults.begin(), end = oldResults.end(); it != end; ++it) { results_[it->first] = AsyncIOResult(it->second); } diff --git a/Core/HW/AsyncIOManager.h b/Core/HW/AsyncIOManager.h index 6bb9be5039..4b1e0b5276 100644 --- a/Core/HW/AsyncIOManager.h +++ b/Core/HW/AsyncIOManager.h @@ -61,10 +61,10 @@ struct AsyncIOResult { if (!s) return; - p.Do(result); - p.Do(finishTicks); + Do(p, result); + Do(p, finishTicks); if (s >= 2) { - p.Do(invalidateAddr); + Do(p, invalidateAddr); } else { invalidateAddr = 0; } diff --git a/Core/HW/BufferQueue.cpp b/Core/HW/BufferQueue.cpp new file mode 100644 index 0000000000..14ece774e1 --- /dev/null +++ b/Core/HW/BufferQueue.cpp @@ -0,0 +1,34 @@ +// Copyright (c) 2013- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include "Common/ChunkFileDo.h" +#include "Core/HW/BufferQueue.h" + +void BufferQueue::DoState(PointerWrap &p) { + auto s = p.Section("BufferQueue", 0, 1); + + Do(p, bufQueueSize); + Do(p, start); + Do(p, end); + if (bufQueue) { + DoArray(p, bufQueue, bufQueueSize); + } + + if (s >= 1) { + Do(p, ptsMarks); + } +} diff --git a/Core/HW/BufferQueue.h b/Core/HW/BufferQueue.h index 79e7072f19..b69782e985 100644 --- a/Core/HW/BufferQueue.h +++ b/Core/HW/BufferQueue.h @@ -124,20 +124,7 @@ struct BufferQueue { return bytesgot; } - void DoState(PointerWrap &p) { - auto s = p.Section("BufferQueue", 0, 1); - - p.Do(bufQueueSize); - p.Do(start); - p.Do(end); - if (bufQueue) { - p.DoArray(bufQueue, bufQueueSize); - } - - if (s >= 1) { - p.Do(ptsMarks); - } - } + void DoState(PointerWrap &p); private: void savePts(u64 pts) { diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 1f8113f011..83735a02ce 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/ChunkFileDo.h" #include "Core/Config.h" #include "Core/Debugger/Breakpoints.h" #include "Core/HW/MediaEngine.h" @@ -172,25 +173,25 @@ void MediaEngine::DoState(PointerWrap &p) { if (!s) return; - p.Do(m_videoStream); - p.Do(m_audioStream); + Do(p, m_videoStream); + Do(p, m_audioStream); - p.DoArray(m_mpegheader, sizeof(m_mpegheader)); + DoArray(p, m_mpegheader, sizeof(m_mpegheader)); if (s >= 4) { - p.Do(m_mpegheaderSize); + Do(p, m_mpegheaderSize); } else { m_mpegheaderSize = sizeof(m_mpegheader); } if (s >= 5) { - p.Do(m_mpegheaderReadPos); + Do(p, m_mpegheaderReadPos); } else { m_mpegheaderReadPos = m_mpegheaderSize; } - p.Do(m_ringbuffersize); + Do(p, m_ringbuffersize); u32 hasloadStream = m_pdata != NULL; - p.Do(hasloadStream); + Do(p, hasloadStream); if (hasloadStream && p.mode == p.MODE_READ) reloadStream(); #ifdef USE_FFMPEG @@ -198,29 +199,29 @@ void MediaEngine::DoState(PointerWrap &p) { #else u32 hasopencontext = false; #endif - p.Do(hasopencontext); + Do(p, hasopencontext); if (m_pdata) m_pdata->DoState(p); if (m_demux) m_demux->DoState(p); - p.Do(m_videopts); - p.Do(m_audiopts); + Do(p, m_videopts); + Do(p, m_audiopts); if (s >= 2) { - p.Do(m_firstTimeStamp); - p.Do(m_lastTimeStamp); + Do(p, m_firstTimeStamp); + Do(p, m_lastTimeStamp); } if (hasopencontext && p.mode == p.MODE_READ) { openContext(true); } - p.Do(m_isVideoEnd); + Do(p, m_isVideoEnd); bool noAudioDataRemoved; - p.Do(noAudioDataRemoved); + Do(p, noAudioDataRemoved); if (s >= 3) { - p.Do(m_audioType); + Do(p, m_audioType); } else { m_audioType = PSP_CODEC_AT3PLUS; } diff --git a/Core/HW/MemoryStick.cpp b/Core/HW/MemoryStick.cpp index 42bc625bdb..d04f116508 100644 --- a/Core/HW/MemoryStick.cpp +++ b/Core/HW/MemoryStick.cpp @@ -1,4 +1,5 @@ #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/CoreTiming.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HW/MemoryStick.h" @@ -16,15 +17,15 @@ void MemoryStick_DoState(PointerWrap &p) { if (!s) return; - p.Do(memStickState); - p.Do(memStickFatState); + Do(p, memStickState); + Do(p, memStickFatState); if (s >= 2) - p.Do(memStickSize); + Do(p, memStickSize); else memStickSize = 1ULL * 1024 * 1024 * 1024; if (s >= 3) { - p.Do(memStickNeedsAssign); - p.Do(memStickInsertedAt); + Do(p, memStickNeedsAssign); + Do(p, memStickInsertedAt); } } diff --git a/Core/HW/MpegDemux.cpp b/Core/HW/MpegDemux.cpp index 7b51c6b68a..d65db8d4cf 100644 --- a/Core/HW/MpegDemux.cpp +++ b/Core/HW/MpegDemux.cpp @@ -1,4 +1,5 @@ -#include "MpegDemux.h" +#include "Common/ChunkFileDo.h" +#include "Core/HW/MpegDemux.h" #include "Core/Reporting.h" const int PACKET_START_CODE_MASK = 0xffffff00; @@ -37,13 +38,13 @@ void MpegDemux::DoState(PointerWrap &p) { if (!s) return; - p.Do(m_index); - p.Do(m_len); - p.Do(m_audioChannel); - p.Do(m_readSize); + Do(p, m_index); + Do(p, m_len); + Do(p, m_audioChannel); + Do(p, m_readSize); if (m_buf) - p.DoArray(m_buf, m_len); - p.DoClass(m_audioStream); + DoArray(p, m_buf, m_len); + DoClass(p, m_audioStream); } bool MpegDemux::addStreamData(const u8 *buf, int addSize) { diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index e36bdd1c1b..7cb6db52d0 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -20,6 +20,7 @@ #include "base/basictypes.h" #include "profiler/profiler.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/sceAtrac.h" #include "Core/Config.h" @@ -159,28 +160,28 @@ void VagDecoder::DoState(PointerWrap &p) { return; if (s >= 2) { - p.DoArray(samples, ARRAY_SIZE(samples)); + DoArray(p, samples, ARRAY_SIZE(samples)); } else { int samplesOld[ARRAY_SIZE(samples)]; - p.DoArray(samplesOld, ARRAY_SIZE(samples)); + DoArray(p, samplesOld, ARRAY_SIZE(samples)); for (size_t i = 0; i < ARRAY_SIZE(samples); ++i) { samples[i] = samplesOld[i]; } } - p.Do(curSample); + Do(p, curSample); - p.Do(data_); - p.Do(read_); - p.Do(curBlock_); - p.Do(loopStartBlock_); - p.Do(numBlocks_); + Do(p, data_); + Do(p, read_); + Do(p, curBlock_); + Do(p, loopStartBlock_); + Do(p, numBlocks_); - p.Do(s_1); - p.Do(s_2); + Do(p, s_1); + Do(p, s_2); - p.Do(loopEnabled_); - p.Do(loopAtNextBlock_); - p.Do(end_); + Do(p, loopEnabled_); + Do(p, loopAtNextBlock_); + Do(p, end_); } int SasAtrac3::setContext(u32 context) { @@ -226,13 +227,13 @@ void SasAtrac3::DoState(PointerWrap &p) { if (!s) return; - p.Do(contextAddr_); - p.Do(atracID_); + Do(p, contextAddr_); + Do(p, atracID_); if (p.mode == p.MODE_READ && atracID_ >= 0 && !sampleQueue_) { sampleQueue_ = new BufferQueue(); } if (s >= 2) { - p.Do(end_); + Do(p, end_); } } @@ -692,7 +693,7 @@ void SasInstance::DoState(PointerWrap &p) { if (!s) return; - p.Do(grainSize); + Do(p, grainSize); if (p.mode == p.MODE_READ) { if (grainSize > 0) { SetGrainSize(grainSize); @@ -701,32 +702,32 @@ void SasInstance::DoState(PointerWrap &p) { } } - p.Do(maxVoices); - p.Do(sampleRate); - p.Do(outputMode); + Do(p, maxVoices); + Do(p, sampleRate); + Do(p, outputMode); // SetGrainSize() / ClearGrainSize() should've made our buffers match. if (mixBuffer != NULL && grainSize > 0) { - p.DoArray(mixBuffer, grainSize * 2); + DoArray(p, mixBuffer, grainSize * 2); } if (sendBuffer != NULL && grainSize > 0) { - p.DoArray(sendBuffer, grainSize * 2); + DoArray(p, sendBuffer, grainSize * 2); } if (sendBuffer != NULL && grainSize > 0) { // Backwards compat int16_t *resampleBuf = new int16_t[grainSize * 4 + 3](); - p.DoArray(resampleBuf, grainSize * 4 + 3); + DoArray(p, resampleBuf, grainSize * 4 + 3); delete[] resampleBuf; } int n = PSP_SAS_VOICES_MAX; - p.Do(n); + Do(p, n); if (n != PSP_SAS_VOICES_MAX) { ERROR_LOG(SAVESTATE, "Wrong number of SAS voices"); return; } - p.DoArray(voices, ARRAY_SIZE(voices)); - p.Do(waveformEffect); + DoArray(p, voices, ARRAY_SIZE(voices)); + Do(p, waveformEffect); if (p.mode == p.MODE_READ) { reverb_.SetPreset(waveformEffect.type); } @@ -776,45 +777,45 @@ void SasVoice::DoState(PointerWrap &p) { if (!s) return; - p.Do(playing); - p.Do(paused); - p.Do(on); + Do(p, playing); + Do(p, paused); + Do(p, on); - p.Do(type); + Do(p, type); - p.Do(vagAddr); - p.Do(vagSize); - p.Do(pcmAddr); - p.Do(pcmSize); - p.Do(pcmIndex); + Do(p, vagAddr); + Do(p, vagSize); + Do(p, pcmAddr); + Do(p, pcmSize); + Do(p, pcmIndex); if (s >= 2) { - p.Do(pcmLoopPos); + Do(p, pcmLoopPos); } else { pcmLoopPos = 0; } - p.Do(sampleRate); + Do(p, sampleRate); - p.Do(sampleFrac); - p.Do(pitch); - p.Do(loop); + Do(p, sampleFrac); + Do(p, pitch); + Do(p, loop); if (s < 2 && type == VOICETYPE_PCM) { // We set loop incorrectly before, and always looped. // Let's keep always looping, since it's usually right. loop = true; } - p.Do(noiseFreq); + Do(p, noiseFreq); - p.Do(volumeLeft); - p.Do(volumeRight); + Do(p, volumeLeft); + Do(p, volumeRight); if (s < 3) { // There were extra variables here that were for the same purpose. - p.Do(effectLeft); - p.Do(effectRight); + Do(p, effectLeft); + Do(p, effectRight); } - p.Do(effectLeft); - p.Do(effectRight); - p.DoArray(resampleHist, ARRAY_SIZE(resampleHist)); + Do(p, effectLeft); + Do(p, effectRight); + DoArray(p, resampleHist, ARRAY_SIZE(resampleHist)); envelope.DoState(p); vag.DoState(p); @@ -948,24 +949,24 @@ void ADSREnvelope::DoState(PointerWrap &p) { return; } - p.Do(attackRate); - p.Do(decayRate); - p.Do(sustainRate); - p.Do(releaseRate); - p.Do(attackType); - p.Do(decayType); - p.Do(sustainType); - p.Do(sustainLevel); - p.Do(releaseType); + Do(p, attackRate); + Do(p, decayRate); + Do(p, sustainRate); + Do(p, releaseRate); + Do(p, attackType); + Do(p, decayType); + Do(p, sustainType); + Do(p, sustainLevel); + Do(p, releaseType); if (s < 2) { - p.Do(state_); + Do(p, state_); if (state_ == 4) { state_ = STATE_OFF; } int stepsLegacy; - p.Do(stepsLegacy); + Do(p, stepsLegacy); } else { - p.Do(state_); + Do(p, state_); } - p.Do(height_); + Do(p, height_); } diff --git a/Core/HW/SimpleAudioDec.cpp b/Core/HW/SimpleAudioDec.cpp index be35d16b20..3730b299eb 100644 --- a/Core/HW/SimpleAudioDec.cpp +++ b/Core/HW/SimpleAudioDec.cpp @@ -17,6 +17,7 @@ #include +#include "Common/ChunkFileDo.h" #include "Core/Config.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HW/SimpleAudioDec.h" @@ -500,25 +501,25 @@ void AuCtx::DoState(PointerWrap &p) { if (!s) return; - p.Do(startPos); - p.Do(endPos); - p.Do(AuBuf); - p.Do(AuBufSize); - p.Do(PCMBuf); - p.Do(PCMBufSize); - p.Do(freq); - p.Do(SumDecodedSamples); - p.Do(LoopNum); - p.Do(Channels); - p.Do(MaxOutputSample); - p.Do(readPos); - p.Do(audioType); - p.Do(BitRate); - p.Do(SamplingRate); - p.Do(askedReadSize); + Do(p, startPos); + Do(p, endPos); + Do(p, AuBuf); + Do(p, AuBufSize); + Do(p, PCMBuf); + Do(p, PCMBufSize); + Do(p, freq); + Do(p, SumDecodedSamples); + Do(p, LoopNum); + Do(p, Channels); + Do(p, MaxOutputSample); + Do(p, readPos); + Do(p, audioType); + Do(p, BitRate); + Do(p, SamplingRate); + Do(p, askedReadSize); int dummy = 0; - p.Do(dummy); - p.Do(FrameNum); + Do(p, dummy); + Do(p, FrameNum); if (p.mode == p.MODE_READ) { decoder = new SimpleAudio(audioType); diff --git a/Core/MIPS/ARM/ArmJit.cpp b/Core/MIPS/ARM/ArmJit.cpp index 5cf32aa86d..1ff3c29ee8 100644 --- a/Core/MIPS/ARM/ArmJit.cpp +++ b/Core/MIPS/ARM/ArmJit.cpp @@ -20,7 +20,8 @@ #include "base/logging.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Reporting.h" #include "Core/Config.h" @@ -129,9 +130,9 @@ void ArmJit::DoState(PointerWrap &p) if (!s) return; - p.Do(js.startDefaultPrefix); + Do(p, js.startDefaultPrefix); if (s >= 2) { - p.Do(js.hasSetRounding); + Do(p, js.hasSetRounding); js.lastSetRounding = 0; } else { js.hasSetRounding = 1; diff --git a/Core/MIPS/ARM64/Arm64Jit.cpp b/Core/MIPS/ARM64/Arm64Jit.cpp index 3c39b7bf5a..c1d2bac89f 100644 --- a/Core/MIPS/ARM64/Arm64Jit.cpp +++ b/Core/MIPS/ARM64/Arm64Jit.cpp @@ -20,7 +20,8 @@ #include "base/logging.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/CPUDetect.h" #include "Common/StringUtils.h" @@ -122,9 +123,9 @@ void Arm64Jit::DoState(PointerWrap &p) { if (!s) return; - p.Do(js.startDefaultPrefix); + Do(p, js.startDefaultPrefix); if (s >= 2) { - p.Do(js.hasSetRounding); + Do(p, js.hasSetRounding); js.lastSetRounding = 0; } else { js.hasSetRounding = 1; diff --git a/Core/MIPS/IR/IRFrontend.cpp b/Core/MIPS/IR/IRFrontend.cpp index b86ff2890e..d1ccfec8bf 100644 --- a/Core/MIPS/IR/IRFrontend.cpp +++ b/Core/MIPS/IR/IRFrontend.cpp @@ -18,6 +18,7 @@ #include "base/logging.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/SymbolMap.h" #include "Core/Reporting.h" @@ -46,9 +47,9 @@ void IRFrontend::DoState(PointerWrap &p) { if (!s) return; - p.Do(js.startDefaultPrefix); + Do(p, js.startDefaultPrefix); if (s >= 2) { - p.Do(js.hasSetRounding); + Do(p, js.hasSetRounding); js.lastSetRounding = 0; } else { js.hasSetRounding = 1; diff --git a/Core/MIPS/JitCommon/JitCommon.cpp b/Core/MIPS/JitCommon/JitCommon.cpp index 6ef4a534a7..232c099ec9 100644 --- a/Core/MIPS/JitCommon/JitCommon.cpp +++ b/Core/MIPS/JitCommon/JitCommon.cpp @@ -22,6 +22,7 @@ #include "Common/StringUtils.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Util/DisArm64.h" #include "Core/Config.h" @@ -55,10 +56,10 @@ namespace MIPSComp { return; bool dummy = false; - p.Do(dummy); + Do(p, dummy); if (s >= 2) { dummy = true; - p.Do(dummy); + Do(p, dummy); } } diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index a04e8f2387..6415d5c57e 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -22,6 +22,7 @@ #include "Common.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/ConfigValues.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSInt.h" @@ -265,35 +266,35 @@ void MIPSState::DoState(PointerWrap &p) { else MIPSComp::DoDummyJitState(p); - p.DoArray(r, sizeof(r) / sizeof(r[0])); - p.DoArray(f, sizeof(f) / sizeof(f[0])); + DoArray(p, r, sizeof(r) / sizeof(r[0])); + DoArray(p, f, sizeof(f) / sizeof(f[0])); if (s <= 2) { float vtemp[128]; - p.DoArray(vtemp, sizeof(v) / sizeof(v[0])); + DoArray(p, vtemp, sizeof(v) / sizeof(v[0])); for (int i = 0; i < 128; i++) { v[voffset[i]] = vtemp[i]; } } else { - p.DoArray(v, sizeof(v) / sizeof(v[0])); + DoArray(p, v, sizeof(v) / sizeof(v[0])); } - p.DoArray(vfpuCtrl, sizeof(vfpuCtrl) / sizeof(vfpuCtrl[0])); - p.Do(pc); - p.Do(nextPC); - p.Do(downcount); + DoArray(p, vfpuCtrl, sizeof(vfpuCtrl) / sizeof(vfpuCtrl[0])); + Do(p, pc); + Do(p, nextPC); + Do(p, downcount); // Reversed, but we can just leave it that way. - p.Do(hi); - p.Do(lo); - p.Do(fpcond); + Do(p, hi); + Do(p, lo); + Do(p, fpcond); if (s <= 1) { u32 fcr0_unused = 0; - p.Do(fcr0_unused); + Do(p, fcr0_unused); } - p.Do(fcr31); - p.Do(rng.m_w); - p.Do(rng.m_z); - p.Do(inDelaySlot); - p.Do(llBit); - p.Do(debugCount); + Do(p, fcr31); + Do(p, rng.m_w); + Do(p, rng.m_z); + Do(p, inDelaySlot); + Do(p, llBit); + Do(p, debugCount); if (p.mode == p.MODE_READ && MIPSComp::jit) { // Now that we've loaded fcr31, update any jit state associated. diff --git a/Core/MIPS/MIPS/MipsJit.cpp b/Core/MIPS/MIPS/MipsJit.cpp index bf3b88ee20..e7419bf305 100644 --- a/Core/MIPS/MIPS/MipsJit.cpp +++ b/Core/MIPS/MIPS/MipsJit.cpp @@ -57,9 +57,9 @@ void MipsJit::DoState(PointerWrap &p) if (!s) return; - p.Do(js.startDefaultPrefix); + Do(p, js.startDefaultPrefix); if (s >= 2) { - p.Do(js.hasSetRounding); + Do(p, js.hasSetRounding); js.lastSetRounding = 0; } else { js.hasSetRounding = 1; diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index a062c6fc51..f68993d3d8 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -25,6 +25,7 @@ #include "profiler/profiler.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/Core.h" #include "Core/MemMap.h" #include "Core/System.h" @@ -129,9 +130,9 @@ void Jit::DoState(PointerWrap &p) { if (!s) return; - p.Do(js.startDefaultPrefix); + Do(p, js.startDefaultPrefix); if (s >= 2) { - p.Do(js.hasSetRounding); + Do(p, js.hasSetRounding); js.lastSetRounding = 0; } else { js.hasSetRounding = 1; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 334bb66491..d4d6bc9ed9 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -28,6 +28,7 @@ #include "Common/MemoryUtil.h" #include "Common/MemArena.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/MemMap.h" #include "Core/MemFault.h" @@ -326,7 +327,7 @@ void DoState(PointerWrap &p) { } else if (s == 2) { // In version 2, we determine memory size based on PSP model. u32 oldMemorySize = g_MemorySize; - p.Do(g_PSPModel); + Do(p, g_PSPModel); p.DoMarker("PSPModel"); if (!g_RemasterMode) { g_MemorySize = g_PSPModel == PSP_MODEL_FAT ? RAM_NORMAL_SIZE : RAM_DOUBLE_SIZE; @@ -338,20 +339,20 @@ void DoState(PointerWrap &p) { // In version 3, we started just saving the memory size directly. // It's no longer based strictly on the PSP model. u32 oldMemorySize = g_MemorySize; - p.Do(g_PSPModel); + Do(p, g_PSPModel); p.DoMarker("PSPModel"); - p.Do(g_MemorySize); + Do(p, g_MemorySize); if (oldMemorySize != g_MemorySize) { Reinit(); } } - p.DoArray(GetPointer(PSP_GetKernelMemoryBase()), g_MemorySize); + DoArray(p, GetPointer(PSP_GetKernelMemoryBase()), g_MemorySize); p.DoMarker("RAM"); - p.DoArray(m_pPhysicalVRAM1, VRAM_SIZE); + DoArray(p, m_pPhysicalVRAM1, VRAM_SIZE); p.DoMarker("VRAM"); - p.DoArray(m_pPhysicalScratchPad, SCRATCHPAD_SIZE); + DoArray(p, m_pPhysicalScratchPad, SCRATCHPAD_SIZE); p.DoMarker("ScratchPad"); } diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 388086ad76..ea680cb957 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -22,6 +22,7 @@ #include "Core/Reporting.h" +#include "Common/ChunkFileDo.h" #include "Common/CPUDetect.h" #include "Core/Core.h" #include "Core/CoreTiming.h" @@ -335,7 +336,7 @@ namespace Reporting return; } - p.Do(everUnsupported); + Do(p, everUnsupported); } void UpdateConfig() diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 4b6b944136..46d661b2ce 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -27,6 +27,7 @@ #include "Common/FileUtil.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/SaveState.h" #include "Core/Config.h" @@ -274,11 +275,11 @@ namespace SaveState if (s >= 2) { // This only increments on save, of course. ++saveStateGeneration; - p.Do(saveStateGeneration); + Do(p, saveStateGeneration); // This saves the first git version to create this save state (or generation of save states.) if (saveStateInitialGitVersion.empty()) saveStateInitialGitVersion = PPSSPP_GIT_VERSION; - p.Do(saveStateInitialGitVersion); + Do(p, saveStateInitialGitVersion); } else { saveStateGeneration = 1; } diff --git a/Core/Util/BlockAllocator.cpp b/Core/Util/BlockAllocator.cpp index 1b67b82a9a..10d3d7e627 100644 --- a/Core/Util/BlockAllocator.cpp +++ b/Core/Util/BlockAllocator.cpp @@ -19,6 +19,7 @@ #include "Common/Log.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Common/StringUtils.h" #include "Core/Util/BlockAllocator.h" #include "Core/Reporting.h" @@ -442,7 +443,7 @@ void BlockAllocator::DoState(PointerWrap &p) if (p.mode == p.MODE_READ) { Shutdown(); - p.Do(count); + Do(p, count); bottom_ = new Block(0, 0, false, NULL, NULL); bottom_->DoState(p); @@ -460,7 +461,7 @@ void BlockAllocator::DoState(PointerWrap &p) { for (const Block *bp = bottom_; bp != NULL; bp = bp->next) ++count; - p.Do(count); + Do(p, count); bottom_->DoState(p); --count; @@ -473,9 +474,9 @@ void BlockAllocator::DoState(PointerWrap &p) } } - p.Do(rangeStart_); - p.Do(rangeSize_); - p.Do(grain_); + Do(p, rangeStart_); + Do(p, rangeSize_); + Do(p, grain_); } BlockAllocator::Block::Block(u32 _start, u32 _size, bool _taken, Block *_prev, Block *_next) @@ -498,13 +499,13 @@ void BlockAllocator::Block::DoState(PointerWrap &p) if (!s) return; - p.Do(start); - p.Do(size); - p.Do(taken); + Do(p, start); + Do(p, size); + Do(p, taken); // Since we use truncate_cpy, the empty space is not zeroed. Zero it now. // This avoids saving uninitialized memory. size_t tagLen = strlen(tag); if (tagLen != sizeof(tag)) memset(tag + tagLen, 0, sizeof(tag) - tagLen); - p.DoArray(tag, sizeof(tag)); + DoArray(p, tag, sizeof(tag)); } diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index b679581a0e..9b5cb865f4 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -27,6 +27,7 @@ #include "util/text/utf8.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/HDRemaster.h" #include "Core/Host.h" #include "GPU/ge_constants.h" @@ -282,23 +283,23 @@ void __PPGeDoState(PointerWrap &p) if (!s) return; - p.Do(atlasPtr); - p.Do(atlasWidth); - p.Do(atlasHeight); - p.Do(palette); + Do(p, atlasPtr); + Do(p, atlasWidth); + Do(p, atlasHeight); + Do(p, palette); - p.Do(savedContextPtr); - p.Do(savedContextSize); + Do(p, savedContextPtr); + Do(p, savedContextSize); if (s == 1) { listArgs = 0; } else { - p.Do(listArgs); + Do(p, listArgs); } if (s >= 3) { uint32_t sz = (uint32_t)textDrawerImages.size(); - p.Do(sz); + Do(p, sz); switch (p.mode) { case PointerWrap::MODE_READ: @@ -307,12 +308,12 @@ void __PPGeDoState(PointerWrap &p) // We only care about the pointers, so we can free them. We'll decimate right away. PPGeTextDrawerCacheKey key{ StringFromFormat("__savestate__%d", i), -1, -1 }; textDrawerImages[key] = PPGeTextDrawerImage{}; - p.Do(textDrawerImages[key].ptr); + Do(p, textDrawerImages[key].ptr); } break; default: for (const auto &im : textDrawerImages) { - p.Do(im.second.ptr); + Do(p, im.second.ptr); } break; } @@ -320,19 +321,19 @@ void __PPGeDoState(PointerWrap &p) textDrawerImages.clear(); } - p.Do(dlPtr); - p.Do(dlWritePtr); - p.Do(dlSize); + Do(p, dlPtr); + Do(p, dlWritePtr); + Do(p, dlSize); - p.Do(dataPtr); - p.Do(dataWritePtr); - p.Do(dataSize); + Do(p, dataPtr); + Do(p, dataWritePtr); + Do(p, dataSize); - p.Do(vertexStart); - p.Do(vertexCount); + Do(p, vertexStart); + Do(p, vertexCount); - p.Do(char_lines); - p.Do(char_lines_metrics); + Do(p, char_lines); + Do(p, char_lines_metrics); } void __PPGeShutdown() @@ -1245,13 +1246,13 @@ void PPGeImage::DoState(PointerWrap &p) { if (!s) return; - p.Do(filename_); - p.Do(png_); - p.Do(size_); - p.Do(texture_); - p.Do(width_); - p.Do(height_); - p.Do(lastFrame_); + Do(p, filename_); + Do(p, png_); + Do(p, size_); + Do(p, texture_); + Do(p, width_); + Do(p, height_); + Do(p, lastFrame_); } void PPGeImage::CompatLoad(u32 texture, int width, int height) { diff --git a/GPU/Common/PostShader.h b/GPU/Common/PostShader.h index 4f01d728f9..6febf0ee2d 100644 --- a/GPU/Common/PostShader.h +++ b/GPU/Common/PostShader.h @@ -54,7 +54,7 @@ struct ShaderInfo { Setting settings[4]; // TODO: Add support for all kinds of fun options like mapping the depth buffer, - // SRGB texture reads, etc. + // SRGB texture reads, etc. prev shader? bool operator == (const std::string &other) { return name == other; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 73278fb103..c5f75b5255 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -5,6 +5,7 @@ #include "base/timeutil.h" #include "profiler/profiler.h" +#include "Common/ChunkFileDo.h" #include "Common/ColorConv.h" #include "Common/GraphicsContext.h" #include "Core/Reporting.h" @@ -2409,9 +2410,9 @@ void GPUCommon::DoState(PointerWrap &p) { if (!s) return; - p.Do(dlQueue); + Do(p, dlQueue); if (s >= 4) { - p.DoArray(dls, ARRAY_SIZE(dls)); + DoArray(p, dls, ARRAY_SIZE(dls)); } else if (s >= 3) { // This may have been saved with or without padding, depending on platform. // We need to upconvert it to our consistently-padded struct. @@ -2429,7 +2430,7 @@ void GPUCommon::DoState(PointerWrap &p) { const bool hasPadding = savedPtr32[1] == 1; if (hasPadding) { u32 padding; - p.Do(padding); + Do(p, padding); } for (size_t i = 1; i < ARRAY_SIZE(dls); ++i) { @@ -2437,13 +2438,13 @@ void GPUCommon::DoState(PointerWrap &p) { dls[i].padding = 0; if (hasPadding) { u32 padding; - p.Do(padding); + Do(p, padding); } } } else if (s >= 2) { for (size_t i = 0; i < ARRAY_SIZE(dls); ++i) { DisplayList_v2 oldDL; - p.Do(oldDL); + Do(p, oldDL); // Copy over everything except the last, new member (stackAddr.) memcpy(&dls[i], &oldDL, sizeof(DisplayList_v2)); dls[i].stackAddr = 0; @@ -2452,7 +2453,7 @@ void GPUCommon::DoState(PointerWrap &p) { // Can only be in read mode here. for (size_t i = 0; i < ARRAY_SIZE(dls); ++i) { DisplayList_v1 oldDL; - p.Do(oldDL); + Do(p, oldDL); // On 32-bit, they're the same, on 64-bit oldDL is bigger. memcpy(&dls[i], &oldDL, sizeof(DisplayList_v1)); // Fix the other fields. Let's hope context wasn't important, it was a pointer. @@ -2466,17 +2467,17 @@ void GPUCommon::DoState(PointerWrap &p) { if (currentList != nullptr) { currentID = (int)(currentList - &dls[0]); } - p.Do(currentID); + Do(p, currentID); if (currentID == 0) { currentList = nullptr; } else { currentList = &dls[currentID]; } - p.Do(interruptRunning); - p.Do(gpuState); - p.Do(isbreak); - p.Do(drawCompleteTicks); - p.Do(busyTicks); + Do(p, interruptRunning); + Do(p, gpuState); + Do(p, isbreak); + Do(p, drawCompleteTicks); + Do(p, busyTicks); } void GPUCommon::InterruptStart(int listid) { diff --git a/GPU/GPUState.cpp b/GPU/GPUState.cpp index 44c9419cb9..c64e57d49f 100644 --- a/GPU/GPUState.cpp +++ b/GPU/GPUState.cpp @@ -19,6 +19,7 @@ #include "GPU/GPUState.h" #include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" #include "Core/CoreParameter.h" #include "Core/Config.h" #include "Core/System.h" @@ -277,7 +278,7 @@ void GPUStateCache::DoState(PointerWrap &p) { if (!s) { // Old state, this was not versioned. GPUStateCache_v0 old; - p.Do(old); + Do(p, old); vertexAddr = old.vertexAddr; indexAddr = old.indexAddr; @@ -290,67 +291,67 @@ void GPUStateCache::DoState(PointerWrap &p) { savedContextVersion = 0; } else { - p.Do(vertexAddr); - p.Do(indexAddr); - p.Do(offsetAddr); + Do(p, vertexAddr); + Do(p, indexAddr); + Do(p, offsetAddr); uint8_t textureChanged = 0; - p.Do(textureChanged); // legacy + Do(p, textureChanged); // legacy gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS); - p.Do(textureFullAlpha); - p.Do(vertexFullAlpha); + Do(p, textureFullAlpha); + Do(p, vertexFullAlpha); bool framebufChanged = false; // legacy - p.Do(framebufChanged); + Do(p, framebufChanged); - p.Do(skipDrawReason); + Do(p, skipDrawReason); - p.Do(uv); + Do(p, uv); bool oldFlipTexture = false; - p.Do(oldFlipTexture); // legacy + Do(p, oldFlipTexture); // legacy } // needShaderTexClamp and bgraTexture don't need to be saved. if (s >= 3) { bool oldTextureSimpleAlpha = false; - p.Do(oldTextureSimpleAlpha); + Do(p, oldTextureSimpleAlpha); } if (s < 2) { float l12[12]; float l4[4]; - p.Do(l12); // lightpos - p.Do(l12); // lightdir - p.Do(l12); // lightattr - p.Do(l12); // lightcol0 - p.Do(l12); // lightcol1 - p.Do(l12); // lightcol2 - p.Do(l4); // lightangle - p.Do(l4); // lightspot + Do(p, l12); // lightpos + Do(p, l12); // lightdir + Do(p, l12); // lightattr + Do(p, l12); // lightcol0 + Do(p, l12); // lightcol1 + Do(p, l12); // lightcol2 + Do(p, l4); // lightangle + Do(p, l4); // lightspot } - p.Do(morphWeights); + Do(p, morphWeights); - p.Do(curTextureWidth); - p.Do(curTextureHeight); - p.Do(actualTextureHeight); + Do(p, curTextureWidth); + Do(p, curTextureHeight); + Do(p, actualTextureHeight); // curTextureXOffset and curTextureYOffset don't need to be saved. Well, the above don't either... - p.Do(vpWidth); - p.Do(vpHeight); + Do(p, vpWidth); + Do(p, vpHeight); if (s == 4) { float oldDepth = 1.0f; - p.Do(oldDepth); + Do(p, oldDepth); } - p.Do(curRTWidth); - p.Do(curRTHeight); + Do(p, curRTWidth); + Do(p, curRTHeight); // curRTBufferWidth, curRTBufferHeight, and cutRTOffsetX don't need to be saved. if (s < 5) { savedContextVersion = 0; } else { - p.Do(savedContextVersion); + Do(p, savedContextVersion); } } diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index 4f9545c490..31f2327547 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -727,6 +727,7 @@ + diff --git a/UWP/CoreUWP/CoreUWP.vcxproj.filters b/UWP/CoreUWP/CoreUWP.vcxproj.filters index 781833645f..6538bd1df1 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj.filters +++ b/UWP/CoreUWP/CoreUWP.vcxproj.filters @@ -708,6 +708,9 @@ MIPS\ARM64 + + HW + HW diff --git a/android/jni/Android.mk b/android/jni/Android.mk index ac68cf1815..9b2d62b92a 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -279,6 +279,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/ELF/ParamSFO.cpp \ $(SRC)/Core/HW/SimpleAudioDec.cpp \ $(SRC)/Core/HW/AsyncIOManager.cpp \ + $(SRC)/Core/HW/BufferQueue.cpp \ $(SRC)/Core/HW/Camera.cpp \ $(SRC)/Core/HW/MemoryStick.cpp \ $(SRC)/Core/HW/MpegDemux.cpp.arm \ diff --git a/libretro/Makefile.common b/libretro/Makefile.common index ff7b524875..cf38aae92b 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -438,6 +438,7 @@ SOURCES_CXX += $(NATIVEDIR)/math/dataconv.cpp \ $(COREDIR)/HLE/sceNp.cpp \ $(COREDIR)/HLE/scePauth.cpp \ $(COREDIR)/HLE/sceUsbGps.cpp \ + $(COREDIR)/HW/BufferQueue.cpp \ $(COREDIR)/HW/Camera.cpp \ $(COREDIR)/HW/SimpleAudioDec.cpp \ $(COREDIR)/HW/AsyncIOManager.cpp \ From 1af3009e80e115e496cfa6da50eada1f5abe3ca1 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 02:19:02 +0000 Subject: [PATCH 02/12] HLE: Fix some missing error logging. --- Core/HLE/sceMt19937.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/HLE/sceMt19937.cpp b/Core/HLE/sceMt19937.cpp index ba7aa28166..cc56df502b 100644 --- a/Core/HLE/sceMt19937.cpp +++ b/Core/HLE/sceMt19937.cpp @@ -28,22 +28,21 @@ static u32 sceMt19937Init(u32 mt19937Addr, u32 seed) { - INFO_LOG(HLE, "sceMt19937Init(%08x, %08x)", mt19937Addr, seed); if (!Memory::IsValidAddress(mt19937Addr)) - return -1; + return hleLogError(HLE, -1); void *ptr = Memory::GetPointer(mt19937Addr); // This is made to match the memory layout of a PSP MT structure exactly. // Let's just construct it in place with placement new. Elite C++ hackery FTW. new (ptr) MersenneTwister(seed); - return 0; + return hleLogSuccessInfoI(HLE, 0); } static u32 sceMt19937UInt(u32 mt19937Addr) { if (!Memory::IsValidAddress(mt19937Addr)) - return -1; + return hleLogError(HLE, -1); MersenneTwister *mt = (MersenneTwister *)Memory::GetPointer(mt19937Addr); - return mt->R32(); + return hleLogSuccessVerboseX(HLE, mt->R32()); } const HLEFunction sceMt19937[] = From 667a8522ccad57f7ef7ae3d860f3f73663044c2e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 02:20:07 +0000 Subject: [PATCH 03/12] Global: Cut down on file/string includes. --- Common/ConsoleListener.cpp | 1 + Common/FileUtil.cpp | 1 + Common/FileUtil.h | 10 ---------- Common/LogManager.h | 4 ++-- Common/StringUtils.cpp | 1 + Core/Compatibility.cpp | 1 + Core/Util/DisArm64.cpp | 3 ++- Core/Util/PortManager.cpp | 15 ++++++++------- ext/native/base/stringutil.h | 24 ------------------------ ext/native/file/path.cpp | 1 + ext/native/i18n/i18n.h | 1 - 11 files changed, 17 insertions(+), 45 deletions(-) diff --git a/Common/ConsoleListener.cpp b/Common/ConsoleListener.cpp index 39b1073ad3..5b7217827a 100644 --- a/Common/ConsoleListener.cpp +++ b/Common/ConsoleListener.cpp @@ -17,6 +17,7 @@ #include #include // min +#include #include // System: To be able to add strings with "+" #include #ifdef _WIN32 diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index d1ad8a5b72..d18ccecad4 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -24,6 +24,7 @@ #include "ppsspp_config.h" +#include #include #include "FileUtil.h" #include "StringUtils.h" diff --git a/Common/FileUtil.h b/Common/FileUtil.h index e088ceda4c..f9f86433a7 100644 --- a/Common/FileUtil.h +++ b/Common/FileUtil.h @@ -35,16 +35,6 @@ inline struct tm* localtime_r(const time_t *clock, struct tm *result) { namespace File { -// FileSystem tree node/ -struct FSTEntry -{ - bool isDirectory; - u64 size; // file length or number of entries from children - std::string physicalName; // name on disk - std::string virtualName; // name in FST names table - std::vector children; -}; - struct FileDetails { bool isDirectory; u64 size; diff --git a/Common/LogManager.h b/Common/LogManager.h index 1e8e39547d..e05711a19c 100644 --- a/Common/LogManager.h +++ b/Common/LogManager.h @@ -19,13 +19,13 @@ #include "ppsspp_config.h" -#include +#include #include +#include #include "file/ini_file.h" #include "Log.h" #include "StringUtils.h" -#include "FileUtil.h" #define MAX_MESSAGES 8000 diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index c1289720b0..0bd5da6962 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include #include "Common.h" #include "StringUtils.h" diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 1d8c9d513a..547ebb5925 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "file/ini_file.h" #include "Core/Compatibility.h" #include "Core/System.h" diff --git a/Core/Util/DisArm64.cpp b/Core/Util/DisArm64.cpp index e6c983be55..651ffe35c9 100644 --- a/Core/Util/DisArm64.cpp +++ b/Core/Util/DisArm64.cpp @@ -21,7 +21,8 @@ // Does enough to understand what's going on without having to resort to an // external disassembler all the time... -#include +#include +#include #include "Common/Arm64Emitter.h" #include "Common/StringUtils.h" diff --git a/Core/Util/PortManager.cpp b/Core/Util/PortManager.cpp index d91e4fb428..f1ed937836 100644 --- a/Core/Util/PortManager.cpp +++ b/Core/Util/PortManager.cpp @@ -25,18 +25,19 @@ // All credit goes to him and the official miniupnp project! http://miniupnp.free.fr/ -#include #include -#include -#include -#include -#include "Core/Util/PortManager.h" -#include +#include +#include #include +#include "base/timeutil.h" #include "i18n/i18n.h" #include "net/resolve.h" #include "thread/threadutil.h" -#include "base/timeutil.h" +#include "Common/Log.h" +#include "Core/System.h" +#include "Core/Host.h" +#include "Core/ELF/ParamSFO.h" +#include "Core/Util/PortManager.h" PortManager g_PortManager; diff --git a/ext/native/base/stringutil.h b/ext/native/base/stringutil.h index 6a06a739db..c16602946f 100644 --- a/ext/native/base/stringutil.h +++ b/ext/native/base/stringutil.h @@ -1,11 +1,7 @@ #pragma once -#include -#include -#include #include #include -#include #include #include "base/basictypes.h" @@ -67,26 +63,6 @@ inline void StringToHexString(const std::string &data, std::string *output) { // highly unsafe and not recommended. unsigned int parseHex(const char* _szValue); - -// Suitable for inserting into maps, unlike char*, and cheaper than std::string. -// Strings must be constant and preferably be stored in the read-only part -// of the binary. -class ConstString { -public: - ConstString(const char *ptr) { - ptr_ = ptr; - } - bool operator <(const ConstString &other) const { - return strcmp(ptr_, other.ptr_) < 0; - } - bool operator ==(const ConstString &other) const { - return ptr_ == other.ptr_ || !strcmp(ptr_, other.ptr_); - } - const char *get() const { return ptr_; } -private: - const char *ptr_; -}; - std::string StringFromFormat(const char* format, ...); std::string StringFromInt(int value); std::string StringFromBool(bool value); diff --git a/ext/native/file/path.cpp b/ext/native/file/path.cpp index ec62c179b5..6aa562dbbc 100644 --- a/ext/native/file/path.cpp +++ b/ext/native/file/path.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "base/stringutil.h" #include "base/timeutil.h" diff --git a/ext/native/i18n/i18n.h b/ext/native/i18n/i18n.h index bc4e3ca4bf..75d8ddd776 100644 --- a/ext/native/i18n/i18n.h +++ b/ext/native/i18n/i18n.h @@ -14,7 +14,6 @@ #include #include -#include "base/stringutil.h" #include "file/ini_file.h" // Reasonably thread safe. From 481181714b3412af2994509b70555cb968385f0c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 02:20:28 +0000 Subject: [PATCH 04/12] Audiocodec: Silence a known warning. --- Core/HLE/sceAudiocodec.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index 509d35c50f..2e29668cdd 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -183,6 +183,10 @@ void __sceAudiocodecDoState(PointerWrap &p){ auto ctxPtr_ = new u32[count]; // These sizeof(pointers) are wrong, but kept to avoid breaking on old saves. // They're not used in new savestates. +#ifdef __clang__ +#pragma diagnostic push +#pragma clang diagnostic ignored "-Wsizeof-pointer-div" +#endif DoArray(p, codec_, s >= 2 ? count : (int)ARRAY_SIZE(codec_)); DoArray(p, ctxPtr_, s >= 2 ? count : (int)ARRAY_SIZE(ctxPtr_)); for (int i = 0; i < count; i++) { @@ -190,6 +194,9 @@ void __sceAudiocodecDoState(PointerWrap &p){ decoder->SetCtxPtr(ctxPtr_[i]); audioList[ctxPtr_[i]] = decoder; } +#ifdef __clang__ +#pragma diagnostic pop +#endif delete[] codec_; delete[] ctxPtr_; } From 1bcafafdbb52e62ab93f81eb7c0488456564c94a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 02:20:47 +0000 Subject: [PATCH 05/12] UI: Fix an override warning. --- ext/native/ui/view.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/native/ui/view.h b/ext/native/ui/view.h index 335ce822e8..e8baa55702 100644 --- a/ext/native/ui/view.h +++ b/ext/native/ui/view.h @@ -648,7 +648,7 @@ public: Choice(ImageID image, LayoutParams *layoutParams = nullptr) : ClickableItem(layoutParams), atlasImage_(image), iconImage_(ImageID::invalid()), centered_(false), highlighted_(false), selected_(false) {} - virtual void Click(); + void Click() override; virtual void HighlightChanged(bool highlighted); void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override; void Draw(UIContext &dc) override; From 34f6d085a5b7ece43f75415f3d2930df7793ac6e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 02:40:30 +0000 Subject: [PATCH 06/12] Global: Remove unnecessary includes. --- Common/LogManager.h | 3 +-- UI/GPUDriverTestScreen.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Common/LogManager.h b/Common/LogManager.h index e05711a19c..81a23d518d 100644 --- a/Common/LogManager.h +++ b/Common/LogManager.h @@ -24,8 +24,7 @@ #include #include "file/ini_file.h" -#include "Log.h" -#include "StringUtils.h" +#include "Common/Log.h" #define MAX_MESSAGES 8000 diff --git a/UI/GPUDriverTestScreen.h b/UI/GPUDriverTestScreen.h index bf5c56a02c..a241e81bae 100644 --- a/UI/GPUDriverTestScreen.h +++ b/UI/GPUDriverTestScreen.h @@ -1,7 +1,5 @@ #pragma once -#include - #include "base/display.h" #include "ui/ui_context.h" #include "ui/view.h" From 2da977bed25297a01c6589fd640fd65def3eb60b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 04:22:28 +0000 Subject: [PATCH 07/12] SaveState: Add header to other makefiles. --- CMakeLists.txt | 1 + UWP/CommonUWP/CommonUWP.vcxproj | 1 + UWP/CommonUWP/CommonUWP.vcxproj.filters | 1 + 3 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d616ca6ebf..09ca275110 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -418,6 +418,7 @@ add_library(Common STATIC Common/ColorConv.h Common/ChunkFile.cpp Common/ChunkFile.h + Common/ChunkFileDo.h Common/ConsoleListener.cpp Common/ConsoleListener.h Common/Crypto/md5.cpp diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index 88559e8c82..747a2a83f0 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -385,6 +385,7 @@ + diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index 100c103e66..ec50d08b2a 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -56,6 +56,7 @@ + From 4c46867230c548730550d6d52378cc7c267d577c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 9 Aug 2020 22:03:49 -0700 Subject: [PATCH 08/12] Audio: Avoid exposing fixed size queue in header. --- Core/HLE/__sceAudio.cpp | 38 ++++++++++++++++++++++++-------------- Core/HLE/sceAudio.cpp | 17 ++++++++++------- Core/HLE/sceAudio.h | 12 ++---------- UI/BackgroundAudio.cpp | 3 ++- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index c938c09929..d8472edc47 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -52,6 +52,10 @@ StereoResampler resampler; // atomic locks are used on the lock. TODO: make this lock-free std::atomic_flag atomicLock_; +// We copy samples as they are written into this simple ring buffer. +// Might try something more efficient later. +FixedSizeQueue chanSampleQueues[PSP_AUDIO_CHANNEL_MAX + 1]; + int eventAudioUpdate = -1; int eventHostAudioUpdate = -1; int mixFrequency = 44100; @@ -115,8 +119,10 @@ void __AudioInit() { CoreTiming::ScheduleEvent(audioIntervalCycles, eventAudioUpdate, 0); CoreTiming::ScheduleEvent(audioHostIntervalCycles, eventHostAudioUpdate, 0); - for (u32 i = 0; i < PSP_AUDIO_CHANNEL_MAX + 1; i++) + for (u32 i = 0; i < PSP_AUDIO_CHANNEL_MAX + 1; i++) { + chans[i].index = i; chans[i].clear(); + } mixBuffer = new s32[hwBlockSize * 2]; clampedMixBuffer = new s16[hwBlockSize * 2]; @@ -164,8 +170,10 @@ void __AudioDoState(PointerWrap &p) { p.SetError(p.ERROR_FAILURE); return; } - for (int i = 0; i < chanCount; ++i) + for (int i = 0; i < chanCount; ++i) { + chans[i].index = i; chans[i].DoState(p); + } __AudioCPUMHzChange(); } @@ -175,8 +183,10 @@ void __AudioShutdown() { delete [] clampedMixBuffer; mixBuffer = 0; - for (u32 i = 0; i < PSP_AUDIO_CHANNEL_MAX + 1; i++) + for (u32 i = 0; i < PSP_AUDIO_CHANNEL_MAX + 1; i++) { + chans[i].index = i; chans[i].clear(); + } #ifndef MOBILE_DEVICE if (g_Config.bDumpAudio) { @@ -196,11 +206,11 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) { } // If there's anything on the queue at all, it should be busy, but we try to be a bit lax. - //if (chan.sampleQueue.size() > chan.sampleCount * 2 * chanQueueMaxSizeFactor || chan.sampleAddress == 0) { - if (chan.sampleQueue.size() > 0) { + //if (chanSampleQueues[chanNum].size() > chan.sampleCount * 2 * chanQueueMaxSizeFactor || chan.sampleAddress == 0) { + if (chanSampleQueues[chanNum].size() > 0) { if (blocking) { // TODO: Regular multichannel audio seems to block for 64 samples less? Or enqueue the first 64 sync? - int blockSamples = (int)chan.sampleQueue.size() / 2 / chanQueueMinSizeFactor; + int blockSamples = (int)chanSampleQueues[chanNum].size() / 2 / chanQueueMinSizeFactor; if (__KernelIsDispatchEnabled()) { AudioChannelWaitInfo waitInfo = {__KernelGetCurThread(), blockSamples}; @@ -235,7 +245,7 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) { const u32 totalSamples = chan.sampleCount * (chan.format == PSP_AUDIO_FORMAT_STEREO ? 2 : 1); s16 *buf1 = 0, *buf2 = 0; size_t sz1, sz2; - chan.sampleQueue.pushPointers(totalSamples, &buf1, &sz1, &buf2, &sz2); + chanSampleQueues[chanNum].pushPointers(totalSamples, &buf1, &sz1, &buf2, &sz2); if (Memory::IsValidAddress(chan.sampleAddress + (totalSamples - 1) * sizeof(s16_le))) { Memory::Memcpy(buf1, chan.sampleAddress, (u32)sz1 * sizeof(s16)); @@ -257,7 +267,7 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) { if (Memory::IsValidAddress(chan.sampleAddress + (totalSamples - 1) * sizeof(s16_le))) { s16 *buf1 = 0, *buf2 = 0; size_t sz1, sz2; - chan.sampleQueue.pushPointers(totalSamples, &buf1, &sz1, &buf2, &sz2); + chanSampleQueues[chanNum].pushPointers(totalSamples, &buf1, &sz1, &buf2, &sz2); AdjustVolumeBlock(buf1, sampleData, sz1, leftVol, rightVol); if (buf2) { AdjustVolumeBlock(buf2, sampleData + sz1, sz2, leftVol, rightVol); @@ -267,8 +277,8 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) { // Rare, so unoptimized. Expands to stereo. for (u32 i = 0; i < chan.sampleCount; i++) { s16 sample = (s16)Memory::Read_U16(chan.sampleAddress + 2 * i); - chan.sampleQueue.push(ApplySampleVolume(sample, leftVol)); - chan.sampleQueue.push(ApplySampleVolume(sample, rightVol)); + chanSampleQueues[chanNum].push(ApplySampleVolume(sample, leftVol)); + chanSampleQueues[chanNum].push(ApplySampleVolume(sample, rightVol)); } } } @@ -335,20 +345,20 @@ void __AudioUpdate(bool resetRecording) { __AudioWakeThreads(chans[i], 0, hwBlockSize); - if (!chans[i].sampleQueue.size()) { + if (!chanSampleQueues[i].size()) { continue; } bool needsResample = i == PSP_AUDIO_CHANNEL_SRC && srcFrequency != 0 && srcFrequency != mixFrequency; size_t sz = needsResample ? (hwBlockSize * 2 * srcFrequency) / mixFrequency : hwBlockSize * 2; - if (sz > chans[i].sampleQueue.size()) { - ERROR_LOG(SCEAUDIO, "Channel %i buffer underrun at %i of %i", i, (int)chans[i].sampleQueue.size() / 2, (int)sz / 2); + if (sz > chanSampleQueues[i].size()) { + ERROR_LOG(SCEAUDIO, "Channel %i buffer underrun at %i of %i", i, (int)chanSampleQueues[i].size() / 2, (int)sz / 2); } const s16 *buf1 = 0, *buf2 = 0; size_t sz1, sz2; - chans[i].sampleQueue.popPointers(sz, &buf1, &sz1, &buf2, &sz2); + chanSampleQueues[i].popPointers(sz, &buf1, &sz1, &buf2, &sz2); if (needsResample) { auto read = [&](size_t i) { diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index ba7ca82b62..c5d2d54a0a 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -17,6 +17,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/FixedSizeQueue.h" #include "Core/MIPS/MIPS.h" #include "Core/Host.h" #include "Core/CoreTiming.h" @@ -35,6 +36,8 @@ const int AUDIO_ROUTING_SPEAKER_ON = 1; int defaultRoutingMode = AUDIO_ROUTING_SPEAKER_ON; int defaultRoutingVolMode = AUDIO_ROUTING_SPEAKER_ON; +extern FixedSizeQueue chanSampleQueues[PSP_AUDIO_CHANNEL_MAX + 1]; + void AudioChannel::DoState(PointerWrap &p) { auto s = p.Section("AudioChannel", 1, 2); @@ -52,7 +55,7 @@ void AudioChannel::DoState(PointerWrap &p) Do(p, defaultRoutingMode); Do(p, defaultRoutingVolMode); } - sampleQueue.DoState(p); + chanSampleQueues[index].DoState(p); } void AudioChannel::reset() @@ -69,7 +72,7 @@ void AudioChannel::clear() format = 0; sampleAddress = 0; sampleCount = 0; - sampleQueue.clear(); + chanSampleQueues[index].clear(); waitingThreads.clear(); } @@ -183,7 +186,7 @@ static int sceAudioGetChannelRestLen(u32 chan) { ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLen(%08x) - bad channel", chan); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } - int remainingSamples = (int)chans[chan].sampleQueue.size() / 2; + int remainingSamples = (int)chanSampleQueues[chan].size() / 2; VERBOSE_LOG(SCEAUDIO, "%d=sceAudioGetChannelRestLen(%08x)", remainingSamples, chan); return remainingSamples; } @@ -193,7 +196,7 @@ static int sceAudioGetChannelRestLength(u32 chan) { ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLength(%08x) - bad channel", chan); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } - int remainingSamples = (int)chans[chan].sampleQueue.size() / 2; + int remainingSamples = (int)chanSampleQueues[chan].size() / 2; VERBOSE_LOG(SCEAUDIO, "%d=sceAudioGetChannelRestLength(%08x)", remainingSamples, chan); return remainingSamples; } @@ -371,7 +374,7 @@ static u32 sceAudioOutput2GetRestSample() { if (!chan.reserved) { return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); } - u32 size = (u32)chan.sampleQueue.size() / 2; + u32 size = (u32)chanSampleQueues[PSP_AUDIO_CHANNEL_OUTPUT2].size() / 2; if (size > chan.sampleCount) { // If ChangeLength reduces the size, it still gets output but this return is clamped. size = chan.sampleCount; @@ -383,7 +386,7 @@ static u32 sceAudioOutput2Release() { auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2]; if (!chan.reserved) return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); - if (!chan.sampleQueue.empty()) + if (!chanSampleQueues[PSP_AUDIO_CHANNEL_OUTPUT2].empty()) return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy"); chan.reset(); @@ -444,7 +447,7 @@ static u32 sceAudioSRCChRelease() { auto &chan = chans[PSP_AUDIO_CHANNEL_SRC]; if (!chan.reserved) return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); - if (!chan.sampleQueue.empty()) + if (!chanSampleQueues[PSP_AUDIO_CHANNEL_SRC].empty()) return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy"); chan.reset(); diff --git a/Core/HLE/sceAudio.h b/Core/HLE/sceAudio.h index bf8af1e62b..2c21192710 100644 --- a/Core/HLE/sceAudio.h +++ b/Core/HLE/sceAudio.h @@ -21,7 +21,6 @@ #include "CommonTypes.h" #include "sceKernel.h" -#include "FixedSizeQueue.h" class PointerWrap; @@ -60,9 +59,8 @@ struct AudioChannel clear(); } - // PSP side - - bool reserved; + int index = 0; + bool reserved = false; // last sample address u32 sampleAddress; @@ -73,12 +71,6 @@ struct AudioChannel std::vector waitingThreads; - // PC side - should probably split out - - // We copy samples as they are written into this simple ring buffer. - // Might try something more efficient later. - FixedSizeQueue sampleQueue; - void DoState(PointerWrap &p); void reset(); diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index b8a08fcaa9..7a25c34afa 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -7,10 +7,11 @@ #include "file/vfs.h" #include "ui/root.h" +#include "Common/ChunkFileDo.h" #include "Common/CommonTypes.h" +#include "Common/FixedSizeQueue.h" #include "Core/HW/SimpleAudioDec.h" #include "Core/HLE/__sceAudio.h" -#include "Common/FixedSizeQueue.h" #include "GameInfoCache.h" #include "Core/Config.h" #include "UI/BackgroundAudio.h" From 1dc5ee424bd3843ae9279c4615660795ce9f42f2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 06:38:45 +0000 Subject: [PATCH 09/12] SaveState: Split out Do types to reduce headers. --- Common/ChunkFile.cpp | 7 +- Common/ChunkFile.h | 17 +- Common/ChunkFileDo.h | 293 +--------------------------- Common/ChunkFileDoDeque.h | 44 +++++ Common/ChunkFileDoList.h | 101 ++++++++++ Common/ChunkFileDoMap.h | 164 ++++++++++++++++ Common/ChunkFileDoSet.h | 69 +++++++ Core/CoreTiming.cpp | 2 +- Core/Dialog/PSPSaveDialog.cpp | 1 + Core/FileSystems/MetaFileSystem.cpp | 1 + Core/HLE/sceDisplay.cpp | 1 + Core/HLE/sceFont.cpp | 1 + Core/HLE/sceGe.cpp | 2 + Core/HLE/sceHeap.cpp | 1 + Core/HLE/sceIo.cpp | 3 + Core/HLE/sceKernelAlarm.cpp | 3 +- Core/HLE/sceKernelEventFlag.cpp | 1 + Core/HLE/sceKernelInterrupt.cpp | 2 + Core/HLE/sceKernelMbx.cpp | 1 + Core/HLE/sceKernelMemory.cpp | 1 + Core/HLE/sceKernelModule.cpp | 1 + Core/HLE/sceKernelMsgPipe.cpp | 1 + Core/HLE/sceKernelMutex.cpp | 1 + Core/HLE/sceKernelSemaphore.cpp | 1 + Core/HLE/sceKernelThread.cpp | 4 +- Core/HLE/sceKernelVTimer.cpp | 2 + Core/HLE/sceMp3.cpp | 1 + Core/HLE/sceMp4.cpp | 1 + Core/HLE/sceMpeg.cpp | 1 + Core/HLE/sceNet.cpp | 1 + Core/HLE/sceNetAdhoc.cpp | 1 + Core/HLE/scePsmf.cpp | 1 + Core/HLE/sceUmd.cpp | 1 + Core/HLE/sceUsbGps.cpp | 1 + Core/HLE/sceUtility.cpp | 2 + Core/HW/AsyncIOManager.cpp | 2 + Core/HW/BufferQueue.cpp | 1 + Core/MIPS/IR/IRJit.cpp | 1 + Core/Reporting.cpp | 1 + Core/System.cpp | 1 + GPU/GLES/GPU_GLES.cpp | 1 + GPU/GPUCommon.cpp | 1 + GPU/Vulkan/GPU_Vulkan.cpp | 1 + Windows/MainWindowMenu.cpp | 1 + Windows/main.cpp | 1 + 45 files changed, 440 insertions(+), 306 deletions(-) create mode 100644 Common/ChunkFileDoDeque.h create mode 100644 Common/ChunkFileDoList.h create mode 100644 Common/ChunkFileDoMap.h create mode 100644 Common/ChunkFileDoSet.h diff --git a/Common/ChunkFile.cpp b/Common/ChunkFile.cpp index 229c96aaff..7252d46d68 100644 --- a/Common/ChunkFile.cpp +++ b/Common/ChunkFile.cpp @@ -19,9 +19,10 @@ #include #include -#include "ChunkFile.h" -#include "ChunkFileDo.h" -#include "StringUtils.h" +#include "Common/ChunkFile.h" +#include "Common/ChunkFileDo.h" +#include "Common/FileUtil.h" +#include "Common/StringUtils.h" PointerWrapSection PointerWrap::Section(const char *title, int ver) { return Section(title, ver, ver); diff --git a/Common/ChunkFile.h b/Common/ChunkFile.h index 67ef6f0e21..99d7a5c343 100644 --- a/Common/ChunkFile.h +++ b/Common/ChunkFile.h @@ -29,17 +29,14 @@ // + Sections can be versioned for backwards/forwards compatibility // - Serialization code for anything complex has to be manually written. -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include "Common/CommonTypes.h" +#include "Common/Log.h" -#include "Common.h" -#include "Swap.h" -#include "FileUtil.h" +namespace File { +class IOFile; +}; template struct LinkedListItem : public T diff --git a/Common/ChunkFileDo.h b/Common/ChunkFileDo.h index 3849248295..e43f229e8a 100644 --- a/Common/ChunkFileDo.h +++ b/Common/ChunkFileDo.h @@ -18,7 +18,10 @@ #pragma once // Templates for save state serialization. See ChunkFile.h. +#include +#include #include "Common/ChunkFile.h" +#include "Common/Swap.h" void Do(PointerWrap &p, std::string &x); void Do(PointerWrap &p, std::wstring &x); // DEPRECATED, do not save wstrings @@ -82,147 +85,6 @@ void Do(PointerWrap &p, T &x) { DoHelper_::DoThing(p, x); } -template -void DoMap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { - unsigned int number = (unsigned int)x.size(); - Do(p, number); - switch (p.mode) { - case PointerWrap::MODE_READ: - { - x.clear(); - while (number > 0) { - typename M::key_type first = typename M::key_type(); - Do(p, first); - typename M::mapped_type second = default_val; - Do(p, second); - x[first] = second; - --number; - } - } - break; - case PointerWrap::MODE_WRITE: - case PointerWrap::MODE_MEASURE: - case PointerWrap::MODE_VERIFY: - { - typename M::iterator itr = x.begin(); - while (number > 0) { - typename M::key_type first = itr->first; - Do(p, first); - Do(p, itr->second); - --number; - ++itr; - } - } - break; - } -} - -template -void Do(PointerWrap &p, std::map &x) { - if (p.mode == PointerWrap::MODE_READ) { - for (auto it = x.begin(), end = x.end(); it != end; ++it) { - if (it->second != nullptr) - delete it->second; - } - } - T *dv = nullptr; - DoMap(p, x, dv); -} - -template -void Do(PointerWrap &p, std::map &x) { - T dv = T(); - DoMap(p, x, dv); -} - -template -void Do(PointerWrap &p, std::unordered_map &x) { - if (p.mode == PointerWrap::MODE_READ) { - for (auto it = x.begin(), end = x.end(); it != end; ++it) { - if (it->second != nullptr) - delete it->second; - } - } - T *dv = nullptr; - DoMap(p, x, dv); -} - -template -void Do(PointerWrap &p, std::unordered_map &x) { - T dv = T(); - DoMap(p, x, dv); -} - -template -void DoMultimap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { - unsigned int number = (unsigned int)x.size(); - Do(p, number); - switch (p.mode) { - case PointerWrap::MODE_READ: - { - x.clear(); - while (number > 0) { - typename M::key_type first = typename M::key_type(); - Do(p, first); - typename M::mapped_type second = default_val; - Do(p, second); - x.insert(std::make_pair(first, second)); - --number; - } - } - break; - case PointerWrap::MODE_WRITE: - case PointerWrap::MODE_MEASURE: - case PointerWrap::MODE_VERIFY: - { - typename M::iterator itr = x.begin(); - while (number > 0) { - Do(p, itr->first); - Do(p, itr->second); - --number; - ++itr; - } - } - break; - } -} - -template -void Do(PointerWrap &p, std::multimap &x) { - if (p.mode == PointerWrap::MODE_READ) { - for (auto it = x.begin(), end = x.end(); it != end; ++it) { - if (it->second != nullptr) - delete it->second; - } - } - T *dv = nullptr; - DoMultimap(p, x, dv); -} - -template -void Do(PointerWrap &p, std::multimap &x) { - T dv = T(); - DoMultimap(p, x, dv); -} - -template -void Do(PointerWrap &p, std::unordered_multimap &x) { - if (p.mode == PointerWrap::MODE_READ) { - for (auto it = x.begin(), end = x.end(); it != end; ++it) { - if (it->second != nullptr) - delete it->second; - } - } - T *dv = nullptr; - DoMultimap(p, x, dv); -} - -template -void Do(PointerWrap &p, std::unordered_multimap &x) { - T dv = T(); - DoMultimap(p, x, dv); -} - template void DoVector(PointerWrap &p, std::vector &x, T &default_val) { u32 vec_size = (u32)x.size(); @@ -249,104 +111,6 @@ void Do(PointerWrap &p, std::vector &x, T &default_val) { DoVector(p, x, default_val); } -template -void DoDeque(PointerWrap &p, std::deque &x, T &default_val) { - u32 deq_size = (u32)x.size(); - Do(p, deq_size); - x.resize(deq_size, default_val); - u32 i; - for (i = 0; i < deq_size; i++) - Do(p, x[i]); -} - -template -void Do(PointerWrap &p, std::deque &x) { - T *dv = nullptr; - DoDeque(p, x, dv); -} - -template -void Do(PointerWrap &p, std::deque &x) { - T dv = T(); - DoDeque(p, x, dv); -} - -template -void DoList(PointerWrap &p, std::list &x, T &default_val) { - u32 list_size = (u32)x.size(); - Do(p, list_size); - x.resize(list_size, default_val); - - typename std::list::iterator itr, end; - for (itr = x.begin(), end = x.end(); itr != end; ++itr) - Do(p, *itr); -} - -template -void Do(PointerWrap &p, std::list &x) { - T *dv = nullptr; - Do(p, x, dv); -} - -template -void Do(PointerWrap &p, std::list &x) { - T dv = T(); - DoList(p, x, dv); -} - -template -void Do(PointerWrap &p, std::list &x, T &default_val) { - DoList(p, x, default_val); -} - -template -void DoSet(PointerWrap &p, std::set &x) { - unsigned int number = (unsigned int)x.size(); - Do(p, number); - - switch (p.mode) { - case PointerWrap::MODE_READ: - { - x.clear(); - while (number-- > 0) { - T it = T(); - Do(p, it); - x.insert(it); - } - } - break; - case PointerWrap::MODE_WRITE: - case PointerWrap::MODE_MEASURE: - case PointerWrap::MODE_VERIFY: - { - typename std::set::iterator itr = x.begin(); - while (number-- > 0) - Do(p, *itr++); - } - break; - - default: - ERROR_LOG(SAVESTATE, "Savestate error: invalid mode %d.", p.mode); - } -} - -// Store STL sets. -template -void Do(PointerWrap &p, std::set &x) { - if (p.mode == PointerWrap::MODE_READ) { - for (auto it = x.begin(), end = x.end(); it != end; ++it) { - if (*it != nullptr) - delete *it; - } - } - DoSet(p, x); -} - -template -void Do(PointerWrap &p, std::set &x) { - DoSet(p, x); -} - template void Do(PointerWrap &p, swap_struct_t &x) { T v = x.swap(); @@ -362,54 +126,3 @@ void DoPointer(PointerWrap &p, T *&x, T *const base) { if (p.mode == PointerWrap::MODE_READ) x = base + offset; } - -template *(*TNew)(), void (*TFree)(LinkedListItem *), void (*TDo)(PointerWrap &, T *)> -void DoLinkedList(PointerWrap &p, LinkedListItem *&list_start, LinkedListItem **list_end = nullptr) { - LinkedListItem *list_cur = list_start; - LinkedListItem *prev = nullptr; - - while (true) { - u8 shouldExist = (list_cur ? 1 : 0); - Do(p, shouldExist); - if (shouldExist == 1) { - LinkedListItem *cur = list_cur ? list_cur : TNew(); - TDo(p, (T *)cur); - if (!list_cur) { - if (p.mode == PointerWrap::MODE_READ) { - cur->next = 0; - list_cur = cur; - if (prev) - prev->next = cur; - else - list_start = cur; - } else { - TFree(cur); - continue; - } - } - } else { - if (shouldExist != 0) { - WARN_LOG(SAVESTATE, "Savestate failure: incorrect item marker %d", shouldExist); - p.SetError(p.ERROR_FAILURE); - } - if (p.mode == PointerWrap::MODE_READ) { - if (prev) - prev->next = nullptr; - if (list_end) - *list_end = prev; - if (list_cur) { - if (list_start == list_cur) - list_start = nullptr; - do { - LinkedListItem *next = list_cur->next; - TFree(list_cur); - list_cur = next; - } while (list_cur); - } - } - break; - } - prev = list_cur; - list_cur = list_cur->next; - } -} diff --git a/Common/ChunkFileDoDeque.h b/Common/ChunkFileDoDeque.h new file mode 100644 index 0000000000..1c2aa9339e --- /dev/null +++ b/Common/ChunkFileDoDeque.h @@ -0,0 +1,44 @@ +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// Templates for save state serialization. See ChunkFile.h. +#include +#include "Common/ChunkFileDo.h" + +template +void DoDeque(PointerWrap &p, std::deque &x, T &default_val) { + u32 deq_size = (u32)x.size(); + Do(p, deq_size); + x.resize(deq_size, default_val); + u32 i; + for (i = 0; i < deq_size; i++) + Do(p, x[i]); +} + +template +void Do(PointerWrap &p, std::deque &x) { + T *dv = nullptr; + DoDeque(p, x, dv); +} + +template +void Do(PointerWrap &p, std::deque &x) { + T dv = T(); + DoDeque(p, x, dv); +} diff --git a/Common/ChunkFileDoList.h b/Common/ChunkFileDoList.h new file mode 100644 index 0000000000..1ae1a2a12d --- /dev/null +++ b/Common/ChunkFileDoList.h @@ -0,0 +1,101 @@ +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// Templates for save state serialization. See ChunkFile.h. +#include +#include "Common/ChunkFileDo.h" + +template +void DoList(PointerWrap &p, std::list &x, T &default_val) { + u32 list_size = (u32)x.size(); + Do(p, list_size); + x.resize(list_size, default_val); + + typename std::list::iterator itr, end; + for (itr = x.begin(), end = x.end(); itr != end; ++itr) + Do(p, *itr); +} + +template +void Do(PointerWrap &p, std::list &x) { + T *dv = nullptr; + Do(p, x, dv); +} + +template +void Do(PointerWrap &p, std::list &x) { + T dv = T(); + DoList(p, x, dv); +} + +template +void Do(PointerWrap &p, std::list &x, T &default_val) { + DoList(p, x, default_val); +} + +template *(*TNew)(), void (*TFree)(LinkedListItem *), void (*TDo)(PointerWrap &, T *)> +void DoLinkedList(PointerWrap &p, LinkedListItem *&list_start, LinkedListItem **list_end = nullptr) { + LinkedListItem *list_cur = list_start; + LinkedListItem *prev = nullptr; + + while (true) { + u8 shouldExist = (list_cur ? 1 : 0); + Do(p, shouldExist); + if (shouldExist == 1) { + LinkedListItem *cur = list_cur ? list_cur : TNew(); + TDo(p, (T *)cur); + if (!list_cur) { + if (p.mode == PointerWrap::MODE_READ) { + cur->next = 0; + list_cur = cur; + if (prev) + prev->next = cur; + else + list_start = cur; + } else { + TFree(cur); + continue; + } + } + } else { + if (shouldExist != 0) { + WARN_LOG(SAVESTATE, "Savestate failure: incorrect item marker %d", shouldExist); + p.SetError(p.ERROR_FAILURE); + } + if (p.mode == PointerWrap::MODE_READ) { + if (prev) + prev->next = nullptr; + if (list_end) + *list_end = prev; + if (list_cur) { + if (list_start == list_cur) + list_start = nullptr; + do { + LinkedListItem *next = list_cur->next; + TFree(list_cur); + list_cur = next; + } while (list_cur); + } + } + break; + } + prev = list_cur; + list_cur = list_cur->next; + } +} diff --git a/Common/ChunkFileDoMap.h b/Common/ChunkFileDoMap.h new file mode 100644 index 0000000000..5c01a244c8 --- /dev/null +++ b/Common/ChunkFileDoMap.h @@ -0,0 +1,164 @@ +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// Templates for save state serialization. See ChunkFile.h. +#include +#include +#include "Common/ChunkFileDo.h" + +template +void DoMap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { + unsigned int number = (unsigned int)x.size(); + Do(p, number); + switch (p.mode) { + case PointerWrap::MODE_READ: + { + x.clear(); + while (number > 0) { + typename M::key_type first = typename M::key_type(); + Do(p, first); + typename M::mapped_type second = default_val; + Do(p, second); + x[first] = second; + --number; + } + } + break; + case PointerWrap::MODE_WRITE: + case PointerWrap::MODE_MEASURE: + case PointerWrap::MODE_VERIFY: + { + typename M::iterator itr = x.begin(); + while (number > 0) { + typename M::key_type first = itr->first; + Do(p, first); + Do(p, itr->second); + --number; + ++itr; + } + } + break; + } +} + +template +void Do(PointerWrap &p, std::map &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::map &x) { + T dv = T(); + DoMap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_map &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_map &x) { + T dv = T(); + DoMap(p, x, dv); +} + +template +void DoMultimap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { + unsigned int number = (unsigned int)x.size(); + Do(p, number); + switch (p.mode) { + case PointerWrap::MODE_READ: + { + x.clear(); + while (number > 0) { + typename M::key_type first = typename M::key_type(); + Do(p, first); + typename M::mapped_type second = default_val; + Do(p, second); + x.insert(std::make_pair(first, second)); + --number; + } + } + break; + case PointerWrap::MODE_WRITE: + case PointerWrap::MODE_MEASURE: + case PointerWrap::MODE_VERIFY: + { + typename M::iterator itr = x.begin(); + while (number > 0) { + Do(p, itr->first); + Do(p, itr->second); + --number; + ++itr; + } + } + break; + } +} + +template +void Do(PointerWrap &p, std::multimap &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMultimap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::multimap &x) { + T dv = T(); + DoMultimap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_multimap &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (it->second != nullptr) + delete it->second; + } + } + T *dv = nullptr; + DoMultimap(p, x, dv); +} + +template +void Do(PointerWrap &p, std::unordered_multimap &x) { + T dv = T(); + DoMultimap(p, x, dv); +} diff --git a/Common/ChunkFileDoSet.h b/Common/ChunkFileDoSet.h new file mode 100644 index 0000000000..ff2186b9f2 --- /dev/null +++ b/Common/ChunkFileDoSet.h @@ -0,0 +1,69 @@ +// Copyright (C) 2003 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +// Templates for save state serialization. See ChunkFile.h. +#include +#include "Common/ChunkFileDo.h" + +template +void DoSet(PointerWrap &p, std::set &x) { + unsigned int number = (unsigned int)x.size(); + Do(p, number); + + switch (p.mode) { + case PointerWrap::MODE_READ: + { + x.clear(); + while (number-- > 0) { + T it = T(); + Do(p, it); + x.insert(it); + } + } + break; + case PointerWrap::MODE_WRITE: + case PointerWrap::MODE_MEASURE: + case PointerWrap::MODE_VERIFY: + { + typename std::set::iterator itr = x.begin(); + while (number-- > 0) + Do(p, *itr++); + } + break; + + default: + ERROR_LOG(SAVESTATE, "Savestate error: invalid mode %d.", p.mode); + } +} + +template +void Do(PointerWrap &p, std::set &x) { + if (p.mode == PointerWrap::MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { + if (*it != nullptr) + delete *it; + } + } + DoSet(p, x); +} + +template +void Do(PointerWrap &p, std::set &x) { + DoSet(p, x); +} diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index 8c49a4c15c..7819370885 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -24,7 +24,7 @@ #include "profiler/profiler.h" #include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" #include "Common/MsgHandler.h" #include "Core/CoreTiming.h" #include "Core/Core.h" diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 190e6c41cd..f663c61518 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -24,6 +24,7 @@ #include "i18n/i18n.h" #include "thread/threadutil.h" +#include "Common/FileUtil.h" #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" #include "Core/FileSystems/MetaFileSystem.h" diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index b40a336243..b4d545a25d 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -20,6 +20,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Common/StringUtils.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HLE/sceKernelThread.h" diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 1e30c5112a..1781bc4aec 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -38,6 +38,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/Config.h" #include "Core/CoreTiming.h" #include "Core/CoreParameter.h" diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 605beda7da..786d7b0ed4 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -9,6 +9,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceFont.h" diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 625fa1b3d0..7e90b9e8a4 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -21,6 +21,8 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" +#include "Common/ChunkFileDoMap.h" #include "Common/ThreadSafeList.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" diff --git a/Core/HLE/sceHeap.cpp b/Core/HLE/sceHeap.cpp index 61bf921012..edf8b82698 100644 --- a/Core/HLE/sceHeap.cpp +++ b/Core/HLE/sceHeap.cpp @@ -17,6 +17,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/MemMap.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 93d9adb3ec..9f1a167f66 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -23,6 +23,9 @@ #include "profiler/profiler.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" +#include "Common/ChunkFileDoSet.h" +#include "Common/FileUtil.h" #include "Core/Core.h" #include "Core/Config.h" #include "Core/ConfigValues.h" diff --git a/Core/HLE/sceKernelAlarm.cpp b/Core/HLE/sceKernelAlarm.cpp index 94cd258f96..ce78663ded 100644 --- a/Core/HLE/sceKernelAlarm.cpp +++ b/Core/HLE/sceKernelAlarm.cpp @@ -15,15 +15,16 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelAlarm.h" #include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/HLE.h" #include "Core/CoreTiming.h" #include "Core/MemMap.h" -#include const int NATIVEALARM_SIZE = 20; diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index db79bd4f62..fac0cc1164 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -17,6 +17,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index d065fcce14..fe7b00a9e1 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -21,6 +21,8 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" +#include "Common/ChunkFileDoMap.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index e881363b7b..d18fe88b5a 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -19,6 +19,7 @@ #include #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/sceKernelMbx.h" diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 73e53538df..3965469280 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -22,6 +22,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/System.h" diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index fe51c77699..8d4d0f85c0 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -24,6 +24,7 @@ #include "base/stringutil.h" #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoSet.h" #include "Common/FileUtil.h" #include "Common/StringUtils.h" #include "Core/Config.h" diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 67d0c58e86..632e9815b6 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -19,6 +19,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/Reporting.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index cafc38d289..527a4ffc7a 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -20,6 +20,7 @@ #include #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index 0f81cc43c4..3d74bffa3d 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -18,6 +18,7 @@ #include #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 9ff2fcb8d3..d6c64f87e1 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -16,16 +16,18 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include #include #include #include -#include #include "base/logging.h" #include "Common/LogManager.h" #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" +#include "Common/ChunkFileDoMap.h" #include "Common/CommonTypes.h" #include "Core/HLE/HLE.h" #include "Core/HLE/HLETables.h" diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index 3a3d4e2be0..643ca3a5ab 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -16,8 +16,10 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include +#include #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index b94b06dcb2..048d4df1ef 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -19,6 +19,7 @@ #include #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/Config.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" diff --git a/Core/HLE/sceMp4.cpp b/Core/HLE/sceMp4.cpp index 0bbf4edaa8..646ef63e9e 100644 --- a/Core/HLE/sceMp4.cpp +++ b/Core/HLE/sceMp4.cpp @@ -18,6 +18,7 @@ #include #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/Reporting.h" diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 8a79a786f2..d9f264cfa0 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -21,6 +21,7 @@ #include #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Common/Swap.h" #include "Core/HLE/sceMpeg.h" #include "Core/HLE/sceKernelModule.h" diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index e3936c4841..f7acd4e851 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -27,6 +27,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernelMemory.h" diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 54562f0dd2..174e9ed930 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -30,6 +30,7 @@ #include "Core/MemMapHelpers.h" #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/MIPS/MIPSCodeUtils.h" #include "Core/Util/PortManager.h" diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 74c4f7242a..e02da6b4f1 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -17,6 +17,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/System.h" diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 12c8a53a1b..e609a14592 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -21,6 +21,7 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/Loaders.h" #include "Core/MemMap.h" #include "Core/System.h" diff --git a/Core/HLE/sceUsbGps.cpp b/Core/HLE/sceUsbGps.cpp index b7e1be9902..dce4fe5fb3 100644 --- a/Core/HLE/sceUsbGps.cpp +++ b/Core/HLE/sceUsbGps.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "base/NativeApp.h" #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index d1a13e1fc2..29e745a7f4 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -22,6 +22,8 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" +#include "Common/ChunkFileDoSet.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HW/AsyncIOManager.cpp b/Core/HW/AsyncIOManager.cpp index 98a15f5c48..78f636b809 100644 --- a/Core/HW/AsyncIOManager.cpp +++ b/Core/HW/AsyncIOManager.cpp @@ -20,6 +20,8 @@ #include "Common/ChunkFile.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" +#include "Common/ChunkFileDoSet.h" #include "Core/MIPS/MIPS.h" #include "Core/Reporting.h" #include "Core/System.h" diff --git a/Core/HW/BufferQueue.cpp b/Core/HW/BufferQueue.cpp index 14ece774e1..8051720d6c 100644 --- a/Core/HW/BufferQueue.cpp +++ b/Core/HW/BufferQueue.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoMap.h" #include "Core/HW/BufferQueue.h" void BufferQueue::DoState(PointerWrap &p) { diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index 5063911293..9c07d83280 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "base/logging.h" #include "ext/xxhash.h" #include "profiler/profiler.h" diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index ea680cb957..a993b98947 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -24,6 +24,7 @@ #include "Common/ChunkFileDo.h" #include "Common/CPUDetect.h" +#include "Common/FileUtil.h" #include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/Config.h" diff --git a/Core/System.cpp b/Core/System.cpp index 2d0ced0c6b..f64754e22d 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -38,6 +38,7 @@ #include "thread/threadutil.h" #include "util/text/utf8.h" +#include "Common/FileUtil.h" #include "Common/GraphicsContext.h" #include "Core/MemFault.h" #include "Core/HDRemaster.h" diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 0d4e0035e3..3c3f881aae 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -20,6 +20,7 @@ #include "i18n/i18n.h" #include "Common/ChunkFile.h" +#include "Common/FileUtil.h" #include "Common/GraphicsContext.h" #include "Core/Config.h" diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index c5f75b5255..48d0a332e9 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -6,6 +6,7 @@ #include "profiler/profiler.h" #include "Common/ChunkFileDo.h" +#include "Common/ChunkFileDoList.h" #include "Common/ColorConv.h" #include "Common/GraphicsContext.h" #include "Core/Reporting.h" diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index a912f4b781..7000084dcb 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -23,6 +23,7 @@ #include "profiler/profiler.h" #include "Common/ChunkFile.h" +#include "Common/FileUtil.h" #include "Common/GraphicsContext.h" #include "Core/Config.h" diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 6a3447cdc3..03296a8f28 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -11,6 +11,7 @@ #include "base/NativeApp.h" #include "gfx_es2/gpu_features.h" +#include "Common/FileUtil.h" #include "Common/Log.h" #include "Common/LogManager.h" #include "Common/ConsoleListener.h" diff --git a/Windows/main.cpp b/Windows/main.cpp index 4039264bd0..9a2bcce356 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -21,6 +21,7 @@ #include #include "Common/CommonWindows.h" +#include "Common/FileUtil.h" #include "Common/OSVersion.h" #include "Common/Vulkan/VulkanLoader.h" #include "ppsspp_config.h" From d0f3cfeb9bd4154b27d09bf0a560cb0f7fbb4b72 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 06:39:13 +0000 Subject: [PATCH 10/12] Global: Remove some unused header code. --- Common/Common.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Common/Common.h b/Common/Common.h index afd4176a10..9fffa42922 100644 --- a/Common/Common.h +++ b/Common/Common.h @@ -33,8 +33,6 @@ #define LOGGING 1 #endif -#define STACKALIGN - #include "Log.h" #include "CommonTypes.h" #include "CommonFuncs.h" @@ -45,17 +43,7 @@ void operator =(const t &other) = delete; #endif -#ifdef __APPLE__ -// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries. -// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes. -#if defined __i386__ && defined __GNUC__ -#undef STACKALIGN -#define STACKALIGN __attribute__((__force_align_arg_pointer__)) -#endif - -#define CHECK_HEAP_INTEGRITY() - -#elif defined(_WIN32) +#if defined(_WIN32) // Memory leak checks #define CHECK_HEAP_INTEGRITY() From b8342fb8ec52e071edcccecc6ffd2410a4c1641b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 00:12:51 -0700 Subject: [PATCH 11/12] SaveState: Rename ChunkFile files to Serialize. Makes more sense and less weird than ChunkFileDoMap, etc. --- CMakeLists.txt | 10 ++++--- Common/Common.vcxproj | 10 ++++--- Common/Common.vcxproj.filters | 27 ++++++++++++++++--- Common/FixedSizeQueue.h | 4 +-- .../SerializeDeque.h} | 4 +-- .../SerializeFuncs.h} | 4 +-- .../SerializeList.h} | 4 +-- .../SerializeMap.h} | 4 +-- .../SerializeSet.h} | 4 +-- .../Serializer.cpp} | 4 +-- .../{ChunkFile.h => Serialize/Serializer.h} | 0 Core/CoreTiming.cpp | 4 +-- Core/CwCheat.cpp | 4 +-- Core/Dialog/PSPDialog.cpp | 4 +-- Core/Dialog/PSPGamedataInstallDialog.cpp | 4 +-- Core/Dialog/PSPMsgDialog.cpp | 4 +-- Core/Dialog/PSPNetconfDialog.cpp | 4 +-- Core/Dialog/PSPOskDialog.cpp | 4 +-- Core/Dialog/PSPSaveDialog.cpp | 4 +-- Core/Dialog/PSPScreenshotDialog.cpp | 4 +-- Core/Dialog/SavedataParam.cpp | 4 +-- Core/FileSystems/DirectoryFileSystem.cpp | 4 +-- Core/FileSystems/FileSystem.cpp | 4 +-- Core/FileSystems/ISOFileSystem.cpp | 4 +-- Core/FileSystems/MetaFileSystem.cpp | 6 ++--- Core/FileSystems/VirtualDiscFileSystem.cpp | 4 +-- Core/Font/PGF.cpp | 4 +-- Core/HLE/HLE.cpp | 2 +- Core/HLE/HLEHelperThread.cpp | 4 +-- Core/HLE/ThreadQueueList.h | 2 +- Core/HLE/__sceAudio.cpp | 4 +-- Core/HLE/proAdhoc.cpp | 2 +- Core/HLE/proAdhoc.h | 2 +- Core/HLE/sceAtrac.cpp | 4 +-- Core/HLE/sceAudio.cpp | 4 +-- Core/HLE/sceAudiocodec.cpp | 4 +-- Core/HLE/sceCcc.cpp | 4 +-- Core/HLE/sceCtrl.cpp | 4 +-- Core/HLE/sceDisplay.cpp | 6 ++--- Core/HLE/sceDmac.cpp | 4 +-- Core/HLE/sceFont.cpp | 6 ++--- Core/HLE/sceGe.cpp | 8 +++--- Core/HLE/sceHeap.cpp | 6 ++--- Core/HLE/sceImpose.cpp | 4 +-- Core/HLE/sceIo.cpp | 6 ++--- Core/HLE/sceJpeg.cpp | 4 +-- Core/HLE/sceKernel.cpp | 2 +- Core/HLE/sceKernelAlarm.cpp | 6 ++--- Core/HLE/sceKernelEventFlag.cpp | 6 ++--- Core/HLE/sceKernelHeap.cpp | 4 +-- Core/HLE/sceKernelInterrupt.cpp | 8 +++--- Core/HLE/sceKernelMbx.cpp | 6 ++--- Core/HLE/sceKernelMemory.cpp | 6 ++--- Core/HLE/sceKernelModule.cpp | 6 ++--- Core/HLE/sceKernelMsgPipe.cpp | 6 ++--- Core/HLE/sceKernelMutex.cpp | 6 ++--- Core/HLE/sceKernelSemaphore.cpp | 6 ++--- Core/HLE/sceKernelThread.cpp | 10 +++---- Core/HLE/sceKernelTime.cpp | 4 +-- Core/HLE/sceKernelVTimer.cpp | 6 ++--- Core/HLE/sceMp3.cpp | 4 +-- Core/HLE/sceMp4.cpp | 4 +-- Core/HLE/sceMpeg.cpp | 4 +-- Core/HLE/sceNet.cpp | 6 ++--- Core/HLE/sceNetAdhoc.cpp | 6 ++--- Core/HLE/scePower.cpp | 4 +-- Core/HLE/scePsmf.cpp | 6 ++--- Core/HLE/sceRtc.cpp | 4 +-- Core/HLE/sceSas.cpp | 2 +- Core/HLE/sceSsl.cpp | 4 +-- Core/HLE/sceUmd.cpp | 6 ++--- Core/HLE/sceUsb.cpp | 4 +-- Core/HLE/sceUsbCam.cpp | 4 +-- Core/HLE/sceUsbGps.cpp | 4 +-- Core/HLE/sceUsbMic.cpp | 4 +-- Core/HLE/sceUtility.cpp | 8 +++--- Core/HLE/sceVaudio.cpp | 4 +-- Core/HW/AsyncIOManager.cpp | 8 +++--- Core/HW/BufferQueue.cpp | 4 +-- Core/HW/BufferQueue.h | 2 +- Core/HW/MediaEngine.cpp | 2 +- Core/HW/MemoryStick.cpp | 4 +-- Core/HW/MpegDemux.cpp | 2 +- Core/HW/SasAudio.cpp | 2 +- Core/HW/SimpleAudioDec.cpp | 2 +- Core/HW/StereoResampler.cpp | 2 +- Core/HW/StereoResampler.h | 2 +- Core/MIPS/IR/IRFrontend.cpp | 4 +-- Core/MIPS/IR/IRJit.cpp | 2 +- Core/MIPS/JitCommon/JitCommon.cpp | 4 +-- Core/MIPS/MIPS.cpp | 4 +-- Core/MIPS/MIPS/MipsJit.cpp | 2 +- Core/MIPS/fake/FakeJit.cpp | 2 +- Core/MIPS/x86/Jit.cpp | 4 +-- Core/MemMap.cpp | 4 +-- Core/Reporting.cpp | 2 +- Core/SaveState.cpp | 4 +-- Core/SaveState.h | 2 +- Core/Util/BlockAllocator.cpp | 4 +-- Core/Util/PPGeDraw.cpp | 4 +-- GPU/D3D11/GPU_D3D11.cpp | 2 +- GPU/Directx9/GPU_DX9.cpp | 2 +- GPU/GLES/GPU_GLES.cpp | 2 +- GPU/GPUCommon.cpp | 6 ++--- GPU/GPUState.cpp | 4 +-- GPU/Vulkan/GPU_Vulkan.cpp | 2 +- UI/BackgroundAudio.cpp | 2 +- UWP/CommonUWP/CommonUWP.vcxproj | 10 ++++--- UWP/CommonUWP/CommonUWP.vcxproj.filters | 10 ++++--- android/jni/Android.mk | 2 +- libretro/Makefile.common | 2 +- libretro/libretro.cpp | 2 +- 112 files changed, 268 insertions(+), 231 deletions(-) rename Common/{ChunkFileDoDeque.h => Serialize/SerializeDeque.h} (91%) rename Common/{ChunkFileDo.h => Serialize/SerializeFuncs.h} (96%) rename Common/{ChunkFileDoList.h => Serialize/SerializeList.h} (96%) rename Common/{ChunkFileDoMap.h => Serialize/SerializeMap.h} (97%) rename Common/{ChunkFileDoSet.h => Serialize/SerializeSet.h} (93%) rename Common/{ChunkFile.cpp => Serialize/Serializer.cpp} (99%) rename Common/{ChunkFile.h => Serialize/Serializer.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09ca275110..0137d06d5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,9 +416,13 @@ add_library(Common STATIC ${CommonVulkan} Common/ColorConv.cpp Common/ColorConv.h - Common/ChunkFile.cpp - Common/ChunkFile.h - Common/ChunkFileDo.h + Common/Serialize/Serializer.cpp + Common/Serialize/Serializer.h + Common/Serialize/SerializeDeque.h + Common/Serialize/SerializeFuncs.h + Common/Serialize/SerializeList.h + Common/Serialize/SerializeMap.h + Common/Serialize/SerializeSet.h Common/ConsoleListener.cpp Common/ConsoleListener.h Common/Crypto/md5.cpp diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index c54bc30238..40a9f61a06 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -354,9 +354,12 @@ - + + - + + + @@ -406,6 +409,7 @@ + @@ -445,7 +449,7 @@ false false - + diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index a19ee2e281..92551a3e85 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -3,7 +3,6 @@ - @@ -76,7 +75,24 @@ - + + Serialize + + + Serialize + + + Serialize + + + Serialize + + + Serialize + + + Serialize + @@ -106,7 +122,6 @@ Crypto - @@ -141,6 +156,9 @@ Vulkan + + Serialize + @@ -155,5 +173,8 @@ {c14d66ef-5f7c-4565-975a-72774e7ccfb9} + + {7be79ad5-3520-46a1-a370-dce2a943978c} + \ No newline at end of file diff --git a/Common/FixedSizeQueue.h b/Common/FixedSizeQueue.h index 03ebf5c41f..ed7eb14a75 100644 --- a/Common/FixedSizeQueue.h +++ b/Common/FixedSizeQueue.h @@ -18,8 +18,8 @@ #pragma once #include -#include "ChunkFile.h" -#include "MemoryUtil.h" +#include "Common/MemoryUtil.h" +#include "Common/Serialize/Serializer.h" // STL-look-a-like interface, but name is mixed case to distinguish it clearly from the // real STL classes. diff --git a/Common/ChunkFileDoDeque.h b/Common/Serialize/SerializeDeque.h similarity index 91% rename from Common/ChunkFileDoDeque.h rename to Common/Serialize/SerializeDeque.h index 1c2aa9339e..d0dc8adbb0 100644 --- a/Common/ChunkFileDoDeque.h +++ b/Common/Serialize/SerializeDeque.h @@ -17,9 +17,9 @@ #pragma once -// Templates for save state serialization. See ChunkFile.h. +// Templates for save state serialization. See Serializer.h. #include -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" template void DoDeque(PointerWrap &p, std::deque &x, T &default_val) { diff --git a/Common/ChunkFileDo.h b/Common/Serialize/SerializeFuncs.h similarity index 96% rename from Common/ChunkFileDo.h rename to Common/Serialize/SerializeFuncs.h index e43f229e8a..3080749fa3 100644 --- a/Common/ChunkFileDo.h +++ b/Common/Serialize/SerializeFuncs.h @@ -17,10 +17,10 @@ #pragma once -// Templates for save state serialization. See ChunkFile.h. +// Templates for save state serialization. See Serializer.h. #include #include -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/Swap.h" void Do(PointerWrap &p, std::string &x); diff --git a/Common/ChunkFileDoList.h b/Common/Serialize/SerializeList.h similarity index 96% rename from Common/ChunkFileDoList.h rename to Common/Serialize/SerializeList.h index 1ae1a2a12d..ff4ed57a9a 100644 --- a/Common/ChunkFileDoList.h +++ b/Common/Serialize/SerializeList.h @@ -17,9 +17,9 @@ #pragma once -// Templates for save state serialization. See ChunkFile.h. +// Templates for save state serialization. See Serializer.h. #include -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" template void DoList(PointerWrap &p, std::list &x, T &default_val) { diff --git a/Common/ChunkFileDoMap.h b/Common/Serialize/SerializeMap.h similarity index 97% rename from Common/ChunkFileDoMap.h rename to Common/Serialize/SerializeMap.h index 5c01a244c8..9190f5067e 100644 --- a/Common/ChunkFileDoMap.h +++ b/Common/Serialize/SerializeMap.h @@ -17,10 +17,10 @@ #pragma once -// Templates for save state serialization. See ChunkFile.h. +// Templates for save state serialization. See Serializer.h. #include #include -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" template void DoMap(PointerWrap &p, M &x, typename M::mapped_type &default_val) { diff --git a/Common/ChunkFileDoSet.h b/Common/Serialize/SerializeSet.h similarity index 93% rename from Common/ChunkFileDoSet.h rename to Common/Serialize/SerializeSet.h index ff2186b9f2..7e22f21e56 100644 --- a/Common/ChunkFileDoSet.h +++ b/Common/Serialize/SerializeSet.h @@ -17,9 +17,9 @@ #pragma once -// Templates for save state serialization. See ChunkFile.h. +// Templates for save state serialization. See Serializer.h. #include -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" template void DoSet(PointerWrap &p, std::set &x) { diff --git a/Common/ChunkFile.cpp b/Common/Serialize/Serializer.cpp similarity index 99% rename from Common/ChunkFile.cpp rename to Common/Serialize/Serializer.cpp index 7252d46d68..c2eca8731e 100644 --- a/Common/ChunkFile.cpp +++ b/Common/Serialize/Serializer.cpp @@ -19,8 +19,8 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/FileUtil.h" #include "Common/StringUtils.h" diff --git a/Common/ChunkFile.h b/Common/Serialize/Serializer.h similarity index 100% rename from Common/ChunkFile.h rename to Common/Serialize/Serializer.h diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index 7819370885..b87ee057ed 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -23,9 +23,9 @@ #include "base/logging.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDoList.h" #include "Common/MsgHandler.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeList.h" #include "Core/CoreTiming.h" #include "Core/Core.h" #include "Core/Config.h" diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index 1fb4a4623e..131c739ce1 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -4,8 +4,8 @@ #include #include "i18n/i18n.h" #include "Common/StringUtils.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/FileUtil.h" #include "Core/CoreTiming.h" #include "Core/CoreParameter.h" diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index 4d7eda334a..fd01a96d4f 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -17,8 +17,8 @@ #include "i18n/i18n.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/StringUtils.h" #include "Core/CoreTiming.h" #include "Core/HLE/sceCtrl.h" diff --git a/Core/Dialog/PSPGamedataInstallDialog.cpp b/Core/Dialog/PSPGamedataInstallDialog.cpp index e8b239982d..319314fd20 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.cpp +++ b/Core/Dialog/PSPGamedataInstallDialog.cpp @@ -17,8 +17,8 @@ #include #include "Common/Common.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/ELF/ParamSFO.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index b655dd6300..292c213558 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -16,8 +16,8 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/StringUtils.h" #include "Core/Dialog/PSPMsgDialog.h" #include "Core/Dialog/PSPSaveDialog.h" diff --git a/Core/Dialog/PSPNetconfDialog.cpp b/Core/Dialog/PSPNetconfDialog.cpp index 4a77d37a8c..1898cbcd94 100644 --- a/Core/Dialog/PSPNetconfDialog.cpp +++ b/Core/Dialog/PSPNetconfDialog.cpp @@ -16,8 +16,8 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "i18n/i18n.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Config.h" #include "Core/Dialog/PSPNetconfDialog.h" #include "Core/MemMapHelpers.h" diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 4cec09e0c2..60bcb6d6f5 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -21,7 +21,7 @@ #include "math/math_util.h" #include "util/text/utf8.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Dialog/PSPOskDialog.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" @@ -29,7 +29,7 @@ #include "Core/HLE/sceUtility.h" #include "Core/Config.h" #include "Core/Reporting.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "GPU/GPUState.h" #ifndef _WIN32 diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index f663c61518..80b4f7c6e1 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -25,8 +25,8 @@ #include "thread/threadutil.h" #include "Common/FileUtil.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/Util/PPGeDraw.h" #include "Core/HLE/sceCtrl.h" diff --git a/Core/Dialog/PSPScreenshotDialog.cpp b/Core/Dialog/PSPScreenshotDialog.cpp index 2d5c847828..acec8d08d4 100644 --- a/Core/Dialog/PSPScreenshotDialog.cpp +++ b/Core/Dialog/PSPScreenshotDialog.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Dialog/PSPDialog.h" #include "Core/Dialog/PSPScreenshotDialog.h" #include "Core/HLE/sceKernel.h" diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 32374e98cf..1e021d94fc 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -17,8 +17,8 @@ #include "i18n/i18n.h" #include "base/logging.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/StringUtils.h" #include "Core/Config.h" #include "Core/Host.h" diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index b32f8cc1af..7edb316eef 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -23,8 +23,8 @@ #include "file/zip_read.h" #include "i18n/i18n.h" #include "util/text/utf8.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/FileUtil.h" #include "Core/FileSystems/DirectoryFileSystem.h" #include "Core/FileSystems/ISOFileSystem.h" diff --git a/Core/FileSystems/FileSystem.cpp b/Core/FileSystems/FileSystem.cpp index 7fae8183e7..40b527f562 100644 --- a/Core/FileSystems/FileSystem.cpp +++ b/Core/FileSystems/FileSystem.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/FileSystems/FileSystem.h" void PSPFileInfo::DoState(PointerWrap &p) { diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 7ead5c5e4d..04c52f14c6 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -22,8 +22,8 @@ #include "Common/Common.h" #include "Common/CommonTypes.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/FileSystems/ISOFileSystem.h" #include "Core/HLE/sceKernel.h" #include "Core/MemMap.h" diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index b4d545a25d..31f7bf5689 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -18,9 +18,9 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Common/StringUtils.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HLE/sceKernelThread.h" diff --git a/Core/FileSystems/VirtualDiscFileSystem.cpp b/Core/FileSystems/VirtualDiscFileSystem.cpp index 974823415d..df3375fffb 100644 --- a/Core/FileSystems/VirtualDiscFileSystem.cpp +++ b/Core/FileSystems/VirtualDiscFileSystem.cpp @@ -19,8 +19,8 @@ #include "Common/FileUtil.h" #include "Common/StringUtils.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/FileSystems/VirtualDiscFileSystem.h" #include "Core/FileSystems/ISOFileSystem.h" #include "Core/HLE/sceKernel.h" diff --git a/Core/Font/PGF.cpp b/Core/Font/PGF.cpp index 074688676f..ae3afa57b8 100644 --- a/Core/Font/PGF.cpp +++ b/Core/Font/PGF.cpp @@ -21,8 +21,8 @@ // Some parts, especially in this file, were simply copied, so I guess this really makes this file GPL3. #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/MemMap.h" #include "Core/Reporting.h" #include "Core/Font/PGF.h" diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 6a731ef340..06cdf4f390 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -24,7 +24,7 @@ #include "base/timeutil.h" #include "profiler/profiler.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Config.h" #include "Core/Core.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/HLEHelperThread.cpp b/Core/HLE/HLEHelperThread.cpp index c84be0feca..a142820b92 100644 --- a/Core/HLE/HLEHelperThread.cpp +++ b/Core/HLE/HLEHelperThread.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/ThreadQueueList.h b/Core/HLE/ThreadQueueList.h index e08b9c07a5..72282e2a3f 100644 --- a/Core/HLE/ThreadQueueList.h +++ b/Core/HLE/ThreadQueueList.h @@ -18,7 +18,7 @@ #pragma once #include "Core/HLE/sceKernel.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" struct ThreadQueueList { // Number of queues (number of priority levels starting at 0.) diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index d8472edc47..57ef29281d 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -19,8 +19,8 @@ #include #include "Common/CommonTypes.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/FixedSizeQueue.h" #ifdef _M_SSE diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 6e22b3801f..681e11e493 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -33,7 +33,7 @@ #include #include "util/text/parsers.h" #include "thread/threadutil.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Core.h" #include "Core/Host.h" #include "Core/HLE/sceKernelInterrupt.h" diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index b84a13de6d..e5d39745ee 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -43,7 +43,7 @@ #include "base/timeutil.h" #include "net/resolve.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Core/Config.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index fb54546fdb..bdaeea8b98 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -17,8 +17,8 @@ #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index c5d2d54a0a..41eb487167 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/FixedSizeQueue.h" #include "Core/MIPS/MIPS.h" #include "Core/Host.h" diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index 2e29668cdd..d21be884b8 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceAudiocodec.h" diff --git a/Core/HLE/sceCcc.cpp b/Core/HLE/sceCcc.cpp index 7040a5f329..2dba0143cd 100644 --- a/Core/HLE/sceCcc.cpp +++ b/Core/HLE/sceCcc.cpp @@ -19,8 +19,8 @@ #include "util/text/utf16.h" #include "util/text/shiftjis.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Debugger/Breakpoints.h" #include "Core/MemMap.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index 28957509b2..a87cba554f 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -18,8 +18,8 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 1781bc4aec..5551513e7f 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -36,9 +36,9 @@ #include "gfx_es2/gpu_features.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/Config.h" #include "Core/CoreTiming.h" #include "Core/CoreParameter.h" diff --git a/Core/HLE/sceDmac.cpp b/Core/HLE/sceDmac.cpp index 9290cc4d76..4f186facfe 100644 --- a/Core/HLE/sceDmac.cpp +++ b/Core/HLE/sceDmac.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index 786d7b0ed4..4577aa5d83 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -7,9 +7,9 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceFont.h" diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 7e90b9e8a4..0cdae03b8a 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -19,10 +19,10 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoList.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeList.h" +#include "Common/Serialize/SerializeMap.h" #include "Common/ThreadSafeList.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" diff --git a/Core/HLE/sceHeap.cpp b/Core/HLE/sceHeap.cpp index edf8b82698..0de98e1443 100644 --- a/Core/HLE/sceHeap.cpp +++ b/Core/HLE/sceHeap.cpp @@ -15,9 +15,9 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/MemMap.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/sceImpose.cpp b/Core/HLE/sceImpose.cpp index 8a3b60fec0..086cc83c17 100644 --- a/Core/HLE/sceImpose.cpp +++ b/Core/HLE/sceImpose.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceImpose.h" diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 9f1a167f66..16206298f2 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -22,10 +22,10 @@ #include "thread/threadutil.h" #include "profiler/profiler.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" -#include "Common/ChunkFileDoSet.h" #include "Common/FileUtil.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" +#include "Common/Serialize/SerializeSet.h" #include "Core/Core.h" #include "Core/Config.h" #include "Core/ConfigValues.h" diff --git a/Core/HLE/sceJpeg.cpp b/Core/HLE/sceJpeg.cpp index feb0c0ea58..aa6d554ded 100644 --- a/Core/HLE/sceJpeg.cpp +++ b/Core/HLE/sceJpeg.cpp @@ -19,8 +19,8 @@ #include "ext/jpge/jpgd.h" #include "Common/Common.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceJpeg.h" diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 30fe5dc999..6521f3e79c 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/LogManager.h" #include "Core/Core.h" #include "Core/Config.h" diff --git a/Core/HLE/sceKernelAlarm.cpp b/Core/HLE/sceKernelAlarm.cpp index ce78663ded..d6b12703df 100644 --- a/Core/HLE/sceKernelAlarm.cpp +++ b/Core/HLE/sceKernelAlarm.cpp @@ -16,9 +16,9 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoList.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeList.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelAlarm.h" #include "Core/HLE/sceKernelInterrupt.h" diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index fac0cc1164..b4c28732b6 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -15,9 +15,9 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceKernelHeap.cpp b/Core/HLE/sceKernelHeap.cpp index e73f9f60c6..0399f3a0a6 100644 --- a/Core/HLE/sceKernelHeap.cpp +++ b/Core/HLE/sceKernelHeap.cpp @@ -1,7 +1,7 @@ #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernel.h" diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index fe7b00a9e1..8d8e4124db 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -19,10 +19,10 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoList.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeList.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index d18fe88b5a..29ff672e2a 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -17,9 +17,9 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/sceKernel.h" #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/sceKernelMbx.h" diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 3965469280..7da8bc4ef2 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -20,9 +20,9 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/System.h" diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 8d4d0f85c0..c049729246 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -22,9 +22,9 @@ #include "zlib.h" #include "base/stringutil.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoSet.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeSet.h" #include "Common/FileUtil.h" #include "Common/StringUtils.h" #include "Core/Config.h" diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 632e9815b6..2df1f2d105 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -17,9 +17,9 @@ #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/Reporting.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 527a4ffc7a..1b6b314764 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -18,9 +18,9 @@ #include #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index 3d74bffa3d..0b90a3067c 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -16,9 +16,9 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index d6c64f87e1..5e4ebe84d1 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -23,12 +23,12 @@ #include "base/logging.h" -#include "Common/LogManager.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoList.h" -#include "Common/ChunkFileDoMap.h" #include "Common/CommonTypes.h" +#include "Common/LogManager.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeList.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/HLETables.h" #include "Core/MIPS/MIPSAnalyst.h" diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index 64b454f7e4..8bfa812e30 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -23,8 +23,8 @@ #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/CoreTiming.h" #include "Core/HLE/HLE.h" #include "Core/HLE/sceKernel.h" diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index 643ca3a5ab..245db8a395 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -17,9 +17,9 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoList.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeList.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 048d4df1ef..b3bdcb9b18 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -18,8 +18,8 @@ #include #include -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/Config.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" diff --git a/Core/HLE/sceMp4.cpp b/Core/HLE/sceMp4.cpp index 646ef63e9e..376c4adeaf 100644 --- a/Core/HLE/sceMp4.cpp +++ b/Core/HLE/sceMp4.cpp @@ -17,8 +17,8 @@ #include -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/Reporting.h" diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index d9f264cfa0..6a10183fab 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -20,8 +20,8 @@ #include #include -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Common/Swap.h" #include "Core/HLE/sceMpeg.h" #include "Core/HLE/sceKernelModule.h" diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index f7acd4e851..a631ee09c9 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -25,9 +25,9 @@ #include "net/resolve.h" #include "util/text/parsers.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernelMemory.h" diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 174e9ed930..1260fcaead 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -28,9 +28,9 @@ #include "Core/Core.h" #include "Core/Host.h" #include "Core/MemMapHelpers.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/MIPS/MIPSCodeUtils.h" #include "Core/Util/PortManager.h" diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index 610e21234f..caa8e1d8fe 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -16,8 +16,8 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index e02da6b4f1..0a601db8d4 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -15,9 +15,9 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/MemMapHelpers.h" #include "Core/Reporting.h" #include "Core/System.h" diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index eb19ce95b2..f9ad48aa7e 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -26,8 +26,8 @@ #include #include "base/timeutil.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index 0e5f95f65e..a79e511ae7 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -35,7 +35,7 @@ #include "base/basictypes.h" #include "profiler/profiler.h" #include "thread/threadutil.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/Log.h" #include "Core/Config.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceSsl.cpp b/Core/HLE/sceSsl.cpp index 65efc6cde4..7361962d1d 100644 --- a/Core/HLE/sceSsl.cpp +++ b/Core/HLE/sceSsl.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MemMap.h" diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index e609a14592..9ff737f1b5 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -19,9 +19,9 @@ #include "file/file_util.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/Loaders.h" #include "Core/MemMap.h" #include "Core/System.h" diff --git a/Core/HLE/sceUsb.cpp b/Core/HLE/sceUsb.cpp index 6300be0118..60622c9cf0 100644 --- a/Core/HLE/sceUsb.cpp +++ b/Core/HLE/sceUsb.cpp @@ -16,8 +16,8 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "base/NativeApp.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceUsbCam.cpp b/Core/HLE/sceUsbCam.cpp index 751952dbb9..4b3ec1a4ef 100644 --- a/Core/HLE/sceUsbCam.cpp +++ b/Core/HLE/sceUsbCam.cpp @@ -20,8 +20,8 @@ #include "base/NativeApp.h" #include "ppsspp_config.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/sceUsbCam.h" #include "Core/HLE/sceUsbMic.h" diff --git a/Core/HLE/sceUsbGps.cpp b/Core/HLE/sceUsbGps.cpp index dce4fe5fb3..3d014318ac 100644 --- a/Core/HLE/sceUsbGps.cpp +++ b/Core/HLE/sceUsbGps.cpp @@ -17,8 +17,8 @@ #include #include "base/NativeApp.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceUsbGps.h" diff --git a/Core/HLE/sceUsbMic.cpp b/Core/HLE/sceUsbMic.cpp index 9f165ed064..30035f1584 100644 --- a/Core/HLE/sceUsbMic.cpp +++ b/Core/HLE/sceUsbMic.cpp @@ -18,8 +18,8 @@ #include #include "base/NativeApp.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceKernelThread.h" diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 29e745a7f4..0421c6bb67 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -20,10 +20,10 @@ #include "file/ini_file.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" -#include "Common/ChunkFileDoSet.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" +#include "Common/Serialize/SerializeSet.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/MIPS/MIPS.h" diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index de617a78b4..7d5819114f 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Reporting.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" diff --git a/Core/HW/AsyncIOManager.cpp b/Core/HW/AsyncIOManager.cpp index 78f636b809..1d4ce89b0a 100644 --- a/Core/HW/AsyncIOManager.cpp +++ b/Core/HW/AsyncIOManager.cpp @@ -18,10 +18,10 @@ #include #include -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" -#include "Common/ChunkFileDoSet.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" +#include "Common/Serialize/SerializeSet.h" #include "Core/MIPS/MIPS.h" #include "Core/Reporting.h" #include "Core/System.h" diff --git a/Core/HW/BufferQueue.cpp b/Core/HW/BufferQueue.cpp index 8051720d6c..9fbffe0c65 100644 --- a/Core/HW/BufferQueue.cpp +++ b/Core/HW/BufferQueue.cpp @@ -15,8 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoMap.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeMap.h" #include "Core/HW/BufferQueue.h" void BufferQueue::DoState(PointerWrap &p) { diff --git a/Core/HW/BufferQueue.h b/Core/HW/BufferQueue.h index b69782e985..b587b29498 100644 --- a/Core/HW/BufferQueue.h +++ b/Core/HW/BufferQueue.h @@ -19,7 +19,7 @@ #include #include -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" struct BufferQueue { BufferQueue(int size = 0x20000) { diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 83735a02ce..6b1d646bd1 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -15,7 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Config.h" #include "Core/Debugger/Breakpoints.h" #include "Core/HW/MediaEngine.h" diff --git a/Core/HW/MemoryStick.cpp b/Core/HW/MemoryStick.cpp index d04f116508..f2acf2991b 100644 --- a/Core/HW/MemoryStick.cpp +++ b/Core/HW/MemoryStick.cpp @@ -1,5 +1,5 @@ -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/CoreTiming.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HW/MemoryStick.h" diff --git a/Core/HW/MpegDemux.cpp b/Core/HW/MpegDemux.cpp index d65db8d4cf..da121f72e0 100644 --- a/Core/HW/MpegDemux.cpp +++ b/Core/HW/MpegDemux.cpp @@ -1,4 +1,4 @@ -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HW/MpegDemux.h" #include "Core/Reporting.h" diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 7cb6db52d0..913c6948cf 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -20,7 +20,7 @@ #include "base/basictypes.h" #include "profiler/profiler.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/sceAtrac.h" #include "Core/Config.h" diff --git a/Core/HW/SimpleAudioDec.cpp b/Core/HW/SimpleAudioDec.cpp index 3730b299eb..b6a51438c9 100644 --- a/Core/HW/SimpleAudioDec.cpp +++ b/Core/HW/SimpleAudioDec.cpp @@ -17,7 +17,7 @@ #include -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Config.h" #include "Core/HLE/FunctionWrappers.h" #include "Core/HW/SimpleAudioDec.h" diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 27617e3ba7..29ecf60b76 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -38,7 +38,7 @@ #include "base/logging.h" #include "base/timeutil.h" #include "base/NativeApp.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/MathUtil.h" #include "Core/Config.h" #include "Core/ConfigValues.h" diff --git a/Core/HW/StereoResampler.h b/Core/HW/StereoResampler.h index 451b598d66..4b10d032c0 100644 --- a/Core/HW/StereoResampler.h +++ b/Core/HW/StereoResampler.h @@ -22,7 +22,7 @@ #include #include -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/CommonTypes.h" struct AudioDebugStats; diff --git a/Core/MIPS/IR/IRFrontend.cpp b/Core/MIPS/IR/IRFrontend.cpp index d1ccfec8bf..86f6b0e198 100644 --- a/Core/MIPS/IR/IRFrontend.cpp +++ b/Core/MIPS/IR/IRFrontend.cpp @@ -17,8 +17,8 @@ #include "base/logging.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/SymbolMap.h" #include "Core/Reporting.h" diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index 9c07d83280..12af157044 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -19,7 +19,7 @@ #include "base/logging.h" #include "ext/xxhash.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/StringUtils.h" #include "Core/Core.h" diff --git a/Core/MIPS/JitCommon/JitCommon.cpp b/Core/MIPS/JitCommon/JitCommon.cpp index 232c099ec9..397cc85ad9 100644 --- a/Core/MIPS/JitCommon/JitCommon.cpp +++ b/Core/MIPS/JitCommon/JitCommon.cpp @@ -21,8 +21,8 @@ #include "ext/udis86/udis86.h" #include "Common/StringUtils.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Util/DisArm64.h" #include "Core/Config.h" diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index 6415d5c57e..a85e5a9999 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -21,8 +21,8 @@ #include "math/math_util.h" #include "Common.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/ConfigValues.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSInt.h" diff --git a/Core/MIPS/MIPS/MipsJit.cpp b/Core/MIPS/MIPS/MipsJit.cpp index e7419bf305..345ff74018 100644 --- a/Core/MIPS/MIPS/MipsJit.cpp +++ b/Core/MIPS/MIPS/MipsJit.cpp @@ -20,7 +20,7 @@ #include "base/logging.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Core/Reporting.h" #include "Core/Config.h" #include "Core/Core.h" diff --git a/Core/MIPS/fake/FakeJit.cpp b/Core/MIPS/fake/FakeJit.cpp index 1a521ee68b..25e085c0ed 100644 --- a/Core/MIPS/fake/FakeJit.cpp +++ b/Core/MIPS/fake/FakeJit.cpp @@ -16,7 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "base/logging.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Core/Reporting.h" #include "Core/Config.h" #include "Core/Core.h" diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index f68993d3d8..fb4ec02292 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -24,8 +24,8 @@ #include "math/math_util.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Core.h" #include "Core/MemMap.h" #include "Core/System.h" diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index d4d6bc9ed9..1a60d42b9c 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -27,8 +27,8 @@ #include "Common/Common.h" #include "Common/MemoryUtil.h" #include "Common/MemArena.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/MemMap.h" #include "Core/MemFault.h" diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index a993b98947..0447d6adb9 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -22,9 +22,9 @@ #include "Core/Reporting.h" -#include "Common/ChunkFileDo.h" #include "Common/CPUDetect.h" #include "Common/FileUtil.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/Config.h" diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 46d661b2ce..19a78cc6ac 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -26,8 +26,8 @@ #include "util/text/parsers.h" #include "Common/FileUtil.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/SaveState.h" #include "Core/Config.h" diff --git a/Core/SaveState.h b/Core/SaveState.h index 98b5d9b7d9..f2c1a3a426 100644 --- a/Core/SaveState.h +++ b/Core/SaveState.h @@ -19,7 +19,7 @@ #include #include -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" namespace SaveState { diff --git a/Core/Util/BlockAllocator.cpp b/Core/Util/BlockAllocator.cpp index 10d3d7e627..c302d8e91b 100644 --- a/Core/Util/BlockAllocator.cpp +++ b/Core/Util/BlockAllocator.cpp @@ -18,8 +18,8 @@ #include #include "Common/Log.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/StringUtils.h" #include "Core/Util/BlockAllocator.h" #include "Core/Reporting.h" diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 9b5cb865f4..356bd4ef90 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -26,8 +26,8 @@ #include "image/png_load.h" #include "util/text/utf8.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/HDRemaster.h" #include "Core/Host.h" #include "GPU/ge_constants.h" diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 8535d1fb5e..31a2faa449 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -36,7 +36,7 @@ #include -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/GraphicsContext.h" #include "base/NativeApp.h" #include "base/logging.h" diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 9c490edfa9..73049a864b 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -17,7 +17,7 @@ #include -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/GraphicsContext.h" #include "base/NativeApp.h" #include "base/logging.h" diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 3c3f881aae..1597ae0218 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -19,7 +19,7 @@ #include "profiler/profiler.h" #include "i18n/i18n.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/FileUtil.h" #include "Common/GraphicsContext.h" diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 48d0a332e9..4b8d995983 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -5,16 +5,16 @@ #include "base/timeutil.h" #include "profiler/profiler.h" -#include "Common/ChunkFileDo.h" -#include "Common/ChunkFileDoList.h" #include "Common/ColorConv.h" #include "Common/GraphicsContext.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" +#include "Common/Serialize/SerializeList.h" #include "Core/Reporting.h" #include "GPU/GeDisasm.h" #include "GPU/GPU.h" #include "GPU/GPUCommon.h" #include "GPU/GPUState.h" -#include "ChunkFile.h" #include "Core/Config.h" #include "Core/CoreTiming.h" #include "Core/MemMap.h" diff --git a/GPU/GPUState.cpp b/GPU/GPUState.cpp index c64e57d49f..bc62a3661b 100644 --- a/GPU/GPUState.cpp +++ b/GPU/GPUState.cpp @@ -18,8 +18,8 @@ #include "GPU/ge_constants.h" #include "GPU/GPUState.h" -#include "Common/ChunkFile.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/Serializer.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Core/CoreParameter.h" #include "Core/Config.h" #include "Core/System.h" diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 7000084dcb..eb31fbc95e 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -22,7 +22,7 @@ #include "base/timeutil.h" #include "profiler/profiler.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Common/FileUtil.h" #include "Common/GraphicsContext.h" diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 7a25c34afa..16c8e5cea1 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -7,7 +7,7 @@ #include "file/vfs.h" #include "ui/root.h" -#include "Common/ChunkFileDo.h" +#include "Common/Serialize/SerializeFuncs.h" #include "Common/CommonTypes.h" #include "Common/FixedSizeQueue.h" #include "Core/HW/SimpleAudioDec.h" diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index 747a2a83f0..d07e29c0a5 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -384,8 +384,12 @@ - - + + + + + + @@ -429,7 +433,7 @@ - + diff --git a/UWP/CommonUWP/CommonUWP.vcxproj.filters b/UWP/CommonUWP/CommonUWP.vcxproj.filters index ec50d08b2a..5a670fd890 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj.filters +++ b/UWP/CommonUWP/CommonUWP.vcxproj.filters @@ -11,7 +11,7 @@ - + @@ -55,8 +55,12 @@ - - + + + + + + diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 9b2d62b92a..4f7d7c2899 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -205,7 +205,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Common/Crypto/md5.cpp \ $(SRC)/Common/Crypto/sha1.cpp \ $(SRC)/Common/Crypto/sha256.cpp \ - $(SRC)/Common/ChunkFile.cpp \ + $(SRC)/Common/Serialize/Serializer.cpp \ $(SRC)/Common/ColorConv.cpp \ $(SRC)/Common/ExceptionHandlerSetup.cpp \ $(SRC)/Common/KeyMap.cpp \ diff --git a/libretro/Makefile.common b/libretro/Makefile.common index cf38aae92b..1a347a8acb 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -141,7 +141,7 @@ SOURCES_CXX += \ $(COMMONDIR)/Crypto/sha256.cpp SOURCES_CXX += \ - $(COMMONDIR)/ChunkFile.cpp \ + $(COMMONDIR)/Serialize/Serializer.cpp \ $(COMMONDIR)/ConsoleListener.cpp \ $(COMMONDIR)/ExceptionHandlerSetup.cpp \ $(COMMONDIR)/FileUtil.cpp \ diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 2c782a4b3c..6058b27670 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -6,7 +6,7 @@ #include #include "base/timeutil.h" -#include "Common/ChunkFile.h" +#include "Common/Serialize/Serializer.h" #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/Core.h" From df969a6c31283bce4278b25f07e36715f8cdde0b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 10 Aug 2020 08:04:53 +0000 Subject: [PATCH 12/12] libretro: Buildfix. --- libretro/libretro.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 6058b27670..497cbae28d 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -6,6 +6,7 @@ #include #include "base/timeutil.h" +#include "Common/FileUtil.h" #include "Common/Serialize/Serializer.h" #include "Core/Config.h" #include "Core/ConfigValues.h"