|
Nugget
Bare-metal libraries and examples for the original PlayStation
|
An ISO9660 parser. More...
#include <psyqo/iso9660-parser.hh>
Classes | |
| struct | DirEntry |
| An ISO9660 directory entry. More... | |
| struct | GetDirentryAwaiter |
| struct | InitializeAwaiter |
| struct | ReadRequest |
| An asynchronous read request. More... | |
| struct | WalkDirectoryAwaiter |
Public Member Functions | |
| ISO9660Parser (CDRom *cdrom) | |
| The ISO9660Parser constructor. | |
| void | initialize (eastl::function< void(bool success)> callback) |
| Initializes the parser. | |
| TaskQueue::Task | scheduleInitialize () |
| InitializeAwaiter | initialize () |
| void | getDirentry (eastl::string_view path, DirEntry *entry, eastl::function< void(bool success)> callback) |
| Get the Direntry object for a given path. | |
| TaskQueue::Task | scheduleGetDirentry (eastl::string_view path, DirEntry *entry) |
| GetDirentryAwaiter | getDirentry (eastl::string_view path, DirEntry *entry) |
| void | walkDirectory (const DirEntry &dir, eastl::function< bool(eastl::string_view name, const DirEntry &entry)> visitor, eastl::function< void(bool success)> callback) |
| Walk the entries of a directory. | |
| TaskQueue::Task | scheduleWalkDirectory (const DirEntry &dir, eastl::function< bool(eastl::string_view name, const DirEntry &entry)> visitor) |
| WalkDirectoryAwaiter | walkDirectory (const DirEntry &dir, eastl::function< bool(eastl::string_view name, const DirEntry &entry)> visitor) |
| TaskQueue::Task | scheduleReadRequest (const ReadRequest *request) |
| Read a file asynchronously. | |
| bool | initialized () |
| Returns the state of the parser. | |
| CDRom * | getCDRom () |
| Returns the CDRom object used by the parser. | |
An ISO9660 parser.
This class is a simple ISO9660 parser. It is not meant to be a full implementation, but rather a simple parser that can be used to find the files to be loaded.
|
inline |
The ISO9660Parser constructor.
This constructor takes a CDRom device as a parameter. It will use that device to read the structure of the ISO9660 filesystem.
| cdrom | The CDRom device to use. |
|
inline |
|
inline |
| void psyqo::ISO9660Parser::getDirentry | ( | eastl::string_view | path, |
| DirEntry * | entry, | ||
| eastl::function< void(bool success)> | callback | ||
| ) |
Get the Direntry object for a given path.
This method looks up the directory entry for a given path. It will fail if the CDRom device fails reading the disk, or if the parser hasn't been initialized yet. If the directory entry is not found, the callback or task will still be successful, but the directory entry will be invalid.
| [in] | path | The path to look for. |
| [out] | entry | The DirEntry object to fill. |
|
inline |
| void psyqo::ISO9660Parser::initialize | ( | eastl::function< void(bool success)> | callback | ) |
Initializes the parser.
This method initializes the basic internal structures of the parser. It must be called before any other method. If the underlying CDRom device fails reading, or if the filesystem is not an ISO9660, the callback or task will fail. It can be called multiple times, and has to be called when the user changes the disc in the drive.
|
inline |
Returns the state of the parser.
This method returns true if the parser was initialized successfully, and false otherwise.
| psyqo::TaskQueue::Task psyqo::ISO9660Parser::scheduleGetDirentry | ( | eastl::string_view | path, |
| DirEntry * | entry | ||
| ) |
| psyqo::TaskQueue::Task psyqo::ISO9660Parser::scheduleInitialize | ( | ) |
| psyqo::TaskQueue::Task psyqo::ISO9660Parser::scheduleReadRequest | ( | const ReadRequest * | request | ) |
Read a file asynchronously.
This method reads a file asynchronously. It will read the file from the given entry in the ReadRequest, and will read the number of sectors corresponding to the entry's size. The buffer is specified by the buffer field in the ReadRequest, and must be large enough to hold the whole file. This method is mainly a helper around the CDRom device's readSectors method.
| [in] | request | The request to fill. |
| psyqo::TaskQueue::Task psyqo::ISO9660Parser::scheduleWalkDirectory | ( | const DirEntry & | dir, |
| eastl::function< bool(eastl::string_view name, const DirEntry &entry)> | visitor | ||
| ) |
|
inline |
| void psyqo::ISO9660Parser::walkDirectory | ( | const DirEntry & | dir, |
| eastl::function< bool(eastl::string_view name, const DirEntry &entry)> | visitor, | ||
| eastl::function< void(bool success)> | callback | ||
| ) |
Walk the entries of a directory.
This method reads every sector of the directory dir, and calls visitor once per entry, in the order they appear on the disc, with the entry's name as recorded on the disc (including the ;1 version suffix of files) and its parsed DirEntry. The . and .. entries are passed too, as CURRENT_DIR and PARENT_DIR. The name only lives for the duration of the call, and the visitor must not call into the parser. Returning true from the visitor stops the walk. Then callback is called, with false if the CDRom device failed reading, if the parser isn't initialized, or if dir isn't a directory; stopping early still counts as success. dir is copied, so it doesn't need to outlive the call.
| [in] | dir | The directory to walk, as returned by getDirentry. |
| [in] | visitor | Called for each entry; returns true to stop the walk. |