-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* GetLocaleInfoW for ee-as.exe 991111b * Try to do it the right way * 3rd time's the charm? * round 4 * it doesn't matter now what happens i will never give up the fight * comments * fin
- Loading branch information
Showing
6 changed files
with
100 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "common.h" | ||
#include "strings.h" | ||
#include <vector> | ||
|
||
size_t wstrlen(const uint16_t *str) { | ||
size_t len = 0; | ||
while (str[len] != 0) | ||
++len; | ||
return len; | ||
} | ||
|
||
size_t wstrncpy(uint16_t *dst, const uint16_t *src, size_t n) { | ||
size_t i = 0; | ||
while (i < n && src[i] != 0) { | ||
dst[i] = src[i]; | ||
++i; | ||
} | ||
if (i < n) | ||
dst[i] = 0; | ||
return i; | ||
} | ||
|
||
std::string wideStringToString(const uint16_t *src, int len = -1) { | ||
if (len < 0) { | ||
len = src ? wstrlen(src) : 0; | ||
} | ||
std::string res(len, '\0'); | ||
for (int i = 0; i < len; i++) { | ||
res[i] = src[i] & 0xFF; | ||
} | ||
return res; | ||
} | ||
|
||
std::vector<uint16_t> stringToWideString(const char *src) { | ||
int len = strlen(src); | ||
std::vector<uint16_t> res(len + 1); | ||
|
||
for (size_t i = 0; i < res.size(); i++) { | ||
res[i] = src[i] & 0xFF; | ||
} | ||
res[len] = 0; // NUL terminate | ||
|
||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <string> | ||
#include <vector> | ||
|
||
size_t wstrlen(const uint16_t *str); | ||
size_t wstrncpy(uint16_t *dst, const uint16_t *src, size_t n); | ||
std::string wideStringToString(const uint16_t *src, int len = -1); | ||
std::vector<uint16_t> stringToWideString(const char *src); |