Binary File Object Functions

From Danmakufu Wiki
Jump to: navigation, search

ObjFileB_SetByteOrder

Arguments:
 1) object ID (real)
 2) Byte Order (real)

Sets Byte Order of file. Options are:

  • ENDIAN_LITTLE: Little endian (default)
  • ENDIAN_BIG: Big endian

ObjFileB_SetCharacterCode

Arguments:
 1) object ID (real)
 2) Character Code (real)

Sets Character Code of file. Options are:

  • CODE_ACP: ANSI/Shift-JIS
  • CODE_UTF8: UTF-8
  • CODE_UTF16LE: UTF-16 Little Endian
  • CODE_UTF16BE: UTF-16 Big Endian

Default is CODE_ACP.

ObjFileB_GetPointer

Arguments:
 1) object ID (real)
 
Returns: value (real)

Returns the current file pointer position of the object.

ObjFileB_Seek

Arguments:
 1) object ID (real)
 2) offset (real)

Sets the file pointer of the object to seek to the specified byte position.

ObjFileB_ReadBoolean

Arguments:
 1) object ID (real)

Returns: value (real)

Reads a boolean value from the file, then returns it as an integer.

Advances the file pointer by 1 byte.

ObjFileB_ReadByte

Arguments:
 1) object ID (real)
 
Returns: value (real)

Reads a 1-byte value from the file, then returns it as an integer.

Advances the file pointer by 1 byte.

ObjFileB_ReadShort

Arguments:
 1) object ID (real)
 
Returns: value (real)

Reads a 2-byte value from the file, then returns it as an integer.

Advances the file pointer by 2 bytes.

ObjFileB_ReadInteger

Arguments:
 1) object ID (real)
 
Returns: value (real)

Reads a 4-byte value from the file, then returns it as an integer.

Advances the file pointer by 4 bytes.

ObjFileB_ReadLong

Arguments:
 1) object ID (real)
 
Returns: value (real)

Reads an 8-byte value from the file, then returns it as an integer.

Advances the file pointer by 8 bytes.

ObjFileB_ReadFloat

Arguments:
 1) object ID (real)
 
Returns: value (real)

Reads a 4-byte value from the file, then returns it as a floating-point value.

Advances the file pointer by 4 bytes.

ObjFileB_ReadDouble

Arguments:
 1) object ID (real)
 
Returns: value (real)

Reads a 8-byte value from the file, then returns it as a floating-point value.

Advances the file pointer by 8 bytes.

ObjFileB_ReadString

Arguments:
 1) object ID (real)
 2) number of bytes to read (real)

Given a specified number of bytes to read, reads a string.

Note: due to a bug, this function will never return any characters outside of Shift-JIS.