mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01:00
Don't leak binaryBlob
This commit is contained in:
parent
9b91047bba
commit
f3b26904ec
4 changed files with 19 additions and 1 deletions
|
@ -123,6 +123,18 @@ bool binaryBlob::unPackBinary(const char* name)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void binaryBlob::clear()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 128; i += 1)
|
||||||
|
{
|
||||||
|
if (m_headers[i].valid)
|
||||||
|
{
|
||||||
|
free(m_memblocks[i]);
|
||||||
|
m_headers[i].valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int binaryBlob::getIndex(const char* _name)
|
int binaryBlob::getIndex(const char* _name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 128; i += 1)
|
for (int i = 0; i < 128; i += 1)
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
|
|
||||||
char* getAddress(int _index);
|
char* getAddress(int _index);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int numberofHeaders;
|
int numberofHeaders;
|
||||||
resourceheader m_headers[128];
|
resourceheader m_headers[128];
|
||||||
|
|
|
@ -9,6 +9,8 @@ void musicclass::init()
|
||||||
soundTracks.clear();
|
soundTracks.clear();
|
||||||
musicTracks.clear();
|
musicTracks.clear();
|
||||||
|
|
||||||
|
musicReadBlob.clear();
|
||||||
|
|
||||||
soundTracks.push_back(SoundTrack( "sounds/jump.wav" ));
|
soundTracks.push_back(SoundTrack( "sounds/jump.wav" ));
|
||||||
soundTracks.push_back(SoundTrack( "sounds/jump2.wav" ));
|
soundTracks.push_back(SoundTrack( "sounds/jump2.wav" ));
|
||||||
soundTracks.push_back(SoundTrack( "sounds/hurt.wav" ));
|
soundTracks.push_back(SoundTrack( "sounds/hurt.wav" ));
|
||||||
|
@ -60,7 +62,6 @@ void musicclass::init()
|
||||||
musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv");
|
musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
binaryBlob musicReadBlob;
|
|
||||||
if (!musicReadBlob.unPackBinary("mmmmmm.vvv"))
|
if (!musicReadBlob.unPackBinary("mmmmmm.vvv"))
|
||||||
{
|
{
|
||||||
mmmmmm = false;
|
mmmmmm = false;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define MUSIC_H
|
#define MUSIC_H
|
||||||
|
|
||||||
#include "SoundSystem.h"
|
#include "SoundSystem.h"
|
||||||
|
#include "BinaryBlob.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -50,6 +51,8 @@ public:
|
||||||
// MMMMMM mod settings
|
// MMMMMM mod settings
|
||||||
bool mmmmmm;
|
bool mmmmmm;
|
||||||
bool usingmmmmmm;
|
bool usingmmmmmm;
|
||||||
|
|
||||||
|
binaryBlob musicReadBlob;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern musicclass music;
|
extern musicclass music;
|
||||||
|
|
Loading…
Reference in a new issue