VOYEUR: Fixes for ControlResource initialisation
This commit is contained in:
parent
bad9219c27
commit
96b1fb8601
4 changed files with 27 additions and 8 deletions
|
@ -236,7 +236,9 @@ BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _stat
|
|||
}
|
||||
|
||||
BoltFile::~BoltFile() {
|
||||
_state._curFd->close();
|
||||
_file.close();
|
||||
if (_state._curFd == &_file)
|
||||
_state._curFd = NULL;
|
||||
}
|
||||
|
||||
bool BoltFile::getBoltGroup(uint32 id) {
|
||||
|
@ -1306,6 +1308,7 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
|
|||
/*------------------------------------------------------------------------*/
|
||||
|
||||
ThreadResource::ThreadResource(BoltFilesState &state, const byte *src) {
|
||||
_flags = READ_LE_UINT16(&src[8]);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
@ -1330,10 +1333,8 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
|
|||
uint32 ptrId = READ_LE_UINT32(&src[0x32]);
|
||||
_ptr = state._curLibPtr->getBoltEntryFromLong(ptrId)._data;
|
||||
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
for (int i = 0; i < 8; ++i)
|
||||
_memberIds[i] = READ_LE_UINT16(src + i * 2);
|
||||
_entries[i] = NULL;
|
||||
}
|
||||
|
||||
// Load pointer list
|
||||
uint32 *idP = (uint32 *)&src[0x10];
|
||||
|
@ -1341,9 +1342,7 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
|
|||
|
||||
for (int i = 0; i < count; ++i, ++idP) {
|
||||
uint32 id = READ_LE_UINT32(idP);
|
||||
BoltEntry &entry = state._curLibPtr->getBoltEntryFromLong(id);
|
||||
|
||||
_entries[i] = entry._data;
|
||||
state._curLibPtr->resolveIt(id, &_entries[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -417,6 +417,7 @@ public:
|
|||
int _field0;
|
||||
int _controlIndex;
|
||||
int _field4, _field6;
|
||||
int _flags;
|
||||
int _field3A;
|
||||
int _field3E;
|
||||
byte *_ctlPtr;
|
||||
|
|
|
@ -83,10 +83,12 @@ private:
|
|||
|
||||
void playStamp();
|
||||
void initStamp();
|
||||
void closeStamp();
|
||||
void initUseCount();
|
||||
void initThreadStruct(ThreadResource *thread, int v1, int idx);
|
||||
bool stm_loadAStack(ThreadResource *thread, int idx);
|
||||
void stm_unloadAStack(int idx);
|
||||
void stm_unloadAllStacks();
|
||||
void stm_doState(ThreadResource *thread);
|
||||
protected:
|
||||
// Engine APIs
|
||||
|
|
|
@ -59,6 +59,9 @@ void VoyeurEngine::playStamp() {
|
|||
}
|
||||
|
||||
_voy._field4386 = 0;
|
||||
closeStamp();
|
||||
_stampLibPtr->freeBoltGroup(0x10000);
|
||||
delete _stampLibPtr;
|
||||
}
|
||||
|
||||
void VoyeurEngine::initStamp() {
|
||||
|
@ -71,6 +74,10 @@ void VoyeurEngine::initStamp() {
|
|||
initUseCount();
|
||||
}
|
||||
|
||||
void VoyeurEngine::closeStamp() {
|
||||
stm_unloadAllStacks();
|
||||
}
|
||||
|
||||
void VoyeurEngine::initUseCount() {
|
||||
Common::fill(&_stm_useCount[0], &_stm_useCount[8], 0);
|
||||
}
|
||||
|
@ -102,6 +109,7 @@ bool VoyeurEngine::stm_loadAStack(ThreadResource *thread, int idx) {
|
|||
}
|
||||
|
||||
thread->_ctlPtr = _controlPtr->_entries[idx];
|
||||
return true;
|
||||
}
|
||||
|
||||
void VoyeurEngine::stm_unloadAStack(int idx) {
|
||||
|
@ -112,8 +120,17 @@ void VoyeurEngine::stm_unloadAStack(int idx) {
|
|||
}
|
||||
}
|
||||
|
||||
void VoyeurEngine::stm_doState(ThreadResource *thread) {
|
||||
void VoyeurEngine::stm_unloadAllStacks() {
|
||||
if (_stampFlags & 1) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (_stm_useCount[i])
|
||||
_stampLibPtr->freeBoltMember(_controlPtr->_memberIds[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoyeurEngine::stm_doState(ThreadResource *thread) {
|
||||
warning("TODO: stm_doState");
|
||||
}
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue