[Project64] Code cleanup and added some more log messages

This commit is contained in:
zilmar 2016-01-28 20:40:08 +11:00
parent a6bfe74a28
commit 3a1fc904c6
10 changed files with 105 additions and 97 deletions

View File

@ -10,7 +10,8 @@
****************************************************************************/
#pragma once
enum LanguageStringID{
enum LanguageStringID
{
EMPTY_STRING = 0,
/*********************************************************************************

View File

@ -9,7 +9,6 @@
* *
****************************************************************************/
// Based from MAME's N64DD driver code by Happy_
#pragma once
#include "stdafx.h"
#include "Disk.h"
#include <Project64-core/N64System/N64DiskClass.h>

View File

@ -8,12 +8,12 @@
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#include "stdafx.h"
#include "N64DiskClass.h"
#include "SystemGlobals.h"
#include <Common/Platform.h>
#include <Common/MemoryManagement.h>
#include <memory>
CN64Disk::CN64Disk() :
m_DiskImage(NULL),
@ -101,7 +101,7 @@ bool CN64Disk::AllocateAndLoadDiskImage(const char * FileLoc)
if (DiskFileSize == MameFormatSize)
{
//If Disk is MAME Format (size is constant, it should be the same for every file), then continue
WriteTrace(TraceN64System, TraceDebug, "Disk File is MAME Format", );
WriteTrace(TraceN64System, TraceDebug, "Disk File is MAME Format");
if (!AllocateDiskImage(DiskFileSize))
{
@ -285,7 +285,7 @@ void CN64Disk::ConvertDiskFormat()
{
OutOffset = OutStart[zone];
InOffset = InStart[RevDiskTypeZones[disktype][zone]];
m_DiskFile.Seek(InOffset, CFileBase::SeekPosition::begin);
m_DiskFile.Seek(InOffset, CFileBase::begin);
block = StartBlock[disktype][zone];
atrack = 0;
for (track = 0; track < ZoneTracks[zone]; track++)
@ -322,7 +322,7 @@ void CN64Disk::ConvertDiskFormat()
{
//OutOffset = OutStart[zone];
InOffset = InStart[RevDiskTypeZones[disktype][zone]];
m_DiskFile.Seek(InOffset, CFileBase::SeekPosition::begin);
m_DiskFile.Seek(InOffset, CFileBase::begin);
block = StartBlock[disktype][zone];
atrack = 0xB;
for (track = 1; track < ZoneTracks[zone] + 1; track++)

View File

@ -11,12 +11,12 @@
#pragma once
//Plugin controller
#include "Plugins/PluginClass.h"
#include <Project64-core/Plugins/PluginClass.h>
//Base Plugin class, all plugin derive from this, handles core functions
#include "Plugins/PluginBase.h"
#include <Project64-core/Plugins/PluginBase.h>
#include "Plugins/GFXPlugin.h"
#include "Plugins/AudioPlugin.h"
#include <Project64-core/Plugins/AudioPlugin.h>
#include "Plugins/ControllerPlugin.h"
#include "Plugins/RSPPlugin.h"

View File

@ -60,10 +60,12 @@ CSettingTypeApplication::~CSettingTypeApplication()
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
if (!BaseDir.DirectoryExists())
{
printf("BaseDir does not exists, doing nothing");
WriteTrace(TraceAppInit, TraceDebug, "BaseDir does not exists, doing nothing");
WriteTrace(TraceAppInit, TraceDebug, "Done");
return;
}
@ -98,6 +100,7 @@ void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
}
m_SettingsIniFile->SetAutoFlush(false);
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
void CSettingTypeApplication::Flush()
@ -123,7 +126,7 @@ bool CSettingTypeApplication::Load ( int /*Index*/, bool & Value ) const
bool bRes = false;
uint32_t dwValue;
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
bRes = m_SettingsIniFile ? m_SettingsIniFile->GetNumber(SectionName(), m_KeyNameIdex.c_str(), Value, dwValue) : false;
if (bRes)
{
Value = dwValue != 0;

View File

@ -11,8 +11,6 @@
#include "stdafx.h"
#include "SettingsType-Cheats.h"
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;
stdstr * CSettingTypeCheats::m_SectionIdent = NULL;
@ -27,11 +25,13 @@ CSettingTypeCheats::~CSettingTypeCheats ( void )
void CSettingTypeCheats::Initialize ( void )
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
m_CheatIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
m_CheatIniFile->SetAutoFlush(false);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
GameChanged(NULL);
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
void CSettingTypeCheats::CleanUp ( void )

View File

@ -37,8 +37,10 @@ CSettingTypeGame::~CSettingTypeGame()
void CSettingTypeGame::Initialize ( void )
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
UpdateSettings(NULL);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
void CSettingTypeGame::CleanUp ( void )

View File

@ -61,6 +61,8 @@ CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
void CSettingTypeRomDatabase::Initialize( void )
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
@ -68,6 +70,7 @@ void CSettingTypeRomDatabase::Initialize( void )
g_Settings->RegisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
void CSettingTypeRomDatabase::CleanUp( void )

View File

@ -28,27 +28,11 @@ class CSettings
public:
typedef void(*SettingChangedFunc)(void *);
private:
void AddHandler ( SettingID TypeID, CSettingType * Handler );
void AddHowToHandleSetting (void);
void UnknownSetting (SettingID Type);
struct SETTING_CHANGED_CB
{
void * Data;
SettingChangedFunc Func;
SETTING_CHANGED_CB * Next;
};
typedef std::map<SettingID, SETTING_CHANGED_CB *> SETTING_CALLBACK;
typedef std::map<SettingID, CSettingType *> SETTING_MAP;
typedef SETTING_MAP::iterator SETTING_HANDLER;
public:
CSettings(void);
~CSettings(void);
bool Initialize ( const char * AppName );
bool Initialize(const char * BaseDirectory, const char * AppName);
//return the values
bool LoadBool(SettingID Type);
@ -116,6 +100,22 @@ public:
static uint32_t FindSetting(CSettings * _this, const char * Name);
static void FlushSettings(CSettings * _this);
private:
void AddHandler(SettingID TypeID, CSettingType * Handler);
void AddHowToHandleSetting(const char * BaseDirectory);
void UnknownSetting(SettingID Type);
struct SETTING_CHANGED_CB
{
void * Data;
SettingChangedFunc Func;
SETTING_CHANGED_CB * Next;
};
typedef std::map<SettingID, SETTING_CHANGED_CB *> SETTING_CALLBACK;
typedef std::map<SettingID, CSettingType *> SETTING_MAP;
typedef SETTING_MAP::iterator SETTING_HANDLER;
private:
void NotifyCallBacks(SettingID Type);

View File

@ -7,5 +7,5 @@
#include <Project64-core/Multilanguage.h>
#include <Project64-core/Notification.h>
#include "Version.h"
#include "Settings/SettingsClass.h"
#include <Project64-core/Settings/SettingsClass.h>
#include <Project64-core/TraceModulesProject64.h>