[Project64] Start to add code for enhancements

This commit is contained in:
zilmar 2019-01-12 09:50:25 +11:00
parent 95d1fc3bea
commit ed079e4b16
29 changed files with 1085 additions and 60 deletions

View File

@ -26,10 +26,14 @@ public enum SettingsID
SupportFile_SettingsDefault,
SupportFile_RomDatabase,
SupportFile_RomDatabaseDefault,
SupportFile_Glide64RDB,
SupportFile_Glide64RDBDefault,
SupportFile_VideoRDB,
SupportFile_VideoRDBDefault,
SupportFile_AudioRDB,
SupportFile_AudioRDBDefault,
SupportFile_Cheats,
SupportFile_CheatsDefault,
SupportFile_Enhancements,
SupportFile_EnhancementsDefault,
SupportFile_Notes,
SupportFile_NotesDefault,
SupportFile_ExtInfo,
@ -43,6 +47,8 @@ public enum SettingsID
Setting_AutoStart,
Setting_CheckEmuRunning,
Setting_EraseGameDefaults,
Setting_ForceInterpreterCPU,
Setting_FixedRdramAddress,
Setting_AutoZipInstantSave,
Setting_RememberCheats,
@ -51,6 +57,20 @@ public enum SettingsID
Setting_LanguageDirDefault,
Setting_CurrentLanguage,
Setting_EnableDisk,
Setting_SyncViaAudioEnabled,
Setting_Enhancement,
//Default Settings
Default_RDRamSize,
Default_UseHleGfx,
Default_UseTlb,
Default_ViRefreshRate,
Default_AiCountPerBytes,
Default_CounterFactor,
Default_32Bit,
Default_SyncViaAudio,
Default_FixedAudio,
Default_UnalignedDMA,
//RDB Settings
Rdb_GoodName,
@ -89,6 +109,7 @@ public enum SettingsID
Rdb_AudioResetOnLoad,
Rdb_AllowROMWrites,
Rdb_CRC_Recalc,
Rdb_UnalignedDMA,
//Individual Game Settings
Game_IniKey,
@ -142,6 +163,8 @@ public enum SettingsID
Game_Transferpak_ROM,
Game_Transferpak_Sav,
Game_LoadSaveAtStart,
Game_FullSpeed,
Game_UnalignedDMA,
// General Game running info
GameRunning_LoadingInProgress,
@ -197,6 +220,7 @@ public enum SettingsID
RomList_GameDirSelected,
RomList_GameDirUseSelected,
RomList_GameDirRecursive,
RomList_ShowFileExtensions,
RomList_7zipCache,
RomList_7zipCacheDefault,
@ -217,6 +241,13 @@ public enum SettingsID
Debugger_ShowRecompMemSize,
Debugger_DebugLanguage,
Debugger_RecordExecutionTimes,
Debugger_SteppingOps,
Debugger_SkipOp,
Debugger_HaveExecutionBP,
Debugger_WriteBPExists,
Debugger_ReadBPExists,
Debugger_WaitingForStep,
Debugger_AutoRefreshMemoryView,
//Trace
Debugger_TraceMD5,
@ -290,6 +321,14 @@ public enum SettingsID
Cheat_Range,
Cheat_RangeNotes,
//Enhancement
Enhancement_Name,
Enhancement_Active,
Enhancement_OnByDefault,
Enhancement_Overclock,
Enhancement_OverclockValue,
Enhancement_Notes,
FirstUISettings, LastUISettings(FirstUISettings.getValue() + 65535),
FirstRSPDefaultSet, LastRSPDefaultSet(FirstRSPDefaultSet.getValue() + 65535),
FirstRSPSettings, LastRSPSettings(FirstRSPSettings.getValue() + 65535),

View File

@ -4,6 +4,7 @@ AudioRDB=..\..\Config\Audio.rdb
Auto Sleep=0
Basic Mode=0
Cheats=..\..\Config\Project64.cht
Enhancement=..\..\Config\Project64.enh
ExtInfo=..\..\Config\Project64.rdx
Notes=..\..\Config\Project64.rdn
RomDatabase=..\..\Config\Project64.rdb

6
Config/Project64.enh Normal file
View File

@ -0,0 +1,6 @@
[DCBC50D1-09FD1AA3-C:45]
Enhancement0=Overclock
Enhancement0_AO=1
Enhancement0_N=
Enhancement0_OVER=1
Enhancement0_OVERV=7

View File

@ -27,6 +27,7 @@ Source: "{#BaseDir}\Bin\{#Configuration}\Project64.exe"; DestDir: "{app}"; Flags
Source: "{#BaseDir}\Config\Video.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Audio.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.cht"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.enh"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.rdb"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Config\Project64.rdx"; DestDir: "{app}\Config"
Source: "{#BaseDir}\Lang\*.pj.Lang"; DestDir: "{app}\Lang"

View File

@ -128,6 +128,7 @@ enum LanguageStringID
POPUP_CHEATS = 213,
POPUP_GFX_PLUGIN = 214,
POPUP_PLAYDISK = 215,
POPUP_ENHANCEMENTS = 216,
//selecting save slot
SAVE_SLOT_DEFAULT = 220,

View File

@ -135,6 +135,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(POPUP_CHEATS, "Edit Cheats");
DEF_STR(POPUP_GFX_PLUGIN, "Graphics Plugin");
DEF_STR(POPUP_PLAYDISK, "Play Game with Disk");
DEF_STR(POPUP_ENHANCEMENTS, "Choose Enhancement");
//Alternate Name to save Slot
DEF_STR(SAVE_SLOT_DEFAULT, "Save Slot - Default");

View File

@ -106,6 +106,7 @@
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationIndex.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-ApplicationPath.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-Cheats.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-Enhancements.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-GameSetting.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-GameSettingIndex.cpp" />
<ClCompile Include="Settings\SettingType\SettingsType-RDBCpuType.cpp" />
@ -212,6 +213,7 @@
<ClInclude Include="Settings\SettingType\SettingsType-ApplicationPath.h" />
<ClInclude Include="Settings\SettingType\SettingsType-Base.h" />
<ClInclude Include="Settings\SettingType\SettingsType-Cheats.h" />
<ClInclude Include="Settings\SettingType\SettingsType-Enhancements.h" />
<ClInclude Include="Settings\SettingType\SettingsType-GameSetting.h" />
<ClInclude Include="Settings\SettingType\SettingsType-GameSettingIndex.h" />
<ClInclude Include="Settings\SettingType\SettingsType-RDBCpuType.h" />

View File

@ -339,6 +339,9 @@
<ClCompile Include="Settings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Settings\SettingType\SettingsType-Enhancements.cpp">
<Filter>Source Files\Settings\SettingType</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
@ -656,6 +659,9 @@
<ClInclude Include="Settings\SettingsID.h">
<Filter>Header Files\Settings</Filter>
</ClInclude>
<ClInclude Include="Settings\SettingType\SettingsType-Enhancements.h">
<Filter>Header Files\Settings\SettingType</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ClassDiagram.cd" />

View File

@ -15,6 +15,7 @@
#include "Settings/SettingType/SettingsType-ApplicationPath.h"
#include "Settings/SettingType/SettingsType-ApplicationIndex.h"
#include "Settings/SettingType/SettingsType-Cheats.h"
#include "Settings/SettingType/SettingsType-Enhancements.h"
#include "Settings/SettingType/SettingsType-GameSetting.h"
#include "Settings/SettingType/SettingsType-GameSettingIndex.h"
#include "Settings/SettingType/SettingsType-RelativePath.h"
@ -47,6 +48,7 @@ CSettings::~CSettings()
CSettingTypeRomDatabase::CleanUp();
CSettingTypeGame::CleanUp();
CSettingTypeCheats::CleanUp();
CSettingTypeEnhancements::CleanUp();
for (SETTING_MAP::iterator iter = m_SettingInfo.begin(); iter != m_SettingInfo.end(); iter++)
{
@ -100,6 +102,8 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(SupportFile_AudioRDBDefault, new CSettingTypeRelativePath("Config", "Audio.rdb"));
AddHandler(SupportFile_Cheats, new CSettingTypeApplicationPath("Settings", "Cheats", SupportFile_CheatsDefault));
AddHandler(SupportFile_CheatsDefault, new CSettingTypeRelativePath("Config", "Project64.cht"));
AddHandler(SupportFile_Enhancements, new CSettingTypeApplicationPath("Settings", "Enhancement", SupportFile_EnhancementsDefault));
AddHandler(SupportFile_EnhancementsDefault, new CSettingTypeRelativePath("Config", "Project64.enh"));
AddHandler(SupportFile_Notes, new CSettingTypeApplicationPath("Settings", "Notes", SupportFile_NotesDefault));
AddHandler(SupportFile_NotesDefault, new CSettingTypeRelativePath("Config", "Project64.rdn"));
AddHandler(SupportFile_ExtInfo, new CSettingTypeApplicationPath("Settings", "ExtInfo", SupportFile_ExtInfoDefault));
@ -116,6 +120,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Setting_CheckEmuRunning, new CSettingTypeApplication("Settings", "Check Running", (uint32_t)true));
AddHandler(Setting_ForceInterpreterCPU, new CSettingTypeApplication("Settings", "Force Interpreter CPU", false));
AddHandler(Setting_FixedRdramAddress, new CSettingTypeApplication("Settings", "Fixed Rdram Address", (uint32_t)0));
AddHandler(Setting_Enhancement, new CSettingTypeApplication("Settings", "Enable Enhancement", (uint32_t)false));
AddHandler(Setting_RememberCheats, new CSettingTypeApplication("Settings", "Remember Cheats", (uint32_t)false));
#ifdef ANDROID
@ -180,7 +185,6 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDBYesNo("AudioResetOnLoad", false));
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDBYesNo("AllowROMWrites", false));
AddHandler(Rdb_CRC_Recalc, new CSettingTypeRDBYesNo("CRC-Recalc", false));
AddHandler(Rdb_OverClockModifier, new CSettingTypeRomDatabase("OverClockModifier", (uint32_t)1));
AddHandler(Rdb_UnalignedDMA, new CSettingTypeRomDatabase("Unaligned DMA", Default_UnalignedDMA));
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
@ -238,7 +242,6 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Game_Transferpak_ROM, new CSettingTypeGame("Tpak-ROM-dir", Default_None));
AddHandler(Game_Transferpak_Sav, new CSettingTypeGame("Tpak-Sav-dir", Default_None));
AddHandler(Game_LoadSaveAtStart, new CSettingTypeTempBool(false));
AddHandler(Game_OverClockModifier, new CSettingTypeGame("OverClockModifier", Rdb_OverClockModifier));
AddHandler(Game_FullSpeed, new CSettingTypeTempBool(true, "Full Speed"));
AddHandler(Game_UnalignedDMA, new CSettingTypeGame("Unaligned DMA", Rdb_UnalignedDMA));
@ -423,6 +426,13 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Cheat_Range, new CSettingTypeCheats("_R"));
AddHandler(Cheat_RangeNotes, new CSettingTypeCheats("_RN"));
// Enhancement
AddHandler(Enhancement_Name, new CSettingTypeEnhancements(""));
AddHandler(Enhancement_Active, new CSettingTypeGameIndex("Enhancement", "", Enhancement_OnByDefault));
AddHandler(Enhancement_OnByDefault, new CSettingTypeEnhancements("_AO"));
AddHandler(Enhancement_Overclock, new CSettingTypeEnhancements("_OVER"));
AddHandler(Enhancement_OverclockValue, new CSettingTypeEnhancements("_OVERV"));
AddHandler(Enhancement_Notes, new CSettingTypeEnhancements("_N"));
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
@ -661,6 +671,7 @@ bool CSettings::Initialize(const char * BaseDirectory, const char * AppName)
CSettingTypeRomDatabase::Initialize();
CSettingTypeGame::Initialize();
CSettingTypeCheats::Initialize();
CSettingTypeEnhancements::Initialize();
g_Settings->SaveString(Setting_ApplicationName, AppName);
WriteTrace(TraceAppInit, TraceDebug, "Done");

View File

@ -71,10 +71,20 @@ void CGameSettings::RefreshGameSettings()
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
m_OverClockModifier = g_Settings->LoadDword(Game_OverClockModifier);
if (m_CountPerOp == 0)
{
m_CountPerOp = 2;
}
m_OverClockModifier = 1;
if (g_Settings->LoadBool(Setting_Enhancement))
{
for (int i = 0; i < CCheats::MaxCheats; i++)
{
if (g_Settings->LoadBoolIndex(Enhancement_Active, i) && g_Settings->LoadBoolIndex(Enhancement_Overclock, i))
{
m_OverClockModifier = g_Settings->LoadDwordIndex(Enhancement_OverclockValue, i);
}
}
}
if (m_OverClockModifier < 1) { m_OverClockModifier = 1; }
if (m_OverClockModifier > 20) { m_OverClockModifier = 20; }

View File

@ -137,7 +137,7 @@ void CSettingTypeApplication::CleanUp()
}
}
bool CSettingTypeApplication::Load(uint32_t /*Index*/, bool & Value) const
bool CSettingTypeApplication::Load(uint32_t Index, bool & Value) const
{
bool bRes = false;
@ -155,10 +155,17 @@ bool CSettingTypeApplication::Load(uint32_t /*Index*/, bool & Value) const
Value = m_DefaultValue != 0;
}
else
{
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
{
g_Settings->LoadBoolIndex(m_DefaultSetting, Index, Value);
}
else
{
g_Settings->LoadBool(m_DefaultSetting, Value);
}
}
}
return bRes;
}

View File

@ -31,6 +31,7 @@ enum SettingType
SettingType_StringVariable = 11,
SettingType_SelectedDirectory = 12,
SettingType_RdbSetting = 13,
SettingType_Enhancement = 14,
};
class CSettingType

View File

@ -0,0 +1,168 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#include "stdafx.h"
#include "SettingsType-Enhancements.h"
CIniFile * CSettingTypeEnhancements::m_EnhancementIniFile = NULL;
std::string * CSettingTypeEnhancements::m_SectionIdent = NULL;
std::string * CSettingTypeEnhancements::m_GameName = NULL;
CSettingTypeEnhancements::CSettingTypeEnhancements(const char * PostFix ) :
m_PostFix(PostFix)
{
}
CSettingTypeEnhancements::~CSettingTypeEnhancements( void )
{
}
void CSettingTypeEnhancements::Initialize ( void )
{
WriteTrace(TraceAppInit, TraceDebug, "Start");
m_EnhancementIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Enhancements).c_str());
m_EnhancementIniFile->SetAutoFlush(false);
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
m_SectionIdent = new std::string(g_Settings->LoadStringVal(Game_IniKey));
m_GameName = new std::string(g_Settings->LoadStringVal(Game_IniKey));
GameChanged(NULL);
WriteTrace(TraceAppInit, TraceDebug, "Done");
}
void CSettingTypeEnhancements::CleanUp ( void )
{
if (m_EnhancementIniFile)
{
m_EnhancementIniFile->SetAutoFlush(true);
delete m_EnhancementIniFile;
m_EnhancementIniFile = NULL;
}
if (m_SectionIdent)
{
delete m_SectionIdent;
m_SectionIdent = NULL;
}
if (m_GameName)
{
delete m_GameName;
m_GameName = NULL;
}
}
void CSettingTypeEnhancements::FlushChanges( void )
{
if (m_EnhancementIniFile)
{
m_EnhancementIniFile->FlushChanges();
}
}
void CSettingTypeEnhancements::GameChanged ( void * /*Data */ )
{
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
*m_GameName = g_Settings->LoadStringVal(Rdb_GoodName);
}
bool CSettingTypeEnhancements::IsSettingSet(void) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}
bool CSettingTypeEnhancements::Load (uint32_t Index, bool & Value ) const
{
if (m_EnhancementIniFile == NULL)
{
return false;
}
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
uint32_t dwValue = 0;
bool bRes = m_EnhancementIniFile->GetNumber(m_SectionIdent->c_str(), Key.c_str(), 0, dwValue);
if (bRes)
{
Value = dwValue != 0;
}
return bRes;
}
bool CSettingTypeEnhancements::Load (uint32_t Index, uint32_t & Value ) const
{
if (m_EnhancementIniFile == NULL)
{
return false;
}
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
return m_EnhancementIniFile->GetNumber(m_SectionIdent->c_str(), Key.c_str(), 0, Value);
}
bool CSettingTypeEnhancements::Load (uint32_t Index, std::string & Value ) const
{
if (m_EnhancementIniFile == NULL)
{
return false;
}
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
return m_EnhancementIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
}
//return the default values
void CSettingTypeEnhancements::LoadDefault (uint32_t /*Index*/, bool & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeEnhancements::LoadDefault (uint32_t /*Index*/, uint32_t & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
void CSettingTypeEnhancements::LoadDefault (uint32_t /*Index*/, std::string & /*Value*/ ) const
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
//Update the settings
void CSettingTypeEnhancements::Save (uint32_t Index, bool Value )
{
if (m_EnhancementIniFile == NULL) { return; }
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
m_EnhancementIniFile->SaveNumber(m_SectionIdent->c_str(), Key.c_str(), Value);
}
void CSettingTypeEnhancements::Save (uint32_t Index, uint32_t Value )
{
if (m_EnhancementIniFile == NULL) { return; }
stdstr_f Key("Enhancement%d%s", Index, m_PostFix);
m_EnhancementIniFile->SaveNumber(m_SectionIdent->c_str(), Key.c_str(), Value);
}
void CSettingTypeEnhancements::Save (uint32_t Index, const std::string & Value )
{
if (m_EnhancementIniFile == NULL) { return; }
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
m_EnhancementIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
}
void CSettingTypeEnhancements::Save (uint32_t Index, const char * Value )
{
if (m_EnhancementIniFile == NULL) { return; }
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
m_EnhancementIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
}
void CSettingTypeEnhancements::Delete (uint32_t Index )
{
stdstr_f Key("Enhancement%d%s",Index,m_PostFix);
m_EnhancementIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
}

View File

@ -0,0 +1,62 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
#include <Common/IniFileClass.h>
class CSettingTypeEnhancements :
public CSettingType
{
public:
CSettingTypeEnhancements(const char * PostFix );
~CSettingTypeEnhancements();
virtual bool IndexBasedSetting ( void ) const { return true; }
virtual SettingType GetSettingType ( void ) const { return SettingType_Enhancement; }
virtual bool IsSettingSet ( void ) const;
//return the values
virtual bool Load (uint32_t Index, bool & Value ) const;
virtual bool Load (uint32_t Index, uint32_t & Value ) const;
virtual bool Load (uint32_t Index, std::string & Value ) const;
//return the default values
virtual void LoadDefault (uint32_t Index, bool & Value ) const;
virtual void LoadDefault (uint32_t Index, uint32_t & Value ) const;
virtual void LoadDefault (uint32_t Index, std::string & Value ) const;
//Update the settings
virtual void Save (uint32_t Index, bool Value );
virtual void Save (uint32_t Index, uint32_t Value );
virtual void Save (uint32_t Index, const std::string & Value );
virtual void Save (uint32_t Index, const char * Value );
// Delete the setting
virtual void Delete (uint32_t Index );
// Initialize this class to use ini or registry
static void Initialize ( void );
static void CleanUp ( void );
static void FlushChanges ( void );
protected:
static CIniFile * m_EnhancementIniFile;
static std::string * m_SectionIdent;
static std::string * m_GameName;
const char * const m_PostFix;
static void GameChanged ( void * /*Data */ );
private:
CSettingTypeEnhancements(void); // Disable default constructor
CSettingTypeEnhancements(const CSettingTypeEnhancements&); // Disable copy constructor
CSettingTypeEnhancements& operator=(const CSettingTypeEnhancements&); // Disable assignment
};

View File

@ -37,6 +37,8 @@ enum SettingID
SupportFile_AudioRDBDefault,
SupportFile_Cheats,
SupportFile_CheatsDefault,
SupportFile_Enhancements,
SupportFile_EnhancementsDefault,
SupportFile_Notes,
SupportFile_NotesDefault,
SupportFile_ExtInfo,
@ -61,6 +63,7 @@ enum SettingID
Setting_CurrentLanguage,
Setting_EnableDisk,
Setting_SyncViaAudioEnabled,
Setting_Enhancement,
//Default Settings
Default_RDRamSize,
@ -111,7 +114,6 @@ enum SettingID
Rdb_AudioResetOnLoad,
Rdb_AllowROMWrites,
Rdb_CRC_Recalc,
Rdb_OverClockModifier,
Rdb_UnalignedDMA,
//Individual Game Settings
@ -166,7 +168,6 @@ enum SettingID
Game_Transferpak_ROM,
Game_Transferpak_Sav,
Game_LoadSaveAtStart,
Game_OverClockModifier,
Game_FullSpeed,
Game_UnalignedDMA,
@ -325,6 +326,14 @@ enum SettingID
Cheat_Range,
Cheat_RangeNotes,
//Enhancement
Enhancement_Name,
Enhancement_Active,
Enhancement_OnByDefault,
Enhancement_Overclock,
Enhancement_OverclockValue,
Enhancement_Notes,
FirstUISettings, LastUISettings = FirstUISettings + MaxPluginSetting,
FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting,
FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting,

View File

@ -101,6 +101,7 @@
<ClCompile Include="UserInterface\Debugger\ScriptInstance.cpp" />
<ClCompile Include="UserInterface\Debugger\ScriptSystem.cpp" />
<ClCompile Include="UserInterface\Debugger\Symbols.cpp" />
<ClCompile Include="UserInterface\EnhancementConfig.cpp" />
<ClCompile Include="UserInterface\MainWindow.cpp" />
<ClCompile Include="UserInterface\LoggingUI.cpp" />
<ClCompile Include="UserInterface\MainMenu.cpp" />
@ -164,6 +165,7 @@
<ClInclude Include="UserInterface\Debugger\ScriptSystem.h" />
<ClInclude Include="UserInterface\Debugger\stdafx.h" />
<ClInclude Include="UserInterface\Debugger\Symbols.h" />
<ClInclude Include="UserInterface\EnhancementConfig.h" />
<ClInclude Include="UserInterface\MainWindow.h" />
<ClInclude Include="UserInterface\LoggingUI.h" />
<ClInclude Include="UserInterface\MainMenu.h" />

View File

@ -219,6 +219,9 @@
<ClCompile Include="UserInterface\Settings\SettingsPage-Defaults.cpp">
<Filter>Source Files\User Interface Source\Settings Source</Filter>
</ClCompile>
<ClCompile Include="UserInterface\EnhancementConfig.cpp">
<Filter>Source Files\User Interface Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UserInterface\resource.h">
@ -419,6 +422,9 @@
<ClInclude Include="UserInterface\Settings\SettingsPage-Defaults.h">
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
</ClInclude>
<ClInclude Include="UserInterface\EnhancementConfig.h">
<Filter>Header Files\User Interface Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\divider.cur">

View File

@ -26,5 +26,6 @@
#include <Project64-core/N64System/FramePerSecondClass.h>
#include "UserInterface/resource.h"
#include "UserInterface/SettingsConfig.h"
#include "UserInterface/EnhancementConfig.h"
#include "UserInterface/CheatClassUI.h"
#include "UserInterface/SupportWindow.h"

View File

@ -0,0 +1,537 @@
#include "stdafx.h"
#include <Project64-core/Settings/SettingType/SettingsType-Enhancements.h>
class CEditEnhancement :
public CDialogImpl < CEditEnhancement >
{
public:
BEGIN_MSG_MAP_EX(CEditEnhancement)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
END_MSG_MAP()
enum { IDD = IDD_Enhancement_Edit };
CEditEnhancement(int EditItem);
void Display(HWND ParentWindow);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
private:
CEditEnhancement(void); // Disable default constructor
CEditEnhancement(const CEditEnhancement&); // Disable copy constructor
CEditEnhancement& operator=(const CEditEnhancement&); // Disable assignment
std::string GetDlgItemStr(int nIDDlgItem);
int m_EditItem;
};
CEnhancementConfig::CEnhancementConfig(void) :
m_hSelectedItem(NULL)
{
}
CEnhancementConfig::~CEnhancementConfig()
{
}
void CEnhancementConfig::Display(void * ParentWindow)
{
BOOL result = m_thunk.Init(NULL, NULL);
if (result)
{
_AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
#ifdef _DEBUG
m_bModal = true;
#endif //_DEBUG
::DialogBoxParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(IDD), (HWND)ParentWindow, StartDialogProc, NULL);
}
}
LRESULT CEnhancementConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
m_TreeList.Attach(GetDlgItem(IDC_ENHANCEMENTLIST));
LONG Style = m_TreeList.GetWindowLong(GWL_STYLE);
m_TreeList.SetWindowLong(GWL_STYLE, TVS_CHECKBOXES | TVS_SHOWSELALWAYS | Style);
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 40, 40);
HBITMAP hBmp = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_TRI_STATE));
ImageList_AddMasked(hImageList, hBmp, RGB(255, 0, 255));
DeleteObject(hBmp);
m_TreeList.SetImageList(hImageList, TVSIL_STATE);
RefreshList();
return TRUE;
}
LRESULT CEnhancementConfig::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return TRUE;
}
LRESULT CEnhancementConfig::OnAddEnhancement(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CEditEnhancement(-1).Display(m_hWnd);
RefreshList();
return TRUE;
}
LRESULT CEnhancementConfig::OnEnhancementListClicked(NMHDR* pNMHDR)
{
SetMsgHandled(false);
TVHITTESTINFO ht = { 0 };
uint32_t dwpos = GetMessagePos();
// include <windowsx.h> and <windows.h> header files
ht.pt.x = GET_X_LPARAM(dwpos);
ht.pt.y = GET_Y_LPARAM(dwpos);
::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &ht.pt, 1);
TreeView_HitTest(pNMHDR->hwndFrom, &ht);
if (TVHT_ONITEMSTATEICON & ht.flags)
{
switch (TV_GetCheckState(ht.hItem))
{
case TV_STATE_CLEAR:
case TV_STATE_INDETERMINATE:
TV_SetCheckState(ht.hItem, TV_STATE_CHECKED);
ChangeChildrenStatus(ht.hItem, true);
CheckParentStatus(m_TreeList.GetParentItem(ht.hItem));
break;
case TV_STATE_CHECKED:
TV_SetCheckState(ht.hItem, TV_STATE_CLEAR);
ChangeChildrenStatus(ht.hItem, false);
CheckParentStatus(m_TreeList.GetParentItem(ht.hItem));
break;
}
switch (TV_GetCheckState(ht.hItem))
{
case TV_STATE_CHECKED: TV_SetCheckState(ht.hItem, TV_STATE_INDETERMINATE); break;
case TV_STATE_CLEAR: TV_SetCheckState(ht.hItem, TV_STATE_CHECKED); break;
case TV_STATE_INDETERMINATE: TV_SetCheckState(ht.hItem, TV_STATE_CLEAR); break;
}
}
return TRUE;
}
void CEnhancementConfig::CheckParentStatus(HTREEITEM hParent)
{
TV_CHECK_STATE CurrentState, InitialState;
if (!hParent) { return; }
HTREEITEM hItem = m_TreeList.GetChildItem(hParent);
InitialState = (TV_CHECK_STATE)TV_GetCheckState(hParent);
CurrentState = (TV_CHECK_STATE)TV_GetCheckState(hItem);
while (hItem != NULL)
{
if (TV_GetCheckState(hItem) != CurrentState)
{
CurrentState = TV_STATE_INDETERMINATE;
break;
}
hItem = m_TreeList.GetNextSiblingItem(hItem);
}
TV_SetCheckState(hParent, CurrentState);
if (InitialState != CurrentState)
{
CheckParentStatus(m_TreeList.GetParentItem(hParent));
}
}
LRESULT CEnhancementConfig::OnEnhancementListRClicked(NMHDR* pNMHDR)
{
TVHITTESTINFO ht = { 0 };
uint32_t dwpos = GetMessagePos();
ht.pt.x = GET_X_LPARAM(dwpos);
ht.pt.y = GET_Y_LPARAM(dwpos);
::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &ht.pt, 1);
TreeView_HitTest(pNMHDR->hwndFrom, &ht);
m_hSelectedItem = ht.hItem;
POINT Mouse;
GetCursorPos(&Mouse);
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_ENHANCEMENT_MENU));
HMENU hPopupMenu = GetSubMenu(hMenu, 0);
if (m_hSelectedItem == NULL)
{
RemoveMenu(hPopupMenu, 3, MF_BYPOSITION);
RemoveMenu(hPopupMenu, 2, MF_BYPOSITION);
RemoveMenu(hPopupMenu, 1, MF_BYPOSITION);
}
TrackPopupMenu(hPopupMenu, 0, Mouse.x, Mouse.y, 0, m_hWnd, NULL);
DestroyMenu(hMenu);
return TRUE;
}
LRESULT CEnhancementConfig::OnEnhancementListDblClicked(NMHDR * pNMHDR)
{
TVHITTESTINFO ht = { 0 };
uint32_t dwpos = GetMessagePos();
ht.pt.x = GET_X_LPARAM(dwpos);
ht.pt.y = GET_Y_LPARAM(dwpos);
::MapWindowPoints(HWND_DESKTOP, pNMHDR->hwndFrom, &ht.pt, 1);
TreeView_HitTest(pNMHDR->hwndFrom, &ht);
if (TVHT_ONITEMLABEL & ht.flags)
{
TVITEM item;
item.mask = TVIF_PARAM;
item.hItem = ht.hItem;
m_TreeList.GetItem(&item);
CEditEnhancement(item.lParam).Display(m_hWnd);
RefreshList();
}
return TRUE;
}
LRESULT CEnhancementConfig::OnEnhancementListSelChanged(NMHDR * /*pNMHDR*/)
{
HTREEITEM hItem = m_TreeList.GetSelectedItem();
if (m_TreeList.GetChildItem(hItem) == NULL)
{
TVITEM item;
item.mask = TVIF_PARAM;
item.hItem = hItem;
m_TreeList.GetItem(&item);
std::string Notes(g_Settings->LoadStringIndex(Enhancement_Notes, item.lParam));
SetDlgItemText(IDC_NOTES, Notes.c_str());
}
else
{
SetDlgItemText(IDC_NOTES, "");
}
return TRUE;
}
LRESULT CEnhancementConfig::OnDeleteItem(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (m_hSelectedItem == NULL)
{
return TRUE;
}
int Response = MessageBoxW(m_hWnd, wGS(MSG_DEL_SURE).c_str(), wGS(MSG_DEL_TITLE).c_str(), MB_YESNO | MB_ICONQUESTION);
if (Response != IDYES) { return TRUE; }
TVITEM item;
item.hItem = m_hSelectedItem;
item.mask = TVIF_PARAM;
m_TreeList.GetItem(&item);
for (int i = item.lParam; i < CCheats::MaxCheats; i++)
{
stdstr Name = g_Settings->LoadStringIndex(Enhancement_Name, i + 1);
if (Name.empty())
{
g_Settings->DeleteSettingIndex(Enhancement_Name, i);
g_Settings->DeleteSettingIndex(Enhancement_Active, i);
g_Settings->DeleteSettingIndex(Enhancement_OnByDefault, i);
g_Settings->DeleteSettingIndex(Enhancement_Notes, i);
g_Settings->DeleteSettingIndex(Enhancement_Overclock, i);
g_Settings->DeleteSettingIndex(Enhancement_OverclockValue, i);
break;
}
stdstr Value;
if (g_Settings->LoadStringIndex(Enhancement_Notes, i + 1, Value))
{
g_Settings->SaveStringIndex(Enhancement_Notes, i, Value);
}
else
{
g_Settings->DeleteSettingIndex(Enhancement_Notes, i);
}
bool bValue;
if (g_Settings->LoadBoolIndex(Enhancement_Active, i + 1, bValue))
{
g_Settings->SaveBoolIndex(Enhancement_Active, i, bValue);
}
else
{
g_Settings->DeleteSettingIndex(Enhancement_Active, i);
}
if (g_Settings->LoadBoolIndex(Enhancement_OnByDefault, i + 1, bValue))
{
g_Settings->SaveBoolIndex(Enhancement_OnByDefault, i, bValue);
}
else
{
g_Settings->DeleteSettingIndex(Enhancement_OnByDefault, i);
}
if (g_Settings->LoadBoolIndex(Enhancement_Overclock, i + 1, bValue))
{
g_Settings->SaveBoolIndex(Enhancement_Overclock, i, bValue);
}
else
{
g_Settings->DeleteSettingIndex(Enhancement_Overclock, i);
}
uint32_t dwValue;
if (g_Settings->LoadDwordIndex(Enhancement_OverclockValue, i + 1, dwValue))
{
g_Settings->SaveDwordIndex(Enhancement_OverclockValue, i, dwValue);
}
else
{
g_Settings->DeleteSettingIndex(Enhancement_OverclockValue, i);
}
g_Settings->SaveStringIndex(Enhancement_Name, i, Name);
}
CSettingTypeEnhancements::FlushChanges();
RefreshList();
return TRUE;
}
void CEnhancementConfig::RefreshList()
{
m_TreeList.DeleteAllItems();
for (int i = 0; i < CCheats::MaxCheats; i++)
{
std::string Name = g_Settings->LoadStringIndex(Enhancement_Name, i);
if (Name.length() == 0) { break; }
AddCodeLayers(i, Name, TVI_ROOT, g_Settings->LoadBoolIndex(Enhancement_Active, i) != 0);
}
}
void CEnhancementConfig::AddCodeLayers(int index, const std::string & Name, HTREEITEM hParent, bool Active)
{
TV_INSERTSTRUCT tv;
//Work out text to add
char Text[500], Item[500];
if (Name.length() > (sizeof(Text) - 5)) { g_Notify->BreakPoint(__FILE__, __LINE__); }
strcpy(Text, Name.c_str());
if (strchr(Text, '\\') > 0) { *strchr(Text, '\\') = 0; }
//See if text is already added
tv.item.mask = TVIF_TEXT;
tv.item.pszText = Item;
tv.item.cchTextMax = sizeof(Item);
tv.item.hItem = m_TreeList.GetChildItem(hParent);
while (tv.item.hItem)
{
m_TreeList.GetItem(&tv.item);
if (strcmp(Text, Item) == 0)
{
//If already exists then just use existing one
int State = TV_GetCheckState(tv.item.hItem);
if ((Active && State == TV_STATE_CLEAR) || (!Active && State == TV_STATE_CHECKED))
{
TV_SetCheckState(tv.item.hItem, TV_STATE_INDETERMINATE);
}
size_t StartPos = strlen(Text) + 1;
stdstr TempCheatName;
if (StartPos < Name.length())
{
TempCheatName = Name.substr(StartPos);
}
AddCodeLayers(index, TempCheatName, tv.item.hItem, Active);
return;
}
tv.item.hItem = TreeView_GetNextSibling(m_TreeList, tv.item.hItem);
}
//Add to dialog
tv.hInsertAfter = TVI_SORT;
tv.item.mask = TVIF_TEXT | TVIF_PARAM;
tv.item.pszText = Text;
tv.item.lParam = index;
tv.hParent = (HTREEITEM)hParent;
hParent = m_TreeList.InsertItem(&tv);
TV_SetCheckState(hParent, Active ? TV_STATE_CHECKED : TV_STATE_CLEAR);
if (strcmp(Text, Name.c_str()) == 0) { return; }
AddCodeLayers(index, (stdstr)(Name.substr(strlen(Text) + 1)), hParent, Active);
}
bool CEnhancementConfig::TV_SetCheckState( HTREEITEM hItem, TV_CHECK_STATE state)
{
TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
tvItem.hItem = hItem;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
/*Image 1 in the tree-view check box image list is the
unchecked box. Image 2 is the checked box.*/
switch (state)
{
case TV_STATE_CHECKED: tvItem.state = INDEXTOSTATEIMAGEMASK(1); break;
case TV_STATE_CLEAR: tvItem.state = INDEXTOSTATEIMAGEMASK(2); break;
case TV_STATE_INDETERMINATE: tvItem.state = INDEXTOSTATEIMAGEMASK(3); break;
default: tvItem.state = INDEXTOSTATEIMAGEMASK(0); break;
}
return m_TreeList.SetItem(&tvItem) != 0;
}
int CEnhancementConfig::TV_GetCheckState(HTREEITEM hItem)
{
TVITEM tvItem;
// Prepare to receive the desired information.
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
tvItem.hItem = hItem;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
// Request the information.
m_TreeList.GetItem(&tvItem);
// Return zero if it's not checked, or nonzero otherwise.
switch (tvItem.state >> 12) {
case 1: return TV_STATE_CHECKED;
case 2: return TV_STATE_CLEAR;
case 3: return TV_STATE_INDETERMINATE;
}
return ((int)(tvItem.state >> 12) - 1);
}
void CEnhancementConfig::ChangeChildrenStatus(HTREEITEM hParent, bool Checked)
{
HTREEITEM hItem = m_TreeList.GetChildItem(hParent);
if (hItem == NULL)
{
if (hParent == TVI_ROOT) { return; }
TVITEM item;
item.mask = TVIF_PARAM;
item.hItem = (HTREEITEM)hParent;
m_TreeList.GetItem(&item);
TV_SetCheckState(hParent, Checked ? TV_STATE_CHECKED : TV_STATE_CLEAR);
g_Settings->SaveBoolIndex(Enhancement_Active, item.lParam, Checked);
}
else
{
TV_CHECK_STATE state = TV_STATE_UNKNOWN;
while (hItem != NULL)
{
TV_CHECK_STATE ChildState = (TV_CHECK_STATE)TV_GetCheckState(hItem);
if ((ChildState != TV_STATE_CHECKED || !Checked) &&
(ChildState != TV_STATE_CLEAR || Checked))
{
ChangeChildrenStatus(hItem, Checked);
}
ChildState = (TV_CHECK_STATE)TV_GetCheckState(hItem);
if (state == TV_STATE_UNKNOWN) { state = ChildState; }
if (state != ChildState) { state = TV_STATE_INDETERMINATE; }
hItem = m_TreeList.GetNextSiblingItem(hItem);
}
if (state != TV_STATE_UNKNOWN)
{
TV_SetCheckState(hParent, state);
}
}
}
CEditEnhancement::CEditEnhancement(int EditItem) :
m_EditItem(EditItem)
{
}
void CEditEnhancement::Display(HWND ParentWindow)
{
BOOL result = m_thunk.Init(NULL, NULL);
if (result)
{
_AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
#ifdef _DEBUG
m_bModal = true;
#endif //_DEBUG
::DialogBoxParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(IDD), ParentWindow, StartDialogProc, NULL);
}
}
LRESULT CEditEnhancement::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
GetDlgItem(IDC_CODE_NAME).SetWindowTextA(m_EditItem >= 0 ? g_Settings->LoadStringIndex(Enhancement_Name, m_EditItem).c_str() : "");
GetDlgItem(IDC_NOTES).SetWindowTextA(m_EditItem >= 0 ? g_Settings->LoadStringIndex(Enhancement_Notes, m_EditItem).c_str() : "");
CButton(GetDlgItem(IDC_AUTOON)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_OnByDefault, m_EditItem) ? BST_CHECKED : BST_UNCHECKED);
CButton(GetDlgItem(IDC_OVERCLOCK)).SetCheck(g_Settings->LoadBoolIndex(Enhancement_Overclock, m_EditItem) ? BST_CHECKED : BST_UNCHECKED);
GetDlgItem(IDC_OVER_CLOCK_MODIFIER).SetWindowTextA(m_EditItem >= 0 ? stdstr_f("%d", g_Settings->LoadDwordIndex(Enhancement_OverclockValue, m_EditItem)).c_str() : "");
return TRUE;
}
LRESULT CEditEnhancement::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return TRUE;
}
LRESULT CEditEnhancement::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
std::string NewName = GetDlgItemStr(IDC_CODE_NAME);
for (int i = 0; i < CCheats::MaxCheats; i++)
{
if (m_EditItem == i)
{
continue;
}
std::string Name = g_Settings->LoadStringIndex(Enhancement_Name, i);
if (Name.length() == 0)
{
if (m_EditItem < 0)
{
m_EditItem = i;
}
break;
}
if (_stricmp(Name.c_str(), NewName.c_str()) == 0)
{
g_Notify->DisplayError(GS(MSG_CHEAT_NAME_IN_USE));
GetDlgItem(IDC_CODE_NAME).SetFocus();
return true;
}
}
if (m_EditItem < 0)
{
g_Notify->DisplayError(GS(MSG_MAX_CHEATS));
return true;
}
g_Settings->SaveStringIndex(Enhancement_Name, m_EditItem, NewName);
g_Settings->SaveStringIndex(Enhancement_Notes, m_EditItem, GetDlgItemStr(IDC_NOTES));
g_Settings->SaveBoolIndex(Enhancement_OnByDefault, m_EditItem, CButton(GetDlgItem(IDC_AUTOON)).GetCheck() == 1);
g_Settings->SaveBoolIndex(Enhancement_Overclock, m_EditItem, CButton(GetDlgItem(IDC_OVERCLOCK)).GetCheck() == 1);
g_Settings->SaveDwordIndex(Enhancement_OverclockValue, m_EditItem, atoi(GetDlgItemStr(IDC_OVER_CLOCK_MODIFIER).c_str()));
CSettingTypeEnhancements::FlushChanges();
EndDialog(wID);
return TRUE;
}
std::string CEditEnhancement::GetDlgItemStr(int nIDDlgItem)
{
CWindow DlgItem = GetDlgItem(nIDDlgItem);
int length = DlgItem.SendMessage(WM_GETTEXTLENGTH, 0, 0);
if (length == 0)
{
return "";
}
stdstr Result;
Result.resize(length + 1);
DlgItem.GetWindowText((char *)Result.c_str(), Result.length());
return Result;
}

View File

@ -0,0 +1,59 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
class CEnhancementConfig :
public CDialogImpl < CEnhancementConfig >
{
public:
BEGIN_MSG_MAP_EX(CEnhancementConfig)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
COMMAND_ID_HANDLER(ID_POPUP_DELETE, OnDeleteItem)
COMMAND_ID_HANDLER(ID_POPUP_ADDENHANCEMENT, OnAddEnhancement)
NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_CLICK, OnEnhancementListClicked)
NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_RCLICK, OnEnhancementListRClicked)
NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, NM_DBLCLK, OnEnhancementListDblClicked)
NOTIFY_HANDLER_EX(IDC_ENHANCEMENTLIST, TVN_SELCHANGED, OnEnhancementListSelChanged)
END_MSG_MAP()
enum { IDD = IDD_Enhancement_Config };
CEnhancementConfig(void);
~CEnhancementConfig(void);
void Display(void * ParentWindow);
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnAddEnhancement(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnEnhancementListClicked(NMHDR* pNMHDR);
LRESULT OnEnhancementListRClicked(NMHDR* pNMHDR);
LRESULT OnEnhancementListDblClicked(NMHDR* pNMHDR);
LRESULT OnEnhancementListSelChanged(NMHDR* pNMHDR);
LRESULT OnDeleteItem(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
private:
CEnhancementConfig(const CEnhancementConfig&); // Disable copy constructor
CEnhancementConfig& operator=(const CEnhancementConfig&); // Disable assignment
enum TV_CHECK_STATE { TV_STATE_UNKNOWN, TV_STATE_CLEAR, TV_STATE_CHECKED, TV_STATE_INDETERMINATE };
void RefreshList(void);
void AddCodeLayers(int index, const std::string & Name, HTREEITEM hParent, bool Active);
void ChangeChildrenStatus(HTREEITEM hParent, bool Checked);
void CheckParentStatus(HTREEITEM hParent);
bool TV_SetCheckState(HTREEITEM hItem, TV_CHECK_STATE state);
int TV_GetCheckState(HTREEITEM hItem);
CTreeViewCtrl m_TreeList;
HTREEITEM m_hSelectedItem;
};

View File

@ -53,6 +53,7 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) :
m_ChangeSettingList.push_back(Debugger_AppLogFlush);
m_ChangeSettingList.push_back(Game_CurrentSaveState);
m_ChangeSettingList.push_back(Setting_CurrentLanguage);
m_ChangeSettingList.push_back(Setting_Enhancement);
for (UISettingList::const_iterator iter = m_ChangeUISettingList.begin(); iter != m_ChangeUISettingList.end(); iter++)
{
@ -469,7 +470,9 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUG_DISABLE_GAMEFIX:
g_Settings->SaveBool(Debugger_DisableGameFixes, !g_Settings->LoadBool(Debugger_DisableGameFixes));
break;
case ID_DEBUG_ENANCEMENT:
g_Settings->SaveBool(Setting_Enhancement, !g_Settings->LoadBool(Setting_Enhancement));
break;
case ID_DEBUGGER_TRACE_MD5: SetTraceModuleSetttings(Debugger_TraceMD5); break;
case ID_DEBUGGER_TRACE_SETTINGS: SetTraceModuleSetttings(Debugger_TraceSettings); break;
case ID_DEBUGGER_TRACE_UNKNOWN: SetTraceModuleSetttings(Debugger_TraceUnknown); break;
@ -1208,6 +1211,12 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
Item.Reset(SUB_MENU, EMPTY_STRING, EMPTY_STDSTR, &DebugLoggingMenu, L"Logging");
DebugMenu.push_back(Item);
Item.Reset(SUB_MENU, EMPTY_STRING, EMPTY_STDSTR, &DebugNotificationMenu, L"Notification");
DebugMenu.push_back(Item);
Item.Reset(ID_DEBUG_ENANCEMENT, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Enable Enhancement");
if (g_Settings->LoadBool(Setting_Enhancement))
{
Item.SetItemTicked(true);
}
DebugMenu.push_back(Item);
DebugMenu.push_back(MENU_ITEM(SPLITER));
Item.Reset(ID_DEBUG_SHOW_TLB_MISSES, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Show TLB Misses");

View File

@ -40,7 +40,7 @@ enum MainMenuID
ID_DEBUGGER_TLBENTRIES, ID_DEBUGGER_BREAKPOINTS, ID_DEBUGGER_MEMORY, ID_DEBUGGER_R4300REGISTERS,
ID_DEBUGGER_INTERRUPT_SP, ID_DEBUGGER_INTERRUPT_SI, ID_DEBUGGER_INTERRUPT_AI, ID_DEBUGGER_INTERRUPT_VI,
ID_DEBUGGER_INTERRUPT_PI, ID_DEBUGGER_INTERRUPT_DP, ID_DEBUGGER_SCRIPTS, ID_DEBUGGER_SYMBOLS, ID_DEBUGGER_DMALOG,
ID_DEBUGGER_STACKTRACE, ID_DEBUGGER_STACKVIEW,
ID_DEBUGGER_STACKTRACE, ID_DEBUGGER_STACKVIEW, ID_DEBUG_ENANCEMENT,
// App logging
ID_DEBUGGER_APPLOG_FLUSH, ID_DEBUGGER_TRACE_MD5, ID_DEBUGGER_TRACE_SETTINGS, ID_DEBUGGER_TRACE_UNKNOWN, ID_DEBUGGER_TRACE_APPINIT,

View File

@ -1027,6 +1027,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
break;
case ID_POPUPMENU_EDITSETTINGS:
case ID_POPUPMENU_EDITCHEATS:
case ID_POPUPMENU_CHOOSEENHANCEMENT:
{
CN64Rom Rom;
Rom.LoadN64Image(_this->CurrentedSelectedRom(), true);
@ -1037,8 +1038,11 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
CSettingConfig SettingConfig(true);
SettingConfig.Display(hWnd);
}
if (LOWORD(wParam) == ID_POPUPMENU_EDITCHEATS)
else if (LOWORD(wParam) == ID_POPUPMENU_CHOOSEENHANCEMENT)
{
CEnhancementConfig().Display(hWnd);
}
else if (LOWORD(wParam) == ID_POPUPMENU_EDITCHEATS)
{
CCheatsUI * cheatUI = new CCheatsUI;
g_cheatUI = cheatUI;

View File

@ -844,9 +844,11 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
MenuSetText(hPopupMenu, 7, wGS(POPUP_GFX_PLUGIN).c_str(), NULL);
MenuSetText(hPopupMenu, 9, wGS(POPUP_SETTINGS).c_str(), NULL);
MenuSetText(hPopupMenu, 10, wGS(POPUP_CHEATS).c_str(), NULL);
MenuSetText(hPopupMenu, 11, wGS(POPUP_ENHANCEMENTS).c_str(), NULL);
if (m_SelectedRom.size() == 0)
{
DeleteMenu(hPopupMenu, 11, MF_BYPOSITION);
DeleteMenu(hPopupMenu, 10, MF_BYPOSITION);
DeleteMenu(hPopupMenu, 9, MF_BYPOSITION);
DeleteMenu(hPopupMenu, 8, MF_BYPOSITION);
@ -859,8 +861,11 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
}
else
{
bool inBasicMode = g_Settings->LoadDword(UserInterface_BasicMode) != 0;
bool CheatsRemembered = g_Settings->LoadDword(Setting_RememberCheats) != 0;
bool inBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
bool CheatsRemembered = g_Settings->LoadBool(Setting_RememberCheats);
bool Enhancement = !inBasicMode && g_Settings->LoadBool(Setting_Enhancement);
if (!Enhancement) { DeleteMenu(hPopupMenu, 11, MF_BYPOSITION); }
if (!CheatsRemembered) { DeleteMenu(hPopupMenu, 10, MF_BYPOSITION); }
if (inBasicMode) { DeleteMenu(hPopupMenu, 9, MF_BYPOSITION); }
if (inBasicMode && !CheatsRemembered) { DeleteMenu(hPopupMenu, 8, MF_BYPOSITION); }

View File

@ -28,7 +28,6 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
SetDlgItemTextW(m_hWnd, IDC_COUNTFACT_TEXT, wGS(ROM_COUNTER_FACTOR).c_str());
SetDlgItemTextW(m_hWnd, IDC_VIREFESH_TEXT, wGS(ROM_VIREFRESH).c_str());
SetDlgItemTextW(m_hWnd, IDC_COUNTPERBYTE_TEXT, wGS(ROM_COUNTPERBYTE).c_str());
SetDlgItemTextW(m_hWnd, IDC_OVER_CLOCK_MODIFIER_TEXT, wGS(ROM_OVER_CLOCK_MODIFIER).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_32BIT, wGS(ROM_32BIT).c_str());
SetDlgItemTextW(m_hWnd, IDC_ROM_FIXEDAUDIO, wGS(ROM_FIXED_AUDIO).c_str());
@ -88,9 +87,6 @@ CGameGeneralPage::CGameGeneralPage(HWND hParent, const RECT & rcDispay)
TxtBox = AddModTextBox(GetDlgItem(IDC_COUNTPERBYTE), Game_AiCountPerBytes, false);
TxtBox->SetTextField(GetDlgItem(IDC_COUNTPERBYTE_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_OVER_CLOCK_MODIFIER), Game_OverClockModifier, false);
TxtBox->SetTextField(GetDlgItem(IDC_OVER_CLOCK_MODIFIER_TEXT));
if (!g_Settings->LoadBool(Setting_SyncViaAudioEnabled))
{
GetDlgItem(IDC_SYNC_AUDIO).EnableWindow(false);

View File

@ -31,7 +31,6 @@ class CGameGeneralPage :
COMMAND_ID_HANDLER_EX(IDC_UNALIGNED_DMA, CheckBoxChanged)
COMMAND_HANDLER_EX(IDC_VIREFRESH, EN_UPDATE, EditBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTPERBYTE, EN_UPDATE, EditBoxChanged)
COMMAND_HANDLER_EX(IDC_OVER_CLOCK_MODIFIER, EN_UPDATE, EditBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_GameGeneral };

View File

@ -217,17 +217,15 @@ BEGIN
EDITTEXT IDC_VIREFRESH,102,75,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "AI Count Per Byte:",IDC_COUNTPERBYTE_TEXT,6,90,91,10
EDITTEXT IDC_COUNTPERBYTE,102,88,109,12,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Over Clock Modifier",IDC_OVER_CLOCK_MODIFIER_TEXT,6,103,91,10
EDITTEXT IDC_OVER_CLOCK_MODIFIER,102,101,109,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,116,208,1
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,121,91,10
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,121,91,10
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,132,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,132,91,10
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,143,91,10
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,143,91,10
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,154,91,10
CONTROL "Unaligned DMA",IDC_UNALIGNED_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,154,91,10
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,103,208,1
CONTROL "32 Bit Engine",IDC_ROM_32BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,108,91,10
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,108,91,10
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,119,91,10
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,119,91,10
CONTROL "Delay DP Interrupt",IDC_DELAY_DP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,130,91,10
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,130,91,10
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,141,91,10
CONTROL "Unaligned DMA",IDC_UNALIGNED_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,141,91,10
END
IDD_Settings_Accelerator DIALOGEX 0, 0, 218, 183
@ -1279,6 +1277,33 @@ BEGIN
CONTROL "Unaligned DMA",IDC_UNALIGNED_DMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,81,91,10
END
IDD_Enhancement_Config DIALOGEX 0, 0, 206, 214
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Enhancements"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
GROUPBOX " Notes: ",IDC_NOTESFRAME,0,156,199,51
EDITTEXT IDC_NOTES,5,171,188,36,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | WS_VSCROLL
CONTROL "",IDC_ENHANCEMENTLIST,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,5,7,194,146
END
IDD_Enhancement_Edit DIALOGEX 0, 0, 206, 214
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit Enhancement"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Name:",IDC_NAME,7,9,25,10
EDITTEXT IDC_CODE_NAME,37,7,162,12,ES_AUTOHSCROLL
CONTROL "Overclock Modifier:",IDC_OVERCLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,20,74,10
EDITTEXT IDC_OVER_CLOCK_MODIFIER,90,20,109,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "On by default",IDC_AUTOON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,31,74,10
GROUPBOX "Notes",IDC_ENHANCEMENTNOTES,7,139,192,43
EDITTEXT IDC_NOTES,11,148,186,30,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,8,186,190,1
DEFPUSHBUTTON "OK",IDOK,94,193,50,14
PUSHBUTTON "Cancel",IDCANCEL,148,193,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
@ -1701,6 +1726,22 @@ BEGIN
TOPMARGIN, 4
BOTTOMMARGIN, 163
END
IDD_Enhancement_Config, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 199
TOPMARGIN, 7
BOTTOMMARGIN, 207
END
IDD_Enhancement_Edit, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 199
TOPMARGIN, 7
BOTTOMMARGIN, 207
END
END
#endif // APSTUDIO_INVOKED
@ -1737,6 +1778,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Edit Game Settings", ID_POPUPMENU_EDITSETTINGS
MENUITEM "Edit Cheats", ID_POPUPMENU_EDITCHEATS
MENUITEM "Choose Enhancement", ID_POPUPMENU_CHOOSEENHANCEMENT
END
END
@ -1805,6 +1847,17 @@ BEGIN
END
END
IDR_ENHANCEMENT_MENU MENU
BEGIN
POPUP "Popup"
BEGIN
MENUITEM "Add Enhancement...", ID_POPUP_ADDENHANCEMENT
MENUITEM "Edit", ID_POPUP_EDIT
MENUITEM SEPARATOR
MENUITEM "Delete", ID_POPUP_DELETE
END
END
/////////////////////////////////////////////////////////////////////////////
//
@ -1895,6 +1948,21 @@ BEGIN
0
END
IDD_Enhancement_Config AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_Enhancement_Edit AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_Settings_GameGeneral AFX_DIALOG_LAYOUT
BEGIN
0
END
/////////////////////////////////////////////////////////////////////////////
//

View File

@ -2,7 +2,11 @@
// Microsoft Visual C++ generated include file.
// Used by UIResources.rc
//
#define VERSION_REVISION 0
#define VER_VER_DEBUG 0
#define VERSION_MAJOR 2
#define IDAPPLY 3
#define VERSION_MINOR 4
#define IDI_PJ64_Icon 101
#define IDD_Rom_Information 104
#define IDD_Key_Prompt 108
@ -62,6 +66,7 @@
#define IDR_MENU1 186
#define IDR_SCRIPT_POPUP 186
#define IDR_OP_POPUP 187
#define IDR_ENHANCEMENT_MENU 188
#define IDD_Debugger_Stack 191
#define IDD_Debugger_RegSP 192
#define IDD_Debugger_RegMI 193
@ -73,6 +78,9 @@
#define IDD_Debugger_RegVI 199
#define IDD_Debugger_RegDD 200
#define IDD_Settings_Defaults 201
#define IDD_Enhancement_Config 202
#define IDD_Enhancement_Edit 203
#define VERSION_BUILD 771
#define IDC_MENU_ITEM_TEXT 1000
#define IDC_CLOSE_BUTTON 1001
#define IDC_LIST2 1003
@ -271,7 +279,6 @@
#define IDC_DIR_FRAME1 1101
#define IDC_ROM_FASTSP 1101
#define IDC_INFO 1101
#define IDC_OVER_CLOCK_MODIFIER_TEXT 1101
#define IDC_AUDIO_SIGNAL 1102
#define IDC_DIR_TEXTURE_FRAME 1102
#define IDC_ENTER_CODE 1102
@ -606,6 +613,10 @@
#define IDC_ROM_FIXEDAUDIO 1445
#define IDC_CHK_AUTOREFRESH 1446
#define IDC_SHOW_FILE_EXTENSIONS 1447
#define IDC_ENHANCEMENTLIST 1450
#define IDC_OVERCLOCK 1451
#define IDC_AUTOON 1452
#define IDC_ENHANCEMENTNOTES 1453
#define ID_POPUP_SHOWINMEMORYVIEWER 40005
#define ID_POPUPMENU_PLAYGAMEWITHDISK 40008
#define ID_POPUPMENU_ADDSYMBOL 40013
@ -633,17 +644,19 @@
#define ID_POPUPMENU_EDITSETTINGS 40153
#define ID_POPUPMENU_EDITCHEATS 40154
#define ID_POPUPMENU_ROMINFORMATION 40155
#define ID_POPUPMENU_CHOOSEENHANCEMENT 40156
#define ID_POPUP_ADDNEWCHEAT 40161
#define ID_POPUP_EDIT 40162
#define ID_POPUP_DELETE 40163
#define ID_POPUP_ADDENHANCEMENT 40164
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 199
#define _APS_NEXT_RESOURCE_VALUE 200
#define _APS_NEXT_COMMAND_VALUE 40043
#define _APS_NEXT_CONTROL_VALUE 1449
#define _APS_NEXT_CONTROL_VALUE 1454
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif

View File

@ -37,6 +37,7 @@ copy "%base_dir%\Bin\Release\Project64.exe" "%base_dir%\Bin\Package"
copy "%base_dir%\Config\Video.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Audio.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.cht" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.enh" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.rdb" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Config\Project64.rdx" "%base_dir%\Bin\Package\Config"
copy "%base_dir%\Lang\*.pj.Lang" "%base_dir%\Bin\Package\Lang"