This is a "cheat sheet" for "Raw file functions" extension by YellowAfterlife. The extension can be found on itch.io.

Click on sections to expand/collapse them.
Quick display controls: Categories · Sections · Everything ·

General functions
file_raw_is_available()success?

Returns whether the DLL loaded up fine.

file_raw_open(path, mode)rawfile_ind

Tries to open a file. Returns file index or -1 if the file could not be opened.

If path is relative, the extension will look for the file in the game's save directory.

Mode is as per MSDN.

Examples:

var a_file = file_raw_open("some.bin", "wb"); // binary for writing
file_raw_write_u8(a_file, 100);
file_raw_write_string(a_file, "hello!");
file_raw_close(a_file);

var a_file = file_raw_open("some.bin", "rb"); // binary for reading
var a_byte = file_raw_read_u8(a_file); // 100
var a_string = file_raw_read_string(a_file); // "hello!"
file_raw_close(a_file);
file_raw_flush(rawfile_ind)

Ensures that any file changes are finalized on disk.

Native: fflush

file_raw_close(rawfile_ind)success?

Closes a previously open raw file, returning whether successful.

file_raw_exists(rawfile_ind)valid?

Returns whether a file_raw index is currently in use.

Note that the extension will reuse file indexes, so having "if file exists then close file" will result in familiar problems.

Position functions
file_raw_rewind(rawfile_ind)

Repositions to the beginning of a file.

Native: rewind

file_raw_tell(rawfile_ind)

Returns the current file position.

Native: ftell

file_raw_seek(rawfile_ind, origin, pos)

Moves the file pointer. Origin can be:

  • file_raw_seek_end
  • file_raw_seek_relative
  • file_raw_seek_start

Native: fseek

file_raw_eof(rawfile_ind)

Returns whether end-of-file is reached.

Native: feof