Fallback to LINUX to avoid build error of missing functions

This commit is contained in:
maron2000 2025-04-29 07:56:35 +09:00
parent dac5dcac27
commit a68bf785eb

View File

@ -1103,36 +1103,7 @@ void GFX_SetTitle(int32_t cycles, int frameskip, Bits timing, bool paused) {
bool warn_on_mem_write = false;
bool CodePageGuestToHostUTF8(char *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/) ;
#if defined(LINUX)
std::string replaceNewlineWithEscaped(const std::string& input) {
std::string output;
size_t i = 0;
while (i < input.length()) {
if (input[i] == '\\') {
if(input[i+1] != 'n') output += '\\'; // "\n" needs to be escaped to "\\n"
}
else if (input[i] == '\n'){
output += "\\\\n"; // '\n' needs to be replaced to "\\n"
i++;
}
else if(input[i] == '`'){
output += "\\`"; // '`' needs to be replaced to "\\`"
i++;
}
else if(input[i] == '"'){
output += "\\\""; // '"' needs to be replaced to "\\\""
i++;
}
else {
output += input[i];
i++;
}
}
return output;
}
#elif defined(WIN32)
#if defined(WIN32)
char* convert_escape_newlines(const char* aMessage) {
size_t len = strlen(aMessage);
char* lMessage = (char*)malloc(len * 2 + 1); // Allocate memory considering convert to UTF8
@ -1200,6 +1171,35 @@ std::string replaceNewlineWithEscaped(const std::string& input) {
}
return output;
}
#else
std::string replaceNewlineWithEscaped(const std::string& input) {
std::string output;
size_t i = 0;
while(i < input.length()) {
if(input[i] == '\\') {
if(input[i + 1] != 'n') output += '\\'; // "\n" needs to be escaped to "\\n"
}
else if(input[i] == '\n') {
output += "\\\\n"; // '\n' needs to be replaced to "\\n"
i++;
}
else if(input[i] == '`') {
output += "\\`"; // '`' needs to be replaced to "\\`"
i++;
}
else if(input[i] == '"') {
output += "\\\""; // '"' needs to be replaced to "\\\""
i++;
}
else {
output += input[i];
i++;
}
}
return output;
}
#endif
bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton) {