Skip to content

class System


methods


System.getFPS


function System.getFPS(
  prev,
  cur
)

@deprecated Deprecated

@see Screen.getFPS

System.openFile


function System.openFile(
  path: string,
  openmode: integer
) -> fd integer

@param path - path to file

@param openmode - can be a combination of the following: O_RDONLY, O_WRONLY, O_CREAT, O_TRUNC, O_RDWR

@return fd - file descriptor number or negative number on error

Opens file for further operations

System.readFile


function System.readFile(
  fd: integer,
  lenght: integer
)
 -> buf string
 -> lenght integer

@param fd - the file descriptor

@param lenght - size in bytes to be read from the file

@return buf - a string containing the readed data

@return lenght - ammount of bytes read from the file

reads data from an already opened file

@see System.openFile

System.writeFile


function System.writeFile(
  fd: integer,
  buf: string,
  lenght: integer
) -> lenght integer

@param fd - the file descriptor

@param buf - buffer of data to be written

@param lenght - the ammount of bytes to be written (should always be smaller or equal to the lenght of the buf)

@return lenght - ammount of bytes written the file

reads data from an already opened file

@see System.openFile

System.closeFile


function System.closeFile(fd: integer) -> r integer

@param fd - the file descriptor to be closed

@return r - 0 on success

closes a file descriptor

@see System.openFile

System.seekFile


function System.seekFile(
  fd: integer,
  pos: seektypes,
  type
) -> newpos integer

@param fd - the file descriptor

@param pos - position mode to be used: [SET, CUR, END]

@return newpos - the new position on the file, counting in bytes from file begining

reads data from an already opened file

@see System.openFile seektypes

System.sizeFile


function System.sizeFile(fd: integer) -> size integer

@param fd - the file descriptor

@return size - size of file in bytes, or negative number on error

simple wrapper to quickly obtain size of file in bytes

System.currentDirectory


function System.currentDirectory(path: string)

@param path - when passed a string, that string is used as the new Current Working Directory of the program, pass no parameters or nil to make the function return the current working directory

returns or sets the current directory depending on the parameter passed

System.listDirectory


function System.listDirectory(path: string) -> dirent luadirent {
    name = string,
    size = integer,
    directory = boolean,
}

@param path - the path that the function must scan, if no path passed, then the CWD is used instead

@return dirent - an array of tables with the directory contents

iterates over the contents of a directory and returns a table listing it's contents

@see luadirent: the array of tables returned structure

System.createDirectory


function System.createDirectory(path: string) -> ret integer

@param path - the path to the directory to be created

@return ret - operation result. 0 for success

attempts to create a directory at the specified path

System.removeDirectory


function System.removeDirectory(path: string) -> ret integer

@param path - the path to the directory to be removed

@return ret - operation result. 0 for success

attempts to remove a directory at the specified path

System.copyFile


function System.copyFile(
  file: string,
  newfile: string
)

@param file - the path to the original file

@param newfile - the path to the new file WARNING: this function does not perform any kind of error handling nor error return

simplified wrapper for copying of one file into another location

System.moveFile


function System.moveFile(
  file: string,
  newfile: string
)

@param file - the path to the original file

@param newfile - the path to the new file WARNING: this function does not perform any kind of error handling nor error return

simplified wrapper for moving one file into another location

System.threadCopyFile


function System.threadCopyFile(
  file: string,
  newfile: string
)

@param file - the path to the original file

@param newfile - the path to the new file WARNING: this function does not perform any kind of error handling nor error return

threaded version of System.copyFile

System.getFileProgress


function System.getFileProgress() -> progress cpprog {
    current = integer,
    final = integer,
}

threaded version of System.copyFile

@see cpprog

System.removeFile


function System.removeFile(file: string) -> ret integer

@param file - the path for the file to be deleted

@return ret - 0 on success

attempts to remove a file

System.rename


function System.rename(
  source,
  dest
)

internally it is the same than System.moveFile. use that instead

@deprecated Deprecated

@see System.moveFile System.moveFile

System.md5sum


function System.md5sum(data: string) -> md5 string

@param data - the data to obtain the checksum from

@return md5 - the string representation of the obtained checksum

Calculates MD5 checksum for a string (or data buffer)

System.md5sum


function System.md5sum(sec: integer)

@param sec - how many seconds to wait

Same then C sleep(). waits for the specified ammount of seconds

System.getFreeMemory


function System.getFreeMemory() -> freebytes integer

@return freebytes - ammount of of free RAM on the Emotion Engine. expressed as bytes Total RAM: - Retail PS2: 32mb - System246/Konami Python1: 32mb - PSX DESR and System256: 64mb - PS2 DTL-T TOOL units: 128mb

System.exitToBrowser


function System.exitToBrowser()

Executes the system OSDSYS abruptly

System.getMCInfo


function System.getMCInfo(port: integer) -> mcinfo mcinfo {
    type = mctypes,
    freemem = integer,
    format = mcformat,
    result = integer,
}

@param port - The memory card port to obtain information. defaults to 0 if no param passed

Obtains information about a memory card connected

@see mcinfo

System.loadELF


function System.loadELF(
  path: string,
  reboot_iop: (boolean|integer),
  ...: string
)

@param path - the location of the ELF file to be executed

@param reboot_iop - if the I/O Processor should be rebooted before firing the ELF

@param ... - argumments for the ELF file. path is assigned as argv[0]

Executes an ELF file

System.checkValidDisc


function System.checkValidDisc() ->  integer

@return - 0: Valid disc | 1: Invalid disc

Checks if a valid disc is inserted on tray

System.getDiscType


function System.getDiscType() -> disctypes disctypes {
    SCECdGDTFUNCFAIL = -1,
    SCECdNODISC = 1,
    SCECdDETCT = 2,
    SCECdDETCTCD = 3,
    SCECdDETCTDVDS = 4,
    SCECdDETCTDVDD = 5,
    SCECdUNKNOWN = 6,
    SCECdPSCD = 7,
    SCECdPSCDDA = 8,
    SCECdPS2CD = 9,
    SCECdPS2CDDA = 10,
    SCECdPS2DVD = 11,
    SCECdESRDVD_0 = 12,
    SCECdESRDVD_1 = 13,
    SCECdCDDA = 14,
    SCECdDVDV = 15,
    SCECdIllegalMedia = 16,
}

Checks what kind of disc is inserted on the system

@see disctypes

System.checkDiscTray


function System.checkDiscTray() -> status integer

@return status - 1 if its open, 0 otherwise

Checks if the disc tray is open

System.fileXioMount


function System.fileXioMount(
  mountpoint: string,
  path: string,
  FIO_MT_RDWR
) -> result integer

@param mountpoint - path to the mountpoint that will be exposed

@param path - path to the block to mount

Mounts a filesystem via the fileXio driver

@see mountmode

System.fileXioUmount


function System.fileXioUmount(mountpoint: string) -> result integer

@param mountpoint - path to the mountpoint that will be unmounted

Unmounts a filesystem