2019-12-29 22:12:11 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-01-04 01:19:01 -05:00
|
|
|
#include "PLHandle.h"
|
2019-12-29 22:12:11 -05:00
|
|
|
#include "ResTypeID.h"
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2020-09-12 13:32:53 -04:00
|
|
|
class GpIOStream;
|
|
|
|
|
|
2019-12-29 22:12:11 -05:00
|
|
|
namespace PortabilityLayer
|
|
|
|
|
{
|
|
|
|
|
class MacFileMem;
|
|
|
|
|
struct MMHandleBlock;
|
|
|
|
|
struct ResourceCompiledRef;
|
|
|
|
|
struct ResourceCompiledTypeList;
|
|
|
|
|
class ResTypeID;
|
|
|
|
|
|
2020-01-18 08:37:57 -05:00
|
|
|
class ResourceFile final
|
2019-12-29 22:12:11 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2020-09-12 13:32:53 -04:00
|
|
|
bool Load(GpIOStream *stream);
|
2019-12-29 22:12:11 -05:00
|
|
|
|
|
|
|
|
void GetAllResourceTypeLists(ResourceCompiledTypeList *&outTypeLists, size_t &outCount) const;
|
|
|
|
|
|
2021-09-01 22:06:43 -04:00
|
|
|
const uint8_t *GetResNames() const;
|
|
|
|
|
const size_t GetResNamesSize() const;
|
|
|
|
|
|
2019-12-29 22:12:11 -05:00
|
|
|
const ResourceCompiledTypeList *GetResourceTypeList(const ResTypeID &resType);
|
2020-01-18 08:37:57 -05:00
|
|
|
THandle<void> LoadResource(const ResTypeID &resType, int id);
|
2020-01-04 01:19:01 -05:00
|
|
|
|
|
|
|
|
static ResourceFile *Create();
|
|
|
|
|
void Destroy();
|
2019-12-29 22:12:11 -05:00
|
|
|
|
|
|
|
|
private:
|
2020-01-04 01:19:01 -05:00
|
|
|
ResourceFile();
|
|
|
|
|
~ResourceFile();
|
2019-12-29 22:12:11 -05:00
|
|
|
|
|
|
|
|
uint8_t *m_resDataBlob;
|
|
|
|
|
size_t m_resDataBlobSize;
|
|
|
|
|
|
|
|
|
|
uint8_t *m_resNameBlob;
|
|
|
|
|
size_t m_resNameBlobSize;
|
|
|
|
|
|
|
|
|
|
ResourceCompiledRef *m_compiledRefBlob;
|
|
|
|
|
size_t m_numResources;
|
|
|
|
|
|
|
|
|
|
ResourceCompiledTypeList *m_compiledTypeListBlob;
|
|
|
|
|
size_t m_numResourceTypes;
|
|
|
|
|
|
2021-09-01 22:06:43 -04:00
|
|
|
uint32_t m_nameListOffset;
|
|
|
|
|
|
2019-12-29 22:12:11 -05:00
|
|
|
static bool CompiledRefSortPredicate(const ResourceCompiledRef &a, const ResourceCompiledRef &b);
|
|
|
|
|
static bool CompiledTypeListSortPredicate(const ResourceCompiledTypeList &a, const ResourceCompiledTypeList &b);
|
|
|
|
|
|
|
|
|
|
static int CompiledRefSearchPredicate(int resID, const ResourceCompiledRef &ref);
|
|
|
|
|
static int CompiledTypeListSearchPredicate(const ResTypeID &resTypeID, const ResourceCompiledTypeList &typeList);
|
|
|
|
|
};
|
|
|
|
|
}
|