mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
My first commit :)
Fixed more memory leaks when doing state load. Now all file devices(handles) are stored in state, and this will fix some crash after loading state. Warning: Do NOT Save/Load state before game title is shown and controllable, or else you will get a corrupt state. If you encounter "Emu WiiMote Desync" frequently, please report the condition (PS: To recover from wiimote desync, just load a saved state) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4608 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -74,13 +74,48 @@ public:
|
||||
(*ptr) += size;
|
||||
}
|
||||
|
||||
// Store maps to file. Very useful.
|
||||
template<class T>
|
||||
void Do(std::map<unsigned int, T> &x) {
|
||||
void Do(std::map<unsigned int, T> &x)
|
||||
{
|
||||
// TODO
|
||||
PanicAlert("Do(map<>) does not yet work.");
|
||||
}
|
||||
|
||||
|
||||
void Do(std::map<unsigned int, std::string> &x)
|
||||
{
|
||||
unsigned int number = (unsigned int)x.size();
|
||||
Do(number);
|
||||
switch (mode) {
|
||||
case MODE_READ:
|
||||
{
|
||||
x.clear();
|
||||
while (number > 0)
|
||||
{
|
||||
unsigned int first;
|
||||
Do(first);
|
||||
std::string second;
|
||||
Do(second);
|
||||
x[first] = second;
|
||||
--number;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MODE_WRITE:
|
||||
case MODE_MEASURE:
|
||||
{
|
||||
std::map<unsigned int, std::string>::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) {
|
||||
|
Reference in New Issue
Block a user