mirror of
https://github.com/PodeCaradox/GalaxyQuest-SteamFrame.git
synced 2026-10-20 15:00:45 +02:00
The sources of Petari (https://github.com/SMGCommunity/Petari), the Super Mario Galaxy decompilation by the SMGCommunity, at commit 0a5c6608dc3b4c44a9aa68c2535d1793dc565f02, unchanged but for LF line endings: LICENSE (as LICENSE-Petari.txt; CC0 1.0), include/, libs/ and src/. Left out: the game data Petari keeps from the original executable, the error message archive (include/Game/System/ ErrorArchive.hpp) and two tables (src/Game/System/GalaxyID.bcsv and StoryEvent.bcsv); GalaxyQuest's converter takes them from the player's own disc. The port's changes follow in the next commit, so `git diff petari-base -- decomp` shows them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <revolution/types.h>
|
|
|
|
class BinaryDataChunkBase {
|
|
public:
|
|
virtual u32 makeHeaderHashCode() const = 0;
|
|
virtual u32 getSignature() const = 0;
|
|
virtual s32 serialize(u8*, u32) const = 0;
|
|
virtual s32 deserialize(const u8*, u32) = 0;
|
|
virtual void initializeData() = 0;
|
|
};
|
|
|
|
struct BinaryDataChunkHolderChunkData {
|
|
public:
|
|
u32 getDataOffset() const {
|
|
return 0x0C; // TODO: offsetof?
|
|
}
|
|
|
|
u8* getData() const {
|
|
return (u8*)this + getDataOffset();
|
|
}
|
|
|
|
/* 0x00 */ u32 mSignature;
|
|
/* 0x04 */ u32 mHash;
|
|
/* 0x08 */ u32 mChunkSize;
|
|
/* 0x0C */ void* mData;
|
|
};
|
|
|
|
class BinaryDataChunkHolder {
|
|
public:
|
|
BinaryDataChunkHolder(u32 dataSize, int maxChunks);
|
|
|
|
void addChunk(BinaryDataChunkBase* pChunk);
|
|
u32 makeFileBinary(u8*, u32);
|
|
bool loadFromFileBinary(const u8* pData, u32 dataSize);
|
|
static void makeChunkData(BinaryDataChunkHolderChunkData* pData, u32 dataSize, const BinaryDataChunkBase*);
|
|
BinaryDataChunkBase* findFromSignature(u32 signature) const;
|
|
static u32 calcBinarySize(const u8* pData);
|
|
|
|
/* 0x00 */ BinaryDataChunkBase** mChunks;
|
|
/* 0x04 */ s32 mMaxChunks;
|
|
/* 0x08 */ s32 mNumChunks;
|
|
/* 0x0C */ void* mData;
|
|
/* 0x10 */ u32 mBufferSize;
|
|
};
|