mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Merge pull request #13267 from unknownbrackets/headers
Reorganize DoState headers and cut back on common header includes
This commit is contained in:
commit
6b6ecf4427
@ -416,8 +416,13 @@ add_library(Common STATIC
|
|||||||
${CommonVulkan}
|
${CommonVulkan}
|
||||||
Common/ColorConv.cpp
|
Common/ColorConv.cpp
|
||||||
Common/ColorConv.h
|
Common/ColorConv.h
|
||||||
Common/ChunkFile.cpp
|
Common/Serialize/Serializer.cpp
|
||||||
Common/ChunkFile.h
|
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.cpp
|
||||||
Common/ConsoleListener.h
|
Common/ConsoleListener.h
|
||||||
Common/Crypto/md5.cpp
|
Common/Crypto/md5.cpp
|
||||||
@ -1687,6 +1692,8 @@ add_library(${CoreLibName} ${CoreLinkType}
|
|||||||
Core/HW/SimpleAudioDec.h
|
Core/HW/SimpleAudioDec.h
|
||||||
Core/HW/AsyncIOManager.cpp
|
Core/HW/AsyncIOManager.cpp
|
||||||
Core/HW/AsyncIOManager.h
|
Core/HW/AsyncIOManager.h
|
||||||
|
Core/HW/BufferQueue.cpp
|
||||||
|
Core/HW/BufferQueue.h
|
||||||
Core/HW/Camera.cpp
|
Core/HW/Camera.cpp
|
||||||
Core/HW/Camera.h
|
Core/HW/Camera.h
|
||||||
Core/HW/MediaEngine.cpp
|
Core/HW/MediaEngine.cpp
|
||||||
|
@ -1,714 +0,0 @@
|
|||||||
// 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
|
|
||||||
|
|
||||||
#include "ppsspp_config.h"
|
|
||||||
|
|
||||||
// Extremely simple serialization framework.
|
|
||||||
// Currently mis-named, a native ChunkFile is something different (a RIFF file)
|
|
||||||
|
|
||||||
// (mis)-features:
|
|
||||||
// + Super fast
|
|
||||||
// + Very simple
|
|
||||||
// + Same code is used for serialization and deserializaition (in most cases)
|
|
||||||
// + Sections can be versioned for backwards/forwards compatibility
|
|
||||||
// - Serialization code for anything complex has to be manually written.
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <map>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <deque>
|
|
||||||
#include <list>
|
|
||||||
#include <set>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
#include "Swap.h"
|
|
||||||
#include "FileUtil.h"
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct LinkedListItem : public T
|
|
||||||
{
|
|
||||||
LinkedListItem<T> *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PointerWrap;
|
|
||||||
|
|
||||||
class PointerWrapSection
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PointerWrapSection(PointerWrap &p, int ver, const char *title) : p_(p), ver_(ver), title_(title) {
|
|
||||||
}
|
|
||||||
~PointerWrapSection();
|
|
||||||
|
|
||||||
bool operator == (const int &v) const { return ver_ == v; }
|
|
||||||
bool operator != (const int &v) const { return ver_ != v; }
|
|
||||||
bool operator <= (const int &v) const { return ver_ <= v; }
|
|
||||||
bool operator >= (const int &v) const { return ver_ >= v; }
|
|
||||||
bool operator < (const int &v) const { return ver_ < v; }
|
|
||||||
bool operator > (const int &v) const { return ver_ > v; }
|
|
||||||
|
|
||||||
operator bool() const {
|
|
||||||
return ver_ > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
PointerWrap &p_;
|
|
||||||
int ver_;
|
|
||||||
const char *title_;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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<typename T, bool isPOD = std::is_pod<T>::value, bool isPointer = std::is_pointer<T>::value>
|
|
||||||
#else
|
|
||||||
template<typename T, bool isPOD = __is_pod(T), bool isPointer = std::is_pointer<T>::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<typename T>
|
|
||||||
struct DoHelper<T, true, false>
|
|
||||||
{
|
|
||||||
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
|
|
||||||
MODE_WRITE, // save
|
|
||||||
MODE_MEASURE, // calculate size
|
|
||||||
MODE_VERIFY, // compare
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Error {
|
|
||||||
ERROR_NONE = 0,
|
|
||||||
ERROR_WARNING = 1,
|
|
||||||
ERROR_FAILURE = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
u8 **ptr;
|
|
||||||
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_) {}
|
|
||||||
|
|
||||||
PointerWrapSection Section(const char *title, int ver);
|
|
||||||
|
|
||||||
// The returned object can be compared against the version that was loaded.
|
|
||||||
// This can be used to support versions as old as minVer.
|
|
||||||
// Version = 0 means the section was not found.
|
|
||||||
PointerWrapSection Section(const char *title, int minVer, int ver);
|
|
||||||
|
|
||||||
void SetMode(Mode mode_) {mode = mode_;}
|
|
||||||
Mode GetMode() const {return mode;}
|
|
||||||
u8 **GetPPtr() {return ptr;}
|
|
||||||
void SetError(Error error_);
|
|
||||||
|
|
||||||
const char *GetBadSectionTitle() const {
|
|
||||||
return firstBadSectionTitle_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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<class K, class T>
|
|
||||||
void Do(std::map<K, T *> &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<class K, class T>
|
|
||||||
void Do(std::map<K, T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoMap(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class K, class T>
|
|
||||||
void Do(std::unordered_map<K, T *> &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<class K, class T>
|
|
||||||
void Do(std::unordered_map<K, T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoMap(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class M>
|
|
||||||
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<class K, class T>
|
|
||||||
void Do(std::multimap<K, T *> &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<class K, class T>
|
|
||||||
void Do(std::multimap<K, T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoMultimap(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class K, class T>
|
|
||||||
void Do(std::unordered_multimap<K, T *> &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<class K, class T>
|
|
||||||
void Do(std::unordered_multimap<K, T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoMultimap(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class M>
|
|
||||||
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<class T>
|
|
||||||
void Do(std::vector<T *> &x)
|
|
||||||
{
|
|
||||||
T *dv = NULL;
|
|
||||||
DoVector(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void Do(std::vector<T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoVector(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void Do(std::vector<T> &x, T &default_val)
|
|
||||||
{
|
|
||||||
DoVector(x, default_val);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void DoVector(std::vector<T> &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<class T>
|
|
||||||
void Do(std::deque<T *> &x)
|
|
||||||
{
|
|
||||||
T *dv = NULL;
|
|
||||||
DoDeque(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void Do(std::deque<T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoDeque(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void DoDeque(std::deque<T> &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<class T>
|
|
||||||
void Do(std::list<T *> &x)
|
|
||||||
{
|
|
||||||
T *dv = NULL;
|
|
||||||
Do(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void Do(std::list<T> &x)
|
|
||||||
{
|
|
||||||
T dv = T();
|
|
||||||
DoList(x, dv);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void Do(std::list<T> &x, T &default_val)
|
|
||||||
{
|
|
||||||
DoList(x, default_val);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void DoList(std::list<T> &x, T &default_val)
|
|
||||||
{
|
|
||||||
u32 list_size = (u32)x.size();
|
|
||||||
Do(list_size);
|
|
||||||
x.resize(list_size, default_val);
|
|
||||||
|
|
||||||
typename std::list<T>::iterator itr, end;
|
|
||||||
for (itr = x.begin(), end = x.end(); itr != end; ++itr)
|
|
||||||
Do(*itr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store STL sets.
|
|
||||||
template <class T>
|
|
||||||
void Do(std::set<T *> &x)
|
|
||||||
{
|
|
||||||
if (mode == MODE_READ)
|
|
||||||
{
|
|
||||||
for (auto it = x.begin(), end = x.end(); it != end; ++it)
|
|
||||||
{
|
|
||||||
if (*it != NULL)
|
|
||||||
delete *it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DoSet(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void Do(std::set<T> &x)
|
|
||||||
{
|
|
||||||
DoSet(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void DoSet(std::set<T> &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<T>::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<typename T, typename F>
|
|
||||||
void Do(swap_struct_t<T, F> &x) {
|
|
||||||
T v = x.swap();
|
|
||||||
Do(v);
|
|
||||||
x = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void DoClass(T &x) {
|
|
||||||
x.DoState(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void DoClass(T *&x) {
|
|
||||||
if (mode == MODE_READ)
|
|
||||||
{
|
|
||||||
if (x != NULL)
|
|
||||||
delete x;
|
|
||||||
x = new T();
|
|
||||||
}
|
|
||||||
x->DoState(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void DoArray(T *x, int count) {
|
|
||||||
DoHelper<T>::DoArray(this, x, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void Do(T &x) {
|
|
||||||
DoHelper<T>::Do(this, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
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<class T, LinkedListItem<T>* (*TNew)(), void (*TFree)(LinkedListItem<T>*), void (*TDo)(PointerWrap&, T*)>
|
|
||||||
void DoLinkedList(LinkedListItem<T>*& list_start, LinkedListItem<T>** list_end=0)
|
|
||||||
{
|
|
||||||
LinkedListItem<T>* list_cur = list_start;
|
|
||||||
LinkedListItem<T>* prev = 0;
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
u8 shouldExist = (list_cur ? 1 : 0);
|
|
||||||
Do(shouldExist);
|
|
||||||
if (shouldExist == 1)
|
|
||||||
{
|
|
||||||
LinkedListItem<T>* 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<T>* 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);
|
|
||||||
};
|
|
||||||
|
|
||||||
class CChunkFileReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Error {
|
|
||||||
ERROR_NONE,
|
|
||||||
ERROR_BAD_FILE,
|
|
||||||
ERROR_BROKEN_STATE,
|
|
||||||
ERROR_BAD_ALLOC,
|
|
||||||
};
|
|
||||||
|
|
||||||
// May fail badly if ptr doesn't point to valid data.
|
|
||||||
template<class T>
|
|
||||||
static Error LoadPtr(u8 *ptr, T &_class, std::string *errorString)
|
|
||||||
{
|
|
||||||
PointerWrap p(&ptr, PointerWrap::MODE_READ);
|
|
||||||
_class.DoState(p);
|
|
||||||
|
|
||||||
if (p.error != p.ERROR_FAILURE) {
|
|
||||||
return ERROR_NONE;
|
|
||||||
} else {
|
|
||||||
*errorString = std::string("Failure at ") + p.GetBadSectionTitle();
|
|
||||||
return ERROR_BROKEN_STATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
static size_t MeasurePtr(T &_class)
|
|
||||||
{
|
|
||||||
u8 *ptr = 0;
|
|
||||||
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
|
|
||||||
_class.DoState(p);
|
|
||||||
return (size_t)ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expects ptr to have at least MeasurePtr bytes at ptr.
|
|
||||||
template<class T>
|
|
||||||
static Error SavePtr(u8 *ptr, T &_class)
|
|
||||||
{
|
|
||||||
PointerWrap p(&ptr, PointerWrap::MODE_WRITE);
|
|
||||||
_class.DoState(p);
|
|
||||||
|
|
||||||
if (p.error != p.ERROR_FAILURE) {
|
|
||||||
return ERROR_NONE;
|
|
||||||
} else {
|
|
||||||
return ERROR_BROKEN_STATE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load file template
|
|
||||||
template<class T>
|
|
||||||
static Error Load(const std::string &filename, std::string *gitVersion, T& _class, std::string *failureReason)
|
|
||||||
{
|
|
||||||
*failureReason = "LoadStateWrongVersion";
|
|
||||||
|
|
||||||
u8 *ptr = nullptr;
|
|
||||||
size_t sz;
|
|
||||||
Error error = LoadFile(filename, gitVersion, ptr, sz, failureReason);
|
|
||||||
if (error == ERROR_NONE) {
|
|
||||||
failureReason->clear();
|
|
||||||
error = LoadPtr(ptr, _class, failureReason);
|
|
||||||
delete [] ptr;
|
|
||||||
INFO_LOG(SAVESTATE, "ChunkReader: Done loading '%s'", filename.c_str());
|
|
||||||
} else {
|
|
||||||
WARN_LOG(SAVESTATE, "ChunkReader: Error found during load of '%s'", filename.c_str());
|
|
||||||
}
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save file template
|
|
||||||
template<class T>
|
|
||||||
static Error Save(const std::string &filename, const std::string &title, const char *gitVersion, T& _class)
|
|
||||||
{
|
|
||||||
// Get data
|
|
||||||
size_t const sz = MeasurePtr(_class);
|
|
||||||
u8 *buffer = (u8 *)malloc(sz);
|
|
||||||
if (!buffer)
|
|
||||||
return ERROR_BAD_ALLOC;
|
|
||||||
Error error = SavePtr(buffer, _class);
|
|
||||||
|
|
||||||
// SaveFile takes ownership of buffer
|
|
||||||
if (error == ERROR_NONE)
|
|
||||||
error = SaveFile(filename, title, gitVersion, buffer, sz);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
static Error Verify(T& _class)
|
|
||||||
{
|
|
||||||
u8 *ptr = 0;
|
|
||||||
|
|
||||||
// Step 1: Measure the space required.
|
|
||||||
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
|
|
||||||
_class.DoState(p);
|
|
||||||
size_t const sz = (size_t)ptr;
|
|
||||||
std::vector<u8> buffer(sz);
|
|
||||||
|
|
||||||
// Step 2: Dump the state.
|
|
||||||
ptr = &buffer[0];
|
|
||||||
p.SetMode(PointerWrap::MODE_WRITE);
|
|
||||||
_class.DoState(p);
|
|
||||||
|
|
||||||
// Step 3: Verify the state.
|
|
||||||
ptr = &buffer[0];
|
|
||||||
p.SetMode(PointerWrap::MODE_VERIFY);
|
|
||||||
_class.DoState(p);
|
|
||||||
|
|
||||||
return ERROR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Error GetFileTitle(const std::string &filename, std::string *title);
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct SChunkHeader
|
|
||||||
{
|
|
||||||
int Revision;
|
|
||||||
int Compress;
|
|
||||||
u32 ExpectedSize;
|
|
||||||
u32 UncompressedSize;
|
|
||||||
char GitVersion[32];
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
REVISION_MIN = 4,
|
|
||||||
REVISION_TITLE = 5,
|
|
||||||
REVISION_CURRENT = REVISION_TITLE,
|
|
||||||
};
|
|
||||||
|
|
||||||
static Error LoadFile(const std::string &filename, std::string *gitVersion, u8 *&buffer, size_t &sz, std::string *failureReason);
|
|
||||||
static Error SaveFile(const std::string &filename, const std::string &title, const char *gitVersion, u8 *buffer, size_t sz);
|
|
||||||
static Error LoadFileHeader(File::IOFile &pFile, SChunkHeader &header, std::string *title);
|
|
||||||
};
|
|
@ -33,8 +33,6 @@
|
|||||||
#define LOGGING 1
|
#define LOGGING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STACKALIGN
|
|
||||||
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "CommonTypes.h"
|
#include "CommonTypes.h"
|
||||||
#include "CommonFuncs.h"
|
#include "CommonFuncs.h"
|
||||||
@ -45,17 +43,7 @@
|
|||||||
void operator =(const t &other) = delete;
|
void operator =(const t &other) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#if defined(_WIN32)
|
||||||
// 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)
|
|
||||||
|
|
||||||
// Memory leak checks
|
// Memory leak checks
|
||||||
#define CHECK_HEAP_INTEGRITY()
|
#define CHECK_HEAP_INTEGRITY()
|
||||||
|
@ -354,8 +354,12 @@
|
|||||||
<ClInclude Include="ArmEmitter.h" />
|
<ClInclude Include="ArmEmitter.h" />
|
||||||
<ClInclude Include="BitScan.h" />
|
<ClInclude Include="BitScan.h" />
|
||||||
<ClInclude Include="BitSet.h" />
|
<ClInclude Include="BitSet.h" />
|
||||||
|
<ClInclude Include="Serialize\SerializeDeque.h" />
|
||||||
|
<ClInclude Include="Serialize\SerializeFuncs.h" />
|
||||||
<ClInclude Include="ColorConvNEON.h" />
|
<ClInclude Include="ColorConvNEON.h" />
|
||||||
<ClInclude Include="ChunkFile.h" />
|
<ClInclude Include="Serialize\SerializeList.h" />
|
||||||
|
<ClInclude Include="Serialize\SerializeMap.h" />
|
||||||
|
<ClInclude Include="Serialize\Serializer.h" />
|
||||||
<ClInclude Include="CodeBlock.h" />
|
<ClInclude Include="CodeBlock.h" />
|
||||||
<ClInclude Include="ColorConv.h" />
|
<ClInclude Include="ColorConv.h" />
|
||||||
<ClInclude Include="Common.h" />
|
<ClInclude Include="Common.h" />
|
||||||
@ -405,6 +409,7 @@
|
|||||||
<ClInclude Include="MipsEmitter.h" />
|
<ClInclude Include="MipsEmitter.h" />
|
||||||
<ClInclude Include="MsgHandler.h" />
|
<ClInclude Include="MsgHandler.h" />
|
||||||
<ClInclude Include="OSVersion.h" />
|
<ClInclude Include="OSVersion.h" />
|
||||||
|
<ClInclude Include="Serialize\SerializeSet.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="StringUtils.h" />
|
<ClInclude Include="StringUtils.h" />
|
||||||
<ClInclude Include="Swap.h" />
|
<ClInclude Include="Swap.h" />
|
||||||
@ -444,7 +449,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ChunkFile.cpp" />
|
<ClCompile Include="Serialize\Serializer.cpp" />
|
||||||
<ClCompile Include="ColorConv.cpp" />
|
<ClCompile Include="ColorConv.cpp" />
|
||||||
<ClCompile Include="ConsoleListener.cpp" />
|
<ClCompile Include="ConsoleListener.cpp" />
|
||||||
<ClCompile Include="CPUDetect.cpp" />
|
<ClCompile Include="CPUDetect.cpp" />
|
||||||
@ -524,4 +529,4 @@
|
|||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
@ -3,7 +3,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="ABI.h" />
|
<ClInclude Include="ABI.h" />
|
||||||
<ClInclude Include="ChunkFile.h" />
|
|
||||||
<ClInclude Include="Common.h" />
|
<ClInclude Include="Common.h" />
|
||||||
<ClInclude Include="CommonFuncs.h" />
|
<ClInclude Include="CommonFuncs.h" />
|
||||||
<ClInclude Include="CommonTypes.h" />
|
<ClInclude Include="CommonTypes.h" />
|
||||||
@ -76,6 +75,24 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="ExceptionHandlerSetup.h" />
|
<ClInclude Include="ExceptionHandlerSetup.h" />
|
||||||
<ClInclude Include="MachineContext.h" />
|
<ClInclude Include="MachineContext.h" />
|
||||||
|
<ClInclude Include="Serialize\Serializer.h">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Serialize\SerializeFuncs.h">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Serialize\SerializeMap.h">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Serialize\SerializeList.h">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Serialize\SerializeDeque.h">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Serialize\SerializeSet.h">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp" />
|
<ClCompile Include="stdafx.cpp" />
|
||||||
@ -105,7 +122,6 @@
|
|||||||
<ClCompile Include="Crypto\sha256.cpp">
|
<ClCompile Include="Crypto\sha256.cpp">
|
||||||
<Filter>Crypto</Filter>
|
<Filter>Crypto</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ChunkFile.cpp" />
|
|
||||||
<ClCompile Include="MipsEmitter.cpp" />
|
<ClCompile Include="MipsEmitter.cpp" />
|
||||||
<ClCompile Include="Arm64Emitter.cpp" />
|
<ClCompile Include="Arm64Emitter.cpp" />
|
||||||
<ClCompile Include="ColorConv.cpp" />
|
<ClCompile Include="ColorConv.cpp" />
|
||||||
@ -140,6 +156,9 @@
|
|||||||
<Filter>Vulkan</Filter>
|
<Filter>Vulkan</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ExceptionHandlerSetup.cpp" />
|
<ClCompile Include="ExceptionHandlerSetup.cpp" />
|
||||||
|
<ClCompile Include="Serialize\Serializer.cpp">
|
||||||
|
<Filter>Serialize</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Crypto">
|
<Filter Include="Crypto">
|
||||||
@ -154,5 +173,8 @@
|
|||||||
<Filter Include="Vulkan">
|
<Filter Include="Vulkan">
|
||||||
<UniqueIdentifier>{c14d66ef-5f7c-4565-975a-72774e7ccfb9}</UniqueIdentifier>
|
<UniqueIdentifier>{c14d66ef-5f7c-4565-975a-72774e7ccfb9}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Serialize">
|
||||||
|
<UniqueIdentifier>{7be79ad5-3520-46a1-a370-dce2a943978c}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <algorithm> // min
|
#include <algorithm> // min
|
||||||
|
#include <cstring>
|
||||||
#include <string> // System: To be able to add strings with "+"
|
#include <string> // System: To be able to add strings with "+"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "ppsspp_config.h"
|
#include "ppsspp_config.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
@ -35,16 +35,6 @@ inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
|
|||||||
|
|
||||||
namespace File {
|
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<FSTEntry> children;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FileDetails {
|
struct FileDetails {
|
||||||
bool isDirectory;
|
bool isDirectory;
|
||||||
u64 size;
|
u64 size;
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "ChunkFile.h"
|
#include "Common/MemoryUtil.h"
|
||||||
#include "MemoryUtil.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
|
||||||
// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
|
// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
|
||||||
// real STL classes.
|
// real STL classes.
|
||||||
@ -147,16 +147,16 @@ public:
|
|||||||
|
|
||||||
void DoState(PointerWrap &p) {
|
void DoState(PointerWrap &p) {
|
||||||
int size = N;
|
int size = N;
|
||||||
p.Do(size);
|
Do(p, size);
|
||||||
if (size != N)
|
if (size != N)
|
||||||
{
|
{
|
||||||
ERROR_LOG(COMMON, "Savestate failure: Incompatible queue size.");
|
ERROR_LOG(COMMON, "Savestate failure: Incompatible queue size.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.DoArray<T>(storage_, N);
|
DoArray<T>(p, storage_, N);
|
||||||
p.Do(head_);
|
Do(p, head_);
|
||||||
p.Do(tail_);
|
Do(p, tail_);
|
||||||
p.Do(count_);
|
Do(p, count_);
|
||||||
p.DoMarker("FixedSizeQueue");
|
p.DoMarker("FixedSizeQueue");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,13 +19,12 @@
|
|||||||
|
|
||||||
#include "ppsspp_config.h"
|
#include "ppsspp_config.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <fstream>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "file/ini_file.h"
|
#include "file/ini_file.h"
|
||||||
#include "Log.h"
|
#include "Common/Log.h"
|
||||||
#include "StringUtils.h"
|
|
||||||
#include "FileUtil.h"
|
|
||||||
|
|
||||||
#define MAX_MESSAGES 8000
|
#define MAX_MESSAGES 8000
|
||||||
|
|
||||||
|
44
Common/Serialize/SerializeDeque.h
Normal file
44
Common/Serialize/SerializeDeque.h
Normal file
@ -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 Serializer.h.
|
||||||
|
#include <deque>
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void DoDeque(PointerWrap &p, std::deque<T> &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<class T>
|
||||||
|
void Do(PointerWrap &p, std::deque<T *> &x) {
|
||||||
|
T *dv = nullptr;
|
||||||
|
DoDeque(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, std::deque<T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoDeque(p, x, dv);
|
||||||
|
}
|
128
Common/Serialize/SerializeFuncs.h
Normal file
128
Common/Serialize/SerializeFuncs.h
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
// 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 Serializer.h.
|
||||||
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Swap.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<typename T, bool isPOD = std::is_pod<T>::value, bool isPointer = std::is_pointer<T>::value>
|
||||||
|
#else
|
||||||
|
template<typename T, bool isPOD = __is_pod(T), bool isPointer = std::is_pointer<T>::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<typename T>
|
||||||
|
struct DoHelper_<T, true, false> {
|
||||||
|
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<class T>
|
||||||
|
void DoClass(PointerWrap &p, T &x) {
|
||||||
|
x.DoState(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void DoClass(PointerWrap &p, T *&x) {
|
||||||
|
if (p.mode == PointerWrap::MODE_READ) {
|
||||||
|
if (x != nullptr)
|
||||||
|
delete x;
|
||||||
|
x = new T();
|
||||||
|
}
|
||||||
|
x->DoState(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void DoArray(PointerWrap &p, T *x, int count) {
|
||||||
|
DoHelper_<T>::DoArray(p, x, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, T &x) {
|
||||||
|
DoHelper_<T>::DoThing(p, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void DoVector(PointerWrap &p, std::vector<T> &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<class T>
|
||||||
|
void Do(PointerWrap &p, std::vector<T *> &x) {
|
||||||
|
T *dv = nullptr;
|
||||||
|
DoVector(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, std::vector<T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoVector(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, std::vector<T> &x, T &default_val) {
|
||||||
|
DoVector(p, x, default_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T, typename F>
|
||||||
|
void Do(PointerWrap &p, swap_struct_t<T, F> &x) {
|
||||||
|
T v = x.swap();
|
||||||
|
Do(p, v);
|
||||||
|
x = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
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;
|
||||||
|
}
|
101
Common/Serialize/SerializeList.h
Normal file
101
Common/Serialize/SerializeList.h
Normal file
@ -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 Serializer.h.
|
||||||
|
#include <list>
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void DoList(PointerWrap &p, std::list<T> &x, T &default_val) {
|
||||||
|
u32 list_size = (u32)x.size();
|
||||||
|
Do(p, list_size);
|
||||||
|
x.resize(list_size, default_val);
|
||||||
|
|
||||||
|
typename std::list<T>::iterator itr, end;
|
||||||
|
for (itr = x.begin(), end = x.end(); itr != end; ++itr)
|
||||||
|
Do(p, *itr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, std::list<T *> &x) {
|
||||||
|
T *dv = nullptr;
|
||||||
|
Do(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, std::list<T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoList(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Do(PointerWrap &p, std::list<T> &x, T &default_val) {
|
||||||
|
DoList(p, x, default_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, LinkedListItem<T> *(*TNew)(), void (*TFree)(LinkedListItem<T> *), void (*TDo)(PointerWrap &, T *)>
|
||||||
|
void DoLinkedList(PointerWrap &p, LinkedListItem<T> *&list_start, LinkedListItem<T> **list_end = nullptr) {
|
||||||
|
LinkedListItem<T> *list_cur = list_start;
|
||||||
|
LinkedListItem<T> *prev = nullptr;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
u8 shouldExist = (list_cur ? 1 : 0);
|
||||||
|
Do(p, shouldExist);
|
||||||
|
if (shouldExist == 1) {
|
||||||
|
LinkedListItem<T> *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<T> *next = list_cur->next;
|
||||||
|
TFree(list_cur);
|
||||||
|
list_cur = next;
|
||||||
|
} while (list_cur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
prev = list_cur;
|
||||||
|
list_cur = list_cur->next;
|
||||||
|
}
|
||||||
|
}
|
164
Common/Serialize/SerializeMap.h
Normal file
164
Common/Serialize/SerializeMap.h
Normal file
@ -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 Serializer.h.
|
||||||
|
#include <map>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
|
||||||
|
template<class M>
|
||||||
|
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<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::map<K, T *> &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<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::map<K, T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoMap(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::unordered_map<K, T *> &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<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::unordered_map<K, T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoMap(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class M>
|
||||||
|
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<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::multimap<K, T *> &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<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::multimap<K, T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoMultimap(p, x, dv);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::unordered_multimap<K, T *> &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<class K, class T>
|
||||||
|
void Do(PointerWrap &p, std::unordered_multimap<K, T> &x) {
|
||||||
|
T dv = T();
|
||||||
|
DoMultimap(p, x, dv);
|
||||||
|
}
|
69
Common/Serialize/SerializeSet.h
Normal file
69
Common/Serialize/SerializeSet.h
Normal file
@ -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 Serializer.h.
|
||||||
|
#include <set>
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void DoSet(PointerWrap &p, std::set<T> &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<T>::iterator itr = x.begin();
|
||||||
|
while (number-- > 0)
|
||||||
|
Do(p, *itr++);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ERROR_LOG(SAVESTATE, "Savestate error: invalid mode %d.", p.mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void Do(PointerWrap &p, std::set<T *> &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 <class T>
|
||||||
|
void Do(PointerWrap &p, std::set<T> &x) {
|
||||||
|
DoSet(p, x);
|
||||||
|
}
|
@ -19,8 +19,10 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <snappy-c.h>
|
#include <snappy-c.h>
|
||||||
|
|
||||||
#include "ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
#include "StringUtils.h"
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/FileUtil.h"
|
||||||
|
#include "Common/StringUtils.h"
|
||||||
|
|
||||||
PointerWrapSection PointerWrap::Section(const char *title, int ver) {
|
PointerWrapSection PointerWrap::Section(const char *title, int ver) {
|
||||||
return Section(title, ver, ver);
|
return Section(title, ver, ver);
|
||||||
@ -42,7 +44,7 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver)
|
|||||||
foundVersion = 0;
|
foundVersion = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Do(foundVersion);
|
Do(*this, foundVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) {
|
if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) {
|
||||||
@ -95,43 +97,43 @@ void PointerWrap::DoVoid(void *data, int size) {
|
|||||||
(*ptr) += size;
|
(*ptr) += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerWrap::Do(std::string &x) {
|
void Do(PointerWrap &p, std::string &x) {
|
||||||
int stringLen = (int)x.length() + 1;
|
int stringLen = (int)x.length() + 1;
|
||||||
Do(stringLen);
|
Do(p, stringLen);
|
||||||
|
|
||||||
switch (mode) {
|
switch (p.mode) {
|
||||||
case MODE_READ: x = (char*)*ptr; break;
|
case PointerWrap::MODE_READ: x = (char*)*p.ptr; break;
|
||||||
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
|
case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break;
|
||||||
case MODE_MEASURE: break;
|
case PointerWrap::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;
|
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);
|
int stringLen = sizeof(wchar_t)*((int)x.length() + 1);
|
||||||
Do(stringLen);
|
Do(p, stringLen);
|
||||||
|
|
||||||
switch (mode) {
|
switch (p.mode) {
|
||||||
case MODE_READ: x = (wchar_t*)*ptr; break;
|
case PointerWrap::MODE_READ: x = (wchar_t*)*p.ptr; break;
|
||||||
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
|
case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break;
|
||||||
case MODE_MEASURE: break;
|
case PointerWrap::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;
|
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);
|
int stringLen = sizeof(char16_t) * ((int)x.length() + 1);
|
||||||
Do(stringLen);
|
Do(p, stringLen);
|
||||||
|
|
||||||
switch (mode) {
|
switch (p.mode) {
|
||||||
case MODE_READ: x = (char16_t*)*ptr; break;
|
case PointerWrap::MODE_READ: x = (char16_t*)*p.ptr; break;
|
||||||
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
|
case PointerWrap::MODE_WRITE: memcpy(*p.ptr, x.c_str(), stringLen); break;
|
||||||
case MODE_MEASURE: break;
|
case PointerWrap::MODE_MEASURE: break;
|
||||||
case MODE_VERIFY: _dbg_assert_msg_(x == (char16_t*)*ptr, "Savestate verification failure: (at %p).\n", x.c_str()); 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 {
|
struct standard_tm {
|
||||||
@ -146,31 +148,31 @@ struct standard_tm {
|
|||||||
int tm_isdst;
|
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.
|
// We savestate this separately because some platforms use extra data at the end.
|
||||||
// However, old files may have the native tm in them.
|
// 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.
|
// 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.
|
// If our funny value ('tm' 0x1337) exists, it's a new version savestate.
|
||||||
int funnyValue = 0x13376D74;
|
int funnyValue = 0x13376D74;
|
||||||
if (ExpectVoid(&funnyValue, sizeof(funnyValue))) {
|
if (p.ExpectVoid(&funnyValue, sizeof(funnyValue))) {
|
||||||
standard_tm stm;
|
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.
|
// Null out the extra members, e.g. tm_gmtoff or tm_zone.
|
||||||
memset(&t, 0, sizeof(t));
|
memset(&t, 0, sizeof(t));
|
||||||
} else {
|
} else {
|
||||||
memcpy(&stm, &t, sizeof(stm));
|
memcpy(&stm, &t, sizeof(stm));
|
||||||
}
|
}
|
||||||
|
|
||||||
DoVoid((void *)&stm, sizeof(stm));
|
p.DoVoid((void *)&stm, sizeof(stm));
|
||||||
memcpy(&t, &stm, sizeof(stm));
|
memcpy(&t, &stm, sizeof(stm));
|
||||||
} else {
|
} else {
|
||||||
DoVoid((void *)&t, sizeof(t));
|
p.DoVoid((void *)&t, sizeof(t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerWrap::DoMarker(const char *prevName, u32 arbitraryNumber) {
|
void PointerWrap::DoMarker(const char *prevName, u32 arbitraryNumber) {
|
||||||
u32 cookie = arbitraryNumber;
|
u32 cookie = arbitraryNumber;
|
||||||
Do(cookie);
|
Do(*this, cookie);
|
||||||
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) {
|
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);
|
_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);
|
SetError(ERROR_FAILURE);
|
253
Common/Serialize/Serializer.h
Normal file
253
Common/Serialize/Serializer.h
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
// 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
|
||||||
|
|
||||||
|
#include "ppsspp_config.h"
|
||||||
|
|
||||||
|
// Extremely simple serialization framework.
|
||||||
|
// Currently mis-named, a native ChunkFile is something different (a RIFF file)
|
||||||
|
|
||||||
|
// (mis)-features:
|
||||||
|
// + Super fast
|
||||||
|
// + Very simple
|
||||||
|
// + Same code is used for serialization and deserializaition (in most cases)
|
||||||
|
// + Sections can be versioned for backwards/forwards compatibility
|
||||||
|
// - Serialization code for anything complex has to be manually written.
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/Log.h"
|
||||||
|
|
||||||
|
namespace File {
|
||||||
|
class IOFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct LinkedListItem : public T
|
||||||
|
{
|
||||||
|
LinkedListItem<T> *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PointerWrap;
|
||||||
|
|
||||||
|
class PointerWrapSection
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PointerWrapSection(PointerWrap &p, int ver, const char *title) : p_(p), ver_(ver), title_(title) {
|
||||||
|
}
|
||||||
|
~PointerWrapSection();
|
||||||
|
|
||||||
|
bool operator == (const int &v) const { return ver_ == v; }
|
||||||
|
bool operator != (const int &v) const { return ver_ != v; }
|
||||||
|
bool operator <= (const int &v) const { return ver_ <= v; }
|
||||||
|
bool operator >= (const int &v) const { return ver_ >= v; }
|
||||||
|
bool operator < (const int &v) const { return ver_ < v; }
|
||||||
|
bool operator > (const int &v) const { return ver_ > v; }
|
||||||
|
|
||||||
|
operator bool() const {
|
||||||
|
return ver_ > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
PointerWrap &p_;
|
||||||
|
int ver_;
|
||||||
|
const char *title_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Wrapper class
|
||||||
|
class PointerWrap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Mode {
|
||||||
|
MODE_READ = 1, // load
|
||||||
|
MODE_WRITE, // save
|
||||||
|
MODE_MEASURE, // calculate size
|
||||||
|
MODE_VERIFY, // compare
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Error {
|
||||||
|
ERROR_NONE = 0,
|
||||||
|
ERROR_WARNING = 1,
|
||||||
|
ERROR_FAILURE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 **ptr;
|
||||||
|
Mode mode;
|
||||||
|
Error error = ERROR_NONE;
|
||||||
|
|
||||||
|
PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {}
|
||||||
|
PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {}
|
||||||
|
|
||||||
|
PointerWrapSection Section(const char *title, int ver);
|
||||||
|
|
||||||
|
// The returned object can be compared against the version that was loaded.
|
||||||
|
// This can be used to support versions as old as minVer.
|
||||||
|
// Version = 0 means the section was not found.
|
||||||
|
PointerWrapSection Section(const char *title, int minVer, int ver);
|
||||||
|
|
||||||
|
void SetMode(Mode mode_) {mode = mode_;}
|
||||||
|
Mode GetMode() const {return mode;}
|
||||||
|
u8 **GetPPtr() {return ptr;}
|
||||||
|
void SetError(Error error_);
|
||||||
|
|
||||||
|
const char *GetBadSectionTitle() const {
|
||||||
|
return firstBadSectionTitle_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
void DoMarker(const char *prevName, u32 arbitraryNumber = 0x42);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char *firstBadSectionTitle_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CChunkFileReader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Error {
|
||||||
|
ERROR_NONE,
|
||||||
|
ERROR_BAD_FILE,
|
||||||
|
ERROR_BROKEN_STATE,
|
||||||
|
ERROR_BAD_ALLOC,
|
||||||
|
};
|
||||||
|
|
||||||
|
// May fail badly if ptr doesn't point to valid data.
|
||||||
|
template<class T>
|
||||||
|
static Error LoadPtr(u8 *ptr, T &_class, std::string *errorString)
|
||||||
|
{
|
||||||
|
PointerWrap p(&ptr, PointerWrap::MODE_READ);
|
||||||
|
_class.DoState(p);
|
||||||
|
|
||||||
|
if (p.error != p.ERROR_FAILURE) {
|
||||||
|
return ERROR_NONE;
|
||||||
|
} else {
|
||||||
|
*errorString = std::string("Failure at ") + p.GetBadSectionTitle();
|
||||||
|
return ERROR_BROKEN_STATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
static size_t MeasurePtr(T &_class)
|
||||||
|
{
|
||||||
|
u8 *ptr = 0;
|
||||||
|
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
|
||||||
|
_class.DoState(p);
|
||||||
|
return (size_t)ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expects ptr to have at least MeasurePtr bytes at ptr.
|
||||||
|
template<class T>
|
||||||
|
static Error SavePtr(u8 *ptr, T &_class)
|
||||||
|
{
|
||||||
|
PointerWrap p(&ptr, PointerWrap::MODE_WRITE);
|
||||||
|
_class.DoState(p);
|
||||||
|
|
||||||
|
if (p.error != p.ERROR_FAILURE) {
|
||||||
|
return ERROR_NONE;
|
||||||
|
} else {
|
||||||
|
return ERROR_BROKEN_STATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load file template
|
||||||
|
template<class T>
|
||||||
|
static Error Load(const std::string &filename, std::string *gitVersion, T& _class, std::string *failureReason)
|
||||||
|
{
|
||||||
|
*failureReason = "LoadStateWrongVersion";
|
||||||
|
|
||||||
|
u8 *ptr = nullptr;
|
||||||
|
size_t sz;
|
||||||
|
Error error = LoadFile(filename, gitVersion, ptr, sz, failureReason);
|
||||||
|
if (error == ERROR_NONE) {
|
||||||
|
failureReason->clear();
|
||||||
|
error = LoadPtr(ptr, _class, failureReason);
|
||||||
|
delete [] ptr;
|
||||||
|
INFO_LOG(SAVESTATE, "ChunkReader: Done loading '%s'", filename.c_str());
|
||||||
|
} else {
|
||||||
|
WARN_LOG(SAVESTATE, "ChunkReader: Error found during load of '%s'", filename.c_str());
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save file template
|
||||||
|
template<class T>
|
||||||
|
static Error Save(const std::string &filename, const std::string &title, const char *gitVersion, T& _class)
|
||||||
|
{
|
||||||
|
// Get data
|
||||||
|
size_t const sz = MeasurePtr(_class);
|
||||||
|
u8 *buffer = (u8 *)malloc(sz);
|
||||||
|
if (!buffer)
|
||||||
|
return ERROR_BAD_ALLOC;
|
||||||
|
Error error = SavePtr(buffer, _class);
|
||||||
|
|
||||||
|
// SaveFile takes ownership of buffer
|
||||||
|
if (error == ERROR_NONE)
|
||||||
|
error = SaveFile(filename, title, gitVersion, buffer, sz);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
static Error Verify(T& _class)
|
||||||
|
{
|
||||||
|
u8 *ptr = 0;
|
||||||
|
|
||||||
|
// Step 1: Measure the space required.
|
||||||
|
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
|
||||||
|
_class.DoState(p);
|
||||||
|
size_t const sz = (size_t)ptr;
|
||||||
|
std::vector<u8> buffer(sz);
|
||||||
|
|
||||||
|
// Step 2: Dump the state.
|
||||||
|
ptr = &buffer[0];
|
||||||
|
p.SetMode(PointerWrap::MODE_WRITE);
|
||||||
|
_class.DoState(p);
|
||||||
|
|
||||||
|
// Step 3: Verify the state.
|
||||||
|
ptr = &buffer[0];
|
||||||
|
p.SetMode(PointerWrap::MODE_VERIFY);
|
||||||
|
_class.DoState(p);
|
||||||
|
|
||||||
|
return ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Error GetFileTitle(const std::string &filename, std::string *title);
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct SChunkHeader
|
||||||
|
{
|
||||||
|
int Revision;
|
||||||
|
int Compress;
|
||||||
|
u32 ExpectedSize;
|
||||||
|
u32 UncompressedSize;
|
||||||
|
char GitVersion[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
REVISION_MIN = 4,
|
||||||
|
REVISION_TITLE = 5,
|
||||||
|
REVISION_CURRENT = REVISION_TITLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
static Error LoadFile(const std::string &filename, std::string *gitVersion, u8 *&buffer, size_t &sz, std::string *failureReason);
|
||||||
|
static Error SaveFile(const std::string &filename, const std::string &title, const char *gitVersion, u8 *buffer, size_t sz);
|
||||||
|
static Error LoadFileHeader(File::IOFile &pFile, SChunkHeader &header, std::string *title);
|
||||||
|
};
|
@ -15,6 +15,7 @@
|
|||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
void DoState(PointerWrap &p) {
|
void DoState(PointerWrap &p) {
|
||||||
std::lock_guard<std::mutex> guard(lock);
|
std::lock_guard<std::mutex> guard(lock);
|
||||||
p.Do(list);
|
Do(p, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include "file/ini_file.h"
|
#include "file/ini_file.h"
|
||||||
#include "Core/Compatibility.h"
|
#include "Core/Compatibility.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
@ -388,6 +388,7 @@
|
|||||||
<ClCompile Include="HLE\sceUsbAcc.cpp" />
|
<ClCompile Include="HLE\sceUsbAcc.cpp" />
|
||||||
<ClCompile Include="HLE\sceUsbCam.cpp" />
|
<ClCompile Include="HLE\sceUsbCam.cpp" />
|
||||||
<ClCompile Include="HLE\sceUsbMic.cpp" />
|
<ClCompile Include="HLE\sceUsbMic.cpp" />
|
||||||
|
<ClCompile Include="HW\BufferQueue.cpp" />
|
||||||
<ClCompile Include="HW\Camera.cpp" />
|
<ClCompile Include="HW\Camera.cpp" />
|
||||||
<ClCompile Include="Instance.cpp" />
|
<ClCompile Include="Instance.cpp" />
|
||||||
<ClCompile Include="MemFault.cpp" />
|
<ClCompile Include="MemFault.cpp" />
|
||||||
|
@ -748,13 +748,16 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="MemFault.cpp">
|
<ClCompile Include="MemFault.cpp">
|
||||||
<Filter>Core</Filter>
|
<Filter>Core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Util\PortManager.cpp">
|
<ClCompile Include="Util\PortManager.cpp">
|
||||||
<Filter>Util</Filter>
|
<Filter>Util</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Instance.cpp">
|
<ClCompile Include="Instance.cpp">
|
||||||
<Filter>Core</Filter>
|
<Filter>Core</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="HW\BufferQueue.cpp">
|
||||||
|
<Filter>HW</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="ELF\ElfReader.h">
|
<ClInclude Include="ELF\ElfReader.h">
|
||||||
@ -1396,7 +1399,7 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="MemFault.h">
|
<ClInclude Include="MemFault.h">
|
||||||
<Filter>Core</Filter>
|
<Filter>Core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Util\PortManager.h">
|
<ClInclude Include="Util\PortManager.h">
|
||||||
<Filter>Util</Filter>
|
<Filter>Util</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "profiler/profiler.h"
|
#include "profiler/profiler.h"
|
||||||
|
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeList.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
@ -31,7 +33,6 @@
|
|||||||
#include "Core/HLE/sceDisplay.h"
|
#include "Core/HLE/sceDisplay.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
static const int initialHz = 222000000;
|
static const int initialHz = 222000000;
|
||||||
int CPU_HZ = 222000000;
|
int CPU_HZ = 222000000;
|
||||||
@ -671,14 +672,14 @@ std::string GetScheduledEventsSummary() {
|
|||||||
void Event_DoState(PointerWrap &p, BaseEvent *ev)
|
void Event_DoState(PointerWrap &p, BaseEvent *ev)
|
||||||
{
|
{
|
||||||
// There may be padding, so do each one individually.
|
// There may be padding, so do each one individually.
|
||||||
p.Do(ev->time);
|
Do(p, ev->time);
|
||||||
p.Do(ev->userdata);
|
Do(p, ev->userdata);
|
||||||
p.Do(ev->type);
|
Do(p, ev->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event_DoStateOld(PointerWrap &p, BaseEvent *ev)
|
void Event_DoStateOld(PointerWrap &p, BaseEvent *ev)
|
||||||
{
|
{
|
||||||
p.Do(*ev);
|
Do(p, *ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
@ -690,26 +691,26 @@ void DoState(PointerWrap &p)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int n = (int) event_types.size();
|
int n = (int) event_types.size();
|
||||||
p.Do(n);
|
Do(p, n);
|
||||||
// These (should) be filled in later by the modules.
|
// These (should) be filled in later by the modules.
|
||||||
event_types.resize(n, EventType(AntiCrashCallback, "INVALID EVENT"));
|
event_types.resize(n, EventType(AntiCrashCallback, "INVALID EVENT"));
|
||||||
|
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.DoLinkedList<BaseEvent, GetNewEvent, FreeEvent, Event_DoState>(first, (Event **) NULL);
|
DoLinkedList<BaseEvent, GetNewEvent, FreeEvent, Event_DoState>(p, first, (Event **) NULL);
|
||||||
p.DoLinkedList<BaseEvent, GetNewTsEvent, FreeTsEvent, Event_DoState>(tsFirst, &tsLast);
|
DoLinkedList<BaseEvent, GetNewTsEvent, FreeTsEvent, Event_DoState>(p, tsFirst, &tsLast);
|
||||||
} else {
|
} else {
|
||||||
p.DoLinkedList<BaseEvent, GetNewEvent, FreeEvent, Event_DoStateOld>(first, (Event **) NULL);
|
DoLinkedList<BaseEvent, GetNewEvent, FreeEvent, Event_DoStateOld>(p, first, (Event **) NULL);
|
||||||
p.DoLinkedList<BaseEvent, GetNewTsEvent, FreeTsEvent, Event_DoStateOld>(tsFirst, &tsLast);
|
DoLinkedList<BaseEvent, GetNewTsEvent, FreeTsEvent, Event_DoStateOld>(p, tsFirst, &tsLast);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(CPU_HZ);
|
Do(p, CPU_HZ);
|
||||||
p.Do(slicelength);
|
Do(p, slicelength);
|
||||||
p.Do(globalTimer);
|
Do(p, globalTimer);
|
||||||
p.Do(idledCycles);
|
Do(p, idledCycles);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(lastGlobalTimeTicks);
|
Do(p, lastGlobalTimeTicks);
|
||||||
p.Do(lastGlobalTimeUs);
|
Do(p, lastGlobalTimeUs);
|
||||||
} else {
|
} else {
|
||||||
lastGlobalTimeTicks = 0;
|
lastGlobalTimeTicks = 0;
|
||||||
lastGlobalTimeUs = 0;
|
lastGlobalTimeUs = 0;
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
#include "Common/StringUtils.h"
|
#include "Common/StringUtils.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/CoreParameter.h"
|
#include "Core/CoreParameter.h"
|
||||||
@ -304,7 +305,7 @@ void __CheatDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(CheatEvent);
|
Do(p, CheatEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(CheatEvent, "CheatEvent", &hleCheat);
|
CoreTiming::RestoreRegisterEvent(CheatEvent, "CheatEvent", &hleCheat);
|
||||||
|
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Common/StringUtils.h"
|
#include "Common/StringUtils.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HLE/sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
@ -137,26 +138,26 @@ void PSPDialog::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(status);
|
Do(p, status);
|
||||||
p.Do(lastButtons);
|
Do(p, lastButtons);
|
||||||
p.Do(buttons);
|
Do(p, buttons);
|
||||||
p.Do(fadeTimer);
|
Do(p, fadeTimer);
|
||||||
p.Do(isFading);
|
Do(p, isFading);
|
||||||
p.Do(fadeIn);
|
Do(p, fadeIn);
|
||||||
p.Do(fadeValue);
|
Do(p, fadeValue);
|
||||||
|
|
||||||
// I don't think we should save these two... Let's just ignore them for now for compat.
|
// I don't think we should save these two... Let's just ignore them for now for compat.
|
||||||
int okButtonImg = 0;
|
int okButtonImg = 0;
|
||||||
p.Do(okButtonImg);
|
Do(p, okButtonImg);
|
||||||
int cancelButtonImg = 0;
|
int cancelButtonImg = 0;
|
||||||
p.Do(cancelButtonImg);
|
Do(p, cancelButtonImg);
|
||||||
|
|
||||||
p.Do(okButtonFlag);
|
Do(p, okButtonFlag);
|
||||||
p.Do(cancelButtonFlag);
|
Do(p, cancelButtonFlag);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(pendingStatus);
|
Do(p, pendingStatus);
|
||||||
p.Do(pendingStatusTicks);
|
Do(p, pendingStatusTicks);
|
||||||
} else {
|
} else {
|
||||||
pendingStatusTicks = 0;
|
pendingStatusTicks = 0;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/ELF/ParamSFO.h"
|
#include "Core/ELF/ParamSFO.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
@ -260,25 +261,25 @@ void PSPGamedataInstallDialog::DoState(PointerWrap &p) {
|
|||||||
|
|
||||||
// This was included in version 1 and higher.
|
// This was included in version 1 and higher.
|
||||||
PSPDialog::DoState(p);
|
PSPDialog::DoState(p);
|
||||||
p.Do(request);
|
Do(p, request);
|
||||||
|
|
||||||
// This was included in version 2 and higher, but for BC reasons we use 3+.
|
// This was included in version 2 and higher, but for BC reasons we use 3+.
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(param.ptr);
|
Do(p, param.ptr);
|
||||||
p.Do(inFileNames);
|
Do(p, inFileNames);
|
||||||
p.Do(numFiles);
|
Do(p, numFiles);
|
||||||
p.Do(readFiles);
|
Do(p, readFiles);
|
||||||
p.Do(allFilesSize);
|
Do(p, allFilesSize);
|
||||||
p.Do(allReadSize);
|
Do(p, allReadSize);
|
||||||
p.Do(progressValue);
|
Do(p, progressValue);
|
||||||
} else {
|
} else {
|
||||||
param.ptr = 0;
|
param.ptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(currentInputFile);
|
Do(p, currentInputFile);
|
||||||
p.Do(currentInputBytesLeft);
|
Do(p, currentInputBytesLeft);
|
||||||
p.Do(currentOutputFile);
|
Do(p, currentOutputFile);
|
||||||
} else {
|
} else {
|
||||||
currentInputFile = 0;
|
currentInputFile = 0;
|
||||||
currentInputBytesLeft = 0;
|
currentInputBytesLeft = 0;
|
||||||
|
@ -16,14 +16,15 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/StringUtils.h"
|
||||||
#include "Core/Dialog/PSPMsgDialog.h"
|
#include "Core/Dialog/PSPMsgDialog.h"
|
||||||
#include "Core/Dialog/PSPSaveDialog.h"
|
#include "Core/Dialog/PSPSaveDialog.h"
|
||||||
#include "Core/Util/PPGeDraw.h"
|
#include "Core/Util/PPGeDraw.h"
|
||||||
#include "Core/HLE/sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
#include "Common/StringUtils.h"
|
|
||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
#include "util/text/utf8.h"
|
#include "util/text/utf8.h"
|
||||||
|
|
||||||
@ -378,11 +379,11 @@ void PSPMsgDialog::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(flag);
|
Do(p, flag);
|
||||||
p.Do(messageDialog);
|
Do(p, messageDialog);
|
||||||
p.Do(messageDialogAddr);
|
Do(p, messageDialogAddr);
|
||||||
p.DoArray(msgText, sizeof(msgText));
|
DoArray(p, msgText, sizeof(msgText));
|
||||||
p.Do(yesnoChoice);
|
Do(p, yesnoChoice);
|
||||||
|
|
||||||
// We don't save state this, you'll just have to scroll down again.
|
// We don't save state this, you'll just have to scroll down again.
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
|
@ -15,15 +15,16 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "PSPNetconfDialog.h"
|
#include "i18n/i18n.h"
|
||||||
#include "ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
|
#include "Core/Dialog/PSPNetconfDialog.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/HLE/sceNetAdhoc.h"
|
#include "Core/HLE/sceNetAdhoc.h"
|
||||||
#include "Core/Util/PPGeDraw.h"
|
#include "Core/Util/PPGeDraw.h"
|
||||||
#include "Core/HLE/sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
#include "Core/HLE/sceUtility.h"
|
#include "Core/HLE/sceUtility.h"
|
||||||
#include "i18n/i18n.h"
|
|
||||||
|
|
||||||
#define NETCONF_CONNECT_APNET 0
|
#define NETCONF_CONNECT_APNET 0
|
||||||
#define NETCONF_STATUS_APNET 1
|
#define NETCONF_STATUS_APNET 1
|
||||||
@ -140,5 +141,5 @@ void PSPNetconfDialog::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(request);
|
Do(p, request);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "math/math_util.h"
|
#include "math/math_util.h"
|
||||||
#include "util/text/utf8.h"
|
#include "util/text/utf8.h"
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Dialog/PSPOskDialog.h"
|
#include "Core/Dialog/PSPOskDialog.h"
|
||||||
#include "Core/Util/PPGeDraw.h"
|
#include "Core/Util/PPGeDraw.h"
|
||||||
#include "Core/HLE/sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
@ -28,7 +29,7 @@
|
|||||||
#include "Core/HLE/sceUtility.h"
|
#include "Core/HLE/sceUtility.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
#include "GPU/GPUState.h"
|
#include "GPU/GPUState.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -1135,17 +1136,17 @@ void PSPOskDialog::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(oskParams);
|
Do(p, oskParams);
|
||||||
p.Do(oskDesc);
|
Do(p, oskDesc);
|
||||||
p.Do(oskIntext);
|
Do(p, oskIntext);
|
||||||
p.Do(oskOuttext);
|
Do(p, oskOuttext);
|
||||||
p.Do(selectedChar);
|
Do(p, selectedChar);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(inputChars);
|
Do(p, inputChars);
|
||||||
} else {
|
} else {
|
||||||
// Discard the wstring.
|
// Discard the wstring.
|
||||||
std::wstring wstr;
|
std::wstring wstr;
|
||||||
p.Do(wstr);
|
Do(p, wstr);
|
||||||
}
|
}
|
||||||
// Don't need to save state native status or value.
|
// Don't need to save state native status or value.
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
#include "thread/threadutil.h"
|
#include "thread/threadutil.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/FileUtil.h"
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/FileSystems/MetaFileSystem.h"
|
#include "Core/FileSystems/MetaFileSystem.h"
|
||||||
#include "Core/Util/PPGeDraw.h"
|
#include "Core/Util/PPGeDraw.h"
|
||||||
#include "Core/HLE/sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
@ -1140,20 +1141,20 @@ void PSPSaveDialog::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(display);
|
Do(p, display);
|
||||||
param.DoState(p);
|
param.DoState(p);
|
||||||
p.Do(request);
|
Do(p, request);
|
||||||
// Just reset it.
|
// Just reset it.
|
||||||
bool hasParam = param.GetPspParam() != NULL;
|
bool hasParam = param.GetPspParam() != NULL;
|
||||||
p.Do(hasParam);
|
Do(p, hasParam);
|
||||||
if (hasParam) {
|
if (hasParam) {
|
||||||
param.SetPspParam(&request);
|
param.SetPspParam(&request);
|
||||||
}
|
}
|
||||||
p.Do(requestAddr);
|
Do(p, requestAddr);
|
||||||
p.Do(currentSelectedSave);
|
Do(p, currentSelectedSave);
|
||||||
p.Do(yesnoChoice);
|
Do(p, yesnoChoice);
|
||||||
if (s > 2) {
|
if (s > 2) {
|
||||||
p.Do(ioThreadStatus);
|
Do(p, ioThreadStatus);
|
||||||
} else {
|
} else {
|
||||||
ioThreadStatus = SAVEIO_NONE;
|
ioThreadStatus = SAVEIO_NONE;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Dialog/PSPDialog.h"
|
#include "Core/Dialog/PSPDialog.h"
|
||||||
#include "Core/Dialog/PSPScreenshotDialog.h"
|
#include "Core/Dialog/PSPScreenshotDialog.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
@ -123,8 +124,8 @@ void PSPScreenshotDialog::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(mode);
|
Do(p, mode);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(params_);
|
Do(p, params_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Common/StringUtils.h"
|
#include "Common/StringUtils.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
@ -153,23 +154,23 @@ void SaveFileInfo::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(size);
|
Do(p, size);
|
||||||
p.Do(saveName);
|
Do(p, saveName);
|
||||||
p.Do(idx);
|
Do(p, idx);
|
||||||
|
|
||||||
p.DoArray(title, sizeof(title));
|
DoArray(p, title, sizeof(title));
|
||||||
p.DoArray(saveTitle, sizeof(saveTitle));
|
DoArray(p, saveTitle, sizeof(saveTitle));
|
||||||
p.DoArray(saveDetail, sizeof(saveDetail));
|
DoArray(p, saveDetail, sizeof(saveDetail));
|
||||||
|
|
||||||
p.Do(modif_time);
|
Do(p, modif_time);
|
||||||
|
|
||||||
if (s <= 1) {
|
if (s <= 1) {
|
||||||
u32 textureData;
|
u32 textureData;
|
||||||
int textureWidth;
|
int textureWidth;
|
||||||
int textureHeight;
|
int textureHeight;
|
||||||
p.Do(textureData);
|
Do(p, textureData);
|
||||||
p.Do(textureWidth);
|
Do(p, textureWidth);
|
||||||
p.Do(textureHeight);
|
Do(p, textureHeight);
|
||||||
|
|
||||||
if (textureData != 0) {
|
if (textureData != 0) {
|
||||||
// Must be MODE_READ.
|
// Must be MODE_READ.
|
||||||
@ -178,7 +179,7 @@ void SaveFileInfo::DoState(PointerWrap &p)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bool hasTexture = texture != NULL;
|
bool hasTexture = texture != NULL;
|
||||||
p.Do(hasTexture);
|
Do(p, hasTexture);
|
||||||
if (hasTexture) {
|
if (hasTexture) {
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
delete texture;
|
delete texture;
|
||||||
@ -1725,9 +1726,9 @@ void SavedataParam::DoState(PointerWrap &p)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// pspParam is handled in PSPSaveDialog.
|
// pspParam is handled in PSPSaveDialog.
|
||||||
p.Do(selectedSave);
|
Do(p, selectedSave);
|
||||||
p.Do(saveDataListCount);
|
Do(p, saveDataListCount);
|
||||||
p.Do(saveNameListDataCount);
|
Do(p, saveNameListDataCount);
|
||||||
if (p.mode == p.MODE_READ)
|
if (p.mode == p.MODE_READ)
|
||||||
{
|
{
|
||||||
if (saveDataList != NULL)
|
if (saveDataList != NULL)
|
||||||
@ -1735,13 +1736,13 @@ void SavedataParam::DoState(PointerWrap &p)
|
|||||||
if (saveDataListCount != 0)
|
if (saveDataListCount != 0)
|
||||||
{
|
{
|
||||||
saveDataList = new SaveFileInfo[saveDataListCount];
|
saveDataList = new SaveFileInfo[saveDataListCount];
|
||||||
p.DoArray(saveDataList, saveDataListCount);
|
DoArray(p, saveDataList, saveDataListCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
saveDataList = NULL;
|
saveDataList = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p.DoArray(saveDataList, saveDataListCount);
|
DoArray(p, saveDataList, saveDataListCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SavedataParam::GetSaveCryptMode(SceUtilitySavedataParam* param, const std::string &saveDirName)
|
int SavedataParam::GetSaveCryptMode(SceUtilitySavedataParam* param, const std::string &saveDirName)
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
#include "file/zip_read.h"
|
#include "file/zip_read.h"
|
||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
#include "util/text/utf8.h"
|
#include "util/text/utf8.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Core/FileSystems/DirectoryFileSystem.h"
|
#include "Core/FileSystems/DirectoryFileSystem.h"
|
||||||
#include "Core/FileSystems/ISOFileSystem.h"
|
#include "Core/FileSystems/ISOFileSystem.h"
|
||||||
@ -976,41 +977,41 @@ void DirectoryFileSystem::DoState(PointerWrap &p) {
|
|||||||
// s64 current truncate position (v2+ only)
|
// s64 current truncate position (v2+ only)
|
||||||
|
|
||||||
u32 num = (u32) entries.size();
|
u32 num = (u32) entries.size();
|
||||||
p.Do(num);
|
Do(p, num);
|
||||||
|
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
CloseAll();
|
CloseAll();
|
||||||
u32 key;
|
u32 key;
|
||||||
OpenFileEntry entry;
|
OpenFileEntry entry;
|
||||||
for (u32 i = 0; i < num; i++) {
|
for (u32 i = 0; i < num; i++) {
|
||||||
p.Do(key);
|
Do(p, key);
|
||||||
p.Do(entry.guestFilename);
|
Do(p, entry.guestFilename);
|
||||||
p.Do(entry.access);
|
Do(p, entry.access);
|
||||||
u32 err;
|
u32 err;
|
||||||
if (!entry.hFile.Open(basePath,entry.guestFilename,entry.access, 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());
|
ERROR_LOG(FILESYS, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
u32 position;
|
u32 position;
|
||||||
p.Do(position);
|
Do(p, position);
|
||||||
if (position != entry.hFile.Seek(position, FILEMOVE_BEGIN)) {
|
if (position != entry.hFile.Seek(position, FILEMOVE_BEGIN)) {
|
||||||
ERROR_LOG(FILESYS, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str());
|
ERROR_LOG(FILESYS, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(entry.hFile.needsTrunc_);
|
Do(p, entry.hFile.needsTrunc_);
|
||||||
}
|
}
|
||||||
entries[key] = entry;
|
entries[key] = entry;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto iter = entries.begin(); iter != entries.end(); ++iter) {
|
for (auto iter = entries.begin(); iter != entries.end(); ++iter) {
|
||||||
u32 key = iter->first;
|
u32 key = iter->first;
|
||||||
p.Do(key);
|
Do(p, key);
|
||||||
p.Do(iter->second.guestFilename);
|
Do(p, iter->second.guestFilename);
|
||||||
p.Do(iter->second.access);
|
Do(p, iter->second.access);
|
||||||
u32 position = (u32)iter->second.hFile.Seek(0, FILEMOVE_CURRENT);
|
u32 position = (u32)iter->second.hFile.Seek(0, FILEMOVE_CURRENT);
|
||||||
p.Do(position);
|
Do(p, position);
|
||||||
p.Do(iter->second.hFile.needsTrunc_);
|
Do(p, iter->second.hFile.needsTrunc_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1186,7 +1187,7 @@ void VFSFileSystem::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
u32 num = (u32) entries.size();
|
u32 num = (u32) entries.size();
|
||||||
p.Do(num);
|
Do(p, num);
|
||||||
|
|
||||||
if (num != 0) {
|
if (num != 0) {
|
||||||
p.SetError(p.ERROR_WARNING);
|
p.SetError(p.ERROR_WARNING);
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/FileSystems/FileSystem.h"
|
#include "Core/FileSystems/FileSystem.h"
|
||||||
|
|
||||||
void PSPFileInfo::DoState(PointerWrap &p) {
|
void PSPFileInfo::DoState(PointerWrap &p) {
|
||||||
@ -23,17 +24,17 @@ void PSPFileInfo::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(name);
|
Do(p, name);
|
||||||
p.Do(size);
|
Do(p, size);
|
||||||
p.Do(access);
|
Do(p, access);
|
||||||
p.Do(exists);
|
Do(p, exists);
|
||||||
p.Do(type);
|
Do(p, type);
|
||||||
p.Do(atime);
|
Do(p, atime);
|
||||||
p.Do(ctime);
|
Do(p, ctime);
|
||||||
p.Do(mtime);
|
Do(p, mtime);
|
||||||
p.Do(isOnSectorSystem);
|
Do(p, isOnSectorSystem);
|
||||||
p.Do(startSector);
|
Do(p, startSector);
|
||||||
p.Do(numSectors);
|
Do(p, numSectors);
|
||||||
p.Do(sectorSize);
|
Do(p, sectorSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/FileSystems/ISOFileSystem.h"
|
#include "Core/FileSystems/ISOFileSystem.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
@ -710,7 +711,7 @@ void ISOFileSystem::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int n = (int) entries.size();
|
int n = (int) entries.size();
|
||||||
p.Do(n);
|
Do(p, n);
|
||||||
|
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
entries.clear();
|
entries.clear();
|
||||||
@ -718,18 +719,18 @@ void ISOFileSystem::DoState(PointerWrap &p) {
|
|||||||
u32 fd = 0;
|
u32 fd = 0;
|
||||||
OpenFileEntry of;
|
OpenFileEntry of;
|
||||||
|
|
||||||
p.Do(fd);
|
Do(p, fd);
|
||||||
p.Do(of.seekPos);
|
Do(p, of.seekPos);
|
||||||
p.Do(of.isRawSector);
|
Do(p, of.isRawSector);
|
||||||
p.Do(of.isBlockSectorMode);
|
Do(p, of.isBlockSectorMode);
|
||||||
p.Do(of.sectorStart);
|
Do(p, of.sectorStart);
|
||||||
p.Do(of.openSize);
|
Do(p, of.openSize);
|
||||||
|
|
||||||
bool hasFile = false;
|
bool hasFile = false;
|
||||||
p.Do(hasFile);
|
Do(p, hasFile);
|
||||||
if (hasFile) {
|
if (hasFile) {
|
||||||
std::string path;
|
std::string path;
|
||||||
p.Do(path);
|
Do(p, path);
|
||||||
of.file = GetFromPath(path);
|
of.file = GetFromPath(path);
|
||||||
} else {
|
} else {
|
||||||
of.file = NULL;
|
of.file = NULL;
|
||||||
@ -740,24 +741,24 @@ void ISOFileSystem::DoState(PointerWrap &p) {
|
|||||||
} else {
|
} else {
|
||||||
for (EntryMap::iterator it = entries.begin(), end = entries.end(); it != end; ++it) {
|
for (EntryMap::iterator it = entries.begin(), end = entries.end(); it != end; ++it) {
|
||||||
OpenFileEntry &of = it->second;
|
OpenFileEntry &of = it->second;
|
||||||
p.Do(it->first);
|
Do(p, it->first);
|
||||||
p.Do(of.seekPos);
|
Do(p, of.seekPos);
|
||||||
p.Do(of.isRawSector);
|
Do(p, of.isRawSector);
|
||||||
p.Do(of.isBlockSectorMode);
|
Do(p, of.isBlockSectorMode);
|
||||||
p.Do(of.sectorStart);
|
Do(p, of.sectorStart);
|
||||||
p.Do(of.openSize);
|
Do(p, of.openSize);
|
||||||
|
|
||||||
bool hasFile = of.file != NULL;
|
bool hasFile = of.file != NULL;
|
||||||
p.Do(hasFile);
|
Do(p, hasFile);
|
||||||
if (hasFile) {
|
if (hasFile) {
|
||||||
std::string path = EntryFullPath(of.file);
|
std::string path = EntryFullPath(of.file);
|
||||||
p.Do(path);
|
Do(p, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(lastReadBlock_);
|
Do(p, lastReadBlock_);
|
||||||
} else {
|
} else {
|
||||||
lastReadBlock_ = 0;
|
lastReadBlock_ = 0;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Common/StringUtils.h"
|
#include "Common/StringUtils.h"
|
||||||
#include "Core/FileSystems/MetaFileSystem.h"
|
#include "Core/FileSystems/MetaFileSystem.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
@ -641,13 +643,13 @@ void MetaFileSystem::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(current);
|
Do(p, current);
|
||||||
|
|
||||||
// Save/load per-thread current directory map
|
// Save/load per-thread current directory map
|
||||||
p.Do(currentDir);
|
Do(p, currentDir);
|
||||||
|
|
||||||
u32 n = (u32) fileSystems.size();
|
u32 n = (u32) fileSystems.size();
|
||||||
p.Do(n);
|
Do(p, n);
|
||||||
bool skipPfat0 = false;
|
bool skipPfat0 = false;
|
||||||
if (n != (u32) fileSystems.size())
|
if (n != (u32) fileSystems.size())
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/StringUtils.h"
|
#include "Common/StringUtils.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/FileSystems/VirtualDiscFileSystem.h"
|
#include "Core/FileSystems/VirtualDiscFileSystem.h"
|
||||||
#include "Core/FileSystems/ISOFileSystem.h"
|
#include "Core/FileSystems/ISOFileSystem.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
@ -167,18 +168,18 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p)
|
|||||||
int fileListSize = (int)fileList.size();
|
int fileListSize = (int)fileList.size();
|
||||||
int entryCount = (int)entries.size();
|
int entryCount = (int)entries.size();
|
||||||
|
|
||||||
p.Do(fileListSize);
|
Do(p, fileListSize);
|
||||||
p.Do(entryCount);
|
Do(p, entryCount);
|
||||||
p.Do(currentBlockIndex);
|
Do(p, currentBlockIndex);
|
||||||
|
|
||||||
FileListEntry dummy = {""};
|
FileListEntry dummy = {""};
|
||||||
fileList.resize(fileListSize, dummy);
|
fileList.resize(fileListSize, dummy);
|
||||||
|
|
||||||
for (int i = 0; i < fileListSize; i++)
|
for (int i = 0; i < fileListSize; i++)
|
||||||
{
|
{
|
||||||
p.Do(fileList[i].fileName);
|
Do(p, fileList[i].fileName);
|
||||||
p.Do(fileList[i].firstBlock);
|
Do(p, fileList[i].firstBlock);
|
||||||
p.Do(fileList[i].totalSize);
|
Do(p, fileList[i].totalSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.mode == p.MODE_READ)
|
if (p.mode == p.MODE_READ)
|
||||||
@ -190,12 +191,12 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p)
|
|||||||
u32 fd = 0;
|
u32 fd = 0;
|
||||||
OpenFileEntry of;
|
OpenFileEntry of;
|
||||||
|
|
||||||
p.Do(fd);
|
Do(p, fd);
|
||||||
p.Do(of.fileIndex);
|
Do(p, of.fileIndex);
|
||||||
p.Do(of.type);
|
Do(p, of.type);
|
||||||
p.Do(of.curOffset);
|
Do(p, of.curOffset);
|
||||||
p.Do(of.startOffset);
|
Do(p, of.startOffset);
|
||||||
p.Do(of.size);
|
Do(p, of.size);
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
if (of.type != VFILETYPE_ISO) {
|
if (of.type != VFILETYPE_ISO) {
|
||||||
@ -222,17 +223,17 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p)
|
|||||||
{
|
{
|
||||||
OpenFileEntry &of = it->second;
|
OpenFileEntry &of = it->second;
|
||||||
|
|
||||||
p.Do(it->first);
|
Do(p, it->first);
|
||||||
p.Do(of.fileIndex);
|
Do(p, of.fileIndex);
|
||||||
p.Do(of.type);
|
Do(p, of.type);
|
||||||
p.Do(of.curOffset);
|
Do(p, of.curOffset);
|
||||||
p.Do(of.startOffset);
|
Do(p, of.startOffset);
|
||||||
p.Do(of.size);
|
Do(p, of.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(lastReadBlock_);
|
Do(p, lastReadBlock_);
|
||||||
} else {
|
} else {
|
||||||
lastReadBlock_ = 0;
|
lastReadBlock_ = 0;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
// Some parts, especially in this file, were simply copied, so I guess this really makes this file GPL3.
|
// Some parts, especially in this file, were simply copied, so I guess this really makes this file GPL3.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/Font/PGF.h"
|
#include "Core/Font/PGF.h"
|
||||||
@ -128,12 +129,12 @@ void PGF::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(header);
|
Do(p, header);
|
||||||
p.Do(rev3extra);
|
Do(p, rev3extra);
|
||||||
|
|
||||||
// Don't savestate size_t directly, 32-bit and 64-bit are different.
|
// Don't savestate size_t directly, 32-bit and 64-bit are different.
|
||||||
u32 fontDataSizeTemp = (u32)fontDataSize;
|
u32 fontDataSizeTemp = (u32)fontDataSize;
|
||||||
p.Do(fontDataSizeTemp);
|
Do(p, fontDataSizeTemp);
|
||||||
fontDataSize = (size_t)fontDataSizeTemp;
|
fontDataSize = (size_t)fontDataSizeTemp;
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
if (fontData) {
|
if (fontData) {
|
||||||
@ -141,39 +142,39 @@ void PGF::DoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
if (fontDataSize) {
|
if (fontDataSize) {
|
||||||
fontData = new u8[fontDataSize];
|
fontData = new u8[fontDataSize];
|
||||||
p.DoArray(fontData, (int)fontDataSize);
|
DoArray(p, fontData, (int)fontDataSize);
|
||||||
}
|
}
|
||||||
} else if (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));
|
DoArray(p, dimensionTable, ARRAY_SIZE(dimensionTable));
|
||||||
p.DoArray(xAdjustTable, ARRAY_SIZE(xAdjustTable));
|
DoArray(p, xAdjustTable, ARRAY_SIZE(xAdjustTable));
|
||||||
p.DoArray(yAdjustTable, ARRAY_SIZE(yAdjustTable));
|
DoArray(p, yAdjustTable, ARRAY_SIZE(yAdjustTable));
|
||||||
p.DoArray(advanceTable, ARRAY_SIZE(advanceTable));
|
DoArray(p, advanceTable, ARRAY_SIZE(advanceTable));
|
||||||
p.DoArray(charmapCompressionTable1, ARRAY_SIZE(charmapCompressionTable1));
|
DoArray(p, charmapCompressionTable1, ARRAY_SIZE(charmapCompressionTable1));
|
||||||
p.DoArray(charmapCompressionTable2, ARRAY_SIZE(charmapCompressionTable2));
|
DoArray(p, charmapCompressionTable2, ARRAY_SIZE(charmapCompressionTable2));
|
||||||
|
|
||||||
p.Do(charmap_compr);
|
Do(p, charmap_compr);
|
||||||
p.Do(charmap);
|
Do(p, charmap);
|
||||||
if (s == 1) {
|
if (s == 1) {
|
||||||
std::vector<GlyphFromPGF1State> oldGlyphs;
|
std::vector<GlyphFromPGF1State> oldGlyphs;
|
||||||
p.Do(oldGlyphs);
|
Do(p, oldGlyphs);
|
||||||
glyphs.resize(oldGlyphs.size());
|
glyphs.resize(oldGlyphs.size());
|
||||||
for (size_t i = 0; i < oldGlyphs.size(); ++i) {
|
for (size_t i = 0; i < oldGlyphs.size(); ++i) {
|
||||||
glyphs[i] = oldGlyphs[i];
|
glyphs[i] = oldGlyphs[i];
|
||||||
}
|
}
|
||||||
p.Do(oldGlyphs);
|
Do(p, oldGlyphs);
|
||||||
shadowGlyphs.resize(oldGlyphs.size());
|
shadowGlyphs.resize(oldGlyphs.size());
|
||||||
for (size_t i = 0; i < oldGlyphs.size(); ++i) {
|
for (size_t i = 0; i < oldGlyphs.size(); ++i) {
|
||||||
shadowGlyphs[i] = oldGlyphs[i];
|
shadowGlyphs[i] = oldGlyphs[i];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.Do(glyphs);
|
Do(p, glyphs);
|
||||||
p.Do(shadowGlyphs);
|
Do(p, shadowGlyphs);
|
||||||
}
|
}
|
||||||
p.Do(firstGlyph);
|
Do(p, firstGlyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PGF::ReadPtr(const u8 *ptr, size_t dataSize) {
|
bool PGF::ReadPtr(const u8 *ptr, size_t dataSize) {
|
||||||
|
@ -24,13 +24,13 @@
|
|||||||
#include "base/timeutil.h"
|
#include "base/timeutil.h"
|
||||||
#include "profiler/profiler.h"
|
#include "profiler/profiler.h"
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
|
#include "Core/Core.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
|
#include "Core/Host.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
|
|
||||||
#include "Core/Core.h"
|
|
||||||
#include "Core/Host.h"
|
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/MIPS/MIPSCodeUtils.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.
|
// Can't be inside a syscall, reset this so errors aren't misleading.
|
||||||
latestSyscall = nullptr;
|
latestSyscall = nullptr;
|
||||||
p.Do(delayedResultEvent);
|
Do(p, delayedResultEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(delayedResultEvent, "HLEDelayedResult", hleDelayResultFinish);
|
CoreTiming::RestoreRegisterEvent(delayedResultEvent, "HLEDelayedResult", hleDelayResultFinish);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
int actions = (int)mipsCallActions.size();
|
int actions = (int)mipsCallActions.size();
|
||||||
p.Do(actions);
|
Do(p, actions);
|
||||||
if (actions != (int)mipsCallActions.size()) {
|
if (actions != (int)mipsCallActions.size()) {
|
||||||
mipsCallActions.resize(actions);
|
mipsCallActions.resize(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &action : mipsCallActions) {
|
for (auto &action : mipsCallActions) {
|
||||||
int actionTypeID = action != nullptr ? action->actionTypeID : -1;
|
int actionTypeID = action != nullptr ? action->actionTypeID : -1;
|
||||||
p.Do(actionTypeID);
|
Do(p, actionTypeID);
|
||||||
if (actionTypeID != -1) {
|
if (actionTypeID != -1) {
|
||||||
if (p.mode == p.MODE_READ)
|
if (p.mode == p.MODE_READ)
|
||||||
action = __KernelCreateAction(actionTypeID);
|
action = __KernelCreateAction(actionTypeID);
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
@ -73,8 +74,8 @@ void HLEHelperThread::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(id_);
|
Do(p, id_);
|
||||||
p.Do(entry_);
|
Do(p, entry_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HLEHelperThread::Start(u32 a0, u32 a1) {
|
void HLEHelperThread::Start(u32 a0, u32 a1) {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
|
||||||
struct ThreadQueueList {
|
struct ThreadQueueList {
|
||||||
// Number of queues (number of priority levels starting at 0.)
|
// Number of queues (number of priority levels starting at 0.)
|
||||||
@ -184,7 +184,7 @@ struct ThreadQueueList {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int numQueues = NUM_QUEUES;
|
int numQueues = NUM_QUEUES;
|
||||||
p.Do(numQueues);
|
Do(p, numQueues);
|
||||||
if (numQueues != NUM_QUEUES) {
|
if (numQueues != NUM_QUEUES) {
|
||||||
p.SetError(p.ERROR_FAILURE);
|
p.SetError(p.ERROR_FAILURE);
|
||||||
ERROR_LOG(SCEKERNEL, "Savestate loading error: invalid data");
|
ERROR_LOG(SCEKERNEL, "Savestate loading error: invalid data");
|
||||||
@ -197,9 +197,9 @@ struct ThreadQueueList {
|
|||||||
for (int i = 0; i < NUM_QUEUES; ++i) {
|
for (int i = 0; i < NUM_QUEUES; ++i) {
|
||||||
Queue *cur = &queues[i];
|
Queue *cur = &queues[i];
|
||||||
int size = cur->size();
|
int size = cur->size();
|
||||||
p.Do(size);
|
Do(p, size);
|
||||||
int capacity = cur->capacity;
|
int capacity = cur->capacity;
|
||||||
p.Do(capacity);
|
Do(p, capacity);
|
||||||
|
|
||||||
if (capacity == 0)
|
if (capacity == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -211,7 +211,7 @@ struct ThreadQueueList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (size != 0)
|
if (size != 0)
|
||||||
p.DoArray(&cur->data[cur->first], size);
|
DoArray(p, &cur->data[cur->first], size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Common/FixedSizeQueue.h"
|
#include "Common/FixedSizeQueue.h"
|
||||||
|
|
||||||
#ifdef _M_SSE
|
#ifdef _M_SSE
|
||||||
@ -51,6 +52,10 @@ StereoResampler resampler;
|
|||||||
// atomic locks are used on the lock. TODO: make this lock-free
|
// atomic locks are used on the lock. TODO: make this lock-free
|
||||||
std::atomic_flag atomicLock_;
|
std::atomic_flag atomicLock_;
|
||||||
|
|
||||||
|
// We copy samples as they are written into this simple ring buffer.
|
||||||
|
// Might try something more efficient later.
|
||||||
|
FixedSizeQueue<s16, 32768 * 8> chanSampleQueues[PSP_AUDIO_CHANNEL_MAX + 1];
|
||||||
|
|
||||||
int eventAudioUpdate = -1;
|
int eventAudioUpdate = -1;
|
||||||
int eventHostAudioUpdate = -1;
|
int eventHostAudioUpdate = -1;
|
||||||
int mixFrequency = 44100;
|
int mixFrequency = 44100;
|
||||||
@ -114,8 +119,10 @@ void __AudioInit() {
|
|||||||
|
|
||||||
CoreTiming::ScheduleEvent(audioIntervalCycles, eventAudioUpdate, 0);
|
CoreTiming::ScheduleEvent(audioIntervalCycles, eventAudioUpdate, 0);
|
||||||
CoreTiming::ScheduleEvent(audioHostIntervalCycles, eventHostAudioUpdate, 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();
|
chans[i].clear();
|
||||||
|
}
|
||||||
|
|
||||||
mixBuffer = new s32[hwBlockSize * 2];
|
mixBuffer = new s32[hwBlockSize * 2];
|
||||||
clampedMixBuffer = new s16[hwBlockSize * 2];
|
clampedMixBuffer = new s16[hwBlockSize * 2];
|
||||||
@ -130,14 +137,14 @@ void __AudioDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(eventAudioUpdate);
|
Do(p, eventAudioUpdate);
|
||||||
CoreTiming::RestoreRegisterEvent(eventAudioUpdate, "AudioUpdate", &hleAudioUpdate);
|
CoreTiming::RestoreRegisterEvent(eventAudioUpdate, "AudioUpdate", &hleAudioUpdate);
|
||||||
p.Do(eventHostAudioUpdate);
|
Do(p, eventHostAudioUpdate);
|
||||||
CoreTiming::RestoreRegisterEvent(eventHostAudioUpdate, "AudioUpdateHost", &hleHostAudioUpdate);
|
CoreTiming::RestoreRegisterEvent(eventHostAudioUpdate, "AudioUpdateHost", &hleHostAudioUpdate);
|
||||||
|
|
||||||
p.Do(mixFrequency);
|
Do(p, mixFrequency);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(srcFrequency);
|
Do(p, srcFrequency);
|
||||||
} else {
|
} else {
|
||||||
// Assume that it was actually the SRC channel frequency.
|
// Assume that it was actually the SRC channel frequency.
|
||||||
srcFrequency = mixFrequency;
|
srcFrequency = mixFrequency;
|
||||||
@ -156,15 +163,17 @@ void __AudioDoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int chanCount = ARRAY_SIZE(chans);
|
int chanCount = ARRAY_SIZE(chans);
|
||||||
p.Do(chanCount);
|
Do(p, chanCount);
|
||||||
if (chanCount != ARRAY_SIZE(chans))
|
if (chanCount != ARRAY_SIZE(chans))
|
||||||
{
|
{
|
||||||
ERROR_LOG(SCEAUDIO, "Savestate failure: different number of audio channels.");
|
ERROR_LOG(SCEAUDIO, "Savestate failure: different number of audio channels.");
|
||||||
p.SetError(p.ERROR_FAILURE);
|
p.SetError(p.ERROR_FAILURE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < chanCount; ++i)
|
for (int i = 0; i < chanCount; ++i) {
|
||||||
|
chans[i].index = i;
|
||||||
chans[i].DoState(p);
|
chans[i].DoState(p);
|
||||||
|
}
|
||||||
|
|
||||||
__AudioCPUMHzChange();
|
__AudioCPUMHzChange();
|
||||||
}
|
}
|
||||||
@ -174,8 +183,10 @@ void __AudioShutdown() {
|
|||||||
delete [] clampedMixBuffer;
|
delete [] clampedMixBuffer;
|
||||||
|
|
||||||
mixBuffer = 0;
|
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();
|
chans[i].clear();
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef MOBILE_DEVICE
|
#ifndef MOBILE_DEVICE
|
||||||
if (g_Config.bDumpAudio) {
|
if (g_Config.bDumpAudio) {
|
||||||
@ -195,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 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 (chanSampleQueues[chanNum].size() > chan.sampleCount * 2 * chanQueueMaxSizeFactor || chan.sampleAddress == 0) {
|
||||||
if (chan.sampleQueue.size() > 0) {
|
if (chanSampleQueues[chanNum].size() > 0) {
|
||||||
if (blocking) {
|
if (blocking) {
|
||||||
// TODO: Regular multichannel audio seems to block for 64 samples less? Or enqueue the first 64 sync?
|
// 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()) {
|
if (__KernelIsDispatchEnabled()) {
|
||||||
AudioChannelWaitInfo waitInfo = {__KernelGetCurThread(), blockSamples};
|
AudioChannelWaitInfo waitInfo = {__KernelGetCurThread(), blockSamples};
|
||||||
@ -234,7 +245,7 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) {
|
|||||||
const u32 totalSamples = chan.sampleCount * (chan.format == PSP_AUDIO_FORMAT_STEREO ? 2 : 1);
|
const u32 totalSamples = chan.sampleCount * (chan.format == PSP_AUDIO_FORMAT_STEREO ? 2 : 1);
|
||||||
s16 *buf1 = 0, *buf2 = 0;
|
s16 *buf1 = 0, *buf2 = 0;
|
||||||
size_t sz1, sz2;
|
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))) {
|
if (Memory::IsValidAddress(chan.sampleAddress + (totalSamples - 1) * sizeof(s16_le))) {
|
||||||
Memory::Memcpy(buf1, chan.sampleAddress, (u32)sz1 * sizeof(s16));
|
Memory::Memcpy(buf1, chan.sampleAddress, (u32)sz1 * sizeof(s16));
|
||||||
@ -256,7 +267,7 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) {
|
|||||||
if (Memory::IsValidAddress(chan.sampleAddress + (totalSamples - 1) * sizeof(s16_le))) {
|
if (Memory::IsValidAddress(chan.sampleAddress + (totalSamples - 1) * sizeof(s16_le))) {
|
||||||
s16 *buf1 = 0, *buf2 = 0;
|
s16 *buf1 = 0, *buf2 = 0;
|
||||||
size_t sz1, sz2;
|
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);
|
AdjustVolumeBlock(buf1, sampleData, sz1, leftVol, rightVol);
|
||||||
if (buf2) {
|
if (buf2) {
|
||||||
AdjustVolumeBlock(buf2, sampleData + sz1, sz2, leftVol, rightVol);
|
AdjustVolumeBlock(buf2, sampleData + sz1, sz2, leftVol, rightVol);
|
||||||
@ -266,8 +277,8 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) {
|
|||||||
// Rare, so unoptimized. Expands to stereo.
|
// Rare, so unoptimized. Expands to stereo.
|
||||||
for (u32 i = 0; i < chan.sampleCount; i++) {
|
for (u32 i = 0; i < chan.sampleCount; i++) {
|
||||||
s16 sample = (s16)Memory::Read_U16(chan.sampleAddress + 2 * i);
|
s16 sample = (s16)Memory::Read_U16(chan.sampleAddress + 2 * i);
|
||||||
chan.sampleQueue.push(ApplySampleVolume(sample, leftVol));
|
chanSampleQueues[chanNum].push(ApplySampleVolume(sample, leftVol));
|
||||||
chan.sampleQueue.push(ApplySampleVolume(sample, rightVol));
|
chanSampleQueues[chanNum].push(ApplySampleVolume(sample, rightVol));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,20 +345,20 @@ void __AudioUpdate(bool resetRecording) {
|
|||||||
|
|
||||||
__AudioWakeThreads(chans[i], 0, hwBlockSize);
|
__AudioWakeThreads(chans[i], 0, hwBlockSize);
|
||||||
|
|
||||||
if (!chans[i].sampleQueue.size()) {
|
if (!chanSampleQueues[i].size()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needsResample = i == PSP_AUDIO_CHANNEL_SRC && srcFrequency != 0 && srcFrequency != mixFrequency;
|
bool needsResample = i == PSP_AUDIO_CHANNEL_SRC && srcFrequency != 0 && srcFrequency != mixFrequency;
|
||||||
size_t sz = needsResample ? (hwBlockSize * 2 * srcFrequency) / mixFrequency : hwBlockSize * 2;
|
size_t sz = needsResample ? (hwBlockSize * 2 * srcFrequency) / mixFrequency : hwBlockSize * 2;
|
||||||
if (sz > chans[i].sampleQueue.size()) {
|
if (sz > chanSampleQueues[i].size()) {
|
||||||
ERROR_LOG(SCEAUDIO, "Channel %i buffer underrun at %i of %i", i, (int)chans[i].sampleQueue.size() / 2, (int)sz / 2);
|
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;
|
const s16 *buf1 = 0, *buf2 = 0;
|
||||||
size_t sz1, sz2;
|
size_t sz1, sz2;
|
||||||
|
|
||||||
chans[i].sampleQueue.popPointers(sz, &buf1, &sz1, &buf2, &sz2);
|
chanSampleQueues[i].popPointers(sz, &buf1, &sz1, &buf2, &sz2);
|
||||||
|
|
||||||
if (needsResample) {
|
if (needsResample) {
|
||||||
auto read = [&](size_t i) {
|
auto read = [&](size_t i) {
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "util/text/parsers.h"
|
#include "util/text/parsers.h"
|
||||||
#include "thread/threadutil.h"
|
#include "thread/threadutil.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/HLE/sceKernelInterrupt.h"
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
@ -980,6 +981,24 @@ void clearPeerList(SceNetAdhocMatchingContext * context)
|
|||||||
peerlock.unlock();
|
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)
|
// 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) {
|
void AfterMatchingMipsCall::run(MipsCall &call) {
|
||||||
if (context == NULL) {
|
if (context == NULL) {
|
||||||
@ -1021,6 +1040,21 @@ bool IsMatchingInCallback(SceNetAdhocMatchingContext* context) {
|
|||||||
return inCB;
|
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) {
|
void AfterAdhocMipsCall::run(MipsCall& call) {
|
||||||
u32 v0 = currentMIPS->r[MIPS_REG_V0];
|
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);
|
if (__IsInInterrupt()) ERROR_LOG(SCENET, "AfterAdhocMipsCall::run [ID=%i][Event=%d] is Returning Inside an Interrupt!", HandlerID, EventID);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "base/timeutil.h"
|
#include "base/timeutil.h"
|
||||||
#include "net/resolve.h"
|
#include "net/resolve.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
@ -792,21 +792,7 @@ class AfterAdhocMipsCall : public PSPAction {
|
|||||||
public:
|
public:
|
||||||
AfterAdhocMipsCall() {}
|
AfterAdhocMipsCall() {}
|
||||||
static PSPAction* Create() { return new AfterAdhocMipsCall(); }
|
static PSPAction* Create() { return new AfterAdhocMipsCall(); }
|
||||||
void DoState(PointerWrap& p) override {
|
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 run(MipsCall& call) override;
|
void run(MipsCall& call) override;
|
||||||
void SetData(int handlerID, int eventId, u32_le argsAddr);
|
void SetData(int handlerID, int eventId, u32_le argsAddr);
|
||||||
|
|
||||||
@ -820,25 +806,7 @@ class AfterMatchingMipsCall : public PSPAction {
|
|||||||
public:
|
public:
|
||||||
AfterMatchingMipsCall() {}
|
AfterMatchingMipsCall() {}
|
||||||
static PSPAction *Create() { return new AfterMatchingMipsCall(); }
|
static PSPAction *Create() { return new AfterMatchingMipsCall(); }
|
||||||
void DoState(PointerWrap &p) override {
|
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 run(MipsCall &call) override;
|
void run(MipsCall &call) override;
|
||||||
void SetData(int ContextID, int eventId, u32_le BufAddr);
|
void SetData(int ContextID, int eventId, u32_le BufAddr);
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
@ -27,7 +29,6 @@
|
|||||||
#include "Core/Debugger/Breakpoints.h"
|
#include "Core/Debugger/Breakpoints.h"
|
||||||
#include "Core/HW/MediaEngine.h"
|
#include "Core/HW/MediaEngine.h"
|
||||||
#include "Core/HW/BufferQueue.h"
|
#include "Core/HW/BufferQueue.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/HLE/sceUtility.h"
|
#include "Core/HLE/sceUtility.h"
|
||||||
@ -236,65 +237,65 @@ struct Atrac {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(channels_);
|
Do(p, channels_);
|
||||||
p.Do(outputChannels_);
|
Do(p, outputChannels_);
|
||||||
if (s >= 5) {
|
if (s >= 5) {
|
||||||
p.Do(jointStereo_);
|
Do(p, jointStereo_);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(atracID_);
|
Do(p, atracID_);
|
||||||
p.Do(first_);
|
Do(p, first_);
|
||||||
p.Do(bufferMaxSize_);
|
Do(p, bufferMaxSize_);
|
||||||
p.Do(codecType_);
|
Do(p, codecType_);
|
||||||
|
|
||||||
p.Do(currentSample_);
|
Do(p, currentSample_);
|
||||||
p.Do(endSample_);
|
Do(p, endSample_);
|
||||||
p.Do(firstSampleOffset_);
|
Do(p, firstSampleOffset_);
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(dataOff_);
|
Do(p, dataOff_);
|
||||||
} else {
|
} else {
|
||||||
dataOff_ = firstSampleOffset_;
|
dataOff_ = firstSampleOffset_;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 hasDataBuf = dataBuf_ != nullptr;
|
u32 hasDataBuf = dataBuf_ != nullptr;
|
||||||
p.Do(hasDataBuf);
|
Do(p, hasDataBuf);
|
||||||
if (hasDataBuf) {
|
if (hasDataBuf) {
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
if (dataBuf_)
|
if (dataBuf_)
|
||||||
delete [] dataBuf_;
|
delete [] dataBuf_;
|
||||||
dataBuf_ = new u8[first_.filesize];
|
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) {
|
if (s < 9) {
|
||||||
u32 oldDecodeEnd = 0;
|
u32 oldDecodeEnd = 0;
|
||||||
p.Do(oldDecodeEnd);
|
Do(p, oldDecodeEnd);
|
||||||
}
|
}
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(bufferPos_);
|
Do(p, bufferPos_);
|
||||||
} else {
|
} else {
|
||||||
bufferPos_ = decodePos_;
|
bufferPos_ = decodePos_;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(bitrate_);
|
Do(p, bitrate_);
|
||||||
p.Do(bytesPerFrame_);
|
Do(p, bytesPerFrame_);
|
||||||
|
|
||||||
p.Do(loopinfo_);
|
Do(p, loopinfo_);
|
||||||
if (s < 9) {
|
if (s < 9) {
|
||||||
int oldLoopInfoNum = 42;
|
int oldLoopInfoNum = 42;
|
||||||
p.Do(oldLoopInfoNum);
|
Do(p, oldLoopInfoNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(loopStartSample_);
|
Do(p, loopStartSample_);
|
||||||
p.Do(loopEndSample_);
|
Do(p, loopEndSample_);
|
||||||
p.Do(loopNum_);
|
Do(p, loopNum_);
|
||||||
|
|
||||||
p.Do(context_);
|
Do(p, context_);
|
||||||
if (s >= 6) {
|
if (s >= 6) {
|
||||||
p.Do(bufferState_);
|
Do(p, bufferState_);
|
||||||
} else {
|
} else {
|
||||||
if (dataBuf_ == nullptr) {
|
if (dataBuf_ == nullptr) {
|
||||||
bufferState_ = ATRAC_STATUS_NO_DATA;
|
bufferState_ = ATRAC_STATUS_NO_DATA;
|
||||||
@ -304,14 +305,14 @@ struct Atrac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 7) {
|
if (s >= 7) {
|
||||||
p.Do(ignoreDataBuf_);
|
Do(p, ignoreDataBuf_);
|
||||||
} else {
|
} else {
|
||||||
ignoreDataBuf_ = false;
|
ignoreDataBuf_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 9) {
|
if (s >= 9) {
|
||||||
p.Do(bufferValidBytes_);
|
Do(p, bufferValidBytes_);
|
||||||
p.Do(bufferHeaderSize_);
|
Do(p, bufferHeaderSize_);
|
||||||
} else {
|
} else {
|
||||||
bufferHeaderSize_ = dataOff_;
|
bufferHeaderSize_ = dataOff_;
|
||||||
bufferValidBytes_ = std::min(first_.size - dataOff_, StreamBufferEnd() - dataOff_);
|
bufferValidBytes_ = std::min(first_.size - dataOff_, StreamBufferEnd() - dataOff_);
|
||||||
@ -333,7 +334,7 @@ struct Atrac {
|
|||||||
|
|
||||||
if (s >= 2 && s < 9) {
|
if (s >= 2 && s < 9) {
|
||||||
bool oldResetBuffer = false;
|
bool oldResetBuffer = false;
|
||||||
p.Do(oldResetBuffer);
|
Do(p, oldResetBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,18 +646,18 @@ void __AtracDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(atracInited);
|
Do(p, atracInited);
|
||||||
for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) {
|
for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) {
|
||||||
bool valid = atracIDs[i] != NULL;
|
bool valid = atracIDs[i] != NULL;
|
||||||
p.Do(valid);
|
Do(p, valid);
|
||||||
if (valid) {
|
if (valid) {
|
||||||
p.Do(atracIDs[i]);
|
Do(p, atracIDs[i]);
|
||||||
} else {
|
} else {
|
||||||
delete atracIDs[i];
|
delete atracIDs[i];
|
||||||
atracIDs[i] = NULL;
|
atracIDs[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.DoArray(atracIDTypes, PSP_NUM_ATRAC_IDS);
|
DoArray(p, atracIDTypes, PSP_NUM_ATRAC_IDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __AtracShutdown() {
|
void __AtracShutdown() {
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/FixedSizeQueue.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
@ -34,24 +36,26 @@ const int AUDIO_ROUTING_SPEAKER_ON = 1;
|
|||||||
int defaultRoutingMode = AUDIO_ROUTING_SPEAKER_ON;
|
int defaultRoutingMode = AUDIO_ROUTING_SPEAKER_ON;
|
||||||
int defaultRoutingVolMode = AUDIO_ROUTING_SPEAKER_ON;
|
int defaultRoutingVolMode = AUDIO_ROUTING_SPEAKER_ON;
|
||||||
|
|
||||||
|
extern FixedSizeQueue<s16, 32768 * 8> chanSampleQueues[PSP_AUDIO_CHANNEL_MAX + 1];
|
||||||
|
|
||||||
void AudioChannel::DoState(PointerWrap &p)
|
void AudioChannel::DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
auto s = p.Section("AudioChannel", 1, 2);
|
auto s = p.Section("AudioChannel", 1, 2);
|
||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(reserved);
|
Do(p, reserved);
|
||||||
p.Do(sampleAddress);
|
Do(p, sampleAddress);
|
||||||
p.Do(sampleCount);
|
Do(p, sampleCount);
|
||||||
p.Do(leftVolume);
|
Do(p, leftVolume);
|
||||||
p.Do(rightVolume);
|
Do(p, rightVolume);
|
||||||
p.Do(format);
|
Do(p, format);
|
||||||
p.Do(waitingThreads);
|
Do(p, waitingThreads);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(defaultRoutingMode);
|
Do(p, defaultRoutingMode);
|
||||||
p.Do(defaultRoutingVolMode);
|
Do(p, defaultRoutingVolMode);
|
||||||
}
|
}
|
||||||
sampleQueue.DoState(p);
|
chanSampleQueues[index].DoState(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioChannel::reset()
|
void AudioChannel::reset()
|
||||||
@ -68,7 +72,7 @@ void AudioChannel::clear()
|
|||||||
format = 0;
|
format = 0;
|
||||||
sampleAddress = 0;
|
sampleAddress = 0;
|
||||||
sampleCount = 0;
|
sampleCount = 0;
|
||||||
sampleQueue.clear();
|
chanSampleQueues[index].clear();
|
||||||
waitingThreads.clear();
|
waitingThreads.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +186,7 @@ static int sceAudioGetChannelRestLen(u32 chan) {
|
|||||||
ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLen(%08x) - bad channel", chan);
|
ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLen(%08x) - bad channel", chan);
|
||||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
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);
|
VERBOSE_LOG(SCEAUDIO, "%d=sceAudioGetChannelRestLen(%08x)", remainingSamples, chan);
|
||||||
return remainingSamples;
|
return remainingSamples;
|
||||||
}
|
}
|
||||||
@ -192,7 +196,7 @@ static int sceAudioGetChannelRestLength(u32 chan) {
|
|||||||
ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLength(%08x) - bad channel", chan);
|
ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLength(%08x) - bad channel", chan);
|
||||||
return SCE_ERROR_AUDIO_INVALID_CHANNEL;
|
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);
|
VERBOSE_LOG(SCEAUDIO, "%d=sceAudioGetChannelRestLength(%08x)", remainingSamples, chan);
|
||||||
return remainingSamples;
|
return remainingSamples;
|
||||||
}
|
}
|
||||||
@ -370,7 +374,7 @@ static u32 sceAudioOutput2GetRestSample() {
|
|||||||
if (!chan.reserved) {
|
if (!chan.reserved) {
|
||||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not 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 (size > chan.sampleCount) {
|
||||||
// If ChangeLength reduces the size, it still gets output but this return is clamped.
|
// If ChangeLength reduces the size, it still gets output but this return is clamped.
|
||||||
size = chan.sampleCount;
|
size = chan.sampleCount;
|
||||||
@ -382,7 +386,7 @@ static u32 sceAudioOutput2Release() {
|
|||||||
auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2];
|
auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2];
|
||||||
if (!chan.reserved)
|
if (!chan.reserved)
|
||||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not 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");
|
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy");
|
||||||
|
|
||||||
chan.reset();
|
chan.reset();
|
||||||
@ -443,7 +447,7 @@ static u32 sceAudioSRCChRelease() {
|
|||||||
auto &chan = chans[PSP_AUDIO_CHANNEL_SRC];
|
auto &chan = chans[PSP_AUDIO_CHANNEL_SRC];
|
||||||
if (!chan.reserved)
|
if (!chan.reserved)
|
||||||
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not 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");
|
return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy");
|
||||||
|
|
||||||
chan.reset();
|
chan.reset();
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "CommonTypes.h"
|
#include "CommonTypes.h"
|
||||||
#include "sceKernel.h"
|
#include "sceKernel.h"
|
||||||
#include "FixedSizeQueue.h"
|
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
@ -60,9 +59,8 @@ struct AudioChannel
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PSP side
|
int index = 0;
|
||||||
|
bool reserved = false;
|
||||||
bool reserved;
|
|
||||||
|
|
||||||
// last sample address
|
// last sample address
|
||||||
u32 sampleAddress;
|
u32 sampleAddress;
|
||||||
@ -73,12 +71,6 @@ struct AudioChannel
|
|||||||
|
|
||||||
std::vector<AudioChannelWaitInfo> waitingThreads;
|
std::vector<AudioChannelWaitInfo> 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<s16, 32768 * 8> sampleQueue;
|
|
||||||
|
|
||||||
void DoState(PointerWrap &p);
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -15,13 +15,14 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceAudiocodec.h"
|
#include "Core/HLE/sceAudiocodec.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/HW/SimpleAudioDec.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
|
// 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.
|
// 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();
|
int count = (int)audioList.size();
|
||||||
p.Do(count);
|
Do(p, count);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (p.mode == PointerWrap::MODE_READ) {
|
if (p.mode == PointerWrap::MODE_READ) {
|
||||||
@ -182,13 +183,20 @@ void __sceAudiocodecDoState(PointerWrap &p){
|
|||||||
auto ctxPtr_ = new u32[count];
|
auto ctxPtr_ = new u32[count];
|
||||||
// These sizeof(pointers) are wrong, but kept to avoid breaking on old saves.
|
// These sizeof(pointers) are wrong, but kept to avoid breaking on old saves.
|
||||||
// They're not used in new savestates.
|
// They're not used in new savestates.
|
||||||
p.DoArray(codec_, s >= 2 ? count : (int)ARRAY_SIZE(codec_));
|
#ifdef __clang__
|
||||||
p.DoArray(ctxPtr_, s >= 2 ? count : (int)ARRAY_SIZE(ctxPtr_));
|
#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++) {
|
for (int i = 0; i < count; i++) {
|
||||||
auto decoder = new SimpleAudio(codec_[i]);
|
auto decoder = new SimpleAudio(codec_[i]);
|
||||||
decoder->SetCtxPtr(ctxPtr_[i]);
|
decoder->SetCtxPtr(ctxPtr_[i]);
|
||||||
audioList[ctxPtr_[i]] = decoder;
|
audioList[ctxPtr_[i]] = decoder;
|
||||||
}
|
}
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma diagnostic pop
|
||||||
|
#endif
|
||||||
delete[] codec_;
|
delete[] codec_;
|
||||||
delete[] ctxPtr_;
|
delete[] ctxPtr_;
|
||||||
}
|
}
|
||||||
@ -205,8 +213,8 @@ void __sceAudiocodecDoState(PointerWrap &p){
|
|||||||
ctxPtr_[i] = decoder->GetCtxPtr();
|
ctxPtr_[i] = decoder->GetCtxPtr();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
p.DoArray(codec_, count);
|
DoArray(p, codec_, count);
|
||||||
p.DoArray(ctxPtr_, count);
|
DoArray(p, ctxPtr_, count);
|
||||||
delete[] codec_;
|
delete[] codec_;
|
||||||
delete[] ctxPtr_;
|
delete[] ctxPtr_;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#include "util/text/utf16.h"
|
#include "util/text/utf16.h"
|
||||||
#include "util/text/shiftjis.h"
|
#include "util/text/shiftjis.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Debugger/Breakpoints.h"
|
#include "Core/Debugger/Breakpoints.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
@ -55,11 +56,11 @@ void __CccDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(errorUTF8);
|
Do(p, errorUTF8);
|
||||||
p.Do(errorUTF16);
|
Do(p, errorUTF16);
|
||||||
p.Do(errorSJIS);
|
Do(p, errorSJIS);
|
||||||
p.Do(ucs2jisTable);
|
Do(p, ucs2jisTable);
|
||||||
p.Do(jis2ucsTable);
|
Do(p, jis2ucsTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 __CccUCStoJIS(u32 c, u32 alt)
|
static u32 __CccUCStoJIS(u32 c, u32 alt)
|
||||||
|
@ -18,13 +18,14 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Replay.h"
|
#include "Core/Replay.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
#include "Core/Util/AudioFormat.h" // for clamp_u8
|
#include "Core/Util/AudioFormat.h" // for clamp_u8
|
||||||
#include "Core/HLE/sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
#include "Core/HLE/sceDisplay.h"
|
#include "Core/HLE/sceDisplay.h"
|
||||||
@ -350,33 +351,33 @@ void __CtrlDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(analogEnabled);
|
Do(p, analogEnabled);
|
||||||
p.Do(ctrlLatchBufs);
|
Do(p, ctrlLatchBufs);
|
||||||
p.Do(ctrlOldButtons);
|
Do(p, ctrlOldButtons);
|
||||||
|
|
||||||
p.DoVoid(ctrlBufs, sizeof(ctrlBufs));
|
p.DoVoid(ctrlBufs, sizeof(ctrlBufs));
|
||||||
if (s <= 2) {
|
if (s <= 2) {
|
||||||
CtrlData dummy = {0};
|
CtrlData dummy = {0};
|
||||||
p.Do(dummy);
|
Do(p, dummy);
|
||||||
}
|
}
|
||||||
p.Do(ctrlBuf);
|
Do(p, ctrlBuf);
|
||||||
p.Do(ctrlBufRead);
|
Do(p, ctrlBufRead);
|
||||||
p.Do(latch);
|
Do(p, latch);
|
||||||
if (s == 1) {
|
if (s == 1) {
|
||||||
dialogBtnMake = 0;
|
dialogBtnMake = 0;
|
||||||
} else {
|
} else {
|
||||||
p.Do(dialogBtnMake);
|
Do(p, dialogBtnMake);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(ctrlIdleReset);
|
Do(p, ctrlIdleReset);
|
||||||
p.Do(ctrlIdleBack);
|
Do(p, ctrlIdleBack);
|
||||||
|
|
||||||
p.Do(ctrlCycle);
|
Do(p, ctrlCycle);
|
||||||
|
|
||||||
SceUID dv = 0;
|
SceUID dv = 0;
|
||||||
p.Do(waitingThreads, dv);
|
Do(p, waitingThreads, dv);
|
||||||
|
|
||||||
p.Do(ctrlTimer);
|
Do(p, ctrlTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(ctrlTimer, "CtrlSampleTimer", __CtrlTimerUpdate);
|
CoreTiming::RestoreRegisterEvent(ctrlTimer, "CtrlSampleTimer", __CtrlTimerUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@
|
|||||||
|
|
||||||
#include "gfx_es2/gpu_features.h"
|
#include "gfx_es2/gpu_features.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/CoreParameter.h"
|
#include "Core/CoreParameter.h"
|
||||||
@ -77,8 +79,8 @@ struct WaitVBlankInfo {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(threadID);
|
Do(p, threadID);
|
||||||
p.Do(vcountUnblock);
|
Do(p, vcountUnblock);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,42 +263,42 @@ void __DisplayDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(framebuf);
|
Do(p, framebuf);
|
||||||
p.Do(latchedFramebuf);
|
Do(p, latchedFramebuf);
|
||||||
p.Do(framebufIsLatched);
|
Do(p, framebufIsLatched);
|
||||||
p.Do(frameStartTicks);
|
Do(p, frameStartTicks);
|
||||||
p.Do(vCount);
|
Do(p, vCount);
|
||||||
if (s <= 2) {
|
if (s <= 2) {
|
||||||
double oldHCountBase;
|
double oldHCountBase;
|
||||||
p.Do(oldHCountBase);
|
Do(p, oldHCountBase);
|
||||||
hCountBase = (int) oldHCountBase;
|
hCountBase = (int) oldHCountBase;
|
||||||
} else {
|
} else {
|
||||||
p.Do(hCountBase);
|
Do(p, hCountBase);
|
||||||
}
|
}
|
||||||
p.Do(isVblank);
|
Do(p, isVblank);
|
||||||
p.Do(hasSetMode);
|
Do(p, hasSetMode);
|
||||||
p.Do(mode);
|
Do(p, mode);
|
||||||
p.Do(resumeMode);
|
Do(p, resumeMode);
|
||||||
p.Do(holdMode);
|
Do(p, holdMode);
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(brightnessLevel);
|
Do(p, brightnessLevel);
|
||||||
}
|
}
|
||||||
p.Do(width);
|
Do(p, width);
|
||||||
p.Do(height);
|
Do(p, height);
|
||||||
WaitVBlankInfo wvi(0);
|
WaitVBlankInfo wvi(0);
|
||||||
p.Do(vblankWaitingThreads, wvi);
|
Do(p, vblankWaitingThreads, wvi);
|
||||||
p.Do(vblankPausedWaits);
|
Do(p, vblankPausedWaits);
|
||||||
|
|
||||||
p.Do(enterVblankEvent);
|
Do(p, enterVblankEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(enterVblankEvent, "EnterVBlank", &hleEnterVblank);
|
CoreTiming::RestoreRegisterEvent(enterVblankEvent, "EnterVBlank", &hleEnterVblank);
|
||||||
p.Do(leaveVblankEvent);
|
Do(p, leaveVblankEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(leaveVblankEvent, "LeaveVBlank", &hleLeaveVblank);
|
CoreTiming::RestoreRegisterEvent(leaveVblankEvent, "LeaveVBlank", &hleLeaveVblank);
|
||||||
p.Do(afterFlipEvent);
|
Do(p, afterFlipEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(afterFlipEvent, "AfterFlip", &hleAfterFlip);
|
CoreTiming::RestoreRegisterEvent(afterFlipEvent, "AfterFlip", &hleAfterFlip);
|
||||||
|
|
||||||
if (s >= 5) {
|
if (s >= 5) {
|
||||||
p.Do(lagSyncEvent);
|
Do(p, lagSyncEvent);
|
||||||
p.Do(lagSyncScheduled);
|
Do(p, lagSyncScheduled);
|
||||||
CoreTiming::RestoreRegisterEvent(lagSyncEvent, "LagSync", &hleLagSync);
|
CoreTiming::RestoreRegisterEvent(lagSyncEvent, "LagSync", &hleLagSync);
|
||||||
lastLagSync = real_time_now();
|
lastLagSync = real_time_now();
|
||||||
if (lagSyncScheduled != g_Config.bForceLagSync) {
|
if (lagSyncScheduled != g_Config.bForceLagSync) {
|
||||||
@ -307,7 +309,7 @@ void __DisplayDoState(PointerWrap &p) {
|
|||||||
ScheduleLagSync();
|
ScheduleLagSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(gstate);
|
Do(p, gstate);
|
||||||
|
|
||||||
// TODO: GPU stuff is really not the responsibility of sceDisplay.
|
// TODO: GPU stuff is really not the responsibility of sceDisplay.
|
||||||
// Display just displays the buffers the GPU has drawn, they are really completely distinct.
|
// Display just displays the buffers the GPU has drawn, they are really completely distinct.
|
||||||
@ -321,7 +323,7 @@ void __DisplayDoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
if (s < 6) {
|
if (s < 6) {
|
||||||
GPUStatistics_v0 oldStats;
|
GPUStatistics_v0 oldStats;
|
||||||
p.Do(oldStats);
|
Do(p, oldStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s < 7) {
|
if (s < 7) {
|
||||||
@ -329,8 +331,8 @@ void __DisplayDoState(PointerWrap &p) {
|
|||||||
lastFlipCycles = now;
|
lastFlipCycles = now;
|
||||||
nextFlipCycles = now;
|
nextFlipCycles = now;
|
||||||
} else {
|
} else {
|
||||||
p.Do(lastFlipCycles);
|
Do(p, lastFlipCycles);
|
||||||
p.Do(nextFlipCycles);
|
Do(p, nextFlipCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu->DoState(p);
|
gpu->DoState(p);
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
@ -40,7 +41,7 @@ void __DmacDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(dmacMemcpyDeadline);
|
Do(p, dmacMemcpyDeadline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __DmacMemcpy(u32 dst, u32 src, u32 size) {
|
static int __DmacMemcpy(u32 dst, u32 src, u32 size) {
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceFont.h"
|
#include "Core/HLE/sceFont.h"
|
||||||
@ -221,12 +223,12 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(pgf_);
|
Do(p, pgf_);
|
||||||
p.Do(style_);
|
Do(p, style_);
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
valid_ = true;
|
valid_ = true;
|
||||||
} else {
|
} else {
|
||||||
p.Do(valid_);
|
Do(p, valid_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,29 +319,29 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int numInternalFonts = (int)internalFonts.size();
|
int numInternalFonts = (int)internalFonts.size();
|
||||||
p.Do(numInternalFonts);
|
Do(p, numInternalFonts);
|
||||||
if (numInternalFonts != (int)internalFonts.size()) {
|
if (numInternalFonts != (int)internalFonts.size()) {
|
||||||
ERROR_LOG(SCEFONT, "Unable to load state: different internal font count.");
|
ERROR_LOG(SCEFONT, "Unable to load state: different internal font count.");
|
||||||
p.SetError(p.ERROR_FAILURE);
|
p.SetError(p.ERROR_FAILURE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(fontLibID_);
|
Do(p, fontLibID_);
|
||||||
int internalFont = GetInternalFontIndex(font_);
|
int internalFont = GetInternalFontIndex(font_);
|
||||||
p.Do(internalFont);
|
Do(p, internalFont);
|
||||||
if (internalFont == -1) {
|
if (internalFont == -1) {
|
||||||
p.Do(font_);
|
Do(p, font_);
|
||||||
} else if (p.mode == p.MODE_READ) {
|
} else if (p.mode == p.MODE_READ) {
|
||||||
font_ = internalFonts[internalFont];
|
font_ = internalFonts[internalFont];
|
||||||
}
|
}
|
||||||
p.Do(handle_);
|
Do(p, handle_);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(open_);
|
Do(p, open_);
|
||||||
} else {
|
} else {
|
||||||
open_ = fontLibID_ != (u32)-1;
|
open_ = fontLibID_ != (u32)-1;
|
||||||
}
|
}
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(mode_);
|
Do(p, mode_);
|
||||||
} else {
|
} else {
|
||||||
mode_ = FONT_OPEN_INTERNAL_FULL;
|
mode_ = FONT_OPEN_INTERNAL_FULL;
|
||||||
}
|
}
|
||||||
@ -363,9 +365,9 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fontLibID_);
|
Do(p, fontLibID_);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(errorCodePtr_);
|
Do(p, errorCodePtr_);
|
||||||
} else {
|
} else {
|
||||||
errorCodePtr_ = 0;
|
errorCodePtr_ = 0;
|
||||||
}
|
}
|
||||||
@ -387,7 +389,7 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fontLibID_);
|
Do(p, fontLibID_);
|
||||||
}
|
}
|
||||||
void run(MipsCall &call) override;
|
void run(MipsCall &call) override;
|
||||||
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
||||||
@ -405,9 +407,9 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fontLibID_);
|
Do(p, fontLibID_);
|
||||||
p.Do(fontHandle_);
|
Do(p, fontHandle_);
|
||||||
p.Do(fontIndex_);
|
Do(p, fontIndex_);
|
||||||
}
|
}
|
||||||
void run(MipsCall &call) override;
|
void run(MipsCall &call) override;
|
||||||
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
||||||
@ -428,7 +430,7 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fontLibID_);
|
Do(p, fontLibID_);
|
||||||
}
|
}
|
||||||
void run(MipsCall &call) override;
|
void run(MipsCall &call) override;
|
||||||
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
||||||
@ -446,8 +448,8 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fontLibID_);
|
Do(p, fontLibID_);
|
||||||
p.Do(charInfo_);
|
Do(p, charInfo_);
|
||||||
}
|
}
|
||||||
void run(MipsCall &call) override;
|
void run(MipsCall &call) override;
|
||||||
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
void SetFontLib(u32 fontLibID) { fontLibID_ = fontLibID; }
|
||||||
@ -662,23 +664,23 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fonts_);
|
Do(p, fonts_);
|
||||||
p.Do(isfontopen_);
|
Do(p, isfontopen_);
|
||||||
p.Do(params_);
|
Do(p, params_);
|
||||||
p.Do(fontHRes_);
|
Do(p, fontHRes_);
|
||||||
p.Do(fontVRes_);
|
Do(p, fontVRes_);
|
||||||
p.Do(fileFontHandle_);
|
Do(p, fileFontHandle_);
|
||||||
p.Do(handle_);
|
Do(p, handle_);
|
||||||
p.Do(altCharCode_);
|
Do(p, altCharCode_);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(nfl_);
|
Do(p, nfl_);
|
||||||
} else {
|
} else {
|
||||||
nfl_ = 0;
|
nfl_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(openAllocatedAddresses_);
|
Do(p, openAllocatedAddresses_);
|
||||||
p.Do(charInfoBitmapAddress_);
|
Do(p, charInfoBitmapAddress_);
|
||||||
} else {
|
} else {
|
||||||
openAllocatedAddresses_.resize(params_.numFonts);
|
openAllocatedAddresses_.resize(params_.numFonts);
|
||||||
charInfoBitmapAddress_ = 0;
|
charInfoBitmapAddress_ = 0;
|
||||||
@ -917,20 +919,20 @@ void __FontDoState(PointerWrap &p) {
|
|||||||
|
|
||||||
__LoadInternalFonts();
|
__LoadInternalFonts();
|
||||||
|
|
||||||
p.Do(fontLibList);
|
Do(p, fontLibList);
|
||||||
p.Do(fontLibMap);
|
Do(p, fontLibMap);
|
||||||
p.Do(fontMap);
|
Do(p, fontMap);
|
||||||
|
|
||||||
p.Do(actionPostAllocCallback);
|
Do(p, actionPostAllocCallback);
|
||||||
__KernelRestoreActionType(actionPostAllocCallback, PostAllocCallback::Create);
|
__KernelRestoreActionType(actionPostAllocCallback, PostAllocCallback::Create);
|
||||||
p.Do(actionPostOpenCallback);
|
Do(p, actionPostOpenCallback);
|
||||||
__KernelRestoreActionType(actionPostOpenCallback, PostOpenCallback::Create);
|
__KernelRestoreActionType(actionPostOpenCallback, PostOpenCallback::Create);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(actionPostOpenAllocCallback);
|
Do(p, actionPostOpenAllocCallback);
|
||||||
__KernelRestoreActionType(actionPostOpenAllocCallback, PostOpenAllocCallback::Create);
|
__KernelRestoreActionType(actionPostOpenAllocCallback, PostOpenAllocCallback::Create);
|
||||||
p.Do(actionPostCharInfoAllocCallback);
|
Do(p, actionPostCharInfoAllocCallback);
|
||||||
__KernelRestoreActionType(actionPostCharInfoAllocCallback, PostCharInfoAllocCallback::Create);
|
__KernelRestoreActionType(actionPostCharInfoAllocCallback, PostCharInfoAllocCallback::Create);
|
||||||
p.Do(actionPostCharInfoFreeCallback);
|
Do(p, actionPostCharInfoFreeCallback);
|
||||||
__KernelRestoreActionType(actionPostCharInfoFreeCallback, PostCharInfoFreeCallback::Create);
|
__KernelRestoreActionType(actionPostCharInfoFreeCallback, PostCharInfoFreeCallback::Create);
|
||||||
} else {
|
} else {
|
||||||
useAllocCallbacks = false;
|
useAllocCallbacks = false;
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "Common/ChunkFile.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 "Common/ThreadSafeList.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
@ -219,14 +222,14 @@ void __GeDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.DoArray(ge_callback_data, ARRAY_SIZE(ge_callback_data));
|
DoArray(p, ge_callback_data, ARRAY_SIZE(ge_callback_data));
|
||||||
p.DoArray(ge_used_callbacks, ARRAY_SIZE(ge_used_callbacks));
|
DoArray(p, ge_used_callbacks, ARRAY_SIZE(ge_used_callbacks));
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(ge_pending_cb);
|
Do(p, ge_pending_cb);
|
||||||
} else {
|
} else {
|
||||||
std::list<GeInterruptData_v1> old;
|
std::list<GeInterruptData_v1> old;
|
||||||
p.Do(old);
|
Do(p, old);
|
||||||
ge_pending_cb.clear();
|
ge_pending_cb.clear();
|
||||||
for (auto it = old.begin(), end = old.end(); it != end; ++it) {
|
for (auto it = old.begin(), end = old.end(); it != end; ++it) {
|
||||||
GeInterruptData intrdata = {it->listid, it->pc};
|
GeInterruptData intrdata = {it->listid, it->pc};
|
||||||
@ -235,15 +238,15 @@ void __GeDoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(geSyncEvent);
|
Do(p, geSyncEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(geSyncEvent, "GeSyncEvent", &__GeExecuteSync);
|
CoreTiming::RestoreRegisterEvent(geSyncEvent, "GeSyncEvent", &__GeExecuteSync);
|
||||||
p.Do(geInterruptEvent);
|
Do(p, geInterruptEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(geInterruptEvent, "GeInterruptEvent", &__GeExecuteInterrupt);
|
CoreTiming::RestoreRegisterEvent(geInterruptEvent, "GeInterruptEvent", &__GeExecuteInterrupt);
|
||||||
p.Do(geCycleEvent);
|
Do(p, geCycleEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(geCycleEvent, "GeCycleEvent", &__GeCheckCycles);
|
CoreTiming::RestoreRegisterEvent(geCycleEvent, "GeCycleEvent", &__GeCheckCycles);
|
||||||
|
|
||||||
p.Do(listWaitingThreads);
|
Do(p, listWaitingThreads);
|
||||||
p.Do(drawWaitingThreads);
|
Do(p, drawWaitingThreads);
|
||||||
|
|
||||||
// Everything else is done in sceDisplay.
|
// Everything else is done in sceDisplay.
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
@ -34,10 +36,10 @@ struct Heap {
|
|||||||
BlockAllocator alloc;
|
BlockAllocator alloc;
|
||||||
|
|
||||||
void DoState (PointerWrap &p) {
|
void DoState (PointerWrap &p) {
|
||||||
p.Do(size);
|
Do(p, size);
|
||||||
p.Do(address);
|
Do(p, address);
|
||||||
p.Do(fromtop);
|
Do(p, fromtop);
|
||||||
p.Do(alloc);
|
Do(p, alloc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ void __HeapDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(heapList);
|
Do(p, heapList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceImpose.h"
|
#include "Core/HLE/sceImpose.h"
|
||||||
@ -22,7 +24,6 @@
|
|||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
const int PSP_UMD_POPUP_DISABLE = 0;
|
const int PSP_UMD_POPUP_DISABLE = 0;
|
||||||
const int PSP_UMD_POPUP_ENABLE = 1;
|
const int PSP_UMD_POPUP_ENABLE = 1;
|
||||||
@ -50,10 +51,10 @@ void __ImposeDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(language);
|
Do(p, language);
|
||||||
p.Do(buttonValue);
|
Do(p, buttonValue);
|
||||||
p.Do(umdPopup);
|
Do(p, umdPopup);
|
||||||
p.Do(backlightOffTime);
|
Do(p, backlightOffTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr)
|
static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr)
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
#include "thread/threadutil.h"
|
#include "thread/threadutil.h"
|
||||||
#include "profiler/profiler.h"
|
#include "profiler/profiler.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/Core.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/ConfigValues.h"
|
#include "Core/ConfigValues.h"
|
||||||
@ -227,22 +231,22 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(fullpath);
|
Do(p, fullpath);
|
||||||
p.Do(handle);
|
Do(p, handle);
|
||||||
p.Do(callbackID);
|
Do(p, callbackID);
|
||||||
p.Do(callbackArg);
|
Do(p, callbackArg);
|
||||||
p.Do(asyncResult);
|
Do(p, asyncResult);
|
||||||
p.Do(hasAsyncResult);
|
Do(p, hasAsyncResult);
|
||||||
p.Do(pendingAsyncResult);
|
Do(p, pendingAsyncResult);
|
||||||
p.Do(sectorBlockMode);
|
Do(p, sectorBlockMode);
|
||||||
p.Do(closePending);
|
Do(p, closePending);
|
||||||
p.Do(info);
|
Do(p, info);
|
||||||
p.Do(openMode);
|
Do(p, openMode);
|
||||||
|
|
||||||
p.Do(npdrm);
|
Do(p, npdrm);
|
||||||
p.Do(pgd_offset);
|
Do(p, pgd_offset);
|
||||||
bool hasPGD = pgdInfo != NULL;
|
bool hasPGD = pgdInfo != NULL;
|
||||||
p.Do(hasPGD);
|
Do(p, hasPGD);
|
||||||
if (hasPGD) {
|
if (hasPGD) {
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
pgdInfo = (PGD_DESC*) malloc(sizeof(PGD_DESC));
|
pgdInfo = (PGD_DESC*) malloc(sizeof(PGD_DESC));
|
||||||
@ -253,11 +257,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(waitingThreads);
|
Do(p, waitingThreads);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(waitingSyncThreads);
|
Do(p, waitingSyncThreads);
|
||||||
}
|
}
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fullpath;
|
std::string fullpath;
|
||||||
@ -670,10 +674,10 @@ void __IoDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ioManager.DoState(p);
|
ioManager.DoState(p);
|
||||||
p.DoArray(fds, ARRAY_SIZE(fds));
|
DoArray(p, fds, ARRAY_SIZE(fds));
|
||||||
p.Do(asyncNotifyEvent);
|
Do(p, asyncNotifyEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(asyncNotifyEvent, "IoAsyncNotify", __IoAsyncNotify);
|
CoreTiming::RestoreRegisterEvent(asyncNotifyEvent, "IoAsyncNotify", __IoAsyncNotify);
|
||||||
p.Do(syncNotifyEvent);
|
Do(p, syncNotifyEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(syncNotifyEvent, "IoSyncNotify", __IoSyncNotify);
|
CoreTiming::RestoreRegisterEvent(syncNotifyEvent, "IoSyncNotify", __IoSyncNotify);
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
std::set<SceUID> legacy;
|
std::set<SceUID> legacy;
|
||||||
@ -681,22 +685,22 @@ void __IoDoState(PointerWrap &p) {
|
|||||||
memStickFatCallbacks.clear();
|
memStickFatCallbacks.clear();
|
||||||
|
|
||||||
// Convert from set to vector.
|
// Convert from set to vector.
|
||||||
p.Do(legacy);
|
Do(p, legacy);
|
||||||
for (SceUID id : legacy) {
|
for (SceUID id : legacy) {
|
||||||
memStickCallbacks.push_back(id);
|
memStickCallbacks.push_back(id);
|
||||||
}
|
}
|
||||||
p.Do(legacy);
|
Do(p, legacy);
|
||||||
for (SceUID id : legacy) {
|
for (SceUID id : legacy) {
|
||||||
memStickFatCallbacks.push_back(id);
|
memStickFatCallbacks.push_back(id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.Do(memStickCallbacks);
|
Do(p, memStickCallbacks);
|
||||||
p.Do(memStickFatCallbacks);
|
Do(p, memStickFatCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(lastMemStickState);
|
Do(p, lastMemStickState);
|
||||||
p.Do(lastMemStickFatState);
|
Do(p, lastMemStickFatState);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < PSP_COUNT_FDS; ++i) {
|
for (int i = 0; i < PSP_COUNT_FDS; ++i) {
|
||||||
@ -710,11 +714,11 @@ void __IoDoState(PointerWrap &p) {
|
|||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.DoVoid(&asyncParams[i], (int)sizeof(IoAsyncParams));
|
p.DoVoid(&asyncParams[i], (int)sizeof(IoAsyncParams));
|
||||||
bool hasThread = asyncThreads[i] != nullptr;
|
bool hasThread = asyncThreads[i] != nullptr;
|
||||||
p.Do(hasThread);
|
Do(p, hasThread);
|
||||||
if (hasThread) {
|
if (hasThread) {
|
||||||
if (p.GetMode() == p.MODE_READ)
|
if (p.GetMode() == p.MODE_READ)
|
||||||
clearThread();
|
clearThread();
|
||||||
p.DoClass(asyncThreads[i]);
|
DoClass(p, asyncThreads[i]);
|
||||||
} else if (!hasThread) {
|
} else if (!hasThread) {
|
||||||
clearThread();
|
clearThread();
|
||||||
}
|
}
|
||||||
@ -726,7 +730,7 @@ void __IoDoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 5) {
|
if (s >= 5) {
|
||||||
p.Do(asyncDefaultPriority);
|
Do(p, asyncDefaultPriority);
|
||||||
} else {
|
} else {
|
||||||
asyncDefaultPriority = -1;
|
asyncDefaultPriority = -1;
|
||||||
}
|
}
|
||||||
@ -2244,12 +2248,12 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(name);
|
Do(p, name);
|
||||||
p.Do(index);
|
Do(p, index);
|
||||||
|
|
||||||
// TODO: Is this the right way for it to wake up?
|
// TODO: Is this the right way for it to wake up?
|
||||||
int count = (int) listing.size();
|
int count = (int) listing.size();
|
||||||
p.Do(count);
|
Do(p, count);
|
||||||
listing.resize(count);
|
listing.resize(count);
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
listing[i].DoState(p);
|
listing[i].DoState(p);
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include "ext/jpge/jpgd.h"
|
#include "ext/jpge/jpgd.h"
|
||||||
|
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceJpeg.h"
|
#include "Core/HLE/sceJpeg.h"
|
||||||
@ -33,8 +35,6 @@
|
|||||||
#include "ext/xxhash.h"
|
#include "ext/xxhash.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
static int mjpegWidth, mjpegHeight;
|
static int mjpegWidth, mjpegHeight;
|
||||||
|
|
||||||
void __JpegInit() {
|
void __JpegInit() {
|
||||||
@ -47,8 +47,8 @@ void __JpegDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(mjpegWidth);
|
Do(p, mjpegWidth);
|
||||||
p.Do(mjpegHeight);
|
Do(p, mjpegHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getWidthHeight(int width, int height) {
|
static int getWidthHeight(int width, int height) {
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/LogManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/CwCheat.h"
|
#include "Core/CwCheat.h"
|
||||||
@ -26,7 +28,6 @@
|
|||||||
#include "Core/MIPS/MIPSInt.h"
|
#include "Core/MIPS/MIPSInt.h"
|
||||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||||
|
|
||||||
#include "Common/LogManager.h"
|
|
||||||
#include "Core/FileSystems/FileSystem.h"
|
#include "Core/FileSystems/FileSystem.h"
|
||||||
#include "Core/FileSystems/MetaFileSystem.h"
|
#include "Core/FileSystems/MetaFileSystem.h"
|
||||||
#include "Core/PSPLoaders.h"
|
#include "Core/PSPLoaders.h"
|
||||||
@ -217,11 +218,11 @@ void __KernelDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(kernelRunning);
|
Do(p, kernelRunning);
|
||||||
kernelObjects.DoState(p);
|
kernelObjects.DoState(p);
|
||||||
|
|
||||||
if (s >= 2)
|
if (s >= 2)
|
||||||
p.Do(registeredExitCbId);
|
Do(p, registeredExitCbId);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -542,7 +543,7 @@ void KernelObjectPool::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int _maxCount = maxCount;
|
int _maxCount = maxCount;
|
||||||
p.Do(_maxCount);
|
Do(p, _maxCount);
|
||||||
|
|
||||||
if (_maxCount != maxCount) {
|
if (_maxCount != maxCount) {
|
||||||
p.SetError(p.ERROR_FAILURE);
|
p.SetError(p.ERROR_FAILURE);
|
||||||
@ -555,15 +556,15 @@ void KernelObjectPool::DoState(PointerWrap &p) {
|
|||||||
kernelObjects.Clear();
|
kernelObjects.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(nextID);
|
Do(p, nextID);
|
||||||
p.DoArray(occupied, maxCount);
|
DoArray(p, occupied, maxCount);
|
||||||
for (int i = 0; i < maxCount; ++i) {
|
for (int i = 0; i < maxCount; ++i) {
|
||||||
if (!occupied[i])
|
if (!occupied[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
p.Do(type);
|
Do(p, type);
|
||||||
pool[i] = CreateByIDType(type);
|
pool[i] = CreateByIDType(type);
|
||||||
|
|
||||||
// Already logged an error.
|
// Already logged an error.
|
||||||
@ -573,7 +574,7 @@ void KernelObjectPool::DoState(PointerWrap &p) {
|
|||||||
pool[i]->uid = i + handleOffset;
|
pool[i]->uid = i + handleOffset;
|
||||||
} else {
|
} else {
|
||||||
type = pool[i]->GetIDType();
|
type = pool[i]->GetIDType();
|
||||||
p.Do(type);
|
Do(p, type);
|
||||||
}
|
}
|
||||||
pool[i]->DoState(p);
|
pool[i]->DoState(p);
|
||||||
if (p.error >= p.ERROR_FAILURE)
|
if (p.error >= p.ERROR_FAILURE)
|
||||||
|
@ -15,14 +15,16 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeList.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/HLE/sceKernelAlarm.h"
|
#include "Core/HLE/sceKernelAlarm.h"
|
||||||
#include "Core/HLE/sceKernelInterrupt.h"
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
const int NATIVEALARM_SIZE = 20;
|
const int NATIVEALARM_SIZE = 20;
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ struct PSPAlarm : public KernelObject {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(alm);
|
Do(p, alm);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeAlarm alm;
|
NativeAlarm alm;
|
||||||
@ -136,8 +138,8 @@ void __KernelAlarmDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(alarmTimer);
|
Do(p, alarmTimer);
|
||||||
p.Do(triggeredAlarm);
|
Do(p, triggeredAlarm);
|
||||||
CoreTiming::RestoreRegisterEvent(alarmTimer, "Alarm", __KernelTriggerAlarm);
|
CoreTiming::RestoreRegisterEvent(alarmTimer, "Alarm", __KernelTriggerAlarm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,12 +15,14 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
@ -73,10 +75,10 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nef);
|
Do(p, nef);
|
||||||
EventFlagTh eft = { 0 };
|
EventFlagTh eft = { 0 };
|
||||||
p.Do(waitingThreads, eft);
|
Do(p, waitingThreads, eft);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeEventFlag nef;
|
NativeEventFlag nef;
|
||||||
@ -121,7 +123,7 @@ void __KernelEventFlagDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(eventFlagWaitTimer);
|
Do(p, eventFlagWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(eventFlagWaitTimer, "EventFlagTimeout", __KernelEventFlagTimeout);
|
CoreTiming::RestoreRegisterEvent(eventFlagWaitTimer, "EventFlagTimeout", __KernelEventFlagTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
@ -27,13 +28,13 @@ struct Heap : public KernelObject {
|
|||||||
static const char *GetStaticTypeName() { return "Heap"; }
|
static const char *GetStaticTypeName() { return "Heap"; }
|
||||||
|
|
||||||
void DoState(PointerWrap &p) override {
|
void DoState(PointerWrap &p) override {
|
||||||
p.Do(uid);
|
Do(p, uid);
|
||||||
p.Do(partitionId);
|
Do(p, partitionId);
|
||||||
p.Do(size);
|
Do(p, size);
|
||||||
p.Do(flags);
|
Do(p, flags);
|
||||||
p.Do(address);
|
Do(p, address);
|
||||||
p.Do(name);
|
Do(p, name);
|
||||||
p.Do(alloc);
|
Do(p, alloc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,12 +19,15 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#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/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
#include "Core/Debugger/Breakpoints.h"
|
#include "Core/Debugger/Breakpoints.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
@ -59,7 +62,7 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(savedCpu);
|
Do(p, savedCpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSPThreadContext savedCpu;
|
PSPThreadContext savedCpu;
|
||||||
@ -213,8 +216,8 @@ void IntrHandler::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(intrNumber);
|
Do(p, intrNumber);
|
||||||
p.Do<int, SubIntrHandler>(subIntrHandlers);
|
Do<int, SubIntrHandler>(p, subIntrHandlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PendingInterrupt::DoState(PointerWrap &p)
|
void PendingInterrupt::DoState(PointerWrap &p)
|
||||||
@ -223,8 +226,8 @@ void PendingInterrupt::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(intr);
|
Do(p, intr);
|
||||||
p.Do(subintr);
|
Do(p, subintr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __InterruptsInit()
|
void __InterruptsInit()
|
||||||
@ -244,7 +247,7 @@ void __InterruptsDoState(PointerWrap &p)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int numInterrupts = PSP_NUMBER_INTERRUPTS;
|
int numInterrupts = PSP_NUMBER_INTERRUPTS;
|
||||||
p.Do(numInterrupts);
|
Do(p, numInterrupts);
|
||||||
if (numInterrupts != PSP_NUMBER_INTERRUPTS)
|
if (numInterrupts != PSP_NUMBER_INTERRUPTS)
|
||||||
{
|
{
|
||||||
p.SetError(p.ERROR_FAILURE);
|
p.SetError(p.ERROR_FAILURE);
|
||||||
@ -254,10 +257,10 @@ void __InterruptsDoState(PointerWrap &p)
|
|||||||
|
|
||||||
intState.DoState(p);
|
intState.DoState(p);
|
||||||
PendingInterrupt pi(0, 0);
|
PendingInterrupt pi(0, 0);
|
||||||
p.Do(pendingInterrupts, pi);
|
Do(p, pendingInterrupts, pi);
|
||||||
p.Do(interruptsEnabled);
|
Do(p, interruptsEnabled);
|
||||||
p.Do(inInterrupt);
|
Do(p, inInterrupt);
|
||||||
p.Do(threadBeforeInterrupt);
|
Do(p, threadBeforeInterrupt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __InterruptsDoStateLate(PointerWrap &p)
|
void __InterruptsDoStateLate(PointerWrap &p)
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
#include "Core/HLE/sceKernelMbx.h"
|
#include "Core/HLE/sceKernelMbx.h"
|
||||||
@ -166,10 +168,10 @@ struct Mbx : public KernelObject
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nmb);
|
Do(p, nmb);
|
||||||
MbxWaitingThread mwt = {0};
|
MbxWaitingThread mwt = {0};
|
||||||
p.Do(waitingThreads, mwt);
|
Do(p, waitingThreads, mwt);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeMbx nmb;
|
NativeMbx nmb;
|
||||||
@ -194,7 +196,7 @@ void __KernelMbxDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(mbxWaitTimer);
|
Do(p, mbxWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(mbxWaitTimer, "MbxTimeout", __KernelMbxTimeout);
|
CoreTiming::RestoreRegisterEvent(mbxWaitTimer, "MbxTimeout", __KernelMbxTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
@ -130,16 +132,16 @@ struct FPL : public KernelObject
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nf);
|
Do(p, nf);
|
||||||
if (p.mode == p.MODE_READ)
|
if (p.mode == p.MODE_READ)
|
||||||
blocks = new bool[nf.numBlocks];
|
blocks = new bool[nf.numBlocks];
|
||||||
p.DoArray(blocks, nf.numBlocks);
|
DoArray(p, blocks, nf.numBlocks);
|
||||||
p.Do(address);
|
Do(p, address);
|
||||||
p.Do(alignedSize);
|
Do(p, alignedSize);
|
||||||
p.Do(nextBlock);
|
Do(p, nextBlock);
|
||||||
FplWaitingThread dv = {0};
|
FplWaitingThread dv = {0};
|
||||||
p.Do(waitingThreads, dv);
|
Do(p, waitingThreads, dv);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeFPL nf;
|
NativeFPL nf;
|
||||||
@ -392,15 +394,15 @@ struct VPL : public KernelObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(nv);
|
Do(p, nv);
|
||||||
p.Do(address);
|
Do(p, address);
|
||||||
VplWaitingThread dv = {0};
|
VplWaitingThread dv = {0};
|
||||||
p.Do(waitingThreads, dv);
|
Do(p, waitingThreads, dv);
|
||||||
alloc.DoState(p);
|
alloc.DoState(p);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(header);
|
Do(p, header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,16 +458,16 @@ void __KernelMemoryDoState(PointerWrap &p)
|
|||||||
kernelMemory.DoState(p);
|
kernelMemory.DoState(p);
|
||||||
userMemory.DoState(p);
|
userMemory.DoState(p);
|
||||||
|
|
||||||
p.Do(vplWaitTimer);
|
Do(p, vplWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(vplWaitTimer, "VplTimeout", __KernelVplTimeout);
|
CoreTiming::RestoreRegisterEvent(vplWaitTimer, "VplTimeout", __KernelVplTimeout);
|
||||||
p.Do(fplWaitTimer);
|
Do(p, fplWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(fplWaitTimer, "FplTimeout", __KernelFplTimeout);
|
CoreTiming::RestoreRegisterEvent(fplWaitTimer, "FplTimeout", __KernelFplTimeout);
|
||||||
p.Do(flags_);
|
Do(p, flags_);
|
||||||
p.Do(sdkVersion_);
|
Do(p, sdkVersion_);
|
||||||
p.Do(compilerVersion_);
|
Do(p, compilerVersion_);
|
||||||
p.DoArray(tlsplUsedIndexes, ARRAY_SIZE(tlsplUsedIndexes));
|
DoArray(p, tlsplUsedIndexes, ARRAY_SIZE(tlsplUsedIndexes));
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(tlsplThreadEndChecks);
|
Do(p, tlsplThreadEndChecks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,8 +951,8 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(address);
|
Do(p, address);
|
||||||
p.DoArray(name, sizeof(name));
|
DoArray(p, name, sizeof(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 address;
|
u32 address;
|
||||||
@ -1886,15 +1888,15 @@ struct TLSPL : public KernelObject
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(ntls);
|
Do(p, ntls);
|
||||||
p.Do(address);
|
Do(p, address);
|
||||||
if (s >= 2)
|
if (s >= 2)
|
||||||
p.Do(alignment);
|
Do(p, alignment);
|
||||||
else
|
else
|
||||||
alignment = 4;
|
alignment = 4;
|
||||||
p.Do(waitingThreads);
|
Do(p, waitingThreads);
|
||||||
p.Do(next);
|
Do(p, next);
|
||||||
p.Do(usage);
|
Do(p, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeTlspl ntls;
|
NativeTlspl ntls;
|
||||||
|
@ -22,7 +22,9 @@
|
|||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
#include "base/stringutil.h"
|
#include "base/stringutil.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeSet.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/StringUtils.h"
|
#include "Common/StringUtils.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
@ -265,14 +267,14 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nm);
|
Do(p, nm);
|
||||||
p.Do(memoryBlockAddr);
|
Do(p, memoryBlockAddr);
|
||||||
p.Do(memoryBlockSize);
|
Do(p, memoryBlockSize);
|
||||||
p.Do(isFake);
|
Do(p, isFake);
|
||||||
|
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
bool isStarted = false;
|
bool isStarted = false;
|
||||||
p.Do(isStarted);
|
Do(p, isStarted);
|
||||||
if (isStarted)
|
if (isStarted)
|
||||||
nm.status = MODULE_STATUS_STARTED;
|
nm.status = MODULE_STATUS_STARTED;
|
||||||
else
|
else
|
||||||
@ -280,24 +282,24 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(textStart);
|
Do(p, textStart);
|
||||||
p.Do(textEnd);
|
Do(p, textEnd);
|
||||||
}
|
}
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(libstub);
|
Do(p, libstub);
|
||||||
p.Do(libstubend);
|
Do(p, libstubend);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleWaitingThread mwt = {0};
|
ModuleWaitingThread mwt = {0};
|
||||||
p.Do(waitingThreads, mwt);
|
Do(p, waitingThreads, mwt);
|
||||||
FuncSymbolExport fsx = {{0}};
|
FuncSymbolExport fsx = {{0}};
|
||||||
p.Do(exportedFuncs, fsx);
|
Do(p, exportedFuncs, fsx);
|
||||||
FuncSymbolImport fsi = {{0}};
|
FuncSymbolImport fsi = {{0}};
|
||||||
p.Do(importedFuncs, fsi);
|
Do(p, importedFuncs, fsi);
|
||||||
VarSymbolExport vsx = {{0}};
|
VarSymbolExport vsx = {{0}};
|
||||||
p.Do(exportedVars, vsx);
|
Do(p, exportedVars, vsx);
|
||||||
VarSymbolImport vsi = {{0}};
|
VarSymbolImport vsi = {{0}};
|
||||||
p.Do(importedVars, vsi);
|
Do(p, importedVars, vsi);
|
||||||
|
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
// On load state, we re-examine in case our syscall ids changed.
|
// On load state, we re-examine in case our syscall ids changed.
|
||||||
@ -437,8 +439,8 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(moduleID_);
|
Do(p, moduleID_);
|
||||||
p.Do(retValAddr);
|
Do(p, retValAddr);
|
||||||
}
|
}
|
||||||
static PSPAction *Create() {
|
static PSPAction *Create() {
|
||||||
return new AfterModuleEntryCall;
|
return new AfterModuleEntryCall;
|
||||||
@ -498,11 +500,11 @@ void __KernelModuleDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(actionAfterModule);
|
Do(p, actionAfterModule);
|
||||||
__KernelRestoreActionType(actionAfterModule, AfterModuleEntryCall::Create);
|
__KernelRestoreActionType(actionAfterModule, AfterModuleEntryCall::Create);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(loadedModules);
|
Do(p, loadedModules);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
@ -27,7 +30,6 @@
|
|||||||
#include "Core/HLE/sceKernelInterrupt.h"
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
#include "Core/HLE/KernelWaitHelpers.h"
|
#include "Core/HLE/KernelWaitHelpers.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
#define SCE_KERNEL_MPA_THFIFO_S 0x0000
|
#define SCE_KERNEL_MPA_THFIFO_S 0x0000
|
||||||
#define SCE_KERNEL_MPA_THPRI_S 0x0100
|
#define SCE_KERNEL_MPA_THPRI_S 0x0100
|
||||||
@ -278,13 +280,13 @@ struct MsgPipe : public KernelObject
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nmp);
|
Do(p, nmp);
|
||||||
MsgPipeWaitingThread mpwt1 = {0}, mpwt2 = {0};
|
MsgPipeWaitingThread mpwt1 = {0}, mpwt2 = {0};
|
||||||
p.Do(sendWaitingThreads, mpwt1);
|
Do(p, sendWaitingThreads, mpwt1);
|
||||||
p.Do(receiveWaitingThreads, mpwt2);
|
Do(p, receiveWaitingThreads, mpwt2);
|
||||||
p.Do(pausedSendWaits);
|
Do(p, pausedSendWaits);
|
||||||
p.Do(pausedReceiveWaits);
|
Do(p, pausedReceiveWaits);
|
||||||
p.Do(buffer);
|
Do(p, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeMsgPipe nmp;
|
NativeMsgPipe nmp;
|
||||||
@ -662,7 +664,7 @@ void __KernelMsgPipeDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(waitTimer);
|
Do(p, waitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(waitTimer, "MsgPipeTimeout", __KernelMsgPipeTimeout);
|
CoreTiming::RestoreRegisterEvent(waitTimer, "MsgPipeTimeout", __KernelMsgPipeTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
@ -77,10 +79,10 @@ struct PSPMutex : public KernelObject
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nm);
|
Do(p, nm);
|
||||||
SceUID dv = 0;
|
SceUID dv = 0;
|
||||||
p.Do(waitingThreads, dv);
|
Do(p, waitingThreads, dv);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeMutex nm;
|
NativeMutex nm;
|
||||||
@ -143,10 +145,10 @@ struct LwMutex : public KernelObject
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nm);
|
Do(p, nm);
|
||||||
SceUID dv = 0;
|
SceUID dv = 0;
|
||||||
p.Do(waitingThreads, dv);
|
Do(p, waitingThreads, dv);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeLwMutex nm;
|
NativeLwMutex nm;
|
||||||
@ -182,11 +184,11 @@ void __KernelMutexDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(mutexWaitTimer);
|
Do(p, mutexWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(mutexWaitTimer, "MutexTimeout", __KernelMutexTimeout);
|
CoreTiming::RestoreRegisterEvent(mutexWaitTimer, "MutexTimeout", __KernelMutexTimeout);
|
||||||
p.Do(lwMutexWaitTimer);
|
Do(p, lwMutexWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(lwMutexWaitTimer, "LwMutexTimeout", __KernelLwMutexTimeout);
|
CoreTiming::RestoreRegisterEvent(lwMutexWaitTimer, "LwMutexTimeout", __KernelLwMutexTimeout);
|
||||||
p.Do(mutexHeldLocks);
|
Do(p, mutexHeldLocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
KernelObject *__KernelMutexObject()
|
KernelObject *__KernelMutexObject()
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
#include "Core/HLE/sceKernelSemaphore.h"
|
#include "Core/HLE/sceKernelSemaphore.h"
|
||||||
@ -69,10 +71,10 @@ struct PSPSemaphore : public KernelObject {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(ns);
|
Do(p, ns);
|
||||||
SceUID dv = 0;
|
SceUID dv = 0;
|
||||||
p.Do(waitingThreads, dv);
|
Do(p, waitingThreads, dv);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeSemaphore ns;
|
NativeSemaphore ns;
|
||||||
@ -98,7 +100,7 @@ void __KernelSemaDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(semaWaitTimer);
|
Do(p, semaWaitTimer);
|
||||||
CoreTiming::RestoreRegisterEvent(semaWaitTimer, "SemaphoreTimeout", __KernelSemaTimeout);
|
CoreTiming::RestoreRegisterEvent(semaWaitTimer, "SemaphoreTimeout", __KernelSemaTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,15 +16,19 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <queue>
|
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
|
||||||
#include "Common/LogManager.h"
|
|
||||||
#include "Common/CommonTypes.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/HLE.h"
|
||||||
#include "Core/HLE/HLETables.h"
|
#include "Core/HLE/HLETables.h"
|
||||||
#include "Core/MIPS/MIPSAnalyst.h"
|
#include "Core/MIPS/MIPSAnalyst.h"
|
||||||
@ -36,7 +40,6 @@
|
|||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
#include "Core/HLE/sceAudio.h"
|
#include "Core/HLE/sceAudio.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
@ -162,14 +165,14 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nc);
|
Do(p, nc);
|
||||||
// Saved values were moved to mips call, ignoring here.
|
// Saved values were moved to mips call, ignoring here.
|
||||||
u32 legacySaved = 0;
|
u32 legacySaved = 0;
|
||||||
p.Do(legacySaved);
|
Do(p, legacySaved);
|
||||||
p.Do(legacySaved);
|
Do(p, legacySaved);
|
||||||
p.Do(legacySaved);
|
Do(p, legacySaved);
|
||||||
p.Do(legacySaved);
|
Do(p, legacySaved);
|
||||||
p.Do(legacySaved);
|
Do(p, legacySaved);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeCallback nc;
|
NativeCallback nc;
|
||||||
@ -281,8 +284,8 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(calls_);
|
Do(p, calls_);
|
||||||
p.Do(idGen_);
|
Do(p, idGen_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -312,18 +315,18 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(threadID);
|
Do(p, threadID);
|
||||||
p.Do(status);
|
Do(p, status);
|
||||||
p.Do(waitType);
|
Do(p, waitType);
|
||||||
p.Do(waitID);
|
Do(p, waitID);
|
||||||
p.Do(waitInfo);
|
Do(p, waitInfo);
|
||||||
p.Do(isProcessingCallbacks);
|
Do(p, isProcessingCallbacks);
|
||||||
p.Do(currentCallbackId);
|
Do(p, currentCallbackId);
|
||||||
|
|
||||||
int chainedActionType = 0;
|
int chainedActionType = 0;
|
||||||
if (chainedAction != NULL)
|
if (chainedAction != NULL)
|
||||||
chainedActionType = chainedAction->actionTypeID;
|
chainedActionType = chainedAction->actionTypeID;
|
||||||
p.Do(chainedActionType);
|
Do(p, chainedActionType);
|
||||||
|
|
||||||
if (chainedActionType != 0)
|
if (chainedActionType != 0)
|
||||||
{
|
{
|
||||||
@ -367,7 +370,7 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(cbId);
|
Do(p, cbId);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceUID cbId;
|
SceUID cbId;
|
||||||
@ -532,15 +535,15 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nt);
|
Do(p, nt);
|
||||||
p.Do(waitInfo);
|
Do(p, waitInfo);
|
||||||
p.Do(moduleId);
|
Do(p, moduleId);
|
||||||
p.Do(isProcessingCallbacks);
|
Do(p, isProcessingCallbacks);
|
||||||
p.Do(currentMipscallId);
|
Do(p, currentMipscallId);
|
||||||
p.Do(currentCallbackId);
|
Do(p, currentCallbackId);
|
||||||
|
|
||||||
// TODO: If we want to "version" a DoState method here, we can just use minVer = 0.
|
// 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)
|
if (s <= 3)
|
||||||
{
|
{
|
||||||
@ -561,16 +564,16 @@ public:
|
|||||||
if (s <= 4)
|
if (s <= 4)
|
||||||
std::swap(context.hi, context.lo);
|
std::swap(context.hi, context.lo);
|
||||||
|
|
||||||
p.Do(callbacks);
|
Do(p, callbacks);
|
||||||
|
|
||||||
p.Do(pendingMipsCalls);
|
Do(p, pendingMipsCalls);
|
||||||
p.Do(pushedStacks);
|
Do(p, pushedStacks);
|
||||||
p.Do(currentStack);
|
Do(p, currentStack);
|
||||||
|
|
||||||
if (s >= 2)
|
if (s >= 2)
|
||||||
{
|
{
|
||||||
p.Do(waitingThreads);
|
Do(p, waitingThreads);
|
||||||
p.Do(pausedWaits);
|
Do(p, pausedWaits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,26 +698,26 @@ void MipsCall::DoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(entryPoint);
|
Do(p, entryPoint);
|
||||||
p.Do(cbId);
|
Do(p, cbId);
|
||||||
p.DoArray(args, ARRAY_SIZE(args));
|
DoArray(p, args, ARRAY_SIZE(args));
|
||||||
p.Do(numArgs);
|
Do(p, numArgs);
|
||||||
// No longer used.
|
// No longer used.
|
||||||
u32 legacySavedIdRegister = 0;
|
u32 legacySavedIdRegister = 0;
|
||||||
p.Do(legacySavedIdRegister);
|
Do(p, legacySavedIdRegister);
|
||||||
u32 legacySavedRa = 0;
|
u32 legacySavedRa = 0;
|
||||||
p.Do(legacySavedRa);
|
Do(p, legacySavedRa);
|
||||||
p.Do(savedPc);
|
Do(p, savedPc);
|
||||||
p.Do(savedV0);
|
Do(p, savedV0);
|
||||||
p.Do(savedV1);
|
Do(p, savedV1);
|
||||||
p.Do(tag);
|
Do(p, tag);
|
||||||
p.Do(savedId);
|
Do(p, savedId);
|
||||||
p.Do(reschedAfter);
|
Do(p, reschedAfter);
|
||||||
|
|
||||||
int actionTypeID = 0;
|
int actionTypeID = 0;
|
||||||
if (doAfter != NULL)
|
if (doAfter != NULL)
|
||||||
actionTypeID = doAfter->actionTypeID;
|
actionTypeID = doAfter->actionTypeID;
|
||||||
p.Do(actionTypeID);
|
Do(p, actionTypeID);
|
||||||
if (actionTypeID != 0)
|
if (actionTypeID != 0)
|
||||||
{
|
{
|
||||||
if (p.mode == p.MODE_READ)
|
if (p.mode == p.MODE_READ)
|
||||||
@ -970,48 +973,48 @@ void __KernelThreadingDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(g_inCbCount);
|
Do(p, g_inCbCount);
|
||||||
p.Do(currentCallbackThreadID);
|
Do(p, currentCallbackThreadID);
|
||||||
p.Do(readyCallbacksCount);
|
Do(p, readyCallbacksCount);
|
||||||
p.Do(idleThreadHackAddr);
|
Do(p, idleThreadHackAddr);
|
||||||
p.Do(threadReturnHackAddr);
|
Do(p, threadReturnHackAddr);
|
||||||
p.Do(cbReturnHackAddr);
|
Do(p, cbReturnHackAddr);
|
||||||
p.Do(intReturnHackAddr);
|
Do(p, intReturnHackAddr);
|
||||||
p.Do(extendReturnHackAddr);
|
Do(p, extendReturnHackAddr);
|
||||||
p.Do(moduleReturnHackAddr);
|
Do(p, moduleReturnHackAddr);
|
||||||
|
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(hleReturnHackAddr);
|
Do(p, hleReturnHackAddr);
|
||||||
} else {
|
} else {
|
||||||
hleReturnHackAddr = 0;
|
hleReturnHackAddr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(currentThread);
|
Do(p, currentThread);
|
||||||
SceUID dv = 0;
|
SceUID dv = 0;
|
||||||
p.Do(threadqueue, dv);
|
Do(p, threadqueue, dv);
|
||||||
p.DoArray(threadIdleID, ARRAY_SIZE(threadIdleID));
|
DoArray(p, threadIdleID, ARRAY_SIZE(threadIdleID));
|
||||||
p.Do(dispatchEnabled);
|
Do(p, dispatchEnabled);
|
||||||
|
|
||||||
p.Do(threadReadyQueue);
|
Do(p, threadReadyQueue);
|
||||||
|
|
||||||
p.Do(eventScheduledWakeup);
|
Do(p, eventScheduledWakeup);
|
||||||
CoreTiming::RestoreRegisterEvent(eventScheduledWakeup, "ScheduledWakeup", &hleScheduledWakeup);
|
CoreTiming::RestoreRegisterEvent(eventScheduledWakeup, "ScheduledWakeup", &hleScheduledWakeup);
|
||||||
p.Do(eventThreadEndTimeout);
|
Do(p, eventThreadEndTimeout);
|
||||||
CoreTiming::RestoreRegisterEvent(eventThreadEndTimeout, "ThreadEndTimeout", &hleThreadEndTimeout);
|
CoreTiming::RestoreRegisterEvent(eventThreadEndTimeout, "ThreadEndTimeout", &hleThreadEndTimeout);
|
||||||
p.Do(actionAfterMipsCall);
|
Do(p, actionAfterMipsCall);
|
||||||
__KernelRestoreActionType(actionAfterMipsCall, ActionAfterMipsCall::Create);
|
__KernelRestoreActionType(actionAfterMipsCall, ActionAfterMipsCall::Create);
|
||||||
p.Do(actionAfterCallback);
|
Do(p, actionAfterCallback);
|
||||||
__KernelRestoreActionType(actionAfterCallback, ActionAfterCallback::Create);
|
__KernelRestoreActionType(actionAfterCallback, ActionAfterCallback::Create);
|
||||||
|
|
||||||
p.Do(pausedDelays);
|
Do(p, pausedDelays);
|
||||||
|
|
||||||
__SetCurrentThread(kernelObjects.GetFast<PSPThread>(currentThread), currentThread, __KernelGetThreadName(currentThread));
|
__SetCurrentThread(kernelObjects.GetFast<PSPThread>(currentThread), currentThread, __KernelGetThreadName(currentThread));
|
||||||
lastSwitchCycles = CoreTiming::GetTicks();
|
lastSwitchCycles = CoreTiming::GetTicks();
|
||||||
|
|
||||||
if (s >= 2)
|
if (s >= 2)
|
||||||
p.Do(threadEventHandlers);
|
Do(p, threadEventHandlers);
|
||||||
if (s >= 3)
|
if (s >= 3)
|
||||||
p.Do(pendingDeleteThreads);
|
Do(p, pendingDeleteThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __KernelThreadingDoStateLate(PointerWrap &p)
|
void __KernelThreadingDoStateLate(PointerWrap &p)
|
||||||
@ -3672,7 +3675,7 @@ struct ThreadEventHandler : public KernelObject {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nteh);
|
Do(p, nteh);
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeThreadEventHandler nteh;
|
NativeThreadEventHandler nteh;
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
@ -48,10 +49,10 @@ void __KernelTimeDoState(PointerWrap &p)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
p.Do(start_time);
|
Do(p, start_time);
|
||||||
} else {
|
} else {
|
||||||
u64 t = start_time;
|
u64 t = start_time;
|
||||||
p.Do(t);
|
Do(p, t);
|
||||||
start_time = (time_t)t;
|
start_time = (time_t)t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <list>
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeList.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
@ -24,7 +28,6 @@
|
|||||||
#include "Core/HLE/sceKernelMemory.h"
|
#include "Core/HLE/sceKernelMemory.h"
|
||||||
#include "Core/HLE/sceKernelVTimer.h"
|
#include "Core/HLE/sceKernelVTimer.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
static int vtimerTimer = -1;
|
static int vtimerTimer = -1;
|
||||||
static SceUID runningVTimer = 0;
|
static SceUID runningVTimer = 0;
|
||||||
@ -54,10 +57,10 @@ struct VTimer : public KernelObject {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(nvt);
|
Do(p, nvt);
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
u32 memoryPtr;
|
u32 memoryPtr;
|
||||||
p.Do(memoryPtr);
|
Do(p, memoryPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,12 +195,12 @@ void __KernelVTimerDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(vtimerTimer);
|
Do(p, vtimerTimer);
|
||||||
p.Do(vtimers);
|
Do(p, vtimers);
|
||||||
CoreTiming::RestoreRegisterEvent(vtimerTimer, "VTimer", __KernelTriggerVTimer);
|
CoreTiming::RestoreRegisterEvent(vtimerTimer, "VTimer", __KernelTriggerVTimer);
|
||||||
|
|
||||||
if (s >= 2)
|
if (s >= 2)
|
||||||
p.Do(runningVTimer);
|
Do(p, runningVTimer);
|
||||||
else
|
else
|
||||||
runningVTimer = 0;
|
runningVTimer = 0;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
@ -70,24 +72,24 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(mp3StreamStart);
|
Do(p, mp3StreamStart);
|
||||||
p.Do(mp3StreamEnd);
|
Do(p, mp3StreamEnd);
|
||||||
p.Do(mp3Buf);
|
Do(p, mp3Buf);
|
||||||
p.Do(mp3BufSize);
|
Do(p, mp3BufSize);
|
||||||
p.Do(mp3PcmBuf);
|
Do(p, mp3PcmBuf);
|
||||||
p.Do(mp3PcmBufSize);
|
Do(p, mp3PcmBufSize);
|
||||||
p.Do(readPosition);
|
Do(p, readPosition);
|
||||||
p.Do(bufferRead);
|
Do(p, bufferRead);
|
||||||
p.Do(bufferWrite);
|
Do(p, bufferWrite);
|
||||||
p.Do(bufferAvailable);
|
Do(p, bufferAvailable);
|
||||||
p.Do(mp3DecodedBytes);
|
Do(p, mp3DecodedBytes);
|
||||||
p.Do(mp3LoopNum);
|
Do(p, mp3LoopNum);
|
||||||
p.Do(mp3MaxSamples);
|
Do(p, mp3MaxSamples);
|
||||||
p.Do(mp3SumDecodedSamples);
|
Do(p, mp3SumDecodedSamples);
|
||||||
p.Do(mp3Channels);
|
Do(p, mp3Channels);
|
||||||
p.Do(mp3Bitrate);
|
Do(p, mp3Bitrate);
|
||||||
p.Do(mp3SamplingRate);
|
Do(p, mp3SamplingRate);
|
||||||
p.Do(mp3Version);
|
Do(p, mp3Version);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -114,10 +116,10 @@ void __Mp3DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(mp3Map);
|
Do(p, mp3Map);
|
||||||
} else {
|
} else {
|
||||||
std::map<u32, Mp3Context *> mp3Map_old;
|
std::map<u32, Mp3Context *> 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) {
|
for (auto it = mp3Map_old.begin(), end = mp3Map_old.end(); it != end; ++it) {
|
||||||
auto mp3 = new AuCtx;
|
auto mp3 = new AuCtx;
|
||||||
u32 id = it->first;
|
u32 id = it->first;
|
||||||
@ -147,7 +149,7 @@ void __Mp3DoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(resourceInited);
|
Do(p, resourceInited);
|
||||||
} else {
|
} else {
|
||||||
// Previous behavior acted as if it was already inited.
|
// Previous behavior acted as if it was already inited.
|
||||||
resourceInited = true;
|
resourceInited = true;
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
@ -43,7 +45,7 @@ void __AACDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(aacMap);
|
Do(p, aacMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceMp4Init()
|
static u32 sceMp4Init()
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Common/Swap.h"
|
#include "Common/Swap.h"
|
||||||
#include "Core/HLE/sceMpeg.h"
|
#include "Core/HLE/sceMpeg.h"
|
||||||
#include "Core/HLE/sceKernelModule.h"
|
#include "Core/HLE/sceKernelModule.h"
|
||||||
@ -176,35 +178,35 @@ struct MpegContext {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.DoArray(mpegheader, 2048);
|
DoArray(p, mpegheader, 2048);
|
||||||
p.Do(defaultFrameWidth);
|
Do(p, defaultFrameWidth);
|
||||||
p.Do(videoFrameCount);
|
Do(p, videoFrameCount);
|
||||||
p.Do(audioFrameCount);
|
Do(p, audioFrameCount);
|
||||||
p.Do(endOfAudioReached);
|
Do(p, endOfAudioReached);
|
||||||
p.Do(endOfVideoReached);
|
Do(p, endOfVideoReached);
|
||||||
p.Do(videoPixelMode);
|
Do(p, videoPixelMode);
|
||||||
p.Do(mpegMagic);
|
Do(p, mpegMagic);
|
||||||
p.Do(mpegVersion);
|
Do(p, mpegVersion);
|
||||||
p.Do(mpegRawVersion);
|
Do(p, mpegRawVersion);
|
||||||
p.Do(mpegOffset);
|
Do(p, mpegOffset);
|
||||||
p.Do(mpegStreamSize);
|
Do(p, mpegStreamSize);
|
||||||
p.Do(mpegFirstTimestamp);
|
Do(p, mpegFirstTimestamp);
|
||||||
p.Do(mpegLastTimestamp);
|
Do(p, mpegLastTimestamp);
|
||||||
p.Do(mpegFirstDate);
|
Do(p, mpegFirstDate);
|
||||||
p.Do(mpegLastDate);
|
Do(p, mpegLastDate);
|
||||||
p.Do(mpegRingbufferAddr);
|
Do(p, mpegRingbufferAddr);
|
||||||
p.DoArray(esBuffers, MPEG_DATA_ES_BUFFERS);
|
DoArray(p, esBuffers, MPEG_DATA_ES_BUFFERS);
|
||||||
p.Do(avc);
|
Do(p, avc);
|
||||||
p.Do(avcRegistered);
|
Do(p, avcRegistered);
|
||||||
p.Do(atracRegistered);
|
Do(p, atracRegistered);
|
||||||
p.Do(pcmRegistered);
|
Do(p, pcmRegistered);
|
||||||
p.Do(dataRegistered);
|
Do(p, dataRegistered);
|
||||||
p.Do(ignoreAtrac);
|
Do(p, ignoreAtrac);
|
||||||
p.Do(ignorePcm);
|
Do(p, ignorePcm);
|
||||||
p.Do(ignoreAvc);
|
Do(p, ignoreAvc);
|
||||||
p.Do(isAnalyzed);
|
Do(p, isAnalyzed);
|
||||||
p.Do<u32, StreamInfo>(streamMap);
|
Do<u32, StreamInfo>(p, streamMap);
|
||||||
p.DoClass(mediaengine);
|
DoClass(p, mediaengine);
|
||||||
ringbufferNeedsReverse = s < 2;
|
ringbufferNeedsReverse = s < 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +367,7 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(ringAddr_);
|
Do(p, ringAddr_);
|
||||||
}
|
}
|
||||||
void run(MipsCall &call) override;
|
void run(MipsCall &call) override;
|
||||||
private:
|
private:
|
||||||
@ -392,20 +394,20 @@ void __MpegDoState(PointerWrap &p) {
|
|||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
int oldLastMpeg = -1;
|
int oldLastMpeg = -1;
|
||||||
bool oldIsMpegAnalyzed = false;
|
bool oldIsMpegAnalyzed = false;
|
||||||
p.Do(oldLastMpeg);
|
Do(p, oldLastMpeg);
|
||||||
p.Do(streamIdGen);
|
Do(p, streamIdGen);
|
||||||
p.Do(oldIsMpegAnalyzed);
|
Do(p, oldIsMpegAnalyzed);
|
||||||
// Let's assume the oldest version.
|
// Let's assume the oldest version.
|
||||||
mpegLibVersion = 0x0101;
|
mpegLibVersion = 0x0101;
|
||||||
} else {
|
} else {
|
||||||
p.Do(streamIdGen);
|
Do(p, streamIdGen);
|
||||||
p.Do(mpegLibVersion);
|
Do(p, mpegLibVersion);
|
||||||
}
|
}
|
||||||
p.Do(isMpegInit);
|
Do(p, isMpegInit);
|
||||||
p.Do(actionPostPut);
|
Do(p, actionPostPut);
|
||||||
__KernelRestoreActionType(actionPostPut, PostPutAction::Create);
|
__KernelRestoreActionType(actionPostPut, PostPutAction::Create);
|
||||||
|
|
||||||
p.Do(mpegMap);
|
Do(p, mpegMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __MpegShutdown() {
|
void __MpegShutdown() {
|
||||||
@ -1054,8 +1056,8 @@ void __VideoPmpDoState(PointerWrap &p){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(pmp_videoSource);
|
Do(p, pmp_videoSource);
|
||||||
p.Do(pmp_nBlocks);
|
Do(p, pmp_nBlocks);
|
||||||
if (p.mode == PointerWrap::MODE_READ){
|
if (p.mode == PointerWrap::MODE_READ){
|
||||||
// for loadstate, we will reinitialize the pmp codec
|
// for loadstate, we will reinitialize the pmp codec
|
||||||
__VideoPmpShutdown();
|
__VideoPmpShutdown();
|
||||||
|
@ -28,22 +28,21 @@
|
|||||||
|
|
||||||
static u32 sceMt19937Init(u32 mt19937Addr, u32 seed)
|
static u32 sceMt19937Init(u32 mt19937Addr, u32 seed)
|
||||||
{
|
{
|
||||||
INFO_LOG(HLE, "sceMt19937Init(%08x, %08x)", mt19937Addr, seed);
|
|
||||||
if (!Memory::IsValidAddress(mt19937Addr))
|
if (!Memory::IsValidAddress(mt19937Addr))
|
||||||
return -1;
|
return hleLogError(HLE, -1);
|
||||||
void *ptr = Memory::GetPointer(mt19937Addr);
|
void *ptr = Memory::GetPointer(mt19937Addr);
|
||||||
// This is made to match the memory layout of a PSP MT structure exactly.
|
// 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.
|
// Let's just construct it in place with placement new. Elite C++ hackery FTW.
|
||||||
new (ptr) MersenneTwister(seed);
|
new (ptr) MersenneTwister(seed);
|
||||||
return 0;
|
return hleLogSuccessInfoI(HLE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceMt19937UInt(u32 mt19937Addr)
|
static u32 sceMt19937UInt(u32 mt19937Addr)
|
||||||
{
|
{
|
||||||
if (!Memory::IsValidAddress(mt19937Addr))
|
if (!Memory::IsValidAddress(mt19937Addr))
|
||||||
return -1;
|
return hleLogError(HLE, -1);
|
||||||
MersenneTwister *mt = (MersenneTwister *)Memory::GetPointer(mt19937Addr);
|
MersenneTwister *mt = (MersenneTwister *)Memory::GetPointer(mt19937Addr);
|
||||||
return mt->R32();
|
return hleLogSuccessVerboseX(HLE, mt->R32());
|
||||||
}
|
}
|
||||||
|
|
||||||
const HLEFunction sceMt19937[] =
|
const HLEFunction sceMt19937[] =
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
#include "net/resolve.h"
|
#include "net/resolve.h"
|
||||||
#include "util/text/parsers.h"
|
#include "util/text/parsers.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceKernelMemory.h"
|
#include "Core/HLE/sceKernelMemory.h"
|
||||||
@ -73,6 +75,28 @@ u32 Net_Term();
|
|||||||
int NetApctl_Term();
|
int NetApctl_Term();
|
||||||
void NetApctl_InitInfo();
|
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) {
|
void AfterApctlMipsCall::run(MipsCall& call) {
|
||||||
u32 v0 = currentMIPS->r[MIPS_REG_V0];
|
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);
|
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 +245,34 @@ void __NetDoState(PointerWrap &p) {
|
|||||||
auto cur_netInetInited = netInetInited;
|
auto cur_netInetInited = netInetInited;
|
||||||
auto cur_netApctlInited = netApctlInited;
|
auto cur_netApctlInited = netApctlInited;
|
||||||
|
|
||||||
p.Do(netInited);
|
Do(p, netInited);
|
||||||
p.Do(netInetInited);
|
Do(p, netInetInited);
|
||||||
p.Do(netApctlInited);
|
Do(p, netApctlInited);
|
||||||
p.Do(apctlHandlers);
|
Do(p, apctlHandlers);
|
||||||
p.Do(netMallocStat);
|
Do(p, netMallocStat);
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
netDropRate = 0;
|
netDropRate = 0;
|
||||||
netDropDuration = 0;
|
netDropDuration = 0;
|
||||||
} else {
|
} else {
|
||||||
p.Do(netDropRate);
|
Do(p, netDropRate);
|
||||||
p.Do(netDropDuration);
|
Do(p, netDropDuration);
|
||||||
}
|
}
|
||||||
if (s < 3) {
|
if (s < 3) {
|
||||||
netPoolAddr = 0;
|
netPoolAddr = 0;
|
||||||
netThread1Addr = 0;
|
netThread1Addr = 0;
|
||||||
netThread2Addr = 0;
|
netThread2Addr = 0;
|
||||||
} else {
|
} else {
|
||||||
p.Do(netPoolAddr);
|
Do(p, netPoolAddr);
|
||||||
p.Do(netThread1Addr);
|
Do(p, netThread1Addr);
|
||||||
p.Do(netThread2Addr);
|
Do(p, netThread2Addr);
|
||||||
}
|
}
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(netApctlState);
|
Do(p, netApctlState);
|
||||||
p.Do(netApctlInfo);
|
Do(p, netApctlInfo);
|
||||||
p.Do(actionAfterApctlMipsCall);
|
Do(p, actionAfterApctlMipsCall);
|
||||||
__KernelRestoreActionType(actionAfterApctlMipsCall, AfterApctlMipsCall::Create);
|
__KernelRestoreActionType(actionAfterApctlMipsCall, AfterApctlMipsCall::Create);
|
||||||
p.Do(apctlThreadHackAddr);
|
Do(p, apctlThreadHackAddr);
|
||||||
p.Do(apctlThreadID);
|
Do(p, apctlThreadID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
actionAfterApctlMipsCall = -1;
|
actionAfterApctlMipsCall = -1;
|
||||||
|
@ -204,28 +204,7 @@ class AfterApctlMipsCall : public PSPAction {
|
|||||||
public:
|
public:
|
||||||
AfterApctlMipsCall() {}
|
AfterApctlMipsCall() {}
|
||||||
static PSPAction* Create() { return new AfterApctlMipsCall(); }
|
static PSPAction* Create() { return new AfterApctlMipsCall(); }
|
||||||
void DoState(PointerWrap& p) override {
|
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 run(MipsCall& call) override;
|
void run(MipsCall& call) override;
|
||||||
void SetData(int HandlerID, int OldState, int NewState, int Event, int Error, u32_le ArgsAddr);
|
void SetData(int HandlerID, int OldState, int NewState, int Event, int Error, u32_le ArgsAddr);
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@
|
|||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||||
#include "Core/Util/PortManager.h"
|
#include "Core/Util/PortManager.h"
|
||||||
|
|
||||||
@ -119,34 +121,34 @@ void __NetAdhocDoState(PointerWrap &p) {
|
|||||||
auto cur_netAdhocctlInited = netAdhocctlInited;
|
auto cur_netAdhocctlInited = netAdhocctlInited;
|
||||||
auto cur_netAdhocMatchingInited = netAdhocMatchingInited;
|
auto cur_netAdhocMatchingInited = netAdhocMatchingInited;
|
||||||
|
|
||||||
p.Do(netAdhocInited);
|
Do(p, netAdhocInited);
|
||||||
p.Do(netAdhocctlInited);
|
Do(p, netAdhocctlInited);
|
||||||
p.Do(netAdhocMatchingInited);
|
Do(p, netAdhocMatchingInited);
|
||||||
p.Do(adhocctlHandlers);
|
Do(p, adhocctlHandlers);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(actionAfterMatchingMipsCall);
|
Do(p, actionAfterMatchingMipsCall);
|
||||||
__KernelRestoreActionType(actionAfterMatchingMipsCall, AfterMatchingMipsCall::Create);
|
__KernelRestoreActionType(actionAfterMatchingMipsCall, AfterMatchingMipsCall::Create);
|
||||||
|
|
||||||
p.Do(dummyThreadHackAddr);
|
Do(p, dummyThreadHackAddr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
actionAfterMatchingMipsCall = -1;
|
actionAfterMatchingMipsCall = -1;
|
||||||
dummyThreadHackAddr = 0;
|
dummyThreadHackAddr = 0;
|
||||||
}
|
}
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(actionAfterAdhocMipsCall);
|
Do(p, actionAfterAdhocMipsCall);
|
||||||
__KernelRestoreActionType(actionAfterAdhocMipsCall, AfterAdhocMipsCall::Create);
|
__KernelRestoreActionType(actionAfterAdhocMipsCall, AfterAdhocMipsCall::Create);
|
||||||
|
|
||||||
p.Do(matchingThreadHackAddr);
|
Do(p, matchingThreadHackAddr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
actionAfterAdhocMipsCall = -1;
|
actionAfterAdhocMipsCall = -1;
|
||||||
matchingThreadHackAddr = 0;
|
matchingThreadHackAddr = 0;
|
||||||
}
|
}
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(threadAdhocID);
|
Do(p, threadAdhocID);
|
||||||
p.Do(matchingThreads);
|
Do(p, matchingThreads);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
threadAdhocID = 0;
|
threadAdhocID = 0;
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
@ -132,8 +133,8 @@ void __PowerDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(RealpllFreq);
|
Do(p, RealpllFreq);
|
||||||
p.Do(RealbusFreq);
|
Do(p, RealbusFreq);
|
||||||
|
|
||||||
if (RealpllFreq < 1000000)
|
if (RealpllFreq < 1000000)
|
||||||
RealpllFreq = PowerPllMhzToHz(RealpllFreq);
|
RealpllFreq = PowerPllMhzToHz(RealpllFreq);
|
||||||
@ -151,9 +152,9 @@ void __PowerDoState(PointerWrap &p) {
|
|||||||
pllFreq = RealpllFreq;
|
pllFreq = RealpllFreq;
|
||||||
busFreq = RealbusFreq;
|
busFreq = RealbusFreq;
|
||||||
}
|
}
|
||||||
p.DoArray(powerCbSlots, ARRAY_SIZE(powerCbSlots));
|
DoArray(p, powerCbSlots, ARRAY_SIZE(powerCbSlots));
|
||||||
p.Do(volatileMemLocked);
|
Do(p, volatileMemLocked);
|
||||||
p.Do(volatileWaitingThreads);
|
Do(p, volatileWaitingThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scePowerGetBatteryLifePercent() {
|
static int scePowerGetBatteryLifePercent() {
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
@ -334,13 +336,13 @@ public:
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(type_);
|
Do(p, type_);
|
||||||
p.Do(channel_);
|
Do(p, channel_);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(videoWidth_);
|
Do(p, videoWidth_);
|
||||||
p.Do(videoHeight_);
|
Do(p, videoHeight_);
|
||||||
p.Do(audioChannels_);
|
Do(p, audioChannels_);
|
||||||
p.Do(audioFrequency_);
|
Do(p, audioFrequency_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,38 +442,38 @@ void Psmf::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(magic);
|
Do(p, magic);
|
||||||
p.Do(version);
|
Do(p, version);
|
||||||
p.Do(streamOffset);
|
Do(p, streamOffset);
|
||||||
p.Do(streamSize);
|
Do(p, streamSize);
|
||||||
p.Do(headerOffset);
|
Do(p, headerOffset);
|
||||||
p.Do(streamDataTotalSize);
|
Do(p, streamDataTotalSize);
|
||||||
p.Do(presentationStartTime);
|
Do(p, presentationStartTime);
|
||||||
p.Do(presentationEndTime);
|
Do(p, presentationEndTime);
|
||||||
p.Do(streamDataNextBlockSize);
|
Do(p, streamDataNextBlockSize);
|
||||||
p.Do(streamDataNextInnerBlockSize);
|
Do(p, streamDataNextInnerBlockSize);
|
||||||
p.Do(numStreams);
|
Do(p, numStreams);
|
||||||
|
|
||||||
p.Do(currentStreamNum);
|
Do(p, currentStreamNum);
|
||||||
int legacyStreamNums = 0;
|
int legacyStreamNums = 0;
|
||||||
p.Do(legacyStreamNums);
|
Do(p, legacyStreamNums);
|
||||||
p.Do(legacyStreamNums);
|
Do(p, legacyStreamNums);
|
||||||
|
|
||||||
p.Do(EPMapOffset);
|
Do(p, EPMapOffset);
|
||||||
p.Do(EPMapEntriesNum);
|
Do(p, EPMapEntriesNum);
|
||||||
p.Do(videoWidth);
|
Do(p, videoWidth);
|
||||||
p.Do(videoHeight);
|
Do(p, videoHeight);
|
||||||
p.Do(audioChannels);
|
Do(p, audioChannels);
|
||||||
p.Do(audioFrequency);
|
Do(p, audioFrequency);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(EPMap);
|
Do(p, EPMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(streamMap);
|
Do(p, streamMap);
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(currentStreamType);
|
Do(p, currentStreamType);
|
||||||
p.Do(currentStreamChannel);
|
Do(p, currentStreamChannel);
|
||||||
} else {
|
} else {
|
||||||
currentStreamType = -1;
|
currentStreamType = -1;
|
||||||
currentStreamChannel = -1;
|
currentStreamChannel = -1;
|
||||||
@ -488,65 +490,65 @@ void PsmfPlayer::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(videoCodec);
|
Do(p, videoCodec);
|
||||||
p.Do(videoStreamNum);
|
Do(p, videoStreamNum);
|
||||||
p.Do(audioCodec);
|
Do(p, audioCodec);
|
||||||
p.Do(audioStreamNum);
|
Do(p, audioStreamNum);
|
||||||
p.Do(playMode);
|
Do(p, playMode);
|
||||||
p.Do(playSpeed);
|
Do(p, playSpeed);
|
||||||
|
|
||||||
p.Do(displayBuffer);
|
Do(p, displayBuffer);
|
||||||
p.Do(displayBufferSize);
|
Do(p, displayBufferSize);
|
||||||
p.Do(playbackThreadPriority);
|
Do(p, playbackThreadPriority);
|
||||||
int oldMaxAheadTimestamp = 0;
|
int oldMaxAheadTimestamp = 0;
|
||||||
p.Do(oldMaxAheadTimestamp);
|
Do(p, oldMaxAheadTimestamp);
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(totalDurationTimestamp);
|
Do(p, totalDurationTimestamp);
|
||||||
} else {
|
} else {
|
||||||
long oldTimestamp;
|
long oldTimestamp;
|
||||||
p.Do(oldTimestamp);
|
Do(p, oldTimestamp);
|
||||||
totalDurationTimestamp = oldTimestamp;
|
totalDurationTimestamp = oldTimestamp;
|
||||||
}
|
}
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(totalVideoStreams);
|
Do(p, totalVideoStreams);
|
||||||
p.Do(totalAudioStreams);
|
Do(p, totalAudioStreams);
|
||||||
p.Do(playerVersion);
|
Do(p, playerVersion);
|
||||||
} else {
|
} else {
|
||||||
totalVideoStreams = 1;
|
totalVideoStreams = 1;
|
||||||
totalAudioStreams = 1;
|
totalAudioStreams = 1;
|
||||||
playerVersion = PSMF_PLAYER_VERSION_FULL;
|
playerVersion = PSMF_PLAYER_VERSION_FULL;
|
||||||
}
|
}
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(videoStep);
|
Do(p, videoStep);
|
||||||
} else {
|
} else {
|
||||||
videoStep = 0;
|
videoStep = 0;
|
||||||
}
|
}
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(warmUp);
|
Do(p, warmUp);
|
||||||
} else {
|
} else {
|
||||||
warmUp = 10000;
|
warmUp = 10000;
|
||||||
}
|
}
|
||||||
if (s >= 5) {
|
if (s >= 5) {
|
||||||
p.Do(seekDestTimeStamp);
|
Do(p, seekDestTimeStamp);
|
||||||
} else {
|
} else {
|
||||||
seekDestTimeStamp = 0;
|
seekDestTimeStamp = 0;
|
||||||
}
|
}
|
||||||
p.DoClass(mediaengine);
|
DoClass(p, mediaengine);
|
||||||
p.Do(filehandle);
|
Do(p, filehandle);
|
||||||
p.Do(fileoffset);
|
Do(p, fileoffset);
|
||||||
p.Do(readSize);
|
Do(p, readSize);
|
||||||
p.Do(streamSize);
|
Do(p, streamSize);
|
||||||
|
|
||||||
p.Do(status);
|
Do(p, status);
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(psmfPlayerAtracAu);
|
Do(p, psmfPlayerAtracAu);
|
||||||
}
|
}
|
||||||
p.Do(psmfPlayerAvcAu);
|
Do(p, psmfPlayerAvcAu);
|
||||||
if (s >= 7) {
|
if (s >= 7) {
|
||||||
bool hasFinishThread = finishThread != nullptr;
|
bool hasFinishThread = finishThread != nullptr;
|
||||||
p.Do(hasFinishThread);
|
Do(p, hasFinishThread);
|
||||||
if (hasFinishThread) {
|
if (hasFinishThread) {
|
||||||
p.Do(finishThread);
|
Do(p, finishThread);
|
||||||
} else {
|
} else {
|
||||||
if (finishThread)
|
if (finishThread)
|
||||||
finishThread->Forget();
|
finishThread->Forget();
|
||||||
@ -554,7 +556,7 @@ void PsmfPlayer::DoState(PointerWrap &p) {
|
|||||||
finishThread = nullptr;
|
finishThread = nullptr;
|
||||||
}
|
}
|
||||||
} else if (s >= 6) {
|
} else if (s >= 6) {
|
||||||
p.Do(finishThread);
|
Do(p, finishThread);
|
||||||
} else {
|
} else {
|
||||||
if (finishThread)
|
if (finishThread)
|
||||||
finishThread->Forget();
|
finishThread->Forget();
|
||||||
@ -563,8 +565,8 @@ void PsmfPlayer::DoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 8) {
|
if (s >= 8) {
|
||||||
p.Do(videoWidth);
|
Do(p, videoWidth);
|
||||||
p.Do(videoHeight);
|
Do(p, videoHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,7 +681,7 @@ void __PsmfDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(psmfMap);
|
Do(p, psmfMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __PsmfPlayerDoState(PointerWrap &p) {
|
void __PsmfPlayerDoState(PointerWrap &p) {
|
||||||
@ -687,11 +689,11 @@ void __PsmfPlayerDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(psmfPlayerMap);
|
Do(p, psmfPlayerMap);
|
||||||
p.Do(videoPixelMode);
|
Do(p, videoPixelMode);
|
||||||
p.Do(videoLoopStatus);
|
Do(p, videoLoopStatus);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(psmfPlayerLibVersion);
|
Do(p, psmfPlayerLibVersion);
|
||||||
} else {
|
} else {
|
||||||
// Assume the latest, which is what we were emulating before.
|
// Assume the latest, which is what we were emulating before.
|
||||||
psmfPlayerLibVersion = 0x06060010;
|
psmfPlayerLibVersion = 0x06060010;
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "base/timeutil.h"
|
#include "base/timeutil.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
@ -167,7 +168,7 @@ void __RtcDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(rtcBaseTime);
|
Do(p, rtcBaseTime);
|
||||||
// Update the precalc, pointless to savestate this as it's just based on the other value.
|
// Update the precalc, pointless to savestate this as it's just based on the other value.
|
||||||
RtcUpdateBaseTicks();
|
RtcUpdateBaseTicks();
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "profiler/profiler.h"
|
#include "profiler/profiler.h"
|
||||||
#include "thread/threadutil.h"
|
#include "thread/threadutil.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Common/Log.h"
|
#include "Common/Log.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
@ -204,10 +205,10 @@ void __SasDoState(PointerWrap &p) {
|
|||||||
__SasDrain();
|
__SasDrain();
|
||||||
}
|
}
|
||||||
|
|
||||||
p.DoClass(sas);
|
DoClass(p, sas);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(sasMixEvent);
|
Do(p, sasMixEvent);
|
||||||
} else {
|
} else {
|
||||||
sasMixEvent = -1;
|
sasMixEvent = -1;
|
||||||
__SasDisableThread();
|
__SasDisableThread();
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
|
|
||||||
#include "Core/HLE/sceSsl.h"
|
#include "Core/HLE/sceSsl.h"
|
||||||
|
|
||||||
#define ERROR_SSL_NOT_INIT 0x80435001;
|
#define ERROR_SSL_NOT_INIT 0x80435001;
|
||||||
@ -44,9 +44,9 @@ void __SslDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(isSslInit);
|
Do(p, isSslInit);
|
||||||
p.Do(maxMemSize);
|
Do(p, maxMemSize);
|
||||||
p.Do(currentMemSize);
|
Do(p, currentMemSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sceSslInit(int heapSize)
|
static int sceSslInit(int heapSize)
|
||||||
@ -127,4 +127,4 @@ const HLEFunction sceSsl[] =
|
|||||||
void Register_sceSsl()
|
void Register_sceSsl()
|
||||||
{
|
{
|
||||||
RegisterModule("sceSsl", ARRAY_SIZE(sceSsl), sceSsl);
|
RegisterModule("sceSsl", ARRAY_SIZE(sceSsl), sceSsl);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
#include "file/file_util.h"
|
#include "file/file_util.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.h"
|
||||||
#include "Core/Loaders.h"
|
#include "Core/Loaders.h"
|
||||||
#include "Core/MemMap.h"
|
#include "Core/MemMap.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
@ -87,26 +89,26 @@ void __UmdDoState(PointerWrap &p)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(umdActivated);
|
Do(p, umdActivated);
|
||||||
p.Do(umdStatus);
|
Do(p, umdStatus);
|
||||||
p.Do(umdErrorStat);
|
Do(p, umdErrorStat);
|
||||||
p.Do(driveCBId);
|
Do(p, driveCBId);
|
||||||
p.Do(umdStatTimeoutEvent);
|
Do(p, umdStatTimeoutEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(umdStatTimeoutEvent, "UmdTimeout", __UmdStatTimeout);
|
CoreTiming::RestoreRegisterEvent(umdStatTimeoutEvent, "UmdTimeout", __UmdStatTimeout);
|
||||||
p.Do(umdStatChangeEvent);
|
Do(p, umdStatChangeEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(umdStatChangeEvent, "UmdChange", __UmdStatChange);
|
CoreTiming::RestoreRegisterEvent(umdStatChangeEvent, "UmdChange", __UmdStatChange);
|
||||||
p.Do(umdWaitingThreads);
|
Do(p, umdWaitingThreads);
|
||||||
p.Do(umdPausedWaits);
|
Do(p, umdPausedWaits);
|
||||||
|
|
||||||
if (s > 1) {
|
if (s > 1) {
|
||||||
p.Do(UMDReplacePermit);
|
Do(p, UMDReplacePermit);
|
||||||
if (UMDReplacePermit)
|
if (UMDReplacePermit)
|
||||||
host->UpdateUI();
|
host->UpdateUI();
|
||||||
}
|
}
|
||||||
if (s > 2) {
|
if (s > 2) {
|
||||||
p.Do(umdInsertChangeEvent);
|
Do(p, umdInsertChangeEvent);
|
||||||
CoreTiming::RestoreRegisterEvent(umdInsertChangeEvent, "UmdInsertChange", __UmdInsertChange);
|
CoreTiming::RestoreRegisterEvent(umdInsertChangeEvent, "UmdInsertChange", __UmdInsertChange);
|
||||||
p.Do(UMDInserted);
|
Do(p, UMDInserted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UMDInserted = true;
|
UMDInserted = true;
|
||||||
|
@ -16,11 +16,12 @@
|
|||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "base/NativeApp.h"
|
#include "base/NativeApp.h"
|
||||||
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
#include "Core/HLE/sceUsb.h"
|
#include "Core/HLE/sceUsb.h"
|
||||||
|
|
||||||
// TODO: Map by driver name
|
// TODO: Map by driver name
|
||||||
@ -53,13 +54,13 @@ void __UsbDoState(PointerWrap &p)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(usbStarted);
|
Do(p, usbStarted);
|
||||||
p.Do(usbConnected);
|
Do(p, usbConnected);
|
||||||
} else {
|
} else {
|
||||||
usbStarted = false;
|
usbStarted = false;
|
||||||
usbConnected = true;
|
usbConnected = true;
|
||||||
}
|
}
|
||||||
p.Do(usbActivated);
|
Do(p, usbActivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sceUsbStart(const char* driverName, u32 argsSize, u32 argsPtr) {
|
static int sceUsbStart(const char* driverName, u32 argsSize, u32 argsPtr) {
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
|
|
||||||
#include "base/NativeApp.h"
|
#include "base/NativeApp.h"
|
||||||
#include "ppsspp_config.h"
|
#include "ppsspp_config.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/sceUsbCam.h"
|
#include "Core/HLE/sceUsbCam.h"
|
||||||
#include "Core/HLE/sceUsbMic.h"
|
#include "Core/HLE/sceUsbMic.h"
|
||||||
@ -62,7 +63,7 @@ void __UsbCamDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(*config);
|
Do(p, *config);
|
||||||
if (config->mode == Camera::Mode::Video) { // stillImage? TBD
|
if (config->mode == Camera::Mode::Video) { // stillImage? TBD
|
||||||
Camera::stopCapture();
|
Camera::stopCapture();
|
||||||
Camera::startCapture();
|
Camera::startCapture();
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
#include "base/NativeApp.h"
|
#include "base/NativeApp.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceUsbGps.h"
|
#include "Core/HLE/sceUsbGps.h"
|
||||||
@ -40,7 +42,7 @@ void __UsbGpsDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(gpsStatus);
|
Do(p, gpsStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __UsbGpsShutdown() {
|
void __UsbGpsShutdown() {
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "base/NativeApp.h"
|
#include "base/NativeApp.h"
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
@ -122,12 +123,12 @@ void __UsbMicDoState(PointerWrap &p) {
|
|||||||
if (!s) {
|
if (!s) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.Do(numNeedSamples);
|
Do(p, numNeedSamples);
|
||||||
p.Do(waitingThreads);
|
Do(p, waitingThreads);
|
||||||
p.Do(isNeedInput);
|
Do(p, isNeedInput);
|
||||||
p.Do(curSampleRate);
|
Do(p, curSampleRate);
|
||||||
p.Do(curChannels);
|
Do(p, curChannels);
|
||||||
p.Do(micState);
|
Do(p, micState);
|
||||||
// Maybe also need to save the state of audioBuf.
|
// Maybe also need to save the state of audioBuf.
|
||||||
if (waitingThreads.size() != 0 && p.mode == PointerWrap::MODE_READ) {
|
if (waitingThreads.size() != 0 && p.mode == PointerWrap::MODE_READ) {
|
||||||
u64 waitTimeus = (waitingThreads[0].needSize - Microphone::availableAudioBufSize()) * 1000000 / 2 / waitingThreads[0].sampleRate;
|
u64 waitTimeus = (waitingThreads[0].needSize - Microphone::availableAudioBufSize()) * 1000000 / 2 / waitingThreads[0].sampleRate;
|
||||||
|
@ -20,7 +20,10 @@
|
|||||||
|
|
||||||
#include "file/ini_file.h"
|
#include "file/ini_file.h"
|
||||||
|
|
||||||
#include "Common/ChunkFile.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/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
@ -153,8 +156,8 @@ void __UtilityDoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(currentDialogType);
|
Do(p, currentDialogType);
|
||||||
p.Do(currentDialogActive);
|
Do(p, currentDialogActive);
|
||||||
saveDialog.DoState(p);
|
saveDialog.DoState(p);
|
||||||
msgDialog.DoState(p);
|
msgDialog.DoState(p);
|
||||||
oskDialog.DoState(p);
|
oskDialog.DoState(p);
|
||||||
@ -163,10 +166,10 @@ void __UtilityDoState(PointerWrap &p) {
|
|||||||
gamedataInstallDialog.DoState(p);
|
gamedataInstallDialog.DoState(p);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(currentlyLoadedModules);
|
Do(p, currentlyLoadedModules);
|
||||||
} else {
|
} else {
|
||||||
std::set<int> oldModules;
|
std::set<int> oldModules;
|
||||||
p.Do(oldModules);
|
Do(p, oldModules);
|
||||||
for (auto it = oldModules.begin(), end = oldModules.end(); it != end; ++it) {
|
for (auto it = oldModules.begin(), end = oldModules.end(); it != end; ++it) {
|
||||||
currentlyLoadedModules[*it] = 0;
|
currentlyLoadedModules[*it] = 0;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/HLE/HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
@ -36,7 +37,7 @@ void __VaudioDoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(vaudioReserved);
|
Do(p, vaudioReserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 sceVaudioChReserve(int sampleCount, int freq, int format) {
|
static u32 sceVaudioChReserve(int sampleCount, int freq, int format) {
|
||||||
|
@ -18,7 +18,10 @@
|
|||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "Common/ChunkFile.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/MIPS/MIPS.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
@ -153,12 +156,12 @@ void AsyncIOManager::DoState(PointerWrap &p) {
|
|||||||
|
|
||||||
SyncThread();
|
SyncThread();
|
||||||
std::lock_guard<std::mutex> guard(resultsLock_);
|
std::lock_guard<std::mutex> guard(resultsLock_);
|
||||||
p.Do(resultsPending_);
|
Do(p, resultsPending_);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(results_);
|
Do(p, results_);
|
||||||
} else {
|
} else {
|
||||||
std::map<u32, size_t> oldResults;
|
std::map<u32, size_t> oldResults;
|
||||||
p.Do(oldResults);
|
Do(p, oldResults);
|
||||||
for (auto it = oldResults.begin(), end = oldResults.end(); it != end; ++it) {
|
for (auto it = oldResults.begin(), end = oldResults.end(); it != end; ++it) {
|
||||||
results_[it->first] = AsyncIOResult(it->second);
|
results_[it->first] = AsyncIOResult(it->second);
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,10 @@ struct AsyncIOResult {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(result);
|
Do(p, result);
|
||||||
p.Do(finishTicks);
|
Do(p, finishTicks);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(invalidateAddr);
|
Do(p, invalidateAddr);
|
||||||
} else {
|
} else {
|
||||||
invalidateAddr = 0;
|
invalidateAddr = 0;
|
||||||
}
|
}
|
||||||
|
35
Core/HW/BufferQueue.cpp
Normal file
35
Core/HW/BufferQueue.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// 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/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Common/Serialize/SerializeMap.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);
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
|
||||||
struct BufferQueue {
|
struct BufferQueue {
|
||||||
BufferQueue(int size = 0x20000) {
|
BufferQueue(int size = 0x20000) {
|
||||||
@ -124,20 +124,7 @@ struct BufferQueue {
|
|||||||
return bytesgot;
|
return bytesgot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(PointerWrap &p) {
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void savePts(u64 pts) {
|
void savePts(u64 pts) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/Debugger/Breakpoints.h"
|
#include "Core/Debugger/Breakpoints.h"
|
||||||
#include "Core/HW/MediaEngine.h"
|
#include "Core/HW/MediaEngine.h"
|
||||||
@ -172,25 +173,25 @@ void MediaEngine::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(m_videoStream);
|
Do(p, m_videoStream);
|
||||||
p.Do(m_audioStream);
|
Do(p, m_audioStream);
|
||||||
|
|
||||||
p.DoArray(m_mpegheader, sizeof(m_mpegheader));
|
DoArray(p, m_mpegheader, sizeof(m_mpegheader));
|
||||||
if (s >= 4) {
|
if (s >= 4) {
|
||||||
p.Do(m_mpegheaderSize);
|
Do(p, m_mpegheaderSize);
|
||||||
} else {
|
} else {
|
||||||
m_mpegheaderSize = sizeof(m_mpegheader);
|
m_mpegheaderSize = sizeof(m_mpegheader);
|
||||||
}
|
}
|
||||||
if (s >= 5) {
|
if (s >= 5) {
|
||||||
p.Do(m_mpegheaderReadPos);
|
Do(p, m_mpegheaderReadPos);
|
||||||
} else {
|
} else {
|
||||||
m_mpegheaderReadPos = m_mpegheaderSize;
|
m_mpegheaderReadPos = m_mpegheaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(m_ringbuffersize);
|
Do(p, m_ringbuffersize);
|
||||||
|
|
||||||
u32 hasloadStream = m_pdata != NULL;
|
u32 hasloadStream = m_pdata != NULL;
|
||||||
p.Do(hasloadStream);
|
Do(p, hasloadStream);
|
||||||
if (hasloadStream && p.mode == p.MODE_READ)
|
if (hasloadStream && p.mode == p.MODE_READ)
|
||||||
reloadStream();
|
reloadStream();
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_FFMPEG
|
||||||
@ -198,29 +199,29 @@ void MediaEngine::DoState(PointerWrap &p) {
|
|||||||
#else
|
#else
|
||||||
u32 hasopencontext = false;
|
u32 hasopencontext = false;
|
||||||
#endif
|
#endif
|
||||||
p.Do(hasopencontext);
|
Do(p, hasopencontext);
|
||||||
if (m_pdata)
|
if (m_pdata)
|
||||||
m_pdata->DoState(p);
|
m_pdata->DoState(p);
|
||||||
if (m_demux)
|
if (m_demux)
|
||||||
m_demux->DoState(p);
|
m_demux->DoState(p);
|
||||||
|
|
||||||
p.Do(m_videopts);
|
Do(p, m_videopts);
|
||||||
p.Do(m_audiopts);
|
Do(p, m_audiopts);
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(m_firstTimeStamp);
|
Do(p, m_firstTimeStamp);
|
||||||
p.Do(m_lastTimeStamp);
|
Do(p, m_lastTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasopencontext && p.mode == p.MODE_READ) {
|
if (hasopencontext && p.mode == p.MODE_READ) {
|
||||||
openContext(true);
|
openContext(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(m_isVideoEnd);
|
Do(p, m_isVideoEnd);
|
||||||
bool noAudioDataRemoved;
|
bool noAudioDataRemoved;
|
||||||
p.Do(noAudioDataRemoved);
|
Do(p, noAudioDataRemoved);
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(m_audioType);
|
Do(p, m_audioType);
|
||||||
} else {
|
} else {
|
||||||
m_audioType = PSP_CODEC_AT3PLUS;
|
m_audioType = PSP_CODEC_AT3PLUS;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "Common/ChunkFile.h"
|
#include "Common/Serialize/Serializer.h"
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/FileSystems/MetaFileSystem.h"
|
#include "Core/FileSystems/MetaFileSystem.h"
|
||||||
#include "Core/HW/MemoryStick.h"
|
#include "Core/HW/MemoryStick.h"
|
||||||
@ -16,15 +17,15 @@ void MemoryStick_DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(memStickState);
|
Do(p, memStickState);
|
||||||
p.Do(memStickFatState);
|
Do(p, memStickFatState);
|
||||||
if (s >= 2)
|
if (s >= 2)
|
||||||
p.Do(memStickSize);
|
Do(p, memStickSize);
|
||||||
else
|
else
|
||||||
memStickSize = 1ULL * 1024 * 1024 * 1024;
|
memStickSize = 1ULL * 1024 * 1024 * 1024;
|
||||||
if (s >= 3) {
|
if (s >= 3) {
|
||||||
p.Do(memStickNeedsAssign);
|
Do(p, memStickNeedsAssign);
|
||||||
p.Do(memStickInsertedAt);
|
Do(p, memStickInsertedAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "MpegDemux.h"
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
|
#include "Core/HW/MpegDemux.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
|
|
||||||
const int PACKET_START_CODE_MASK = 0xffffff00;
|
const int PACKET_START_CODE_MASK = 0xffffff00;
|
||||||
@ -37,13 +38,13 @@ void MpegDemux::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(m_index);
|
Do(p, m_index);
|
||||||
p.Do(m_len);
|
Do(p, m_len);
|
||||||
p.Do(m_audioChannel);
|
Do(p, m_audioChannel);
|
||||||
p.Do(m_readSize);
|
Do(p, m_readSize);
|
||||||
if (m_buf)
|
if (m_buf)
|
||||||
p.DoArray(m_buf, m_len);
|
DoArray(p, m_buf, m_len);
|
||||||
p.DoClass(m_audioStream);
|
DoClass(p, m_audioStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MpegDemux::addStreamData(const u8 *buf, int addSize) {
|
bool MpegDemux::addStreamData(const u8 *buf, int addSize) {
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "profiler/profiler.h"
|
#include "profiler/profiler.h"
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/MemMapHelpers.h"
|
#include "Core/MemMapHelpers.h"
|
||||||
#include "Core/HLE/sceAtrac.h"
|
#include "Core/HLE/sceAtrac.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
@ -159,28 +160,28 @@ void VagDecoder::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.DoArray(samples, ARRAY_SIZE(samples));
|
DoArray(p, samples, ARRAY_SIZE(samples));
|
||||||
} else {
|
} else {
|
||||||
int samplesOld[ARRAY_SIZE(samples)];
|
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) {
|
for (size_t i = 0; i < ARRAY_SIZE(samples); ++i) {
|
||||||
samples[i] = samplesOld[i];
|
samples[i] = samplesOld[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.Do(curSample);
|
Do(p, curSample);
|
||||||
|
|
||||||
p.Do(data_);
|
Do(p, data_);
|
||||||
p.Do(read_);
|
Do(p, read_);
|
||||||
p.Do(curBlock_);
|
Do(p, curBlock_);
|
||||||
p.Do(loopStartBlock_);
|
Do(p, loopStartBlock_);
|
||||||
p.Do(numBlocks_);
|
Do(p, numBlocks_);
|
||||||
|
|
||||||
p.Do(s_1);
|
Do(p, s_1);
|
||||||
p.Do(s_2);
|
Do(p, s_2);
|
||||||
|
|
||||||
p.Do(loopEnabled_);
|
Do(p, loopEnabled_);
|
||||||
p.Do(loopAtNextBlock_);
|
Do(p, loopAtNextBlock_);
|
||||||
p.Do(end_);
|
Do(p, end_);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SasAtrac3::setContext(u32 context) {
|
int SasAtrac3::setContext(u32 context) {
|
||||||
@ -226,13 +227,13 @@ void SasAtrac3::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(contextAddr_);
|
Do(p, contextAddr_);
|
||||||
p.Do(atracID_);
|
Do(p, atracID_);
|
||||||
if (p.mode == p.MODE_READ && atracID_ >= 0 && !sampleQueue_) {
|
if (p.mode == p.MODE_READ && atracID_ >= 0 && !sampleQueue_) {
|
||||||
sampleQueue_ = new BufferQueue();
|
sampleQueue_ = new BufferQueue();
|
||||||
}
|
}
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(end_);
|
Do(p, end_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +693,7 @@ void SasInstance::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(grainSize);
|
Do(p, grainSize);
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
if (grainSize > 0) {
|
if (grainSize > 0) {
|
||||||
SetGrainSize(grainSize);
|
SetGrainSize(grainSize);
|
||||||
@ -701,32 +702,32 @@ void SasInstance::DoState(PointerWrap &p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(maxVoices);
|
Do(p, maxVoices);
|
||||||
p.Do(sampleRate);
|
Do(p, sampleRate);
|
||||||
p.Do(outputMode);
|
Do(p, outputMode);
|
||||||
|
|
||||||
// SetGrainSize() / ClearGrainSize() should've made our buffers match.
|
// SetGrainSize() / ClearGrainSize() should've made our buffers match.
|
||||||
if (mixBuffer != NULL && grainSize > 0) {
|
if (mixBuffer != NULL && grainSize > 0) {
|
||||||
p.DoArray(mixBuffer, grainSize * 2);
|
DoArray(p, mixBuffer, grainSize * 2);
|
||||||
}
|
}
|
||||||
if (sendBuffer != NULL && grainSize > 0) {
|
if (sendBuffer != NULL && grainSize > 0) {
|
||||||
p.DoArray(sendBuffer, grainSize * 2);
|
DoArray(p, sendBuffer, grainSize * 2);
|
||||||
}
|
}
|
||||||
if (sendBuffer != NULL && grainSize > 0) {
|
if (sendBuffer != NULL && grainSize > 0) {
|
||||||
// Backwards compat
|
// Backwards compat
|
||||||
int16_t *resampleBuf = new int16_t[grainSize * 4 + 3]();
|
int16_t *resampleBuf = new int16_t[grainSize * 4 + 3]();
|
||||||
p.DoArray(resampleBuf, grainSize * 4 + 3);
|
DoArray(p, resampleBuf, grainSize * 4 + 3);
|
||||||
delete[] resampleBuf;
|
delete[] resampleBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = PSP_SAS_VOICES_MAX;
|
int n = PSP_SAS_VOICES_MAX;
|
||||||
p.Do(n);
|
Do(p, n);
|
||||||
if (n != PSP_SAS_VOICES_MAX) {
|
if (n != PSP_SAS_VOICES_MAX) {
|
||||||
ERROR_LOG(SAVESTATE, "Wrong number of SAS voices");
|
ERROR_LOG(SAVESTATE, "Wrong number of SAS voices");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.DoArray(voices, ARRAY_SIZE(voices));
|
DoArray(p, voices, ARRAY_SIZE(voices));
|
||||||
p.Do(waveformEffect);
|
Do(p, waveformEffect);
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
reverb_.SetPreset(waveformEffect.type);
|
reverb_.SetPreset(waveformEffect.type);
|
||||||
}
|
}
|
||||||
@ -776,45 +777,45 @@ void SasVoice::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(playing);
|
Do(p, playing);
|
||||||
p.Do(paused);
|
Do(p, paused);
|
||||||
p.Do(on);
|
Do(p, on);
|
||||||
|
|
||||||
p.Do(type);
|
Do(p, type);
|
||||||
|
|
||||||
p.Do(vagAddr);
|
Do(p, vagAddr);
|
||||||
p.Do(vagSize);
|
Do(p, vagSize);
|
||||||
p.Do(pcmAddr);
|
Do(p, pcmAddr);
|
||||||
p.Do(pcmSize);
|
Do(p, pcmSize);
|
||||||
p.Do(pcmIndex);
|
Do(p, pcmIndex);
|
||||||
if (s >= 2) {
|
if (s >= 2) {
|
||||||
p.Do(pcmLoopPos);
|
Do(p, pcmLoopPos);
|
||||||
} else {
|
} else {
|
||||||
pcmLoopPos = 0;
|
pcmLoopPos = 0;
|
||||||
}
|
}
|
||||||
p.Do(sampleRate);
|
Do(p, sampleRate);
|
||||||
|
|
||||||
p.Do(sampleFrac);
|
Do(p, sampleFrac);
|
||||||
p.Do(pitch);
|
Do(p, pitch);
|
||||||
p.Do(loop);
|
Do(p, loop);
|
||||||
if (s < 2 && type == VOICETYPE_PCM) {
|
if (s < 2 && type == VOICETYPE_PCM) {
|
||||||
// We set loop incorrectly before, and always looped.
|
// We set loop incorrectly before, and always looped.
|
||||||
// Let's keep always looping, since it's usually right.
|
// Let's keep always looping, since it's usually right.
|
||||||
loop = true;
|
loop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(noiseFreq);
|
Do(p, noiseFreq);
|
||||||
|
|
||||||
p.Do(volumeLeft);
|
Do(p, volumeLeft);
|
||||||
p.Do(volumeRight);
|
Do(p, volumeRight);
|
||||||
if (s < 3) {
|
if (s < 3) {
|
||||||
// There were extra variables here that were for the same purpose.
|
// There were extra variables here that were for the same purpose.
|
||||||
p.Do(effectLeft);
|
Do(p, effectLeft);
|
||||||
p.Do(effectRight);
|
Do(p, effectRight);
|
||||||
}
|
}
|
||||||
p.Do(effectLeft);
|
Do(p, effectLeft);
|
||||||
p.Do(effectRight);
|
Do(p, effectRight);
|
||||||
p.DoArray(resampleHist, ARRAY_SIZE(resampleHist));
|
DoArray(p, resampleHist, ARRAY_SIZE(resampleHist));
|
||||||
|
|
||||||
envelope.DoState(p);
|
envelope.DoState(p);
|
||||||
vag.DoState(p);
|
vag.DoState(p);
|
||||||
@ -948,24 +949,24 @@ void ADSREnvelope::DoState(PointerWrap &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(attackRate);
|
Do(p, attackRate);
|
||||||
p.Do(decayRate);
|
Do(p, decayRate);
|
||||||
p.Do(sustainRate);
|
Do(p, sustainRate);
|
||||||
p.Do(releaseRate);
|
Do(p, releaseRate);
|
||||||
p.Do(attackType);
|
Do(p, attackType);
|
||||||
p.Do(decayType);
|
Do(p, decayType);
|
||||||
p.Do(sustainType);
|
Do(p, sustainType);
|
||||||
p.Do(sustainLevel);
|
Do(p, sustainLevel);
|
||||||
p.Do(releaseType);
|
Do(p, releaseType);
|
||||||
if (s < 2) {
|
if (s < 2) {
|
||||||
p.Do(state_);
|
Do(p, state_);
|
||||||
if (state_ == 4) {
|
if (state_ == 4) {
|
||||||
state_ = STATE_OFF;
|
state_ = STATE_OFF;
|
||||||
}
|
}
|
||||||
int stepsLegacy;
|
int stepsLegacy;
|
||||||
p.Do(stepsLegacy);
|
Do(p, stepsLegacy);
|
||||||
} else {
|
} else {
|
||||||
p.Do(state_);
|
Do(p, state_);
|
||||||
}
|
}
|
||||||
p.Do(height_);
|
Do(p, height_);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "Common/Serialize/SerializeFuncs.h"
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/HLE/FunctionWrappers.h"
|
#include "Core/HLE/FunctionWrappers.h"
|
||||||
#include "Core/HW/SimpleAudioDec.h"
|
#include "Core/HW/SimpleAudioDec.h"
|
||||||
@ -500,25 +501,25 @@ void AuCtx::DoState(PointerWrap &p) {
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p.Do(startPos);
|
Do(p, startPos);
|
||||||
p.Do(endPos);
|
Do(p, endPos);
|
||||||
p.Do(AuBuf);
|
Do(p, AuBuf);
|
||||||
p.Do(AuBufSize);
|
Do(p, AuBufSize);
|
||||||
p.Do(PCMBuf);
|
Do(p, PCMBuf);
|
||||||
p.Do(PCMBufSize);
|
Do(p, PCMBufSize);
|
||||||
p.Do(freq);
|
Do(p, freq);
|
||||||
p.Do(SumDecodedSamples);
|
Do(p, SumDecodedSamples);
|
||||||
p.Do(LoopNum);
|
Do(p, LoopNum);
|
||||||
p.Do(Channels);
|
Do(p, Channels);
|
||||||
p.Do(MaxOutputSample);
|
Do(p, MaxOutputSample);
|
||||||
p.Do(readPos);
|
Do(p, readPos);
|
||||||
p.Do(audioType);
|
Do(p, audioType);
|
||||||
p.Do(BitRate);
|
Do(p, BitRate);
|
||||||
p.Do(SamplingRate);
|
Do(p, SamplingRate);
|
||||||
p.Do(askedReadSize);
|
Do(p, askedReadSize);
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
p.Do(dummy);
|
Do(p, dummy);
|
||||||
p.Do(FrameNum);
|
Do(p, FrameNum);
|
||||||
|
|
||||||
if (p.mode == p.MODE_READ) {
|
if (p.mode == p.MODE_READ) {
|
||||||
decoder = new SimpleAudio(audioType);
|
decoder = new SimpleAudio(audioType);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user