Files
bigmak94andClaude Opus 5.5 4b395efe5c Add the Petari decompilation (SMGCommunity/Petari@0a5c660)
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>
2026-10-01 01:59:38 +02:00

73 lines
2.3 KiB
C++

#pragma once
#include "Game/Util/Array.hpp"
#include <revolution/os/OSMessage.h>
#include <revolution/types.h>
class JKRHeap;
class FileHolderFileEntry {
public:
/// @brief Creates a new `FileHolderFileEntry`.
/// @param pFilePath The path to the file.
/// @param pHeap The heap used for allocation.
/// @param pContext The context data for the file.
FileHolderFileEntry(const char*, JKRHeap*, void*);
/// @brief Destroys the `FileHolderFileEntry`.
~FileHolderFileEntry();
/// @brief Waits until the file read is done.
void waitReadDone();
/// @brief Sets the context data for the file.
/// @param pContext The context data.
/// @param pHeap The heap used for allocation.
void setContext(void*, JKRHeap*);
/* 0x00 */ s32 mEntryNum;
/* 0x04 */ void* mContext;
/* 0x08 */ JKRHeap* mHeap;
/* 0x0C */ s32 mState;
/* 0x10 */ OSMessageQueue mQueue;
/* 0x30 */ OSMessage mMessage;
/* 0x34 */ bool mContextSet;
};
class FileHolder {
public:
/// @brief Creates a new `FileHolder`.
FileHolder();
/// @brief Adds a new file entry.
/// @param pFilePath The path to the file.
/// @param pHeap The heap used for allocation.
/// @param pContext The context data for the file.
FileHolderFileEntry* add(const char*, JKRHeap*, void*);
/// @brief Checks if a file entry exists.
/// @param pFilePath The path to the file.
/// @return `true` if the file entry exists, `false` otherwise.
bool isExist(const char*) const;
/// @brief Gets the context data for the given file.
/// @param pFilePath The path to the file.
void* getContext(const char*) const;
/// @brief Removes file entries that match the given heap.
/// @param pHeap The heap to compare.
void removeIfIsEqualHeap(JKRHeap*);
/// @brief Removes the file entry for the given file.
/// @param pFilePath The path to the file.
/// @return The pointer to the removed entry.
FileHolderFileEntry** removeFile(const char*);
/// @brief Finds the file entry for the given file.
/// @param pFilePath The path to the file.
/// @return The pointer to the found entry, or `nullptr` if not found.
FileHolderFileEntry* findEntry(const char*) const;
/* 0x0 */ MR::Vector< MR::AssignableArray< FileHolderFileEntry* > > mEntries;
};