initial start to eliminate static func init, not compilable atm

move module initialization into a module manager, still has some issues like stopping not working and debug crashing

add #idef 0 to modules that aren't in the windows project

don't double initialize and don't de-initialize for now, since many modules don't expect it and it leads to many errors

remove duplicate module lists for empty modules and implemented ones, make Module non-copyable but movable

add secondary project, no real use for it now

add some memleak config to the emucore and add asmjit path to rpcs3

small rebase error fixed to get it to compile again

add filters for emucore

re-add the module manager and static file

WIP commit, linker errors abound

some more abstraction layer stuff

fix the remaining linker errors, re-enable platform specific mouse, pad and keyboard handlers

rebasing

fix memset undefined and re() usage of se_t before declaration

Add wxGUI define by default for cmake builds

fix copy constructors of Datetime header

fix copy constructors of other wx interface classes

remove static declarations of global variables

make wxGLCanvas constructor non-ambiguous even with wx2.8. compat mode, fix wrong std::exception constructor calls

remove duplicate definition for FromUTF8 and ToUTF8

temp changes
This commit is contained in:
Peter Tissen 2014-05-02 08:30:32 +02:00
parent c4e3ec825e
commit c37905e465
156 changed files with 6567 additions and 4611 deletions

View file

@ -16,163 +16,8 @@
#include "Emu/System.h"
LogWriter ConLog;
LogFrame* ConLogFrame;
std::mutex g_cs_conlog;
static const uint max_item_count = 500;
static const uint buffer_size = 1024 * 64;
static const std::string g_log_colors[] =
{
"Black", "Green", "White", "Yellow", "Red",
};
struct LogPacket
{
const std::string m_prefix;
const std::string m_text;
const std::string m_colour;
LogPacket(const std::string& prefix, const std::string& text, const std::string& colour)
: m_prefix(prefix)
, m_text(text)
, m_colour(colour)
{
}
};
struct _LogBuffer : public MTPacketBuffer<LogPacket>
{
_LogBuffer() : MTPacketBuffer<LogPacket>(buffer_size)
{
}
void _push(const LogPacket& data)
{
const u32 sprefix = data.m_prefix.length();
const u32 stext = data.m_text.length();
const u32 scolour = data.m_colour.length();
m_buffer.resize( m_buffer.size() +
sizeof(u32) + sprefix +
sizeof(u32) + stext +
sizeof(u32) + scolour);
u32 c_put = m_put;
memcpy(&m_buffer[c_put], &sprefix, sizeof(u32));
c_put += sizeof(u32);
memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix);
c_put += sprefix;
memcpy(&m_buffer[c_put], &stext, sizeof(u32));
c_put += sizeof(u32);
memcpy(&m_buffer[c_put], data.m_text.c_str(), stext);
c_put += stext;
memcpy(&m_buffer[c_put], &scolour, sizeof(u32));
c_put += sizeof(u32);
memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour);
c_put += scolour;
m_put = c_put;
CheckBusy();
}
LogPacket _pop()
{
u32 c_get = m_get;
const u32& sprefix = *(u32*)&m_buffer[c_get];
c_get += sizeof(u32);
const std::string prefix( (const char*) &m_buffer[c_get], sprefix);
c_get += sprefix;
const u32& stext = *(u32*)&m_buffer[c_get];
c_get += sizeof(u32);
const std::string text( (const char*) &m_buffer[c_get], stext);
c_get += stext;
const u32& scolour = *(u32*)&m_buffer[c_get];
c_get += sizeof(u32);
const std::string colour( (const char*) &m_buffer[c_get], scolour);
c_get += scolour;
m_get = c_get;
if(!HasNewPacket()) Flush();
return LogPacket(prefix, text, colour);
}
} LogBuffer;
LogWriter::LogWriter()
{
if(!m_logfile.Open(_PRGNAME_ ".log", wxFile::write))
{
#ifndef QT_UI
wxMessageBox("Can't create log file! (" _PRGNAME_ ".log)", wxMessageBoxCaptionStr, wxICON_ERROR);
#endif
}
}
void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/)
{
std::string new_prefix = prefix;
if(!prefix.empty())
{
if(NamedThreadBase* thr = GetCurrentNamedThread())
{
new_prefix += " : " + thr->GetThreadName();
}
}
if(m_logfile.IsOpened() && !new_prefix.empty())
m_logfile.Write(fmt::FromUTF8("[" + new_prefix + "]: " + value + "\n"));
if(!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue()))
return;
std::lock_guard<std::mutex> lock(g_cs_conlog);
#ifdef QT_UI
// TODO: Use ThreadBase instead, track main thread id
if(QThread::currentThread() == qApp->thread())
#else
if(wxThread::IsMain())
#endif
{
while(LogBuffer.IsBusy())
{
// need extra break condition?
wxYieldIfNeeded();
}
}
else
{
while (LogBuffer.IsBusy())
{
if (Emu.IsStopped())
{
break;
}
Sleep(1);
}
}
//if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush();
LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl]));
}
void LogWriter::SkipLn()
{
WriteToLog("", "", 0);
}
BEGIN_EVENT_TABLE(LogFrame, wxPanel)
EVT_CLOSE(LogFrame::OnQuit)
END_EVENT_TABLE()