From 70cc2494aa16d6cc170bb7a5ba486a594e480713 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 28 Mar 2014 12:47:32 +0400 Subject: [PATCH] bad_flip issue fix --- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 12 ++++++++- rpcs3/Gui/ConLog.cpp | 33 ++++++++++------------- rpcs3/Gui/ConLog.h | 10 +++---- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index 877075b86f..a00b49d4ff 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -181,7 +181,17 @@ int cellGcmSetPrepareFlip(mem_ptr_t ctxt, u32 id) if(current + 8 >= end) { ConLog.Warning("bad flip!"); - cellGcmCallback(ctxt.GetAddr(), current + 8 - end); + //cellGcmCallback(ctxt.GetAddr(), current + 8 - end); + //copied: + + CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr]; + + const s32 res = ctxt->current - ctxt->begin - ctrl.put; + + if(res > 0) Memory.Copy(ctxt->begin, ctxt->current - res, res); + ctxt->current = ctxt->begin + res; + ctrl.put = res; + ctrl.get = 0; } current = ctxt->current; diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 4895d74113..8047c3fbd5 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -32,10 +32,6 @@ struct LogPacket { } - - LogPacket() - { - } }; struct _LogBuffer : public MTPacketBuffer @@ -78,29 +74,27 @@ struct _LogBuffer : public MTPacketBuffer LogPacket _pop() { - LogPacket ret; - u32 c_get = m_get; const u32& sprefix = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - ret.m_prefix = wxString((wxChar*)&m_buffer[c_get], sprefix / sizeof(wxChar)); + const wxString& prefix = wxString((wxChar*)&m_buffer[c_get], sprefix / sizeof(wxChar)); c_get += sprefix; const u32& stext = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - ret.m_text = wxString((wxChar*)&m_buffer[c_get], stext / sizeof(wxChar)); + const wxString& text = wxString((wxChar*)&m_buffer[c_get], stext / sizeof(wxChar)); c_get += stext; const u32& scolour = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - ret.m_colour = wxString((wxChar*)&m_buffer[c_get], scolour / sizeof(wxChar)); + const wxString& colour = wxString((wxChar*)&m_buffer[c_get], scolour / sizeof(wxChar)); c_get += scolour; m_get = c_get; if(!HasNewPacket()) Flush(); - return ret; + return LogPacket(prefix, text, colour); } } LogBuffer; @@ -114,18 +108,19 @@ LogWriter::LogWriter() } } -void LogWriter::WriteToLog(wxString prefix, wxString value, u8 lvl/*, wxColour bgcolour*/) +void LogWriter::WriteToLog(const wxString& prefix, const wxString& value, u8 lvl/*, wxColour bgcolour*/) { + wxString new_prefix = prefix; if(!prefix.empty()) { if(NamedThreadBase* thr = GetCurrentNamedThread()) { - prefix += " : " + thr->GetThreadName(); + new_prefix += " : " + thr->GetThreadName(); } } - if(m_logfile.IsOpened() && !prefix.empty()) - m_logfile.Write(wxString("[") + prefix + "]: " + value + "\n"); + if(m_logfile.IsOpened() && !new_prefix.empty()) + m_logfile.Write(wxString("[") + new_prefix + "]: " + value + "\n"); if(!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) return; @@ -159,10 +154,10 @@ void LogWriter::WriteToLog(wxString prefix, wxString value, u8 lvl/*, wxColour b //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush(); - LogBuffer.Push(LogPacket(prefix, value, g_log_colors[lvl])); + LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl])); } -void LogWriter::Write(const wxString fmt, ...) +void LogWriter::Write(const wxString& fmt, ...) { va_list list; va_start(list, fmt); @@ -175,7 +170,7 @@ void LogWriter::Write(const wxString fmt, ...) WriteToLog("!", frmt, 2); } -void LogWriter::Error(const wxString fmt, ...) +void LogWriter::Error(const wxString& fmt, ...) { va_list list; va_start(list, fmt); @@ -188,7 +183,7 @@ void LogWriter::Error(const wxString fmt, ...) WriteToLog("E", frmt, 4); } -void LogWriter::Warning(const wxString fmt, ...) +void LogWriter::Warning(const wxString& fmt, ...) { va_list list; va_start(list, fmt); @@ -201,7 +196,7 @@ void LogWriter::Warning(const wxString fmt, ...) WriteToLog("W", frmt, 3); } -void LogWriter::Success(const wxString fmt, ...) +void LogWriter::Success(const wxString& fmt, ...) { va_list list; va_start(list, fmt); diff --git a/rpcs3/Gui/ConLog.h b/rpcs3/Gui/ConLog.h index 79aec07cf1..dd44054c89 100644 --- a/rpcs3/Gui/ConLog.h +++ b/rpcs3/Gui/ConLog.h @@ -11,15 +11,15 @@ class LogWriter //wxString m_prefix; //wxString m_value; - virtual void WriteToLog(wxString prefix, wxString value, u8 lvl); + virtual void WriteToLog(const wxString& prefix, const wxString& value, u8 lvl); public: LogWriter(); - virtual void Write(const wxString fmt, ...); - virtual void Error(const wxString fmt, ...); - virtual void Warning(const wxString fmt, ...); - virtual void Success(const wxString fmt, ...); + virtual void Write(const wxString& fmt, ...); + virtual void Error(const wxString& fmt, ...); + virtual void Warning(const wxString& fmt, ...); + virtual void Success(const wxString& fmt, ...); virtual void SkipLn(); };