Some FileLoader and SceneObjHolder

This commit is contained in:
shibbo 2020-01-28 17:58:04 -05:00
parent 46dc19cd72
commit 1620b15539
5 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#ifndef SCENEOBJHOLDER_H
#define SCENEOBJHOLDER_H
#include "Actor/NameObj/NameObj.h"
class SceneObjHolder
{
public:
SceneObjHolder();
NameObj* create(s32);
bool isExist(s32) const;
NameObj* getObj(s32) const;
NameObj* newEachObj(s32);
NameObj* mObjs[0x7B]; // _0
};
#endif // SCENEOBJHOLDER_H

View File

@ -0,0 +1,34 @@
#ifndef FILEHOLDER_H
#define FILEHOLDER_H
#include "JKernel/JKRHeap.h"
#include "revolution/os/OSMessage.h"
class FileHolderFileEntry
{
public:
FileHolderFileEntry(const char *, JKRHeap *, void *);
~FileHolderFileEntry();
void waitReadDone();
void setContext(void *, JKRHeap *);
s32 mEntryNum; // _0
void* mSource; // _4
JKRHeap* mHeap; // _8
u32 _C;
OSMessageQueue mQueue; // _10
OSMessage mMessage; // _30
u8 _34;
};
class FileHolder
{
public:
bool isExist(const char *) const;
void* getContext(const char *) const;
FileHolderFileEntry* findEntry(const char *) const;
};
#endif // FILEHOLDER_H

View File

@ -23,6 +23,7 @@ struct OSMessageQueue
void OSInitMessageQueue(OSMessageQueue *, OSMessage *, s32);
s32 OSSendMessage(OSMessageQueue *, OSMessage, s32);
s32 OSReceiveMessage(OSMessageQueue *, OSMessage *, s32);
#ifdef __cplusplus
}

View File

@ -0,0 +1,47 @@
#include "Scene/SceneObjHolder.h"
#include "Actor/NameObj/NameObjGroup.h"
#include "Actor/NameObj/NameObjExecuteHolder.h"
#include "Actor/LiveActor/AllLiveActorGroup.h"
NameObj* SceneObjHolder::create(s32 type)
{
if (mObjs[type] != 0)
{
return mObjs[type];
}
NameObj* obj = newEachObj(type);
obj->initWithoutIter();
mObjs[type] = obj;
return obj;
}
NameObj* SceneObjHolder::getObj(s32 type) const
{
return mObjs[type];
}
bool SceneObjHolder::isExist(s32 type) const
{
return mObjs[type];
}
NameObj* SceneObjHolder::newEachObj(s32 type)
{
NameObj* obj;
switch (type)
{
case 24:
obj = new NameObjGroup("IgnorePauseNameObj", 0x10);
break;
case 48:
obj = new AllLiveActorGroup();
break;
default:
obj = 0;
break;
}
return obj;
}

View File

@ -0,0 +1,47 @@
#include "System/File/FileHolder.h"
#include "revolution/dvd.h"
FileHolderFileEntry::FileHolderFileEntry(const char *pName, JKRHeap *pHeap, void *pSrc)
{
mEntryNum = DVDConvertPathToEntrynum(pName);
mSource = 0;
mHeap = pHeap;
_C = 0;
_34 = 1;
OSInitMessageQueue(&mQueue, &mMessage, 1);
if (pSrc != 0)
{
_34 = 0;
mSource = pSrc;
}
}
void FileHolderFileEntry::waitReadDone()
{
if (_C != 2)
{
OSMessage msg;
OSReceiveMessage(&mQueue, &msg, 1);
_C = 2;
}
}
void FileHolderFileEntry::setContext(void *pSrc, JKRHeap *pHeap)
{
mSource = pSrc;
mHeap = pHeap;
OSSendMessage(&mQueue, 0, 0);
_C = 1;
}
bool FileHolder::isExist(const char *pName) const
{
return findEntry(pName);
}
void* FileHolder::getContext(const char *pName) const
{
return findEntry(pName)->mSource;
}