Added
Link Here
|
1 |
--- src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc.orig 2021-06-09 19:56:36 UTC |
2 |
+++ src/xenia/kernel/xboxkrnl/xboxkrnl_strings.cc |
3 |
@@ -117,8 +117,8 @@ int32_t format_core(PPCContext* ppc_context, FormatDat |
4 |
const bool wide) { |
5 |
int32_t count = 0; |
6 |
|
7 |
- char work8[512]; |
8 |
- char16_t work16[4]; |
9 |
+ char work[512]; |
10 |
+ wchar_t wwork[4]; |
11 |
|
12 |
struct { |
13 |
const void* buffer; |
14 |
@@ -339,13 +339,13 @@ int32_t format_core(PPCContext* ppc_context, FormatDat |
15 |
auto value = args.get32(); |
16 |
|
17 |
if (!is_wide) { |
18 |
- work8[0] = (uint8_t)value; |
19 |
- text.buffer = &work8[0]; |
20 |
+ work[0] = (uint8_t)value; |
21 |
+ text.buffer = &work[0]; |
22 |
text.length = 1; |
23 |
text.is_wide = false; |
24 |
} else { |
25 |
- work16[0] = (uint16_t)value; |
26 |
- text.buffer = &work16[0]; |
27 |
+ wwork[0] = (uint16_t)value; |
28 |
+ text.buffer = &wwork[0]; |
29 |
text.length = 1; |
30 |
text.is_wide = true; |
31 |
text.swap_wide = false; |
32 |
@@ -378,7 +378,7 @@ int32_t format_core(PPCContext* ppc_context, FormatDat |
33 |
} |
34 |
|
35 |
if (precision >= 0) { |
36 |
- precision = std::min(precision, (int32_t)xe::countof(work8)); |
37 |
+ precision = std::min(precision, (int32_t)xe::countof(work)); |
38 |
} else { |
39 |
precision = 1; |
40 |
} |
41 |
@@ -396,7 +396,7 @@ int32_t format_core(PPCContext* ppc_context, FormatDat |
42 |
prefix.length = 0; |
43 |
} |
44 |
|
45 |
- char* end = &work8[xe::countof(work8) - 1]; |
46 |
+ char* end = &work[xe::countof(work) - 1]; |
47 |
char* start = end; |
48 |
start[0] = '\0'; |
49 |
|
50 |
@@ -471,9 +471,9 @@ int32_t format_core(PPCContext* ppc_context, FormatDat |
51 |
|
52 |
auto s = format_double(value, precision, c, flags); |
53 |
auto length = (int32_t)s.size(); |
54 |
- assert_true(length < xe::countof(work8)); |
55 |
+ assert_true(length < xe::countof(work)); |
56 |
|
57 |
- auto start = &work8[0]; |
58 |
+ auto start = &work[0]; |
59 |
auto end = &start[length]; |
60 |
|
61 |
std::memcpy(start, s.c_str(), length); |
62 |
@@ -637,7 +637,7 @@ int32_t format_core(PPCContext* ppc_context, FormatDat |
63 |
} |
64 |
} |
65 |
} else { |
66 |
- // it's a const char16_t* |
67 |
+ // it's a const wchar_t* |
68 |
auto b = (const uint16_t*)text.buffer; |
69 |
if (text.swap_wide) { |
70 |
while (remaining-- > 0) { |
71 |
@@ -768,15 +768,15 @@ class WideStringFormatData : public FormatData { |
72 |
} |
73 |
|
74 |
bool put(uint16_t c) { |
75 |
- output_ << (char16_t)c; |
76 |
+ output_ << (wchar_t)c; |
77 |
return true; |
78 |
} |
79 |
|
80 |
- std::u16string wstr() const { return output_.str(); } |
81 |
+ std::wstring wstr() const { return output_.str(); } |
82 |
|
83 |
private: |
84 |
const uint16_t* input_; |
85 |
- std::basic_stringstream<char16_t> output_; |
86 |
+ std::wostringstream output_; |
87 |
}; |
88 |
|
89 |
class WideCountFormatData : public FormatData { |
90 |
@@ -830,7 +830,7 @@ SHIM_CALL DbgPrint_shim(PPCContext* ppc_context, Kerne |
91 |
return; |
92 |
} |
93 |
|
94 |
- XELOGD("(DbgPrint) {}", data.str()); |
95 |
+ XELOGD("(DbgPrint) %s", data.str().c_str()); |
96 |
|
97 |
SHIM_SET_RETURN_32(X_STATUS_SUCCESS); |
98 |
} |
99 |
@@ -841,7 +841,7 @@ SHIM_CALL _snprintf_shim(PPCContext* ppc_context, Kern |
100 |
int32_t buffer_count = SHIM_GET_ARG_32(1); |
101 |
uint32_t format_ptr = SHIM_GET_ARG_32(2); |
102 |
|
103 |
- XELOGD("_snprintf({:08X}, {}, {:08X}, ...)", buffer_ptr, buffer_count, |
104 |
+ XELOGD("_snprintf(%08X, %i, %08X, ...)", buffer_ptr, buffer_count, |
105 |
format_ptr); |
106 |
|
107 |
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { |
108 |
@@ -877,7 +877,7 @@ SHIM_CALL sprintf_shim(PPCContext* ppc_context, Kernel |
109 |
uint32_t buffer_ptr = SHIM_GET_ARG_32(0); |
110 |
uint32_t format_ptr = SHIM_GET_ARG_32(1); |
111 |
|
112 |
- XELOGD("sprintf({:08X}, {:08X}, ...)", buffer_ptr, format_ptr); |
113 |
+ XELOGD("sprintf(%08X, %08X, ...)", buffer_ptr, format_ptr); |
114 |
|
115 |
if (buffer_ptr == 0 || format_ptr == 0) { |
116 |
SHIM_SET_RETURN_32(-1); |
117 |
@@ -906,7 +906,7 @@ SHIM_CALL _snwprintf_shim(PPCContext* ppc_context, Ker |
118 |
int32_t buffer_count = SHIM_GET_ARG_32(1); |
119 |
uint32_t format_ptr = SHIM_GET_ARG_32(2); |
120 |
|
121 |
- XELOGD("_snwprintf({:08X}, {}, {:08X}, ...)", buffer_ptr, buffer_count, |
122 |
+ XELOGD("_snwprintf(%08X, %i, %08X, ...)", buffer_ptr, buffer_count, |
123 |
format_ptr); |
124 |
|
125 |
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { |
126 |
@@ -942,7 +942,7 @@ SHIM_CALL swprintf_shim(PPCContext* ppc_context, Kerne |
127 |
uint32_t buffer_ptr = SHIM_GET_ARG_32(0); |
128 |
uint32_t format_ptr = SHIM_GET_ARG_32(1); |
129 |
|
130 |
- XELOGD("swprintf({:08X}, {:08X}, ...)", buffer_ptr, format_ptr); |
131 |
+ XELOGD("swprintf(%08X, %08X, ...)", buffer_ptr, format_ptr); |
132 |
|
133 |
if (buffer_ptr == 0 || format_ptr == 0) { |
134 |
SHIM_SET_RETURN_32(-1); |
135 |
@@ -972,7 +972,7 @@ SHIM_CALL _vsnprintf_shim(PPCContext* ppc_context, Ker |
136 |
uint32_t format_ptr = SHIM_GET_ARG_32(2); |
137 |
uint32_t arg_ptr = SHIM_GET_ARG_32(3); |
138 |
|
139 |
- XELOGD("_vsnprintf({:08X}, {}, {:08X}, {:08X})", buffer_ptr, buffer_count, |
140 |
+ XELOGD("_vsnprintf(%08X, %i, %08X, %08X)", buffer_ptr, buffer_count, |
141 |
format_ptr, arg_ptr); |
142 |
|
143 |
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { |
144 |
@@ -1012,7 +1012,7 @@ SHIM_CALL _vsnwprintf_shim(PPCContext* ppc_context, Ke |
145 |
uint32_t format_ptr = SHIM_GET_ARG_32(2); |
146 |
uint32_t arg_ptr = SHIM_GET_ARG_32(3); |
147 |
|
148 |
- XELOGD("_vsnwprintf({:08X}, {}, {:08X}, {:08X})", buffer_ptr, buffer_count, |
149 |
+ XELOGD("_vsnwprintf(%08X, %i, %08X, %08X)", buffer_ptr, buffer_count, |
150 |
format_ptr, arg_ptr); |
151 |
|
152 |
if (buffer_ptr == 0 || buffer_count <= 0 || format_ptr == 0) { |
153 |
@@ -1051,7 +1051,7 @@ SHIM_CALL vsprintf_shim(PPCContext* ppc_context, Kerne |
154 |
uint32_t format_ptr = SHIM_GET_ARG_32(1); |
155 |
uint32_t arg_ptr = SHIM_GET_ARG_32(2); |
156 |
|
157 |
- XELOGD("vsprintf({:08X}, {:08X}, {:08X})", buffer_ptr, format_ptr, arg_ptr); |
158 |
+ XELOGD("vsprintf(%08X, %08X, %08X)", buffer_ptr, format_ptr, arg_ptr); |
159 |
|
160 |
if (buffer_ptr == 0 || format_ptr == 0) { |
161 |
SHIM_SET_RETURN_32(-1); |
162 |
@@ -1079,7 +1079,7 @@ SHIM_CALL _vscwprintf_shim(PPCContext* ppc_context, Ke |
163 |
uint32_t format_ptr = SHIM_GET_ARG_32(0); |
164 |
uint32_t arg_ptr = SHIM_GET_ARG_32(1); |
165 |
|
166 |
- XELOGD("_vscwprintf({:08X}, {:08X})", format_ptr, arg_ptr); |
167 |
+ XELOGD("_vscwprintf(%08X, %08X)", format_ptr, arg_ptr); |
168 |
|
169 |
if (format_ptr == 0) { |
170 |
SHIM_SET_RETURN_32(-1); |
171 |
@@ -1102,7 +1102,7 @@ SHIM_CALL vswprintf_shim(PPCContext* ppc_context, Kern |
172 |
uint32_t format_ptr = SHIM_GET_ARG_32(1); |
173 |
uint32_t arg_ptr = SHIM_GET_ARG_32(2); |
174 |
|
175 |
- XELOGD("vswprintf({:08X}, {:08X}, {:08X})", buffer_ptr, format_ptr, arg_ptr); |
176 |
+ XELOGD("vswprintf(%08X, %08X, %08X)", buffer_ptr, format_ptr, arg_ptr); |
177 |
|
178 |
if (buffer_ptr == 0 || format_ptr == 0) { |
179 |
SHIM_SET_RETURN_32(-1); |