Some small clean up + fixes to make valgrind happy

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4991 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2010-02-02 08:10:23 +00:00
parent 4692f1084f
commit 8bb96156a2
5 changed files with 30 additions and 46 deletions

View File

@ -35,7 +35,7 @@ protected:
bool m_muted;
public:
SoundStream(CMixer *mixer) : m_mixer(mixer), threadData(0), m_muted(false) {}
SoundStream(CMixer *mixer) : m_mixer(mixer), threadData(0), m_logAudio(false), m_muted(false) {}
virtual ~SoundStream() { delete m_mixer;}
static bool isValid() { return false; }

View File

@ -59,10 +59,6 @@
#include "State.h"
#include "OnFrame.h"
#ifndef _WIN32
#define WINAPI
#endif
namespace Core
{
@ -153,46 +149,45 @@ bool isRunning()
}
// This is called from the GUI thread. See the booting call schedule in BootManager.cpp
// This is called from the GUI thread. See the booting call schedule in
// BootManager.cpp
bool Init()
{
if (g_EmuThread != NULL)
{
PanicAlert("ERROR: Emu Thread already running. Report this bug.");
PanicAlert("Emu Thread already running");
return false;
}
Common::InitThreading();
// Get a handle to the current instance of the plugin manager
CPluginManager &pManager = CPluginManager::GetInstance();
SCoreStartupParameter &_CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
Common::InitThreading();
g_CoreStartupParameter = _CoreParameter;
// FIXME DEBUG_LOG(BOOT, dump_params());
Host_SetWaitCursor(true);
// Start the thread again
_dbg_assert_(HLE, g_EmuThread == NULL);
// Check that all plugins exist, potentially call LoadLibrary() for unloaded plugins
// Load all needed plugins
if (!pManager.InitPlugins())
return false;
emuThreadGoing.Init();
// This will execute EmuThread() further down in this file
// Start the emu thread
g_EmuThread = new Common::Thread(EmuThread, NULL);
// Wait until the emu thread is running
emuThreadGoing.MsgWait();
emuThreadGoing.Shutdown();
// All right, the event is set and killed. We are now running.
Host_SetWaitCursor(false);
return true;
}
// Called from GUI thread or VI thread (why VI??? That must be bad. Window close? TODO: Investigate.)
// Called from GUI thread or VI thread (why VI??? That must be bad. Window
// close? TODO: Investigate.)
void Stop() // - Hammertime!
{
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -201,7 +196,8 @@ void Stop() // - Hammertime!
WARN_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
// This must be done a while before freeing the dll to not crash wx around MSWWindowProc and DefWindowProc, will investigate further
// This must be done a while before freeing the dll to not crash wx around
// MSWWindowProc and DefWindowProc, will investigate further
Host_Message(AUDIO_DESTROY);
Host_Message(VIDEO_DESTROY);
@ -216,8 +212,9 @@ void Stop() // - Hammertime!
if (_CoreParameter.bCPUThread)
{
// Video_EnterLoop() should now exit so that EmuThread() will continue concurrently with the rest
// of the commands in this function. We no longer rely on Postmessage.
// Video_EnterLoop() should now exit so that EmuThread() will continue
// concurrently with the rest of the commands in this function. We no
// longer rely on Postmessage.
NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
CPluginManager::GetInstance().GetVideo()->Video_ExitLoop();

View File

@ -77,7 +77,7 @@ void STACKALIGN CheckGatherPipe()
m_gatherPipeCount -= GATHER_PIPE_SIZE;
// HyperIris: dunno why, but I use memcpy. TODO: See if a custom copy can be faster, like 4x MOVAPD
memcpy(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
memmove(m_gatherPipe, m_gatherPipe + GATHER_PIPE_SIZE, m_gatherPipeCount);
// increase the CPUWritePointer
if (ProcessorInterface::Fifo_CPUWritePointer == ProcessorInterface::Fifo_CPUEnd)

View File

@ -38,18 +38,13 @@
namespace FileMon
{
// -----------
// Declarations and definitions
DiscIO::IVolume *OpenISO;
DiscIO::IFileSystem *pFileSystem = NULL;
std::vector<const DiscIO::SFileInfo *> GCFiles;
std::string ISOFile, CurrentFile;
std::string ISOFile = "", CurrentFile = "";
bool FileAccess = true;
// -----------
// Filtered files
bool ShowSound(std::string FileName)
{
std::string Ending;
@ -72,9 +67,7 @@ bool ShowSound(std::string FileName)
}
// -----------
// Read the GC file system
void ReadGC(std::string FileName)
{
GCFiles.clear();
@ -89,9 +82,7 @@ void ReadGC(std::string FileName)
FileAccess = true;
}
// -----------
// Check if we should play this file
void CheckFile(std::string File, int Size)
{
// Don't do anything if the log is unselected
@ -114,7 +105,7 @@ void CheckFile(std::string File, int Size)
CurrentFile = File;
}
// -----------
// Find the GC filename
void FindFilename(u64 offset)
{
@ -133,15 +124,13 @@ void FindFilename(u64 offset)
return;
}
// File
if (!pFileSystem->GetFileName(offset)) return;
std::string File = std::string(pFileSystem->GetFileName(offset));
const char *fname = pFileSystem->GetFileName(offset);
// There's something wrong with the paths
if (File.length() == 512) return;
if (!fname || (strlen(fname) == 512))
return;
int Size = (int)pFileSystem->GetFileSize(File.c_str());
CheckFile(File, Size);
CheckFile(fname, pFileSystem->GetFileSize(fname));
}

View File

@ -50,7 +50,6 @@
#include <wx/datetime.h> // wxWidgets
// ----------
// Resources
extern "C" {
@ -74,9 +73,9 @@ extern "C" {
};
// ---------------
// Windows functions. Setting the cursor with wxSetCursor() did not work in this instance.
// Probably because it's somehow reset from the WndProc() in the child window
// Windows functions. Setting the cursor with wxSetCursor() did not work in
// this instance. Probably because it's somehow reset from the WndProc() in
// the child window
#ifdef _WIN32
// Declare a blank icon and one that will be the normal cursor
HCURSOR hCursor = NULL, hCursorBlank = NULL;
@ -194,7 +193,6 @@ CPanel::CPanel(
}
#endif
//-----------------
// event tables
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
// help button.