diff --git a/Source/Core/Common/Logging/LogManager.cpp b/Source/Core/Common/Logging/LogManager.cpp index 7ce347cbda..2648be986b 100644 --- a/Source/Core/Common/Logging/LogManager.cpp +++ b/Source/Core/Common/Logging/LogManager.cpp @@ -10,7 +10,7 @@ #include #ifdef ANDROID -#include "Core/Host.h" +#include #endif #include "Common/FileUtil.h" #include "Common/IniFile.h" @@ -141,7 +141,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, LogTypes::LOG_LEVEL_TO_CHAR[(int)level], log->GetShortName().c_str(), temp); #ifdef ANDROID - Host_SysMessage(msg.c_str()); + __android_log_write(ANDROID_LOG_INFO, "Dolphinemu", msg.c_str()); #endif log->Trigger(level, msg.c_str()); } diff --git a/Source/Core/Core/Host.h b/Source/Core/Core/Host.h index 7a493bc96a..3d232aca8a 100644 --- a/Source/Core/Core/Host.h +++ b/Source/Core/Core/Host.h @@ -34,7 +34,6 @@ void Host_RequestRenderWindowSize(int width, int height); void Host_RequestFullscreen(bool enable_fullscreen); void Host_SetStartupDebuggingParameters(); void Host_SetWiiMoteConnectionState(int _State); -void Host_SysMessage(const char *fmt, ...); void Host_UpdateDisasmDialog(); void Host_UpdateMainFrame(); void Host_UpdateTitle(const std::string& title); diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index af10de63c9..4748276ade 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -13,20 +13,6 @@ #include "DolphinQt/MainWindow.h" -void Host_SysMessage(const char *fmt, ...) -{ - va_list list; - char msg[512]; - - va_start(list, fmt); - vsprintf(msg, fmt, list); - va_end(list); - - if (msg[strlen(msg)-1] == '\n') - msg[strlen(msg)-1] = '\0'; - PanicAlert("%s", msg); -} - void Host_Message(int id) { // TODO diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 3ec002e456..68c850ee89 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -435,20 +435,6 @@ void DolphinApp::OnFatalException() // ------------ // Talk to GUI -void Host_SysMessage(const char *fmt, ...) -{ - va_list list; - char msg[512]; - - va_start(list, fmt); - vsprintf(msg, fmt, list); - va_end(list); - - if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0; - //wxMessageBox(StrToWxStr(msg)); - PanicAlert("%s", msg); -} - bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/) { #ifdef __WXGTK__ diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp index aa411b450d..e7046cbf74 100644 --- a/Source/Core/DolphinWX/MainAndroid.cpp +++ b/Source/Core/DolphinWX/MainAndroid.cpp @@ -106,15 +106,6 @@ bool Host_RendererHasFocus() void Host_ConnectWiimote(int wm_idx, bool connect) {} -void Host_SysMessage(const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - __android_log_vprint(ANDROID_LOG_INFO, DOLPHIN_TAG, fmt, args); - va_end(args); -} - void Host_SetWiiMoteConnectionState(int _State) {} void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {} diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index 87726f5da4..705491d183 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -104,25 +104,6 @@ bool Host_RendererHasFocus() void Host_ConnectWiimote(int wm_idx, bool connect) {} -void Host_SysMessage(const char *fmt, ...) -{ - va_list list; - char msg[512]; - - va_start(list, fmt); - vsprintf(msg, fmt, list); - va_end(list); - - size_t len = strlen(msg); - if (msg[len - 1] != '\n') - { - msg[len - 1] = '\n'; - msg[len] = '\0'; - } - - fprintf(stderr, "%s", msg); -} - void Host_SetWiiMoteConnectionState(int _State) {} void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {} diff --git a/Source/Core/VideoCommon/OpcodeDecoding.cpp b/Source/Core/VideoCommon/OpcodeDecoding.cpp index 1bb5fae940..1f71bd051b 100644 --- a/Source/Core/VideoCommon/OpcodeDecoding.cpp +++ b/Source/Core/VideoCommon/OpcodeDecoding.cpp @@ -89,43 +89,39 @@ static void InterpretDisplayListPreprocess(u32 address, u32 size) static void UnknownOpcode(u8 cmd_byte, void *buffer, bool preprocess) { // TODO(Omega): Maybe dump FIFO to file on this error - std::string temp = StringFromFormat( - "GFX FIFO: Unknown Opcode (0x%x @ %p, preprocessing=%s).\n" - "This means one of the following:\n" - "* The emulated GPU got desynced, disabling dual core can help\n" - "* Command stream corrupted by some spurious memory bug\n" - "* This really is an unknown opcode (unlikely)\n" - "* Some other sort of bug\n\n" - "Dolphin will now likely crash or hang. Enjoy." , - cmd_byte, - buffer, - preprocess ? "yes" : "no"); - Host_SysMessage(temp.c_str()); - INFO_LOG(VIDEO, "%s", temp.c_str()); + PanicAlert( + "GFX FIFO: Unknown Opcode (0x%x @ %p, preprocessing=%s).\n" + "This means one of the following:\n" + "* The emulated GPU got desynced, disabling dual core can help\n" + "* Command stream corrupted by some spurious memory bug\n" + "* This really is an unknown opcode (unlikely)\n" + "* Some other sort of bug\n\n" + "Dolphin will now likely crash or hang. Enjoy." , + cmd_byte, + buffer, + preprocess ? "yes" : "no"); + { SCPFifoStruct &fifo = CommandProcessor::fifo; - std::string tmp = StringFromFormat( - "Illegal command %02x\n" - "CPBase: 0x%08x\n" - "CPEnd: 0x%08x\n" - "CPHiWatermark: 0x%08x\n" - "CPLoWatermark: 0x%08x\n" - "CPReadWriteDistance: 0x%08x\n" - "CPWritePointer: 0x%08x\n" - "CPReadPointer: 0x%08x\n" - "CPBreakpoint: 0x%08x\n" - "bFF_GPReadEnable: %s\n" - "bFF_BPEnable: %s\n" - "bFF_BPInt: %s\n" - "bFF_Breakpoint: %s\n" - ,cmd_byte, fifo.CPBase, fifo.CPEnd, fifo.CPHiWatermark, fifo.CPLoWatermark, fifo.CPReadWriteDistance - ,fifo.CPWritePointer, fifo.CPReadPointer, fifo.CPBreakpoint, fifo.bFF_GPReadEnable ? "true" : "false" - ,fifo.bFF_BPEnable ? "true" : "false" ,fifo.bFF_BPInt ? "true" : "false" - ,fifo.bFF_Breakpoint ? "true" : "false"); - - Host_SysMessage(tmp.c_str()); - INFO_LOG(VIDEO, "%s", tmp.c_str()); + PanicAlert( + "Illegal command %02x\n" + "CPBase: 0x%08x\n" + "CPEnd: 0x%08x\n" + "CPHiWatermark: 0x%08x\n" + "CPLoWatermark: 0x%08x\n" + "CPReadWriteDistance: 0x%08x\n" + "CPWritePointer: 0x%08x\n" + "CPReadPointer: 0x%08x\n" + "CPBreakpoint: 0x%08x\n" + "bFF_GPReadEnable: %s\n" + "bFF_BPEnable: %s\n" + "bFF_BPInt: %s\n" + "bFF_Breakpoint: %s\n" + ,cmd_byte, fifo.CPBase, fifo.CPEnd, fifo.CPHiWatermark, fifo.CPLoWatermark, fifo.CPReadWriteDistance + ,fifo.CPWritePointer, fifo.CPReadPointer, fifo.CPBreakpoint, fifo.bFF_GPReadEnable ? "true" : "false" + ,fifo.bFF_BPEnable ? "true" : "false" ,fifo.bFF_BPInt ? "true" : "false" + ,fifo.bFF_Breakpoint ? "true" : "false"); } } diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index e4974a8b2b..4e6963124e 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -226,10 +226,9 @@ void VertexLoader::CompileVertexTranslator() if (pFunc == nullptr) { - Host_SysMessage( - StringFromFormat("VertexLoader_Normal::GetFunction(%i %i %i %i) returned zero!", + PanicAlert("VertexLoader_Normal::GetFunction(%i %i %i %i) returned zero!", (u32)m_VtxDesc.Normal, m_VtxAttr.NormalFormat, - m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3).c_str()); + m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3); } WriteCall(pFunc); diff --git a/Source/UnitTests/TestUtils/StubHost.cpp b/Source/UnitTests/TestUtils/StubHost.cpp index e55db7bb75..a8f6f1cf2f 100644 --- a/Source/UnitTests/TestUtils/StubHost.cpp +++ b/Source/UnitTests/TestUtils/StubHost.cpp @@ -24,7 +24,6 @@ void Host_SetStartupDebuggingParameters() {} bool Host_UIHasFocus() { return false; } bool Host_RendererHasFocus() { return false; } void Host_ConnectWiimote(int, bool) {} -void Host_SysMessage(const char*, ...) {} void Host_SetWiiMoteConnectionState(int) {} void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {} cInterfaceBase* HostGL_CreateGLInterface() { return nullptr; }