mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 11:36:22 +00:00
TSAGE: Fixing memory leaks
This commit is contained in:
parent
f5d22217d6
commit
747295e9b4
@ -37,6 +37,7 @@
|
||||
namespace tSage {
|
||||
|
||||
EventsClass::EventsClass() {
|
||||
_currentCursor = CURSOR_NONE;
|
||||
_frameNumber = 0;
|
||||
_priorFrameTime = 0;
|
||||
_prevDelayFrame = 0;
|
||||
|
@ -70,7 +70,6 @@ public:
|
||||
SequenceManager _sequenceManager;
|
||||
Common::RandomSource _randomSource;
|
||||
int _stripNum;
|
||||
FloatSet _floatSet;
|
||||
public:
|
||||
Globals();
|
||||
~Globals();
|
||||
|
@ -178,14 +178,14 @@ void RlbManager::loadSection(uint32 fileOffset) {
|
||||
assert(type <= 1);
|
||||
uint32 offset = _file.readUint32LE();
|
||||
|
||||
ResourceEntry *re = new ResourceEntry();
|
||||
re->id = id;
|
||||
re->fileOffset = offset;
|
||||
re->isCompressed = type != 0;
|
||||
re->size = ((sizeHi & 0xF) << 16) | size;
|
||||
re->uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize;
|
||||
ResourceEntry re;
|
||||
re.id = id;
|
||||
re.fileOffset = offset;
|
||||
re.isCompressed = type != 0;
|
||||
re.size = ((sizeHi & 0xF) << 16) | size;
|
||||
re.uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize;
|
||||
|
||||
_resources.push_back(*re);
|
||||
_resources.push_back(re);
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,12 +340,12 @@ void RlbManager::loadIndex() {
|
||||
fileOffset = READ_LE_UINT16(p + 4);
|
||||
p += 6;
|
||||
|
||||
SectionEntry *se = new SectionEntry();
|
||||
se->resNum = resNum;
|
||||
se->resType = (ResourceType)(configId & 0x1f);
|
||||
se->fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset;
|
||||
SectionEntry se;
|
||||
se.resNum = resNum;
|
||||
se.resType = (ResourceType)(configId & 0x1f);
|
||||
se.fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset;
|
||||
|
||||
_sections.push_back(*se);
|
||||
_sections.push_back(se);
|
||||
}
|
||||
|
||||
_memoryManager.deallocate(pData);
|
||||
|
@ -35,6 +35,7 @@ SceneManager::SceneManager() {
|
||||
_hasPalette = false;
|
||||
_sceneNumber = -1;
|
||||
_nextSceneNumber = -1;
|
||||
_previousScene = 0;
|
||||
_fadeMode = FADEMODE_GRADUAL;
|
||||
_scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
_saver->addListener(this);
|
||||
|
@ -73,15 +73,21 @@ bool TSageEngine::hasFeature(EngineFeature f) const {
|
||||
void TSageEngine::initialise() {
|
||||
_tSageManager = new RlbManager(_memoryManager, "tsage.rlb");
|
||||
_dataManager = new RlbManager(_memoryManager, "ring.rlb");
|
||||
|
||||
_saver = new Saver();
|
||||
_globals = new Globals();
|
||||
_globals->gfxManager().setDefaults();
|
||||
}
|
||||
|
||||
void TSageEngine::deinitialise() {
|
||||
delete _globals;
|
||||
delete _saver;
|
||||
delete _tSageManager;
|
||||
delete _dataManager;
|
||||
}
|
||||
|
||||
Common::Error TSageEngine::run() {
|
||||
// Basic initialisation
|
||||
initialise();
|
||||
_saver = new Saver();
|
||||
_globals = new Globals();
|
||||
_globals->gfxManager().setDefaults();
|
||||
|
||||
initialise();
|
||||
|
||||
_globals->_events.showCursor();
|
||||
@ -89,8 +95,7 @@ Common::Error TSageEngine::run() {
|
||||
_globals->_sceneHandler.registerHandler();
|
||||
_globals->_game.execute();
|
||||
|
||||
delete _globals;
|
||||
delete _saver;
|
||||
deinitialise();
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
Common::String generateSaveName(int slot);
|
||||
|
||||
void initialise();
|
||||
void deinitialise();
|
||||
};
|
||||
|
||||
extern TSageEngine *_vm;
|
||||
|
Loading…
x
Reference in New Issue
Block a user