Difference between revisions of "Bfile StrToName ncpy"

From WikiPrizm
Jump to navigationJump to search
m (This page was crossed off the syscall list, but it wasn't changed...)
 
Line 1: Line 1:
== Synopsis ==
+
{{syscall
 +
| name = Bfile_StrToName_ncpy
 +
| header = fxcg/file.h
 +
| signature = void Bfile_StrToName_ncpy(unsigned short* dest, const unsigned char* source, int n)
 +
| index = 0x1DDC
 +
| parameters = * ''unsigned short*'' '''dest''' - Pointer to a buffer that will hold the resulting 16 bit string.
 +
* ''const unsigned char*'' '''source''' - Pointer to a 8 bit string containing the path to convert.
 +
* ''int'' '''n''' - How many bytes to convert (length of the source string, see [[#Comments]] for information on the behavior of the syscall wen the length doesn't match '''n''').
 +
| synopsis = Converts a 8 bit character array (array of <tt>unsigned char</tt>) to a 16 bit string (array of <tt>unsigned short</tt>), suitable for use with [[:Category:Syscalls:Bfile|Bfile syscalls]].
 +
| comments = When you use a function, such as Bfile_OpenFile_OS, the path string must be a 16 bit string.  Simply using char16_t works in some cases but not for all.  The strings generated by the two (function vs. 16 bit characters) are not identical in data.
  
'''Syscall:'''  
+
If the length of '''source''' is below '''n''', '''dest''' is padded. If '''source''' is terminated by 0xFF, '''dest''' is padded with 0xFFFF, otherwise it is padded with 0x0000.
  
'''Function declaration:''' void Bfile_StrToName_ncpy(short unsigned int *dest, const unsigned char *source, int n);
+
[[Bfile_NameToStr_ncpy]] does the opposite of this syscall.
 
+
}}
This function is used to make a 16 bit string from an 8 bit character array.
+
[[Category:Syscalls:Bfile]]
 
 
=== Inputs ===
 
* ''const unsigned char*'' '''source''' - A pointer to a string that will be converted.
 
* ''int'' '''n''' - Number of characters to be read in from '''source'''.  '''dest''' must be n*2 bytes in size.
 
 
 
=== Outputs ===
 
* ''short unsigned int*'' '''dest''' - A pointer to a buffer of appropriate size containing the output 16 bit string.
 
 
 
== Comments ==
 
When you use a function, such as Bfile_OpenFile_OS, the path string must be a 16 bit string.  Simply using char16_t works in some cases but not for all.  The strings generated by the two (function vs. 16 bit characters) are not identical in data.
 
[[Category:Syscalls]] [[Category:Syscalls:Bfile]]
 

Latest revision as of 07:41, 30 July 2014


Synopsis

Header: fxcg/file.h
Syscall index: 0x1DDC
Function signature: void Bfile_StrToName_ncpy(unsigned short* dest, const unsigned char* source, int n)

Converts a 8 bit character array (array of unsigned char) to a 16 bit string (array of unsigned short), suitable for use with Bfile syscalls.

Parameters

  • unsigned short* dest - Pointer to a buffer that will hold the resulting 16 bit string.
  • const unsigned char* source - Pointer to a 8 bit string containing the path to convert.
  • int n - How many bytes to convert (length of the source string, see #Comments for information on the behavior of the syscall wen the length doesn't match n).

Comments

When you use a function, such as Bfile_OpenFile_OS, the path string must be a 16 bit string. Simply using char16_t works in some cases but not for all. The strings generated by the two (function vs. 16 bit characters) are not identical in data.

If the length of source is below n, dest is padded. If source is terminated by 0xFF, dest is padded with 0xFFFF, otherwise it is padded with 0x0000.

Bfile_NameToStr_ncpy does the opposite of this syscall.