Add __PsmfPlayerDoState(PointerWrap &p) to sceKernel

This commit is contained in:
raven02 2013-01-20 16:16:57 +08:00
parent 6ebb06c171
commit b16a208453
3 changed files with 34 additions and 0 deletions

View File

@ -174,6 +174,7 @@ void __KernelDoState(PointerWrap &p)
__MpegDoState(p);
__PowerDoState(p);
__PsmfDoState(p);
__PsmfPlayerDoState(p);
__SasDoState(p);
__SslDoState(p);
__UmdDoState(p);

View File

@ -373,6 +373,38 @@ void __PsmfDoState(PointerWrap &p)
p.DoMarker("scePsmf");
}
void __PsmfPlayerDoState(PointerWrap &p)
{
int n = (int) psmfPlayerMap.size();
p.Do(n);
if (p.mode == p.MODE_READ) {
std::map<u32, PsmfPlayer *>::iterator it, end;
for (it = psmfPlayerMap.begin(), end = psmfPlayerMap.end(); it != end; ++it) {
delete it->second;
}
psmfMap.clear();
for (int i = 0; i < n; ++i) {
u32 key;
p.Do(key);
PsmfPlayer *psmfplayer = new PsmfPlayer(0);
psmfplayer->DoState(p);
psmfPlayerMap[key] = psmfplayer;
}
} else {
std::map<u32, PsmfPlayer *>::iterator it, end;
for (it = psmfPlayerMap.begin(), end = psmfPlayerMap.end(); it != end; ++it) {
p.Do(it->first);
it->second->DoState(p);
}
}
// TODO: Actually load this from a map.
psmfPlayerStatus = PSMF_PLAYER_STATUS_NONE;
p.DoMarker("scePsmfPlayer");
}
void __PsmfShutdown()
{
for (auto it = psmfMap.begin(), end = psmfMap.end(); it != end; ++it)

View File

@ -22,4 +22,5 @@ void Register_scePsmfPlayer();
void __PsmfInit();
void __PsmfDoState(PointerWrap &p);
void __PsmfPlayerDoState(PointerWrap &p);
void __PsmfShutdown();