mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-08 11:02:57 +02:00
Add fake-api GetUserName
This commit is contained in:
parent
6fa65d8f93
commit
481f23eeef
4 changed files with 16 additions and 1 deletions
|
@ -106,6 +106,7 @@ mkxp-z provides limited support for some WinAPI functions that would normally br
|
||||||
* `ReleaseCapture`: No-op.
|
* `ReleaseCapture`: No-op.
|
||||||
* `GetPrivateProfileString`: Emulated with MKXP's ini code.
|
* `GetPrivateProfileString`: Emulated with MKXP's ini code.
|
||||||
* `GetUserDefaultLangId`: Checks for JP, EN, FR, IT, DE, ES, KO, PT and ZH. Returns English (`0x09`) if the locale can't be determined. Doesn't handle sublanguages.
|
* `GetUserDefaultLangId`: Checks for JP, EN, FR, IT, DE, ES, KO, PT and ZH. Returns English (`0x09`) if the locale can't be determined. Doesn't handle sublanguages.
|
||||||
|
* `GetUserName`: Returns the `$USER` environment variable, or `Ditto` if it doesn't exist.
|
||||||
|
|
||||||
## Midi music
|
## Midi music
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ MiniFFI_GetFunctionHandle(void *libhandle, const char *func)
|
||||||
CAPTURE(ShowCursor);
|
CAPTURE(ShowCursor);
|
||||||
CAPTURE(GetPrivateProfileString);
|
CAPTURE(GetPrivateProfileString);
|
||||||
CAPTURE(GetUserDefaultLangID);
|
CAPTURE(GetUserDefaultLangID);
|
||||||
|
CAPTURE(GetUserName);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (!libhandle) return 0;
|
if (!libhandle) return 0;
|
||||||
|
|
|
@ -460,4 +460,14 @@ MKXP_GetUserDefaultLangID(void)
|
||||||
return 0x09;
|
return 0x09;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PREFABI BOOL
|
||||||
|
MKXP_GetUserName(LPSTR lpBuffer, LPDWORD pcbBuffer)
|
||||||
|
{
|
||||||
|
if (*pcbBuffer < 2) return false;
|
||||||
|
char *username = getenv("USER");
|
||||||
|
strncpy(lpBuffer, (username) ? username : "ditto", *pcbBuffer);
|
||||||
|
lpBuffer[0] = toupper(lpBuffer[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
typedef unsigned int DWORD, UINT, *LPDWORD;
|
typedef unsigned int DWORD, UINT, *LPDWORD;
|
||||||
typedef char BYTE, *LPCSTR, *LPCTSTR, *LPTSTR, *PBYTE;
|
typedef char BYTE, *LPSTR, *LPCSTR, *LPCTSTR, *LPTSTR, *PBYTE;
|
||||||
typedef short SHORT;
|
typedef short SHORT;
|
||||||
typedef int LONG;
|
typedef int LONG;
|
||||||
typedef bool BOOL;
|
typedef bool BOOL;
|
||||||
|
@ -147,4 +147,7 @@ MKXP_GetPrivateProfileString(LPCTSTR lpAppName,
|
||||||
PREFABI short
|
PREFABI short
|
||||||
MKXP_GetUserDefaultLangID(void);
|
MKXP_GetUserDefaultLangID(void);
|
||||||
|
|
||||||
|
PREFABI BOOL
|
||||||
|
MKXP_GetUserName(LPSTR lpBuffer, LPDWORD pcbBuffer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue