wavelength 1.0.0
Loading...
Searching...
No Matches
fileutil.h File Reference
#include <stdbool.h>
Include dependency graph for fileutil.h:

Go to the source code of this file.

Functions

const char * FileRoot ()
 Report the directory the game's files are read from, .
const char * FileNormalizePath (const char *pszPath)
 Normalise a path.
const char * FileRelativePath (const char *pszPath, const char *pszBase)
 Express a path relative to a base directory.
bool FileIsAbsolute (const char *pszPath)
 Report whether a path is absolute.
const char * FileGetPath (const char *pszPath)
 Report the directory part of a path.
const char * FileGetExt (const char *pszPath)
 Report the extension of a path.
const char * FileGetBaseName (const char *pszPath)
 Report the file name of a path without its directory and its extension.
int FileTableRead (int nDescriptor, void *pBuffer, int nBytes)
 Read bytes from a file of gFileTable.

Function Documentation

◆ FileRoot()

const char * FileRoot ( )

Report the directory the game's files are read from, .

.

The name is inferred.

Returns
The directory.
Ghidra address:
NTSC-U/C: 0x002895b8
Ghidra address:
PAL: 0x00292db0

◆ FileNormalizePath()

const char * FileNormalizePath ( const char * pszPath)

Normalise a path.

The path is lower-cased, its backslashes become slashes, and its . components and every .. component with a preceding component to cancel are removed. A path whose last such component cancels a preceding one normalises to the empty string. A leading slash is preserved.

Parameters
pszPathThe path.
Returns
A shared buffer the next call replaces.
Ghidra address:
NTSC-U/C: 0x002895c8
Ghidra address:
PAL: 0x00292dc0

◆ FileRelativePath()

const char * FileRelativePath ( const char * pszPath,
const char * pszBase )

Express a path relative to a base directory.

Both paths are split at their slashes. The components they share at the start are dropped, a .. replaces each remaining component of the base, and the remaining components of the path follow.

Parameters
pszPathThe path.
pszBaseThe base directory.
Returns
A shared buffer the next call replaces, empty for an empty path.
Ghidra address:
NTSC-U/C: 0x002897c0
Ghidra address:
PAL: 0x00292fb8

◆ FileIsAbsolute()

bool FileIsAbsolute ( const char * pszPath)

Report whether a path is absolute.

A path is absolute when it starts with a slash or a backslash or has a colon as its second character. A null or empty path is treated as absolute.

Parameters
pszPathThe path, or null.
Returns
Whether the path is absolute.
Ghidra address:
NTSC-U/C: 0x00289c88
Ghidra address:
PAL: 0x00293480

◆ FileGetPath()

const char * FileGetPath ( const char * pszPath)

Report the directory part of a path.

The result is the path up to its last forward or backward slash, or . when the path has no slash or is null.

Parameters
pszPathThe path, or null.
Returns
A shared buffer the next call replaces.
Ghidra address:
NTSC-U/C: 0x00289cd8
Ghidra address:
PAL: 0x002934d0

◆ FileGetExt()

const char * FileGetExt ( const char * pszPath)

Report the extension of a path.

The result is the text after the last full stop, or the empty text at the end of a path without a full stop.

Parameters
pszPathThe path.
Returns
A pointer into the path.
Ghidra address:
NTSC-U/C: 0x00289d60
Ghidra address:
PAL: 0x00293558

◆ FileGetBaseName()

const char * FileGetBaseName ( const char * pszPath)

Report the file name of a path without its directory and its extension.

Parameters
pszPathThe path.
Returns
A shared buffer the next call replaces.
Ghidra address:
NTSC-U/C: 0x00289da0
Ghidra address:
PAL: 0x00293598

◆ FileTableRead()

int FileTableRead ( int nDescriptor,
void * pBuffer,
int nBytes )

Read bytes from a file of gFileTable.

Parameters
nDescriptorThe index of the file.
pBufferReceives the bytes.
nBytesThe number of bytes.
Returns
The number of bytes read.
Ghidra address:
NTSC-U/C: 0x00289e40
Ghidra address:
PAL: 0x00293638