|
PS2SDK
PS2 Homebrew Libraries
|
#include <tamtypes.h>#include <kernel.h>#include <sifrpc.h>#include <string.h>#include <iopcontrol.h>#include "libmc.h"
Include dependency graph for libmc.c:Go to the source code of this file.
Data Structures | |
| struct | libmc_name_param_stru |
| union | libmc_name_desc_param_unio |
| union | libmc_rdata_param_unio |
| struct | libmc_page_read_align_data_stru |
| union | libmc_extra_send_recv_unio |
| struct | mcExtraEndParam_ |
| struct | libmc_interface_data_stru |
| struct | libmc_internal_data_ |
| struct | libmc_target_desc_ |
| union | libmc_name_param_stru.__unnamed__ |
Macros | |
| #define | LIBMC_PRE_CHECK_FLAG_ONLY_TYPE 1 |
| #define | LIBMC_PRE_RPC(target, flags, only_type) |
Typedefs | |
| typedef struct mcExtraEndParam_ | mcExtraEndParam_t |
| typedef struct libmc_internal_data_ | libmc_internal_data_t |
| typedef struct libmc_target_desc_ | libmc_target_desc_t |
Functions | |
| static int | libmc_pre_rpc_impl (const libmc_target_desc_t *target, int flags, int only_type) |
| static int | libmc_post_rpc (const libmc_target_desc_t *target, int cmd, int desc_param_or_name_param, SifRpcEndFunc_t end_function, void *end_param) |
| static void | libmc_setup_target (libmc_target_desc_t *target, int interface, int port, int slot, int fd) |
| static void | mcGetInfoApdxOld (void *arg) |
| static void | mcGetInfoApdxNew (void *arg) |
| static void | mcReadFixAlignOld (void *arg) |
| static void | mcReadFixAlignNew (void *arg) |
| static void | mcStoreDir (void *arg) |
| static void | libmc_ReadAlignFunction (void *arg) |
| static int | libmc_rpc_reset (const libmc_target_desc_t *target) |
| static int | libmc_rpc_init (const libmc_target_desc_t *target) |
| static int | libmc_rpc_get_info (const libmc_target_desc_t *target, int *type, int *free, int *format) |
| static int | libmc_rpc_open (const libmc_target_desc_t *target, const char *name, int mode) |
| static int | libmc_rpc_close (const libmc_target_desc_t *target) |
| static int | libmc_rpc_seek (const libmc_target_desc_t *target, int offset, int origin) |
| static int | libmc_rpc_read (const libmc_target_desc_t *target, void *buffer, int size) |
| static int | libmc_rpc_write (const libmc_target_desc_t *target, const void *buffer, int size) |
| static int | libmc_rpc_flush (const libmc_target_desc_t *target) |
| static int | libmc_rpc_mkdir (const libmc_target_desc_t *target, const char *name) |
| static int | libmc_rpc_chdir (const libmc_target_desc_t *target, const char *newDir, char *currentDir) |
| static int | libmc_rpc_getdir (const libmc_target_desc_t *target, const char *name, unsigned mode, int maxent, sceMcTblGetDir *table) |
| static int | libmc_rpc_setfileinfo (const libmc_target_desc_t *target, const char *name, const sceMcTblGetDir *info, unsigned flags) |
| static int | libmc_rpc_delete (const libmc_target_desc_t *target, const char *name) |
| static int | libmc_rpc_format (const libmc_target_desc_t *target) |
| static int | libmc_rpc_unformat (const libmc_target_desc_t *target) |
| static int | libmc_rpc_get_ent_space (const libmc_target_desc_t *target, const char *path) |
| static int | libmc_rpc_rename (const libmc_target_desc_t *target, const char *oldName, const char *newName) |
| static int | libmc_rpc_erase_block (const libmc_target_desc_t *target, int block, int mode) |
| static int | libmc_rpc_read_page (const libmc_target_desc_t *target, unsigned int page, void *buffer) |
| static int | libmc_rpc_write_page (const libmc_target_desc_t *target, int page, const void *buffer) |
| static int | libmc_rpc_change_thread_priority (const libmc_target_desc_t *target, int level) |
| static int | libmc_rpc_sync (const libmc_target_desc_t *target, int mode, int *cmd, int *result) |
| int | mcInit (int type) |
| int | mcGetInfo (int port, int slot, int *type, int *free, int *format) |
| int | mcOpen (int port, int slot, const char *name, int mode) |
| int | mcClose (int fd) |
| int | mcSeek (int fd, int offset, int origin) |
| int | mcRead (int fd, void *buffer, int size) |
| int | mcWrite (int fd, const void *buffer, int size) |
| int | mcFlush (int fd) |
| int | mcMkDir (int port, int slot, const char *name) |
| int | mcChdir (int port, int slot, const char *newDir, char *currentDir) |
| int | mcGetDir (int port, int slot, const char *name, unsigned mode, int maxent, sceMcTblGetDir *table) |
| int | mcSetFileInfo (int port, int slot, const char *name, const sceMcTblGetDir *info, unsigned flags) |
| int | mcDelete (int port, int slot, const char *name) |
| int | mcFormat (int port, int slot) |
| int | mcUnformat (int port, int slot) |
| int | mcGetEntSpace (int port, int slot, const char *path) |
| int | mcRename (int port, int slot, const char *oldName, const char *newName) |
| int | mcEraseBlock (int port, int slot, int block, int mode) |
| int | mcReadPage (int port, int slot, unsigned int page, void *buffer) |
| int | mcWritePage (int port, int slot, int page, const void *buffer) |
| int | mcChangeThreadPriority (int level) |
| int | mcSync (int mode, int *cmd, int *result) |
| int | mcReset (void) |
| int | xfromInit (int type) |
| int | xfromGetInfo (int port, int slot, int *type, int *free, int *format) |
| int | xfromOpen (int port, int slot, const char *name, int mode) |
| int | xfromClose (int fd) |
| int | xfromSeek (int fd, int offset, int origin) |
| int | xfromRead (int fd, void *buffer, int size) |
| int | xfromWrite (int fd, const void *buffer, int size) |
| int | xfromFlush (int fd) |
| int | xfromMkDir (int port, int slot, const char *name) |
| int | xfromChdir (int port, int slot, const char *newDir, char *currentDir) |
| int | xfromGetDir (int port, int slot, const char *name, unsigned mode, int maxent, sceMcTblGetDir *table) |
| int | xfromSetFileInfo (int port, int slot, const char *name, const sceMcTblGetDir *info, unsigned flags) |
| int | xfromDelete (int port, int slot, const char *name) |
| int | xfromFormat (int port, int slot) |
| int | xfromUnformat (int port, int slot) |
| int | xfromGetEntSpace (int port, int slot, const char *path) |
| int | xfromRename (int port, int slot, const char *oldName, const char *newName) |
| int | xfromEraseBlock (int port, int slot, int block, int mode) |
| int | xfromReadPage (int port, int slot, unsigned int page, void *buffer) |
| int | xfromWritePage (int port, int slot, int page, const void *buffer) |
| int | xfromChangeThreadPriority (int level) |
| int | xfromSync (int mode, int *cmd, int *result) |
| int | xfromReset (void) |
Variables | |
| static const int | mcRpcCmd [2][17] |
| static libmc_internal_data_t | g_libmc_internal_data |
Function defenitions for mclib.
Definition in file libmc.c.
| struct libmc_name_param_stru |
| Data Fields | ||
|---|---|---|
| int | m_port | |
| int | m_slot | |
| int | m_flags | |
| int | m_maxent | |
| union libmc_name_param_stru | __unnamed__ | |
| char | m_name[1024] | |
| union libmc_name_desc_param_unio |
Collaboration diagram for libmc_name_desc_param_unio:| Data Fields | ||
|---|---|---|
| struct libmc_name_param_stru | m_name_param | |
| mcDescParam_t | m_desc_param | |
| union libmc_rdata_param_unio |
Collaboration diagram for libmc_rdata_param_unio:| Data Fields | ||
|---|---|---|
| int | m_result | |
| mcRpcStat_t | m_rpcStat | |
| u8 | m_buffer[2048] | |
| struct libmc_page_read_align_data_stru |
| union libmc_extra_send_recv_unio |
Collaboration diagram for libmc_extra_send_recv_unio:| Data Fields | ||
|---|---|---|
| int | m_end_parameter[48] | |
| char | m_cur_dir[1024] | |
| sceMcTblGetDir | m_file_info_buff | |
| struct libmc_page_read_align_data_stru | m_page_read_align_data | |
| struct mcExtraEndParam_ |
Collaboration diagram for mcExtraEndParam_:| Data Fields | ||
|---|---|---|
| union libmc_extra_send_recv_unio * | m_extra_send_recv_param | |
| int * | m_p_type | |
| int * | m_p_free | |
| int * | m_p_format | |
| int * | m_p_result | |
| char * | m_dst_cur_dir | |
| struct libmc_internal_data_ |
Collaboration diagram for libmc_internal_data_:| Data Fields | ||
|---|---|---|
| struct libmc_interface_data_stru | m_interface_data[MC_INTERFACE_MAX] | |
| struct libmc_target_desc_ |
Collaboration diagram for libmc_target_desc_:| Data Fields | ||
|---|---|---|
| struct libmc_interface_data_stru * | m_interface_data | |
| int | m_interface | |
| int | m_port | |
| int | m_slot | |
| int | m_fd | |
| union libmc_name_param_stru.__unnamed__ |
| Data Fields | ||
|---|---|---|
| sceMcTblGetDir * | m_mcT | |
| char * | m_curdir | |
| #define LIBMC_PRE_RPC | ( | target, | |
| flags, | |||
| only_type | |||
| ) |
|
static |
|
static |
|
static |
|
static |
|
static |
| int mcInit | ( | int | type | ) |
| int mcGetInfo | ( | int | port, |
| int | slot, | ||
| int * | type, | ||
| int * | free, | ||
| int * | format | ||
| ) |
get memcard state mcSync result: 0 = same card as last getInfo call -1 = formatted card inserted since last getInfo call -2 = unformatted card inserted since last getInfo call < -2 = memcard access error (could be due to accessing psx memcard)
| port | port number |
| slot | slot number |
| type | pointer to get memcard type |
| free | pointer to get number of free clusters |
| format | pointer to get whether or not the card is formatted (Note: Originally, sceMcGetInfo didn't have a 5th argument for returning the format status. As this is emulated based on the return value of sceMcSync() when rom0:MCSERV is used, please keep track of the return value from sceMcSync instead!) |
| int mcOpen | ( | int | port, |
| int | slot, | ||
| const char * | name, | ||
| int | mode | ||
| ) |
| int mcClose | ( | int | fd | ) |
| int mcSeek | ( | int | fd, |
| int | offset, | ||
| int | origin | ||
| ) |
| int mcRead | ( | int | fd, |
| void * | buffer, | ||
| int | size | ||
| ) |
| int mcWrite | ( | int | fd, |
| const void * | buffer, | ||
| int | size | ||
| ) |
| int mcFlush | ( | int | fd | ) |
| int mcMkDir | ( | int | port, |
| int | slot, | ||
| const char * | name | ||
| ) |
| int mcChdir | ( | int | port, |
| int | slot, | ||
| const char * | newDir, | ||
| char * | currentDir | ||
| ) |
| int mcGetDir | ( | int | port, |
| int | slot, | ||
| const char * | name, | ||
| unsigned | mode, | ||
| int | maxent, | ||
| sceMcTblGetDir * | table | ||
| ) |
get memcard filelist mcSync result: 0 or more = number of file entries obtained (success) -2 = unformatted card -4 = dirname error
| port | port number of memcard |
| slot | slot number of memcard |
| name | filename to search for (can use wildcard and relative dirs) |
| mode | mode: 0 = first call, otherwise = followup call |
| maxext | maximum number of entries to be written to filetable in 1 call |
| table | mc table array |
| int mcSetFileInfo | ( | int | port, |
| int | slot, | ||
| const char * | name, | ||
| const sceMcTblGetDir * | info, | ||
| unsigned | flags | ||
| ) |
| int mcDelete | ( | int | port, |
| int | slot, | ||
| const char * | name | ||
| ) |
| int mcFormat | ( | int | port, |
| int | slot | ||
| ) |
| int mcUnformat | ( | int | port, |
| int | slot | ||
| ) |
| int mcGetEntSpace | ( | int | port, |
| int | slot, | ||
| const char * | path | ||
| ) |
| int mcRename | ( | int | port, |
| int | slot, | ||
| const char * | oldName, | ||
| const char * | newName | ||
| ) |
| int mcEraseBlock | ( | int | port, |
| int | slot, | ||
| int | block, | ||
| int | mode | ||
| ) |
Erases a block on the memory card. Note: rom0:XMCSERV does not support this. mcSync returns: 0 if ok < 0 if error
| port | port number |
| slot | slot number |
| block | Block number of the block to be erased. |
| mode | Mode: -1 to inhibit ECC recalculation of the erased block's pages (useful if sceMcWritePage is used to fill in its contents later on), 0 for normal operation. |
| int mcReadPage | ( | int | port, |
| int | slot, | ||
| unsigned int | page, | ||
| void * | buffer | ||
| ) |
Reads a page from the memory card. Note: rom0:XMCSERV does not support this. mcSync returns: 0 if ok < 0 if error
| port | port number |
| slot | slot number |
| page | Page number of the page to be read. |
| buffer | Pointer to buffer that will contain the read data. |
| int mcWritePage | ( | int | port, |
| int | slot, | ||
| int | page, | ||
| const void * | buffer | ||
| ) |
Writes a page to the memory card. (The block which the page resides on must be erased first!) Note: rom0:XMCSERV does not support this. mcSync returns: 0 if ok < 0 if error
| port | port number |
| slot | slot number |
| page | Page number of the page to be written. |
| buffer | Pointer to buffer containing data to be written. |
| int mcChangeThreadPriority | ( | int | level | ) |
| int mcSync | ( | int | mode, |
| int * | cmd, | ||
| int * | result | ||
| ) |
wait for mc functions to finish or check if they have finished yet
| mode | mode 0=wait till function finishes, 1=check function status |
| cmd | pointer for storing the number of the currenlty processing function |
| result | pointer for storing result of function if it finishes |
| int mcReset | ( | void | ) |
| int xfromInit | ( | int | type | ) |
| int xfromGetInfo | ( | int | port, |
| int | slot, | ||
| int * | type, | ||
| int * | free, | ||
| int * | format | ||
| ) |
get external flash ROM state xfromSync result: 0 = same external flash ROM as last getInfo call -1 = formatted external flash ROM inserted since last getInfo call -2 = unformatted external flash ROM inserted since last getInfo call < -2 = external flash ROM access error (could be due to accessing psx external flash ROM)
| port | port number |
| slot | slot number |
| type | pointer to get external flash ROM type |
| free | pointer to get number of free clusters |
| format | pointer to get whether or not the external flash ROM is formatted |
| int xfromOpen | ( | int | port, |
| int | slot, | ||
| const char * | name, | ||
| int | mode | ||
| ) |
| int xfromClose | ( | int | fd | ) |
| int xfromSeek | ( | int | fd, |
| int | offset, | ||
| int | origin | ||
| ) |
| int xfromRead | ( | int | fd, |
| void * | buffer, | ||
| int | size | ||
| ) |
| int xfromWrite | ( | int | fd, |
| const void * | buffer, | ||
| int | size | ||
| ) |
| int xfromFlush | ( | int | fd | ) |
| int xfromMkDir | ( | int | port, |
| int | slot, | ||
| const char * | name | ||
| ) |
| int xfromChdir | ( | int | port, |
| int | slot, | ||
| const char * | newDir, | ||
| char * | currentDir | ||
| ) |
| int xfromGetDir | ( | int | port, |
| int | slot, | ||
| const char * | name, | ||
| unsigned | mode, | ||
| int | maxent, | ||
| sceMcTblGetDir * | table | ||
| ) |
get external flash ROM filelist xfromSync result: 0 or more = number of file entries obtained (success) -2 = unformatted external flash ROM -4 = dirname error
| port | port number of external flash ROM |
| slot | slot number of external flash ROM |
| name | filename to search for (can use wildcard and relative dirs) |
| mode | mode: 0 = first call, otherwise = followup call |
| maxext | maximum number of entries to be written to filetable in 1 call |
| table | external flash ROM table array |
| int xfromSetFileInfo | ( | int | port, |
| int | slot, | ||
| const char * | name, | ||
| const sceMcTblGetDir * | info, | ||
| unsigned | flags | ||
| ) |
| int xfromDelete | ( | int | port, |
| int | slot, | ||
| const char * | name | ||
| ) |
| int xfromFormat | ( | int | port, |
| int | slot | ||
| ) |
| int xfromUnformat | ( | int | port, |
| int | slot | ||
| ) |
| int xfromGetEntSpace | ( | int | port, |
| int | slot, | ||
| const char * | path | ||
| ) |
| int xfromRename | ( | int | port, |
| int | slot, | ||
| const char * | oldName, | ||
| const char * | newName | ||
| ) |
| int xfromEraseBlock | ( | int | port, |
| int | slot, | ||
| int | block, | ||
| int | mode | ||
| ) |
Erases a block on the external flash ROM. Note: The current implementation of xfromserv does not support this. xfromSync returns: 0 if ok < 0 if error
| port | port number |
| slot | slot number |
| block | Block number of the block to be erased. |
| mode | Mode: -1 to inhibit ECC recalculation of the erased block's pages (useful if xfromWritePage is used to fill in its contents later on), 0 for normal operation. |
| int xfromReadPage | ( | int | port, |
| int | slot, | ||
| unsigned int | page, | ||
| void * | buffer | ||
| ) |
Reads a page from the external flash ROM. Note: The current implementation of xfromserv does not support this. xfromSync returns: 0 if ok < 0 if error
| port | port number |
| slot | slot number |
| page | Page number of the page to be read. |
| buffer | Pointer to buffer that will contain the read data. |
| int xfromWritePage | ( | int | port, |
| int | slot, | ||
| int | page, | ||
| const void * | buffer | ||
| ) |
Writes a page to the external flash ROM. (The block which the page resides on must be erased first!) Note: The current implementation of xfromserv does not support this. xfromSync returns: 0 if ok < 0 if error
| port | port number |
| slot | slot number |
| page | Page number of the page to be written. |
| buffer | Pointer to buffer containing data to be written. |
| int xfromChangeThreadPriority | ( | int | level | ) |
| int xfromSync | ( | int | mode, |
| int * | cmd, | ||
| int * | result | ||
| ) |
wait for external flash ROM functions to finish or check if they have finished yet
| mode | mode 0=wait till function finishes, 1=check function status |
| cmd | pointer for storing the number of the currenlty processing function |
| result | pointer for storing result of function if it finishes |