Merge pull request #5536 from sepalani/getstring
HLE: Prevent GetStringVA to strip newlines
This commit is contained in:
commit
442e614021
|
@ -405,6 +405,12 @@ bool StringEndsWith(const std::string& str, const std::string& end)
|
||||||
return str.size() >= end.size() && std::equal(end.rbegin(), end.rend(), str.rbegin());
|
return str.size() >= end.size() && std::equal(end.rbegin(), end.rend(), str.rbegin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StringPopBackIf(std::string* s, char c)
|
||||||
|
{
|
||||||
|
if (!s->empty() && s->back() == c)
|
||||||
|
s->pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
std::string UTF16ToUTF8(const std::wstring& input)
|
std::string UTF16ToUTF8(const std::wstring& input)
|
||||||
|
|
|
@ -119,6 +119,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
|
||||||
|
|
||||||
bool StringBeginsWith(const std::string& str, const std::string& begin);
|
bool StringBeginsWith(const std::string& str, const std::string& begin);
|
||||||
bool StringEndsWith(const std::string& str, const std::string& end);
|
bool StringEndsWith(const std::string& str, const std::string& end);
|
||||||
|
void StringPopBackIf(std::string* s, char c);
|
||||||
|
|
||||||
std::string CP1252ToUTF8(const std::string& str);
|
std::string CP1252ToUTF8(const std::string& str);
|
||||||
std::string SHIFTJISToUTF8(const std::string& str);
|
std::string SHIFTJISToUTF8(const std::string& str);
|
||||||
|
|
|
@ -33,6 +33,9 @@ void HLE_OSPanic()
|
||||||
std::string error = GetStringVA();
|
std::string error = GetStringVA();
|
||||||
std::string msg = GetStringVA(5);
|
std::string msg = GetStringVA(5);
|
||||||
|
|
||||||
|
StringPopBackIf(&error, '\n');
|
||||||
|
StringPopBackIf(&msg, '\n');
|
||||||
|
|
||||||
PanicAlert("OSPanic: %s: %s", error.c_str(), msg.c_str());
|
PanicAlert("OSPanic: %s: %s", error.c_str(), msg.c_str());
|
||||||
ERROR_LOG(OSREPORT, "%08x->%08x| OSPanic: %s: %s", LR, PC, error.c_str(), msg.c_str());
|
ERROR_LOG(OSREPORT, "%08x->%08x| OSPanic: %s: %s", LR, PC, error.c_str(), msg.c_str());
|
||||||
|
|
||||||
|
@ -72,6 +75,8 @@ void HLE_GeneralDebugPrint(ParameterType parameter_type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringPopBackIf(&report_message, '\n');
|
||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||||
|
@ -108,6 +113,8 @@ void HLE_write_console()
|
||||||
ERROR_LOG(OSREPORT, "__write_console uses an unreachable size pointer");
|
ERROR_LOG(OSREPORT, "__write_console uses an unreachable size pointer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringPopBackIf(&report_message, '\n');
|
||||||
|
|
||||||
NPC = LR;
|
NPC = LR;
|
||||||
|
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||||
|
@ -122,6 +129,7 @@ void HLE_LogDPrint(ParameterType parameter_type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string report_message = GetStringVA(4, parameter_type);
|
std::string report_message = GetStringVA(4, parameter_type);
|
||||||
|
StringPopBackIf(&report_message, '\n');
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +169,7 @@ void HLE_LogFPrint(ParameterType parameter_type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string report_message = GetStringVA(4, parameter_type);
|
std::string report_message = GetStringVA(4, parameter_type);
|
||||||
|
StringPopBackIf(&report_message, '\n');
|
||||||
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
NOTICE_LOG(OSREPORT, "%08x->%08x| %s", LR, PC, SHIFTJISToUTF8(report_message).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,9 +260,6 @@ std::string GetStringVA(u32 str_reg, ParameterType parameter_type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result.empty() && result.back() == '\n')
|
|
||||||
result.pop_back();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue