Skip to content

Commit

Permalink
Merge pull request #14 from cad0gan/master
Browse files Browse the repository at this point in the history
Add some swi functions
  • Loading branch information
Azq2 authored May 23, 2024
2 parents 16903a4 + 4d907c4 commit d17fb16
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
23 changes: 23 additions & 0 deletions swilib/include/swilib/explorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ __swi_begin(0x2DB)
void MediaSendCSM_Open(const WSHDR *file, const WSHDR *path)
__swi_end(0x2DB, MediaSendCSM_Open, (file, path));

/**
* Open menu for setting resource as Wallpaper, Logo, Ringtone, etc..
* @param file_name name of the file, example "beans_recipe.jpg"
* @param dir directory of the file, example "0:\\Pictures"
* @param flag 0 or 2
* @param open_mode unknown param, set 0
* @return CSM ID
* */
__swi_begin(0x3CC)
int PersMenuCSM_Open(const WSHDR *file_name, const WSHDR *dir, int flag, int open_mode)
__swi_end(0x3CC, PersMenuCSM_Open, (file_name, dir, flag, open_mode));

/**
* Open NativeExplorer.
* @param data options for the opening explorer
Expand Down Expand Up @@ -250,6 +262,17 @@ __swi_begin(0x1F1)
int ExplorerSetTransferState(char transfer_id, int state)
__swi_end(0x1F1, ExplorerSetTransferState, (transfer_id, state));

/**
* Get MIME type
* @param uid file uid, see #GetExtUid_ws, #GetExtUidByFileName_ws
* @param[out] mime_type pointer to WSHDR string
* @param unk_0 unknown param, set to 0
* @return 1: success, 0: error
* */
__swi_begin(0x3C8)
int GetMimeType(int uid, WSHDR *mime_type, int unk_0)
__swi_end(0x3C8, GetMimeType, (uid, mime_type, unk_0));

__swilib_end

/** @} */
13 changes: 13 additions & 0 deletions swilib/include/swilib/wstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@ __swi_begin(0x2E2)
int wstrcmp(WSHDR *str1, WSHDR *str2)
__swi_end(0x2E2, wstrcmp, (str1, str2));

/**
* Compare two WSHDR strings, up to a specific length
* @param ws1 WSHDR to be compared
* @param ws2 WSHDR to be compared
* @param n length
* @return <0 - the first character that does not match has a lower value in ws1 than in ws2
* @return 0 - the contents of both strings are equal
* @return >0 - the first character that does not match has a greater value in ws1 than in ws2
* */
__swi_begin(0x3C9)
int wstrncmp(const WSHDR *ws1, const WSHDR *ws2, size_t n)
__swi_end(0x3C9, wstrncmp, (ws1, ws2, n));

/**
* Get WSHDR length.
* @param str pointer to the WSHDR
Expand Down

0 comments on commit d17fb16

Please sign in to comment.