diff --git a/desktop_version/src/BinaryBlob.cpp b/desktop_version/src/BinaryBlob.cpp index 2102d22e..e2147374 100644 --- a/desktop_version/src/BinaryBlob.cpp +++ b/desktop_version/src/BinaryBlob.cpp @@ -123,6 +123,18 @@ bool binaryBlob::unPackBinary(const char* name) 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) { for (int i = 0; i < 128; i += 1) diff --git a/desktop_version/src/BinaryBlob.h b/desktop_version/src/BinaryBlob.h index 5aa2827d..0bf8de0e 100644 --- a/desktop_version/src/BinaryBlob.h +++ b/desktop_version/src/BinaryBlob.h @@ -31,6 +31,8 @@ public: char* getAddress(int _index); + void clear(); + private: int numberofHeaders; resourceheader m_headers[128]; diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index 0334ff69..aa0a2f60 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -9,6 +9,8 @@ void musicclass::init() soundTracks.clear(); musicTracks.clear(); + musicReadBlob.clear(); + soundTracks.push_back(SoundTrack( "sounds/jump.wav" )); soundTracks.push_back(SoundTrack( "sounds/jump2.wav" )); soundTracks.push_back(SoundTrack( "sounds/hurt.wav" )); @@ -60,7 +62,6 @@ void musicclass::init() musicWriteBlob.writeBinaryBlob("data/BinaryMusic.vvv"); #endif - binaryBlob musicReadBlob; if (!musicReadBlob.unPackBinary("mmmmmm.vvv")) { mmmmmm = false; diff --git a/desktop_version/src/Music.h b/desktop_version/src/Music.h index 3e479120..ead32835 100644 --- a/desktop_version/src/Music.h +++ b/desktop_version/src/Music.h @@ -2,6 +2,7 @@ #define MUSIC_H #include "SoundSystem.h" +#include "BinaryBlob.h" #include @@ -50,6 +51,8 @@ public: // MMMMMM mod settings bool mmmmmm; bool usingmmmmmm; + + binaryBlob musicReadBlob; }; extern musicclass music;