mirror of
https://github.com/SMGCommunity/Petari.git
synced 2024-12-03 11:11:13 +00:00
Some FileLoader and SceneObjHolder
This commit is contained in:
parent
46dc19cd72
commit
1620b15539
19
include/Scene/SceneObjHolder.h
Normal file
19
include/Scene/SceneObjHolder.h
Normal 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
|
34
include/System/File/FileHolder.h
Normal file
34
include/System/File/FileHolder.h
Normal 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
|
@ -23,6 +23,7 @@ struct OSMessageQueue
|
||||
|
||||
void OSInitMessageQueue(OSMessageQueue *, OSMessage *, s32);
|
||||
s32 OSSendMessage(OSMessageQueue *, OSMessage, s32);
|
||||
s32 OSReceiveMessage(OSMessageQueue *, OSMessage *, s32);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
47
source/Scene/SceneObjHolder.cpp
Normal file
47
source/Scene/SceneObjHolder.cpp
Normal 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;
|
||||
}
|
47
source/System/File/FileHolder.cpp
Normal file
47
source/System/File/FileHolder.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user