mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Handle fragmented atrac IDs better.
This avoids conflicts when ids are deleted.
This commit is contained in:
parent
eb1a76bfc2
commit
ed599375bf
1 changed files with 6 additions and 5 deletions
|
@ -74,19 +74,20 @@ struct Atrac {
|
|||
};
|
||||
|
||||
std::map<int, Atrac *> atracMap;
|
||||
u8 nextAtracID;
|
||||
|
||||
void __AtracInit()
|
||||
{
|
||||
void __AtracInit() {
|
||||
nextAtracID = 0;
|
||||
}
|
||||
|
||||
void __AtracDoState(PointerWrap &p) {
|
||||
p.Do(atracMap);
|
||||
p.Do(nextAtracID);
|
||||
|
||||
p.DoMarker("sceAtrac");
|
||||
}
|
||||
|
||||
void __AtracShutdown()
|
||||
{
|
||||
void __AtracShutdown() {
|
||||
for (auto it = atracMap.begin(), end = atracMap.end(); it != end; ++it) {
|
||||
delete it->second;
|
||||
}
|
||||
|
@ -101,7 +102,7 @@ Atrac *getAtrac(int atracID) {
|
|||
}
|
||||
|
||||
int createAtrac(Atrac *atrac) {
|
||||
int id = (int) atracMap.size();
|
||||
int id = nextAtracID++;
|
||||
atracMap[id] = atrac;
|
||||
return id;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue