line ends ?
This commit is contained in:
parent
2b2283d876
commit
a228a9d1f9
|
@ -1,35 +1,35 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/N64System/Recompiler/FunctionInfo.h>
|
#include <Project64-core/N64System/Recompiler/FunctionInfo.h>
|
||||||
|
|
||||||
class CFunctionMap
|
class CFunctionMap
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
typedef CCompiledFunc * PCCompiledFunc;
|
typedef CCompiledFunc * PCCompiledFunc;
|
||||||
typedef PCCompiledFunc * PCCompiledFunc_TABLE;
|
typedef PCCompiledFunc * PCCompiledFunc_TABLE;
|
||||||
|
|
||||||
CFunctionMap();
|
CFunctionMap();
|
||||||
~CFunctionMap();
|
~CFunctionMap();
|
||||||
|
|
||||||
bool AllocateMemory();
|
bool AllocateMemory();
|
||||||
void Reset(bool bAllocate);
|
void Reset(bool bAllocate);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PCCompiledFunc_TABLE * FunctionTable() const { return m_FunctionTable; }
|
PCCompiledFunc_TABLE * FunctionTable() const { return m_FunctionTable; }
|
||||||
PCCompiledFunc * JumpTable() const { return m_JumpTable; }
|
PCCompiledFunc * JumpTable() const { return m_JumpTable; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CleanBuffers();
|
void CleanBuffers();
|
||||||
|
|
||||||
PCCompiledFunc * m_JumpTable;
|
PCCompiledFunc * m_JumpTable;
|
||||||
PCCompiledFunc_TABLE * m_FunctionTable;
|
PCCompiledFunc_TABLE * m_FunctionTable;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/N64System/Recompiler/ExitInfo.h>
|
#include <Project64-core/N64System/Recompiler/ExitInfo.h>
|
||||||
|
|
||||||
struct CJumpInfo
|
struct CJumpInfo
|
||||||
{
|
{
|
||||||
typedef CExitInfo::EXIT_REASON EXIT_REASON;
|
typedef CExitInfo::EXIT_REASON EXIT_REASON;
|
||||||
CJumpInfo();
|
CJumpInfo();
|
||||||
|
|
||||||
uint32_t TargetPC;
|
uint32_t TargetPC;
|
||||||
uint32_t JumpPC;
|
uint32_t JumpPC;
|
||||||
stdstr BranchLabel;
|
stdstr BranchLabel;
|
||||||
uint32_t * LinkLocation;
|
uint32_t * LinkLocation;
|
||||||
uint32_t * LinkLocation2;
|
uint32_t * LinkLocation2;
|
||||||
bool FallThrough;
|
bool FallThrough;
|
||||||
bool PermLoop;
|
bool PermLoop;
|
||||||
bool DoneDelaySlot; //maybe deletable
|
bool DoneDelaySlot; //maybe deletable
|
||||||
CRegInfo RegSet;
|
CRegInfo RegSet;
|
||||||
EXIT_REASON ExitReason;
|
EXIT_REASON ExitReason;
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,89 +1,89 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
||||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||||
|
|
||||||
class CCodeSection;
|
class CCodeSection;
|
||||||
class CCodeBlock;
|
class CCodeBlock;
|
||||||
|
|
||||||
class LoopAnalysis
|
class LoopAnalysis
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section);
|
LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section);
|
||||||
~LoopAnalysis();
|
~LoopAnalysis();
|
||||||
|
|
||||||
bool SetupRegisterForLoop();
|
bool SetupRegisterForLoop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LoopAnalysis(); // Disable default constructor
|
LoopAnalysis(); // Disable default constructor
|
||||||
LoopAnalysis(const LoopAnalysis&); // Disable copy constructor
|
LoopAnalysis(const LoopAnalysis&); // Disable copy constructor
|
||||||
LoopAnalysis& operator=(const LoopAnalysis&); // Disable assignment
|
LoopAnalysis& operator=(const LoopAnalysis&); // Disable assignment
|
||||||
|
|
||||||
bool SetupEnterSection(CCodeSection * Section, bool & bChanged, bool & bSkipedSection);
|
bool SetupEnterSection(CCodeSection * Section, bool & bChanged, bool & bSkipedSection);
|
||||||
bool CheckLoopRegisterUsage(CCodeSection * Section);
|
bool CheckLoopRegisterUsage(CCodeSection * Section);
|
||||||
bool SyncRegState(CRegInfo & RegSet, const CRegInfo& SyncReg);
|
bool SyncRegState(CRegInfo & RegSet, const CRegInfo& SyncReg);
|
||||||
void SetJumpRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
void SetJumpRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
||||||
void SetContinueRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
void SetContinueRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
||||||
|
|
||||||
/********************** R4300i OpCodes: Special **********************/
|
/********************** R4300i OpCodes: Special **********************/
|
||||||
void SPECIAL_SLL();
|
void SPECIAL_SLL();
|
||||||
void SPECIAL_SRL();
|
void SPECIAL_SRL();
|
||||||
void SPECIAL_SRA();
|
void SPECIAL_SRA();
|
||||||
void SPECIAL_SLLV();
|
void SPECIAL_SLLV();
|
||||||
void SPECIAL_SRLV();
|
void SPECIAL_SRLV();
|
||||||
void SPECIAL_SRAV();
|
void SPECIAL_SRAV();
|
||||||
void SPECIAL_JR();
|
void SPECIAL_JR();
|
||||||
void SPECIAL_JALR();
|
void SPECIAL_JALR();
|
||||||
void SPECIAL_SYSCALL(CCodeSection * Section);
|
void SPECIAL_SYSCALL(CCodeSection * Section);
|
||||||
void SPECIAL_BREAK(CCodeSection * Section);
|
void SPECIAL_BREAK(CCodeSection * Section);
|
||||||
void SPECIAL_MFHI();
|
void SPECIAL_MFHI();
|
||||||
void SPECIAL_MTHI();
|
void SPECIAL_MTHI();
|
||||||
void SPECIAL_MFLO();
|
void SPECIAL_MFLO();
|
||||||
void SPECIAL_MTLO();
|
void SPECIAL_MTLO();
|
||||||
void SPECIAL_DSLLV();
|
void SPECIAL_DSLLV();
|
||||||
void SPECIAL_DSRLV();
|
void SPECIAL_DSRLV();
|
||||||
void SPECIAL_DSRAV();
|
void SPECIAL_DSRAV();
|
||||||
void SPECIAL_ADD();
|
void SPECIAL_ADD();
|
||||||
void SPECIAL_ADDU();
|
void SPECIAL_ADDU();
|
||||||
void SPECIAL_SUB();
|
void SPECIAL_SUB();
|
||||||
void SPECIAL_SUBU();
|
void SPECIAL_SUBU();
|
||||||
void SPECIAL_AND();
|
void SPECIAL_AND();
|
||||||
void SPECIAL_OR();
|
void SPECIAL_OR();
|
||||||
void SPECIAL_XOR();
|
void SPECIAL_XOR();
|
||||||
void SPECIAL_NOR();
|
void SPECIAL_NOR();
|
||||||
void SPECIAL_SLT();
|
void SPECIAL_SLT();
|
||||||
void SPECIAL_SLTU();
|
void SPECIAL_SLTU();
|
||||||
void SPECIAL_DADD();
|
void SPECIAL_DADD();
|
||||||
void SPECIAL_DADDU();
|
void SPECIAL_DADDU();
|
||||||
void SPECIAL_DSUB();
|
void SPECIAL_DSUB();
|
||||||
void SPECIAL_DSUBU();
|
void SPECIAL_DSUBU();
|
||||||
void SPECIAL_DSLL();
|
void SPECIAL_DSLL();
|
||||||
void SPECIAL_DSRL();
|
void SPECIAL_DSRL();
|
||||||
void SPECIAL_DSRA();
|
void SPECIAL_DSRA();
|
||||||
void SPECIAL_DSLL32();
|
void SPECIAL_DSLL32();
|
||||||
void SPECIAL_DSRL32();
|
void SPECIAL_DSRL32();
|
||||||
void SPECIAL_DSRA32();
|
void SPECIAL_DSRA32();
|
||||||
|
|
||||||
typedef std::map<int32_t, CRegInfo *> RegisterMap;
|
typedef std::map<int32_t, CRegInfo *> RegisterMap;
|
||||||
|
|
||||||
RegisterMap m_EnterRegisters;
|
RegisterMap m_EnterRegisters;
|
||||||
RegisterMap m_ContinueRegisters;
|
RegisterMap m_ContinueRegisters;
|
||||||
RegisterMap m_JumpRegisters;
|
RegisterMap m_JumpRegisters;
|
||||||
CCodeSection * m_EnterSection;
|
CCodeSection * m_EnterSection;
|
||||||
CCodeBlock * m_BlockInfo;
|
CCodeBlock * m_BlockInfo;
|
||||||
uint32_t m_PC;
|
uint32_t m_PC;
|
||||||
CRegInfo m_Reg;
|
CRegInfo m_Reg;
|
||||||
STEP_TYPE m_NextInstruction;
|
STEP_TYPE m_NextInstruction;
|
||||||
OPCODE m_Command;
|
OPCODE m_Command;
|
||||||
uint32_t m_Test;
|
uint32_t m_Test;
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,79 +1,79 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||||
#include <Project64-core/N64System/Recompiler/FunctionMapClass.h>
|
#include <Project64-core/N64System/Recompiler/FunctionMapClass.h>
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
||||||
#include <Project64-core/N64System/ProfilingClass.h>
|
#include <Project64-core/N64System/ProfilingClass.h>
|
||||||
|
|
||||||
class CRecompiler :
|
class CRecompiler :
|
||||||
protected CDebugSettings,
|
protected CDebugSettings,
|
||||||
public CRecompilerSettings,
|
public CRecompilerSettings,
|
||||||
public CFunctionMap,
|
public CFunctionMap,
|
||||||
private CRecompMemory,
|
private CRecompMemory,
|
||||||
private CSystemRegisters
|
private CSystemRegisters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum REMOVE_REASON
|
enum REMOVE_REASON
|
||||||
{
|
{
|
||||||
Remove_InitialCode,
|
Remove_InitialCode,
|
||||||
Remove_Cache,
|
Remove_Cache,
|
||||||
Remove_ProtectedMem,
|
Remove_ProtectedMem,
|
||||||
Remove_ValidateFunc,
|
Remove_ValidateFunc,
|
||||||
Remove_TLB,
|
Remove_TLB,
|
||||||
Remove_DMA,
|
Remove_DMA,
|
||||||
Remove_StoreInstruc,
|
Remove_StoreInstruc,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void(*DelayFunc)();
|
typedef void(*DelayFunc)();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRecompiler(CRegisters & Registers, CProfiling & Profile, bool & EndEmulation);
|
CRecompiler(CRegisters & Registers, CProfiling & Profile, bool & EndEmulation);
|
||||||
~CRecompiler();
|
~CRecompiler();
|
||||||
|
|
||||||
void Run();
|
void Run();
|
||||||
void Reset();
|
void Reset();
|
||||||
void ResetRecompCode(bool bAllocate);
|
void ResetRecompCode(bool bAllocate);
|
||||||
|
|
||||||
//Self modifying code methods
|
//Self modifying code methods
|
||||||
void ClearRecompCode_Virt(uint32_t VirtualAddress, int32_t length, REMOVE_REASON Reason);
|
void ClearRecompCode_Virt(uint32_t VirtualAddress, int32_t length, REMOVE_REASON Reason);
|
||||||
void ClearRecompCode_Phys(uint32_t PhysicalAddress, int32_t length, REMOVE_REASON Reason);
|
void ClearRecompCode_Phys(uint32_t PhysicalAddress, int32_t length, REMOVE_REASON Reason);
|
||||||
|
|
||||||
void ResetMemoryStackPos();
|
void ResetMemoryStackPos();
|
||||||
|
|
||||||
uint32_t& MemoryStackPos() { return m_MemoryStack; }
|
uint32_t& MemoryStackPos() { return m_MemoryStack; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CRecompiler(); // Disable default constructor
|
CRecompiler(); // Disable default constructor
|
||||||
CRecompiler(const CRecompiler&); // Disable copy constructor
|
CRecompiler(const CRecompiler&); // Disable copy constructor
|
||||||
CRecompiler& operator=(const CRecompiler&); // Disable assignment
|
CRecompiler& operator=(const CRecompiler&); // Disable assignment
|
||||||
|
|
||||||
CCompiledFunc * CompilerCode();
|
CCompiledFunc * CompilerCode();
|
||||||
|
|
||||||
// Main loops for the different look up methods
|
// Main loops for the different look up methods
|
||||||
void RecompilerMain_VirtualTable();
|
void RecompilerMain_VirtualTable();
|
||||||
void RecompilerMain_VirtualTable_validate();
|
void RecompilerMain_VirtualTable_validate();
|
||||||
void RecompilerMain_ChangeMemory();
|
void RecompilerMain_ChangeMemory();
|
||||||
void RecompilerMain_Lookup();
|
void RecompilerMain_Lookup();
|
||||||
void RecompilerMain_Lookup_TLB();
|
void RecompilerMain_Lookup_TLB();
|
||||||
void RecompilerMain_Lookup_validate();
|
void RecompilerMain_Lookup_validate();
|
||||||
void RecompilerMain_Lookup_validate_TLB();
|
void RecompilerMain_Lookup_validate_TLB();
|
||||||
|
|
||||||
CCompiledFuncList m_Functions;
|
CCompiledFuncList m_Functions;
|
||||||
CRegisters & m_Registers;
|
CRegisters & m_Registers;
|
||||||
CProfiling & m_Profile;
|
CProfiling & m_Profile;
|
||||||
bool & m_EndEmulation;
|
bool & m_EndEmulation;
|
||||||
uint32_t m_MemoryStack;
|
uint32_t m_MemoryStack;
|
||||||
|
|
||||||
//Quick access to registers
|
//Quick access to registers
|
||||||
uint32_t & PROGRAM_COUNTER;
|
uint32_t & PROGRAM_COUNTER;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,95 +1,95 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerClass.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerClass.h>
|
||||||
#include <Common/MemoryManagement.h>
|
#include <Common/MemoryManagement.h>
|
||||||
|
|
||||||
CRecompMemory::CRecompMemory() :
|
CRecompMemory::CRecompMemory() :
|
||||||
m_RecompCode(NULL),
|
m_RecompCode(NULL),
|
||||||
m_RecompSize(0)
|
m_RecompSize(0)
|
||||||
{
|
{
|
||||||
m_RecompPos = NULL;
|
m_RecompPos = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRecompMemory::~CRecompMemory()
|
CRecompMemory::~CRecompMemory()
|
||||||
{
|
{
|
||||||
if (m_RecompCode)
|
if (m_RecompCode)
|
||||||
{
|
{
|
||||||
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
|
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
|
||||||
m_RecompCode = NULL;
|
m_RecompCode = NULL;
|
||||||
}
|
}
|
||||||
m_RecompPos = NULL;
|
m_RecompPos = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRecompMemory::AllocateMemory()
|
bool CRecompMemory::AllocateMemory()
|
||||||
{
|
{
|
||||||
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
|
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
|
||||||
if (RecompCodeBase == NULL)
|
if (RecompCodeBase == NULL)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
|
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
|
||||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
|
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||||
if (m_RecompCode == NULL)
|
if (m_RecompCode == NULL)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
|
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
|
||||||
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
|
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
|
||||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_RecompSize = InitialCompileBufferSize;
|
m_RecompSize = InitialCompileBufferSize;
|
||||||
m_RecompPos = m_RecompCode;
|
m_RecompPos = m_RecompCode;
|
||||||
memset(m_RecompCode, 0, InitialCompileBufferSize);
|
memset(m_RecompCode, 0, InitialCompileBufferSize);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecompMemory::CheckRecompMem()
|
void CRecompMemory::CheckRecompMem()
|
||||||
{
|
{
|
||||||
uint32_t Size = (uint32_t)((uint8_t *)m_RecompPos - (uint8_t *)m_RecompCode);
|
uint32_t Size = (uint32_t)((uint8_t *)m_RecompPos - (uint8_t *)m_RecompCode);
|
||||||
if ((Size + 0x20000) < m_RecompSize)
|
if ((Size + 0x20000) < m_RecompSize)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_RecompSize == MaxCompileBufferSize)
|
if (m_RecompSize == MaxCompileBufferSize)
|
||||||
{
|
{
|
||||||
g_Recompiler->ResetRecompCode(true);
|
g_Recompiler->ResetRecompCode(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
|
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||||
if (MemAddr == NULL)
|
if (MemAddr == NULL)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
|
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
|
||||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||||
}
|
}
|
||||||
m_RecompSize += IncreaseCompileBufferSize;
|
m_RecompSize += IncreaseCompileBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecompMemory::Reset()
|
void CRecompMemory::Reset()
|
||||||
{
|
{
|
||||||
m_RecompPos = m_RecompCode;
|
m_RecompPos = m_RecompCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRecompMemory::ShowMemUsed()
|
void CRecompMemory::ShowMemUsed()
|
||||||
{
|
{
|
||||||
uint32_t Size = m_RecompPos - m_RecompCode;
|
uint32_t Size = m_RecompPos - m_RecompCode;
|
||||||
uint32_t MB = Size / 0x100000;
|
uint32_t MB = Size / 0x100000;
|
||||||
Size -= MB * 0x100000;
|
Size -= MB * 0x100000;
|
||||||
uint32_t KB = Size / 1024;
|
uint32_t KB = Size / 1024;
|
||||||
Size -= KB * 1024;
|
Size -= KB * 1024;
|
||||||
|
|
||||||
uint32_t TotalAvaliable = m_RecompSize / 0x100000;
|
uint32_t TotalAvaliable = m_RecompSize / 0x100000;
|
||||||
|
|
||||||
g_Notify->DisplayMessage(0, stdstr_f("Memory used: %d mb %-3d kb %-3d bytes Total Available: %d mb", MB, KB, Size, TotalAvaliable).c_str());
|
g_Notify->DisplayMessage(0, stdstr_f("Memory used: %d mb %-3d kb %-3d bytes Total Available: %d mb", MB, KB, Size, TotalAvaliable).c_str());
|
||||||
}
|
}
|
|
@ -1,38 +1,38 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||||
|
|
||||||
class CRecompMemory :
|
class CRecompMemory :
|
||||||
protected CX86Ops
|
protected CX86Ops
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CRecompMemory();
|
CRecompMemory();
|
||||||
~CRecompMemory();
|
~CRecompMemory();
|
||||||
|
|
||||||
bool AllocateMemory();
|
bool AllocateMemory();
|
||||||
void CheckRecompMem();
|
void CheckRecompMem();
|
||||||
void Reset();
|
void Reset();
|
||||||
void ShowMemUsed();
|
void ShowMemUsed();
|
||||||
|
|
||||||
uint8_t* RecompPos() const { return m_RecompPos; }
|
uint8_t* RecompPos() const { return m_RecompPos; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CRecompMemory(const CRecompMemory&); // Disable copy constructor
|
CRecompMemory(const CRecompMemory&); // Disable copy constructor
|
||||||
CRecompMemory& operator=(const CRecompMemory&); // Disable assignment
|
CRecompMemory& operator=(const CRecompMemory&); // Disable assignment
|
||||||
|
|
||||||
uint8_t * m_RecompCode;
|
uint8_t * m_RecompCode;
|
||||||
uint32_t m_RecompSize;
|
uint32_t m_RecompSize;
|
||||||
|
|
||||||
enum { MaxCompileBufferSize = 0x03C00000 };
|
enum { MaxCompileBufferSize = 0x03C00000 };
|
||||||
enum { InitialCompileBufferSize = 0x00500000 };
|
enum { InitialCompileBufferSize = 0x00500000 };
|
||||||
enum { IncreaseCompileBufferSize = 0x00100000 };
|
enum { IncreaseCompileBufferSize = 0x00100000 };
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,335 +1,335 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||||
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
||||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||||
#include <Project64-core/Settings/DebugSettings.h>
|
#include <Project64-core/Settings/DebugSettings.h>
|
||||||
#include <Project64-core/Settings/N64SystemSettings.h>
|
#include <Project64-core/Settings/N64SystemSettings.h>
|
||||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||||
|
|
||||||
class CCodeSection;
|
class CCodeSection;
|
||||||
|
|
||||||
class CRecompilerOps :
|
class CRecompilerOps :
|
||||||
protected CDebugSettings,
|
protected CDebugSettings,
|
||||||
protected CX86Ops,
|
protected CX86Ops,
|
||||||
protected CSystemRegisters,
|
protected CSystemRegisters,
|
||||||
protected CN64SystemSettings,
|
protected CN64SystemSettings,
|
||||||
protected CRecompilerSettings
|
protected CRecompilerSettings
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
enum BRANCH_TYPE
|
enum BRANCH_TYPE
|
||||||
{
|
{
|
||||||
BranchTypeCop1, BranchTypeRs, BranchTypeRsRt
|
BranchTypeCop1, BranchTypeRs, BranchTypeRsRt
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void ( * BranchFunction )();
|
typedef void ( * BranchFunction )();
|
||||||
|
|
||||||
/************************** Branch functions ************************/
|
/************************** Branch functions ************************/
|
||||||
static void Compile_Branch ( BranchFunction CompareFunc, BRANCH_TYPE BranchType, bool Link);
|
static void Compile_Branch ( BranchFunction CompareFunc, BRANCH_TYPE BranchType, bool Link);
|
||||||
static void Compile_BranchLikely ( BranchFunction CompareFunc, bool Link);
|
static void Compile_BranchLikely ( BranchFunction CompareFunc, bool Link);
|
||||||
static void BNE_Compare();
|
static void BNE_Compare();
|
||||||
static void BEQ_Compare();
|
static void BEQ_Compare();
|
||||||
static void BGTZ_Compare();
|
static void BGTZ_Compare();
|
||||||
static void BLEZ_Compare();
|
static void BLEZ_Compare();
|
||||||
static void BLTZ_Compare();
|
static void BLTZ_Compare();
|
||||||
static void BGEZ_Compare();
|
static void BGEZ_Compare();
|
||||||
static void COP1_BCF_Compare();
|
static void COP1_BCF_Compare();
|
||||||
static void COP1_BCT_Compare();
|
static void COP1_BCT_Compare();
|
||||||
|
|
||||||
/************************* OpCode functions *************************/
|
/************************* OpCode functions *************************/
|
||||||
static void J ();
|
static void J ();
|
||||||
static void JAL ();
|
static void JAL ();
|
||||||
static void ADDI ();
|
static void ADDI ();
|
||||||
static void ADDIU ();
|
static void ADDIU ();
|
||||||
static void SLTI ();
|
static void SLTI ();
|
||||||
static void SLTIU ();
|
static void SLTIU ();
|
||||||
static void ANDI ();
|
static void ANDI ();
|
||||||
static void ORI ();
|
static void ORI ();
|
||||||
static void XORI ();
|
static void XORI ();
|
||||||
static void LUI ();
|
static void LUI ();
|
||||||
static void DADDIU ();
|
static void DADDIU ();
|
||||||
// static void LDL ();
|
// static void LDL ();
|
||||||
// static void LDR ();
|
// static void LDR ();
|
||||||
// static void LB ();
|
// static void LB ();
|
||||||
// static void LH ();
|
// static void LH ();
|
||||||
// static void LWL ();
|
// static void LWL ();
|
||||||
// static void LW ();
|
// static void LW ();
|
||||||
// static void LBU ();
|
// static void LBU ();
|
||||||
// static void LHU ();
|
// static void LHU ();
|
||||||
// static void LWR ();
|
// static void LWR ();
|
||||||
// static void LWU (); //added by Witten
|
// static void LWU (); //added by Witten
|
||||||
// static void SB ();
|
// static void SB ();
|
||||||
// static void SH ();
|
// static void SH ();
|
||||||
// static void SWL ();
|
// static void SWL ();
|
||||||
// static void SW ();
|
// static void SW ();
|
||||||
// static void SWR ();
|
// static void SWR ();
|
||||||
// static void SDL ();
|
// static void SDL ();
|
||||||
// static void SDR ();
|
// static void SDR ();
|
||||||
static void CACHE ();
|
static void CACHE ();
|
||||||
// static void LL ();
|
// static void LL ();
|
||||||
// static void LWC1 ();
|
// static void LWC1 ();
|
||||||
// static void LDC1 ();
|
// static void LDC1 ();
|
||||||
// static void LD ();
|
// static void LD ();
|
||||||
// static void SC ();
|
// static void SC ();
|
||||||
// static void SWC1 ();
|
// static void SWC1 ();
|
||||||
// static void SDC1 ();
|
// static void SDC1 ();
|
||||||
// static void SD ();
|
// static void SD ();
|
||||||
|
|
||||||
/********************** R4300i OpCodes: Special **********************/
|
/********************** R4300i OpCodes: Special **********************/
|
||||||
static void SPECIAL_SLL ();
|
static void SPECIAL_SLL ();
|
||||||
static void SPECIAL_SRL ();
|
static void SPECIAL_SRL ();
|
||||||
static void SPECIAL_SRA ();
|
static void SPECIAL_SRA ();
|
||||||
static void SPECIAL_SLLV ();
|
static void SPECIAL_SLLV ();
|
||||||
static void SPECIAL_SRLV ();
|
static void SPECIAL_SRLV ();
|
||||||
static void SPECIAL_SRAV ();
|
static void SPECIAL_SRAV ();
|
||||||
static void SPECIAL_JR ();
|
static void SPECIAL_JR ();
|
||||||
static void SPECIAL_JALR ();
|
static void SPECIAL_JALR ();
|
||||||
static void SPECIAL_SYSCALL();
|
static void SPECIAL_SYSCALL();
|
||||||
static void SPECIAL_MFLO ();
|
static void SPECIAL_MFLO ();
|
||||||
static void SPECIAL_MTLO ();
|
static void SPECIAL_MTLO ();
|
||||||
static void SPECIAL_MFHI ();
|
static void SPECIAL_MFHI ();
|
||||||
static void SPECIAL_MTHI ();
|
static void SPECIAL_MTHI ();
|
||||||
static void SPECIAL_DSLLV ();
|
static void SPECIAL_DSLLV ();
|
||||||
static void SPECIAL_DSRLV ();
|
static void SPECIAL_DSRLV ();
|
||||||
static void SPECIAL_DSRAV ();
|
static void SPECIAL_DSRAV ();
|
||||||
static void SPECIAL_MULT ();
|
static void SPECIAL_MULT ();
|
||||||
static void SPECIAL_MULTU ();
|
static void SPECIAL_MULTU ();
|
||||||
static void SPECIAL_DIV ();
|
static void SPECIAL_DIV ();
|
||||||
static void SPECIAL_DIVU ();
|
static void SPECIAL_DIVU ();
|
||||||
static void SPECIAL_DMULT ();
|
static void SPECIAL_DMULT ();
|
||||||
static void SPECIAL_DMULTU ();
|
static void SPECIAL_DMULTU ();
|
||||||
static void SPECIAL_DDIV ();
|
static void SPECIAL_DDIV ();
|
||||||
static void SPECIAL_DDIVU ();
|
static void SPECIAL_DDIVU ();
|
||||||
static void SPECIAL_ADD ();
|
static void SPECIAL_ADD ();
|
||||||
static void SPECIAL_ADDU ();
|
static void SPECIAL_ADDU ();
|
||||||
static void SPECIAL_SUB ();
|
static void SPECIAL_SUB ();
|
||||||
static void SPECIAL_SUBU ();
|
static void SPECIAL_SUBU ();
|
||||||
static void SPECIAL_AND ();
|
static void SPECIAL_AND ();
|
||||||
static void SPECIAL_OR ();
|
static void SPECIAL_OR ();
|
||||||
static void SPECIAL_XOR ();
|
static void SPECIAL_XOR ();
|
||||||
static void SPECIAL_NOR ();
|
static void SPECIAL_NOR ();
|
||||||
static void SPECIAL_SLT ();
|
static void SPECIAL_SLT ();
|
||||||
static void SPECIAL_SLTU ();
|
static void SPECIAL_SLTU ();
|
||||||
static void SPECIAL_DADD ();
|
static void SPECIAL_DADD ();
|
||||||
static void SPECIAL_DADDU ();
|
static void SPECIAL_DADDU ();
|
||||||
static void SPECIAL_DSUB ();
|
static void SPECIAL_DSUB ();
|
||||||
static void SPECIAL_DSUBU ();
|
static void SPECIAL_DSUBU ();
|
||||||
static void SPECIAL_DSLL ();
|
static void SPECIAL_DSLL ();
|
||||||
static void SPECIAL_DSRL ();
|
static void SPECIAL_DSRL ();
|
||||||
static void SPECIAL_DSRA ();
|
static void SPECIAL_DSRA ();
|
||||||
static void SPECIAL_DSLL32 ();
|
static void SPECIAL_DSLL32 ();
|
||||||
static void SPECIAL_DSRL32 ();
|
static void SPECIAL_DSRL32 ();
|
||||||
static void SPECIAL_DSRA32 ();
|
static void SPECIAL_DSRA32 ();
|
||||||
|
|
||||||
/************************** COP0 functions **************************/
|
/************************** COP0 functions **************************/
|
||||||
static void COP0_MF ();
|
static void COP0_MF ();
|
||||||
static void COP0_MT ();
|
static void COP0_MT ();
|
||||||
|
|
||||||
/************************** COP0 CO functions ***********************/
|
/************************** COP0 CO functions ***********************/
|
||||||
static void COP0_CO_TLBR ();
|
static void COP0_CO_TLBR ();
|
||||||
static void COP0_CO_TLBWI ();
|
static void COP0_CO_TLBWI ();
|
||||||
static void COP0_CO_TLBWR ();
|
static void COP0_CO_TLBWR ();
|
||||||
static void COP0_CO_TLBP ();
|
static void COP0_CO_TLBP ();
|
||||||
static void COP0_CO_ERET ();
|
static void COP0_CO_ERET ();
|
||||||
|
|
||||||
/************************** COP1 functions **************************/
|
/************************** COP1 functions **************************/
|
||||||
static void COP1_MF ();
|
static void COP1_MF ();
|
||||||
static void COP1_DMF ();
|
static void COP1_DMF ();
|
||||||
static void COP1_CF ();
|
static void COP1_CF ();
|
||||||
static void COP1_MT ();
|
static void COP1_MT ();
|
||||||
static void COP1_DMT ();
|
static void COP1_DMT ();
|
||||||
static void COP1_CT ();
|
static void COP1_CT ();
|
||||||
|
|
||||||
/************************** COP1: S functions ************************/
|
/************************** COP1: S functions ************************/
|
||||||
static void COP1_S_ADD ();
|
static void COP1_S_ADD ();
|
||||||
static void COP1_S_SUB ();
|
static void COP1_S_SUB ();
|
||||||
static void COP1_S_MUL ();
|
static void COP1_S_MUL ();
|
||||||
static void COP1_S_DIV ();
|
static void COP1_S_DIV ();
|
||||||
static void COP1_S_ABS ();
|
static void COP1_S_ABS ();
|
||||||
static void COP1_S_NEG ();
|
static void COP1_S_NEG ();
|
||||||
static void COP1_S_SQRT ();
|
static void COP1_S_SQRT ();
|
||||||
static void COP1_S_MOV ();
|
static void COP1_S_MOV ();
|
||||||
static void COP1_S_TRUNC_L ();
|
static void COP1_S_TRUNC_L ();
|
||||||
static void COP1_S_CEIL_L (); //added by Witten
|
static void COP1_S_CEIL_L (); //added by Witten
|
||||||
static void COP1_S_FLOOR_L (); //added by Witten
|
static void COP1_S_FLOOR_L (); //added by Witten
|
||||||
static void COP1_S_ROUND_W ();
|
static void COP1_S_ROUND_W ();
|
||||||
static void COP1_S_TRUNC_W ();
|
static void COP1_S_TRUNC_W ();
|
||||||
static void COP1_S_CEIL_W (); //added by Witten
|
static void COP1_S_CEIL_W (); //added by Witten
|
||||||
static void COP1_S_FLOOR_W ();
|
static void COP1_S_FLOOR_W ();
|
||||||
static void COP1_S_CVT_D ();
|
static void COP1_S_CVT_D ();
|
||||||
static void COP1_S_CVT_W ();
|
static void COP1_S_CVT_W ();
|
||||||
static void COP1_S_CVT_L ();
|
static void COP1_S_CVT_L ();
|
||||||
static void COP1_S_CMP ();
|
static void COP1_S_CMP ();
|
||||||
|
|
||||||
/************************** COP1: D functions ************************/
|
/************************** COP1: D functions ************************/
|
||||||
static void COP1_D_ADD ();
|
static void COP1_D_ADD ();
|
||||||
static void COP1_D_SUB ();
|
static void COP1_D_SUB ();
|
||||||
static void COP1_D_MUL ();
|
static void COP1_D_MUL ();
|
||||||
static void COP1_D_DIV ();
|
static void COP1_D_DIV ();
|
||||||
static void COP1_D_ABS ();
|
static void COP1_D_ABS ();
|
||||||
static void COP1_D_NEG ();
|
static void COP1_D_NEG ();
|
||||||
static void COP1_D_SQRT ();
|
static void COP1_D_SQRT ();
|
||||||
static void COP1_D_MOV ();
|
static void COP1_D_MOV ();
|
||||||
static void COP1_D_TRUNC_L (); //added by Witten
|
static void COP1_D_TRUNC_L (); //added by Witten
|
||||||
static void COP1_D_CEIL_L (); //added by Witten
|
static void COP1_D_CEIL_L (); //added by Witten
|
||||||
static void COP1_D_FLOOR_L (); //added by Witten
|
static void COP1_D_FLOOR_L (); //added by Witten
|
||||||
static void COP1_D_ROUND_W ();
|
static void COP1_D_ROUND_W ();
|
||||||
static void COP1_D_TRUNC_W ();
|
static void COP1_D_TRUNC_W ();
|
||||||
static void COP1_D_CEIL_W (); //added by Witten
|
static void COP1_D_CEIL_W (); //added by Witten
|
||||||
static void COP1_D_FLOOR_W (); //added by Witten
|
static void COP1_D_FLOOR_W (); //added by Witten
|
||||||
static void COP1_D_CVT_S ();
|
static void COP1_D_CVT_S ();
|
||||||
static void COP1_D_CVT_W ();
|
static void COP1_D_CVT_W ();
|
||||||
static void COP1_D_CVT_L ();
|
static void COP1_D_CVT_L ();
|
||||||
static void COP1_D_CMP ();
|
static void COP1_D_CMP ();
|
||||||
|
|
||||||
/************************** COP1: W functions ************************/
|
/************************** COP1: W functions ************************/
|
||||||
static void COP1_W_CVT_S ();
|
static void COP1_W_CVT_S ();
|
||||||
static void COP1_W_CVT_D ();
|
static void COP1_W_CVT_D ();
|
||||||
|
|
||||||
/************************** COP1: L functions ************************/
|
/************************** COP1: L functions ************************/
|
||||||
static void COP1_L_CVT_S ();
|
static void COP1_L_CVT_S ();
|
||||||
static void COP1_L_CVT_D ();
|
static void COP1_L_CVT_D ();
|
||||||
|
|
||||||
/************************** Other functions **************************/
|
/************************** Other functions **************************/
|
||||||
static void UnknownOpcode ();
|
static void UnknownOpcode ();
|
||||||
|
|
||||||
static void BeforeCallDirect(CRegInfo & RegSet);
|
static void BeforeCallDirect(CRegInfo & RegSet);
|
||||||
static void AfterCallDirect(CRegInfo & RegSet);
|
static void AfterCallDirect(CRegInfo & RegSet);
|
||||||
static void EnterCodeBlock();
|
static void EnterCodeBlock();
|
||||||
static void ExitCodeBlock();
|
static void ExitCodeBlock();
|
||||||
static void CompileReadTLBMiss(uint32_t VirtualAddress, x86Reg LookUpReg);
|
static void CompileReadTLBMiss(uint32_t VirtualAddress, x86Reg LookUpReg);
|
||||||
static void CompileReadTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
static void CompileReadTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||||
static void CompileWriteTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
static void CompileWriteTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||||
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
||||||
static void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
|
static void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
|
||||||
static void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
static void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
||||||
static void ChangeDefaultRoundingModel();
|
static void ChangeDefaultRoundingModel();
|
||||||
static void OverflowDelaySlot(bool TestTimer);
|
static void OverflowDelaySlot(bool TestTimer);
|
||||||
|
|
||||||
static STEP_TYPE m_NextInstruction;
|
static STEP_TYPE m_NextInstruction;
|
||||||
static uint32_t m_CompilePC;
|
static uint32_t m_CompilePC;
|
||||||
static OPCODE m_Opcode;
|
static OPCODE m_Opcode;
|
||||||
static CRegInfo m_RegWorkingSet;
|
static CRegInfo m_RegWorkingSet;
|
||||||
static uint32_t m_BranchCompare;
|
static uint32_t m_BranchCompare;
|
||||||
static CCodeSection * m_Section;
|
static CCodeSection * m_Section;
|
||||||
|
|
||||||
/********* Helper Functions *********/
|
/********* Helper Functions *********/
|
||||||
typedef CRegInfo::REG_STATE REG_STATE;
|
typedef CRegInfo::REG_STATE REG_STATE;
|
||||||
|
|
||||||
static REG_STATE GetMipsRegState ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegState(Reg); }
|
static REG_STATE GetMipsRegState ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegState(Reg); }
|
||||||
static uint64_t GetMipsReg ( int32_t Reg ) { return m_RegWorkingSet.GetMipsReg(Reg); }
|
static uint64_t GetMipsReg ( int32_t Reg ) { return m_RegWorkingSet.GetMipsReg(Reg); }
|
||||||
static int64_t GetMipsReg_S ( int32_t Reg ) { return m_RegWorkingSet.GetMipsReg_S(Reg); }
|
static int64_t GetMipsReg_S ( int32_t Reg ) { return m_RegWorkingSet.GetMipsReg_S(Reg); }
|
||||||
static uint32_t GetMipsRegLo ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegLo(Reg); }
|
static uint32_t GetMipsRegLo ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegLo(Reg); }
|
||||||
static int32_t GetMipsRegLo_S ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegLo_S(Reg); }
|
static int32_t GetMipsRegLo_S ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegLo_S(Reg); }
|
||||||
static uint32_t GetMipsRegHi ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegHi(Reg); }
|
static uint32_t GetMipsRegHi ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegHi(Reg); }
|
||||||
static int32_t GetMipsRegHi_S ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegHi_S(Reg); }
|
static int32_t GetMipsRegHi_S ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegHi_S(Reg); }
|
||||||
static CX86Ops::x86Reg GetMipsRegMapLo ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegMapLo(Reg); }
|
static CX86Ops::x86Reg GetMipsRegMapLo ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegMapLo(Reg); }
|
||||||
static CX86Ops::x86Reg GetMipsRegMapHi ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegMapHi(Reg); }
|
static CX86Ops::x86Reg GetMipsRegMapHi ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegMapHi(Reg); }
|
||||||
|
|
||||||
static bool IsKnown ( int32_t Reg ) { return m_RegWorkingSet.IsKnown(Reg); }
|
static bool IsKnown ( int32_t Reg ) { return m_RegWorkingSet.IsKnown(Reg); }
|
||||||
static bool IsUnknown ( int32_t Reg ) { return m_RegWorkingSet.IsUnknown(Reg); }
|
static bool IsUnknown ( int32_t Reg ) { return m_RegWorkingSet.IsUnknown(Reg); }
|
||||||
static bool IsMapped ( int32_t Reg ) { return m_RegWorkingSet.IsMapped(Reg); }
|
static bool IsMapped ( int32_t Reg ) { return m_RegWorkingSet.IsMapped(Reg); }
|
||||||
static bool IsConst ( int32_t Reg ) { return m_RegWorkingSet.IsConst(Reg); }
|
static bool IsConst ( int32_t Reg ) { return m_RegWorkingSet.IsConst(Reg); }
|
||||||
static bool IsSigned ( int32_t Reg ) { return m_RegWorkingSet.IsSigned(Reg); }
|
static bool IsSigned ( int32_t Reg ) { return m_RegWorkingSet.IsSigned(Reg); }
|
||||||
static bool IsUnsigned ( int32_t Reg ) { return m_RegWorkingSet.IsUnsigned(Reg); }
|
static bool IsUnsigned ( int32_t Reg ) { return m_RegWorkingSet.IsUnsigned(Reg); }
|
||||||
static bool Is32Bit ( int32_t Reg ) { return m_RegWorkingSet.Is32Bit(Reg); }
|
static bool Is32Bit ( int32_t Reg ) { return m_RegWorkingSet.Is32Bit(Reg); }
|
||||||
static bool Is64Bit ( int32_t Reg ) { return m_RegWorkingSet.Is64Bit(Reg); }
|
static bool Is64Bit ( int32_t Reg ) { return m_RegWorkingSet.Is64Bit(Reg); }
|
||||||
static bool Is32BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
static bool Is32BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
||||||
static bool Is64BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
static bool Is64BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
||||||
|
|
||||||
static void FixRoundModel ( CRegInfo::FPU_ROUND RoundMethod )
|
static void FixRoundModel ( CRegInfo::FPU_ROUND RoundMethod )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.FixRoundModel(RoundMethod);
|
m_RegWorkingSet.FixRoundModel(RoundMethod);
|
||||||
}
|
}
|
||||||
static void ChangeFPURegFormat ( int32_t Reg, CRegInfo::FPU_STATE OldFormat, CRegInfo::FPU_STATE NewFormat, CRegInfo::FPU_ROUND RoundingModel )
|
static void ChangeFPURegFormat ( int32_t Reg, CRegInfo::FPU_STATE OldFormat, CRegInfo::FPU_STATE NewFormat, CRegInfo::FPU_ROUND RoundingModel )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.ChangeFPURegFormat(Reg,OldFormat,NewFormat,RoundingModel);
|
m_RegWorkingSet.ChangeFPURegFormat(Reg,OldFormat,NewFormat,RoundingModel);
|
||||||
}
|
}
|
||||||
static void Load_FPR_ToTop ( int32_t Reg, int32_t RegToLoad, CRegInfo::FPU_STATE Format)
|
static void Load_FPR_ToTop ( int32_t Reg, int32_t RegToLoad, CRegInfo::FPU_STATE Format)
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.Load_FPR_ToTop(Reg,RegToLoad,Format);
|
m_RegWorkingSet.Load_FPR_ToTop(Reg,RegToLoad,Format);
|
||||||
}
|
}
|
||||||
static bool RegInStack ( int32_t Reg, CRegInfo::FPU_STATE Format )
|
static bool RegInStack ( int32_t Reg, CRegInfo::FPU_STATE Format )
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.RegInStack(Reg,Format);
|
return m_RegWorkingSet.RegInStack(Reg,Format);
|
||||||
}
|
}
|
||||||
static x86FpuValues StackPosition ( int32_t Reg )
|
static x86FpuValues StackPosition ( int32_t Reg )
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.StackPosition(Reg);
|
return m_RegWorkingSet.StackPosition(Reg);
|
||||||
}
|
}
|
||||||
static void UnMap_AllFPRs()
|
static void UnMap_AllFPRs()
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.UnMap_AllFPRs();
|
m_RegWorkingSet.UnMap_AllFPRs();
|
||||||
}
|
}
|
||||||
static void UnMap_FPR ( uint32_t Reg, bool WriteBackValue )
|
static void UnMap_FPR ( uint32_t Reg, bool WriteBackValue )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.UnMap_FPR(Reg,WriteBackValue);
|
m_RegWorkingSet.UnMap_FPR(Reg,WriteBackValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static x86Reg FreeX86Reg()
|
static x86Reg FreeX86Reg()
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.FreeX86Reg();
|
return m_RegWorkingSet.FreeX86Reg();
|
||||||
}
|
}
|
||||||
static x86Reg Free8BitX86Reg()
|
static x86Reg Free8BitX86Reg()
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.Free8BitX86Reg();
|
return m_RegWorkingSet.Free8BitX86Reg();
|
||||||
}
|
}
|
||||||
static void Map_GPR_32bit ( int32_t Reg, bool SignValue, int32_t MipsRegToLoad )
|
static void Map_GPR_32bit ( int32_t Reg, bool SignValue, int32_t MipsRegToLoad )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.Map_GPR_32bit(Reg,SignValue,MipsRegToLoad);
|
m_RegWorkingSet.Map_GPR_32bit(Reg,SignValue,MipsRegToLoad);
|
||||||
}
|
}
|
||||||
static void Map_GPR_64bit ( int32_t Reg, int32_t MipsRegToLoad )
|
static void Map_GPR_64bit ( int32_t Reg, int32_t MipsRegToLoad )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.Map_GPR_64bit(Reg,MipsRegToLoad);
|
m_RegWorkingSet.Map_GPR_64bit(Reg,MipsRegToLoad);
|
||||||
}
|
}
|
||||||
static x86Reg Get_MemoryStack()
|
static x86Reg Get_MemoryStack()
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.Get_MemoryStack();
|
return m_RegWorkingSet.Get_MemoryStack();
|
||||||
}
|
}
|
||||||
static x86Reg Map_MemoryStack ( x86Reg Reg, bool bMapRegister, bool LoadValue = true )
|
static x86Reg Map_MemoryStack ( x86Reg Reg, bool bMapRegister, bool LoadValue = true )
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.Map_MemoryStack(Reg,bMapRegister,LoadValue);
|
return m_RegWorkingSet.Map_MemoryStack(Reg,bMapRegister,LoadValue);
|
||||||
}
|
}
|
||||||
static x86Reg Map_TempReg ( x86Reg Reg, int32_t MipsReg, bool LoadHiWord )
|
static x86Reg Map_TempReg ( x86Reg Reg, int32_t MipsReg, bool LoadHiWord )
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.Map_TempReg(Reg,MipsReg,LoadHiWord);
|
return m_RegWorkingSet.Map_TempReg(Reg,MipsReg,LoadHiWord);
|
||||||
}
|
}
|
||||||
static void ProtectGPR ( uint32_t Reg )
|
static void ProtectGPR ( uint32_t Reg )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.ProtectGPR(Reg);
|
m_RegWorkingSet.ProtectGPR(Reg);
|
||||||
}
|
}
|
||||||
static void UnProtectGPR ( uint32_t Reg )
|
static void UnProtectGPR ( uint32_t Reg )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.UnProtectGPR(Reg);
|
m_RegWorkingSet.UnProtectGPR(Reg);
|
||||||
}
|
}
|
||||||
static void ResetX86Protection()
|
static void ResetX86Protection()
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.ResetX86Protection();
|
m_RegWorkingSet.ResetX86Protection();
|
||||||
}
|
}
|
||||||
static x86Reg UnMap_TempReg()
|
static x86Reg UnMap_TempReg()
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.UnMap_TempReg();
|
return m_RegWorkingSet.UnMap_TempReg();
|
||||||
}
|
}
|
||||||
static void UnMap_GPR ( uint32_t Reg, bool WriteBackValue )
|
static void UnMap_GPR ( uint32_t Reg, bool WriteBackValue )
|
||||||
{
|
{
|
||||||
m_RegWorkingSet.UnMap_GPR(Reg,WriteBackValue);
|
m_RegWorkingSet.UnMap_GPR(Reg,WriteBackValue);
|
||||||
}
|
}
|
||||||
static bool UnMap_X86reg ( x86Reg Reg )
|
static bool UnMap_X86reg ( x86Reg Reg )
|
||||||
{
|
{
|
||||||
return m_RegWorkingSet.UnMap_X86reg(Reg);
|
return m_RegWorkingSet.UnMap_X86reg(Reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static uint32_t CompilePC() { return m_CompilePC; }
|
static uint32_t CompilePC() { return m_CompilePC; }
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,186 +1,186 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Settings/DebugSettings.h>
|
#include <Project64-core/Settings/DebugSettings.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||||
|
|
||||||
class CRegInfo :
|
class CRegInfo :
|
||||||
private CDebugSettings,
|
private CDebugSettings,
|
||||||
private CX86Ops,
|
private CX86Ops,
|
||||||
private CSystemRegisters
|
private CSystemRegisters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//enums
|
//enums
|
||||||
enum REG_STATE
|
enum REG_STATE
|
||||||
{
|
{
|
||||||
STATE_UNKNOWN = 0x00,
|
STATE_UNKNOWN = 0x00,
|
||||||
STATE_KNOWN_VALUE = 0x01,
|
STATE_KNOWN_VALUE = 0x01,
|
||||||
STATE_X86_MAPPED = 0x02,
|
STATE_X86_MAPPED = 0x02,
|
||||||
STATE_SIGN = 0x04,
|
STATE_SIGN = 0x04,
|
||||||
STATE_32BIT = 0x08,
|
STATE_32BIT = 0x08,
|
||||||
STATE_MODIFIED = 0x10,
|
STATE_MODIFIED = 0x10,
|
||||||
|
|
||||||
STATE_MAPPED_64 = (STATE_KNOWN_VALUE | STATE_X86_MAPPED), // = 3
|
STATE_MAPPED_64 = (STATE_KNOWN_VALUE | STATE_X86_MAPPED), // = 3
|
||||||
STATE_MAPPED_32_ZERO = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT), // = 11
|
STATE_MAPPED_32_ZERO = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT), // = 11
|
||||||
STATE_MAPPED_32_SIGN = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT | STATE_SIGN), // = 15
|
STATE_MAPPED_32_SIGN = (STATE_KNOWN_VALUE | STATE_X86_MAPPED | STATE_32BIT | STATE_SIGN), // = 15
|
||||||
|
|
||||||
STATE_CONST_32_ZERO = (STATE_KNOWN_VALUE | STATE_32BIT), // = 9
|
STATE_CONST_32_ZERO = (STATE_KNOWN_VALUE | STATE_32BIT), // = 9
|
||||||
STATE_CONST_32_SIGN = (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN), // = 13
|
STATE_CONST_32_SIGN = (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN), // = 13
|
||||||
STATE_CONST_64 = (STATE_KNOWN_VALUE), // = 1
|
STATE_CONST_64 = (STATE_KNOWN_VALUE), // = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum REG_MAPPED
|
enum REG_MAPPED
|
||||||
{
|
{
|
||||||
NotMapped = 0,
|
NotMapped = 0,
|
||||||
GPR_Mapped = 1,
|
GPR_Mapped = 1,
|
||||||
Temp_Mapped = 2,
|
Temp_Mapped = 2,
|
||||||
Stack_Mapped = 3,
|
Stack_Mapped = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FPU_STATE
|
enum FPU_STATE
|
||||||
{
|
{
|
||||||
FPU_Any = -1,
|
FPU_Any = -1,
|
||||||
FPU_Unknown = 0,
|
FPU_Unknown = 0,
|
||||||
FPU_Dword = 1,
|
FPU_Dword = 1,
|
||||||
FPU_Qword = 2,
|
FPU_Qword = 2,
|
||||||
FPU_Float = 3,
|
FPU_Float = 3,
|
||||||
FPU_Double = 4,
|
FPU_Double = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FPU_ROUND
|
enum FPU_ROUND
|
||||||
{
|
{
|
||||||
RoundUnknown = -1,
|
RoundUnknown = -1,
|
||||||
RoundDefault = 0,
|
RoundDefault = 0,
|
||||||
RoundTruncate = 1,
|
RoundTruncate = 1,
|
||||||
RoundNearest = 2,
|
RoundNearest = 2,
|
||||||
RoundDown = 3,
|
RoundDown = 3,
|
||||||
RoundUp = 4,
|
RoundUp = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRegInfo();
|
CRegInfo();
|
||||||
CRegInfo(const CRegInfo&);
|
CRegInfo(const CRegInfo&);
|
||||||
~CRegInfo();
|
~CRegInfo();
|
||||||
|
|
||||||
CRegInfo& operator=(const CRegInfo&);
|
CRegInfo& operator=(const CRegInfo&);
|
||||||
|
|
||||||
bool operator==(const CRegInfo& right) const;
|
bool operator==(const CRegInfo& right) const;
|
||||||
bool operator!=(const CRegInfo& right) const;
|
bool operator!=(const CRegInfo& right) const;
|
||||||
|
|
||||||
static REG_STATE ConstantsType(int64_t Value);
|
static REG_STATE ConstantsType(int64_t Value);
|
||||||
|
|
||||||
void FixRoundModel(FPU_ROUND RoundMethod);
|
void FixRoundModel(FPU_ROUND RoundMethod);
|
||||||
void ChangeFPURegFormat(int32_t Reg, FPU_STATE OldFormat, FPU_STATE NewFormat, FPU_ROUND RoundingModel);
|
void ChangeFPURegFormat(int32_t Reg, FPU_STATE OldFormat, FPU_STATE NewFormat, FPU_ROUND RoundingModel);
|
||||||
void Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Format);
|
void Load_FPR_ToTop(int32_t Reg, int32_t RegToLoad, FPU_STATE Format);
|
||||||
bool RegInStack(int32_t Reg, FPU_STATE Format);
|
bool RegInStack(int32_t Reg, FPU_STATE Format);
|
||||||
void UnMap_AllFPRs();
|
void UnMap_AllFPRs();
|
||||||
void UnMap_FPR(int32_t Reg, bool WriteBackValue);
|
void UnMap_FPR(int32_t Reg, bool WriteBackValue);
|
||||||
x86FpuValues StackPosition(int32_t Reg);
|
x86FpuValues StackPosition(int32_t Reg);
|
||||||
|
|
||||||
x86Reg FreeX86Reg();
|
x86Reg FreeX86Reg();
|
||||||
x86Reg Free8BitX86Reg();
|
x86Reg Free8BitX86Reg();
|
||||||
void Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsRegToLoad);
|
void Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsRegToLoad);
|
||||||
void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad);
|
void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad);
|
||||||
x86Reg Get_MemoryStack() const;
|
x86Reg Get_MemoryStack() const;
|
||||||
x86Reg Map_MemoryStack(x86Reg Reg, bool bMapRegister, bool LoadValue = true);
|
x86Reg Map_MemoryStack(x86Reg Reg, bool bMapRegister, bool LoadValue = true);
|
||||||
x86Reg Map_TempReg(x86Reg Reg, int32_t MipsReg, bool LoadHiWord);
|
x86Reg Map_TempReg(x86Reg Reg, int32_t MipsReg, bool LoadHiWord);
|
||||||
void ProtectGPR(uint32_t Reg);
|
void ProtectGPR(uint32_t Reg);
|
||||||
void UnProtectGPR(uint32_t Reg);
|
void UnProtectGPR(uint32_t Reg);
|
||||||
void ResetX86Protection();
|
void ResetX86Protection();
|
||||||
x86Reg UnMap_TempReg();
|
x86Reg UnMap_TempReg();
|
||||||
void UnMap_GPR(uint32_t Reg, bool WriteBackValue);
|
void UnMap_GPR(uint32_t Reg, bool WriteBackValue);
|
||||||
bool UnMap_X86reg(x86Reg Reg);
|
bool UnMap_X86reg(x86Reg Reg);
|
||||||
void WriteBackRegisters();
|
void WriteBackRegisters();
|
||||||
|
|
||||||
bool IsKnown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) != 0); }
|
bool IsKnown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) != 0); }
|
||||||
bool IsUnknown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) == 0); }
|
bool IsUnknown(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_KNOWN_VALUE) == 0); }
|
||||||
bool IsModified(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_MODIFIED) != 0); }
|
bool IsModified(int32_t Reg) const { return ((GetMipsRegState(Reg) & STATE_MODIFIED) != 0); }
|
||||||
|
|
||||||
bool IsMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
|
bool IsMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
|
||||||
bool IsConst(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == STATE_KNOWN_VALUE); }
|
bool IsConst(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_X86_MAPPED)) == STATE_KNOWN_VALUE); }
|
||||||
|
|
||||||
bool IsSigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == (STATE_KNOWN_VALUE | STATE_SIGN)); }
|
bool IsSigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == (STATE_KNOWN_VALUE | STATE_SIGN)); }
|
||||||
bool IsUnsigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == STATE_KNOWN_VALUE); }
|
bool IsUnsigned(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_SIGN)) == STATE_KNOWN_VALUE); }
|
||||||
|
|
||||||
bool Is32Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == (STATE_KNOWN_VALUE | STATE_32BIT)); }
|
bool Is32Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == (STATE_KNOWN_VALUE | STATE_32BIT)); }
|
||||||
bool Is64Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == STATE_KNOWN_VALUE); }
|
bool Is64Bit(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT)) == STATE_KNOWN_VALUE); }
|
||||||
|
|
||||||
bool Is32BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)); }
|
bool Is32BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)); }
|
||||||
bool Is64BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
|
bool Is64BitMapped(int32_t Reg) const { return ((GetMipsRegState(Reg) & (STATE_KNOWN_VALUE | STATE_32BIT | STATE_X86_MAPPED)) == (STATE_KNOWN_VALUE | STATE_X86_MAPPED)); }
|
||||||
|
|
||||||
REG_STATE GetMipsRegState(int32_t Reg) const { return m_MIPS_RegState[Reg]; }
|
REG_STATE GetMipsRegState(int32_t Reg) const { return m_MIPS_RegState[Reg]; }
|
||||||
uint64_t GetMipsReg(int32_t Reg) const { return m_MIPS_RegVal[Reg].UDW; }
|
uint64_t GetMipsReg(int32_t Reg) const { return m_MIPS_RegVal[Reg].UDW; }
|
||||||
int64_t GetMipsReg_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].DW; }
|
int64_t GetMipsReg_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].DW; }
|
||||||
uint32_t GetMipsRegLo(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[0]; }
|
uint32_t GetMipsRegLo(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[0]; }
|
||||||
int32_t GetMipsRegLo_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[0]; }
|
int32_t GetMipsRegLo_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[0]; }
|
||||||
uint32_t GetMipsRegHi(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[1]; }
|
uint32_t GetMipsRegHi(int32_t Reg) const { return m_MIPS_RegVal[Reg].UW[1]; }
|
||||||
int32_t GetMipsRegHi_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[1]; }
|
int32_t GetMipsRegHi_S(int32_t Reg) const { return m_MIPS_RegVal[Reg].W[1]; }
|
||||||
CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) const { return m_RegMapLo[Reg]; }
|
CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) const { return m_RegMapLo[Reg]; }
|
||||||
CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; }
|
CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; }
|
||||||
|
|
||||||
uint32_t GetX86MapOrder(x86Reg Reg) const { return m_x86reg_MapOrder[Reg]; }
|
uint32_t GetX86MapOrder(x86Reg Reg) const { return m_x86reg_MapOrder[Reg]; }
|
||||||
bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[Reg]; }
|
bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[Reg]; }
|
||||||
REG_MAPPED GetX86Mapped(x86Reg Reg) const { return m_x86reg_MappedTo[Reg]; }
|
REG_MAPPED GetX86Mapped(x86Reg Reg) const { return m_x86reg_MappedTo[Reg]; }
|
||||||
|
|
||||||
uint32_t GetBlockCycleCount() const { return m_CycleCount; }
|
uint32_t GetBlockCycleCount() const { return m_CycleCount; }
|
||||||
|
|
||||||
void SetMipsReg(int32_t Reg, uint64_t Value) { m_MIPS_RegVal[Reg].UDW = Value; }
|
void SetMipsReg(int32_t Reg, uint64_t Value) { m_MIPS_RegVal[Reg].UDW = Value; }
|
||||||
void SetMipsReg_S(int32_t Reg, int64_t Value) { m_MIPS_RegVal[Reg].DW = Value; }
|
void SetMipsReg_S(int32_t Reg, int64_t Value) { m_MIPS_RegVal[Reg].DW = Value; }
|
||||||
void SetMipsRegLo(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[0] = Value; }
|
void SetMipsRegLo(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[0] = Value; }
|
||||||
void SetMipsRegHi(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[1] = Value; }
|
void SetMipsRegHi(int32_t Reg, uint32_t Value) { m_MIPS_RegVal[Reg].UW[1] = Value; }
|
||||||
void SetMipsRegMapLo(int32_t GetMipsReg, x86Reg Reg) { m_RegMapLo[GetMipsReg] = Reg; }
|
void SetMipsRegMapLo(int32_t GetMipsReg, x86Reg Reg) { m_RegMapLo[GetMipsReg] = Reg; }
|
||||||
void SetMipsRegMapHi(int32_t GetMipsReg, x86Reg Reg) { m_RegMapHi[GetMipsReg] = Reg; }
|
void SetMipsRegMapHi(int32_t GetMipsReg, x86Reg Reg) { m_RegMapHi[GetMipsReg] = Reg; }
|
||||||
void SetMipsRegState(int32_t GetMipsReg, REG_STATE State) { m_MIPS_RegState[GetMipsReg] = State; }
|
void SetMipsRegState(int32_t GetMipsReg, REG_STATE State) { m_MIPS_RegState[GetMipsReg] = State; }
|
||||||
|
|
||||||
void SetX86MapOrder(x86Reg Reg, uint32_t Order) { m_x86reg_MapOrder[Reg] = Order; }
|
void SetX86MapOrder(x86Reg Reg, uint32_t Order) { m_x86reg_MapOrder[Reg] = Order; }
|
||||||
void SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; }
|
void SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; }
|
||||||
void SetX86Mapped(x86Reg Reg, REG_MAPPED Mapping) { m_x86reg_MappedTo[Reg] = Mapping; }
|
void SetX86Mapped(x86Reg Reg, REG_MAPPED Mapping) { m_x86reg_MappedTo[Reg] = Mapping; }
|
||||||
|
|
||||||
void SetBlockCycleCount(uint32_t CyleCount) { m_CycleCount = CyleCount; }
|
void SetBlockCycleCount(uint32_t CyleCount) { m_CycleCount = CyleCount; }
|
||||||
|
|
||||||
int32_t & StackTopPos() { return m_Stack_TopPos; }
|
int32_t & StackTopPos() { return m_Stack_TopPos; }
|
||||||
int32_t & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; }
|
int32_t & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; }
|
||||||
FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; }
|
FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; }
|
||||||
FPU_ROUND & FpuRoundingModel(int32_t Reg) { return m_x86fpu_RoundingModel[Reg]; }
|
FPU_ROUND & FpuRoundingModel(int32_t Reg) { return m_x86fpu_RoundingModel[Reg]; }
|
||||||
bool & FpuBeenUsed() { return m_Fpu_Used; }
|
bool & FpuBeenUsed() { return m_Fpu_Used; }
|
||||||
|
|
||||||
FPU_ROUND GetRoundingModel() const { return m_RoundingModel; }
|
FPU_ROUND GetRoundingModel() const { return m_RoundingModel; }
|
||||||
void SetRoundingModel(FPU_ROUND RoundingModel) { m_RoundingModel = RoundingModel; }
|
void SetRoundingModel(FPU_ROUND RoundingModel) { m_RoundingModel = RoundingModel; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char * RoundingModelName(FPU_ROUND RoundType);
|
const char * RoundingModelName(FPU_ROUND RoundType);
|
||||||
x86Reg UnMap_8BitTempReg();
|
x86Reg UnMap_8BitTempReg();
|
||||||
|
|
||||||
//r4k
|
//r4k
|
||||||
REG_STATE m_MIPS_RegState[32];
|
REG_STATE m_MIPS_RegState[32];
|
||||||
MIPS_DWORD m_MIPS_RegVal[32];
|
MIPS_DWORD m_MIPS_RegVal[32];
|
||||||
x86Reg m_RegMapHi[32];
|
x86Reg m_RegMapHi[32];
|
||||||
x86Reg m_RegMapLo[32];
|
x86Reg m_RegMapLo[32];
|
||||||
|
|
||||||
REG_MAPPED m_x86reg_MappedTo[10];
|
REG_MAPPED m_x86reg_MappedTo[10];
|
||||||
uint32_t m_x86reg_MapOrder[10];
|
uint32_t m_x86reg_MapOrder[10];
|
||||||
bool m_x86reg_Protected[10];
|
bool m_x86reg_Protected[10];
|
||||||
|
|
||||||
uint32_t m_CycleCount;
|
uint32_t m_CycleCount;
|
||||||
|
|
||||||
//FPU
|
//FPU
|
||||||
int32_t m_Stack_TopPos;
|
int32_t m_Stack_TopPos;
|
||||||
int32_t m_x86fpu_MappedTo[8];
|
int32_t m_x86fpu_MappedTo[8];
|
||||||
FPU_STATE m_x86fpu_State[8];
|
FPU_STATE m_x86fpu_State[8];
|
||||||
bool m_x86fpu_StateChanged[8];
|
bool m_x86fpu_StateChanged[8];
|
||||||
FPU_ROUND m_x86fpu_RoundingModel[8];
|
FPU_ROUND m_x86fpu_RoundingModel[8];
|
||||||
|
|
||||||
bool m_Fpu_Used;
|
bool m_Fpu_Used;
|
||||||
FPU_ROUND m_RoundingModel;
|
FPU_ROUND m_RoundingModel;
|
||||||
|
|
||||||
static uint32_t m_fpuControl;
|
static uint32_t m_fpuControl;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,173 +1,173 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SectionInfo.h"
|
#include "SectionInfo.h"
|
||||||
#include "JumpInfo.h"
|
#include "JumpInfo.h"
|
||||||
|
|
||||||
CJumpInfo::CJumpInfo()
|
CJumpInfo::CJumpInfo()
|
||||||
{
|
{
|
||||||
TargetPC = (uint32_t)-1;
|
TargetPC = (uint32_t)-1;
|
||||||
JumpPC = (uint32_t)-1;
|
JumpPC = (uint32_t)-1;
|
||||||
BranchLabel = "";
|
BranchLabel = "";
|
||||||
LinkLocation = NULL;
|
LinkLocation = NULL;
|
||||||
LinkLocation2 = NULL;
|
LinkLocation2 = NULL;
|
||||||
FallThrough = false;
|
FallThrough = false;
|
||||||
PermLoop = false;
|
PermLoop = false;
|
||||||
DoneDelaySlot = false;
|
DoneDelaySlot = false;
|
||||||
ExitReason = CExitInfo::Normal;
|
ExitReason = CExitInfo::Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef legacycode
|
#ifdef legacycode
|
||||||
|
|
||||||
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
||||||
{
|
{
|
||||||
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
|
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
|
||||||
if (!InLoop) { return false; }
|
if (!InLoop) { return false; }
|
||||||
if (!Parent->InLoop) { return false; }
|
if (!Parent->InLoop) { return false; }
|
||||||
if (Parent->ParentSection.empty()) { return false; }
|
if (Parent->ParentSection.empty()) { return false; }
|
||||||
if (this == Parent) { return true; }
|
if (this == Parent) { return true; }
|
||||||
if (Parent->Test == Test) { return true; }
|
if (Parent->Test == Test) { return true; }
|
||||||
Parent->Test = Test;
|
Parent->Test = Test;
|
||||||
|
|
||||||
for (SECTION_LIST::iterator iter = Parent->ParentSection.begin(); iter != Parent->ParentSection.end(); iter++)
|
for (SECTION_LIST::iterator iter = Parent->ParentSection.begin(); iter != Parent->ParentSection.end(); iter++)
|
||||||
{
|
{
|
||||||
CCodeSection * ParentSection = *iter;
|
CCodeSection * ParentSection = *iter;
|
||||||
if (!IsAllParentLoops(ParentSection,IgnoreIfCompiled,Test)) { return false; }
|
if (!IsAllParentLoops(ParentSection,IgnoreIfCompiled,Test)) { return false; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection )
|
void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection )
|
||||||
{
|
{
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION_LIST::iterator iter = ParentSection.begin();
|
SECTION_LIST::iterator iter = ParentSection.begin();
|
||||||
while ( iter != ParentSection.end())
|
while ( iter != ParentSection.end())
|
||||||
{
|
{
|
||||||
CCodeSection * ParentIter = *iter;
|
CCodeSection * ParentIter = *iter;
|
||||||
if (ParentIter == Parent && (Parent->ContinueSection != this || Parent->JumpSection != this))
|
if (ParentIter == Parent && (Parent->ContinueSection != this || Parent->JumpSection != this))
|
||||||
{
|
{
|
||||||
ParentSection.erase(iter);
|
ParentSection.erase(iter);
|
||||||
iter = ParentSection.begin();
|
iter = ParentSection.begin();
|
||||||
} else {
|
} else {
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||||
// {
|
// {
|
||||||
// if (!ContinueSection && Parent->ContinueSection == this)
|
// if (!ContinueSection && Parent->ContinueSection == this)
|
||||||
// {
|
// {
|
||||||
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (ContinueSection && Parent->ContinueSection == this)
|
if (ContinueSection && Parent->ContinueSection == this)
|
||||||
{
|
{
|
||||||
Parent->ContinueSection = NULL;
|
Parent->ContinueSection = NULL;
|
||||||
}
|
}
|
||||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||||
// {
|
// {
|
||||||
// if (ContinueSection && Parent->JumpSection == this)
|
// if (ContinueSection && Parent->JumpSection == this)
|
||||||
// {
|
// {
|
||||||
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (!ContinueSection && Parent->JumpSection == this)
|
if (!ContinueSection && Parent->JumpSection == this)
|
||||||
{
|
{
|
||||||
Parent->JumpSection = NULL;
|
Parent->JumpSection = NULL;
|
||||||
}
|
}
|
||||||
if (AllowDelete)
|
if (AllowDelete)
|
||||||
{
|
{
|
||||||
bool KillMe = true;
|
bool KillMe = true;
|
||||||
for (SECTION_LIST::iterator iter = ParentSection.begin(); iter != ParentSection.end(); iter++)
|
for (SECTION_LIST::iterator iter = ParentSection.begin(); iter != ParentSection.end(); iter++)
|
||||||
{
|
{
|
||||||
if (!IsAllParentLoops(*iter,false,GetNewTestValue()))
|
if (!IsAllParentLoops(*iter,false,GetNewTestValue()))
|
||||||
{
|
{
|
||||||
KillMe = false;
|
KillMe = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (KillMe)
|
if (KillMe)
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CCodeSection::~CCodeSection()
|
CCodeSection::~CCodeSection()
|
||||||
{
|
{
|
||||||
while (ParentSection.size() > 0)
|
while (ParentSection.size() > 0)
|
||||||
{
|
{
|
||||||
CCodeSection * Parent = *ParentSection.begin();
|
CCodeSection * Parent = *ParentSection.begin();
|
||||||
if (Parent->ContinueSection == this) { UnlinkParent(Parent, false, true); }
|
if (Parent->ContinueSection == this) { UnlinkParent(Parent, false, true); }
|
||||||
if (Parent->JumpSection == this) { UnlinkParent(Parent, false, false); }
|
if (Parent->JumpSection == this) { UnlinkParent(Parent, false, false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContinueSection)
|
if (ContinueSection)
|
||||||
{
|
{
|
||||||
ContinueSection->UnlinkParent(this, true, true);
|
ContinueSection->UnlinkParent(this, true, true);
|
||||||
if (ContinueSection)
|
if (ContinueSection)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
ContinueSection = NULL;
|
ContinueSection = NULL;
|
||||||
}
|
}
|
||||||
if (JumpSection)
|
if (JumpSection)
|
||||||
{
|
{
|
||||||
JumpSection->UnlinkParent(this, true, false);
|
JumpSection->UnlinkParent(this, true, false);
|
||||||
if (JumpSection)
|
if (JumpSection)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
JumpSection = NULL;
|
JumpSection = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CCodeSection::GetNewTestValue()
|
uint32_t CCodeSection::GetNewTestValue()
|
||||||
{
|
{
|
||||||
static uint32_t LastTest = 0;
|
static uint32_t LastTest = 0;
|
||||||
if (LastTest == 0xFFFFFFFF) { LastTest = 0; }
|
if (LastTest == 0xFFFFFFFF) { LastTest = 0; }
|
||||||
LastTest += 1;
|
LastTest += 1;
|
||||||
return LastTest;
|
return LastTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRegInfo::Initialize()
|
void CRegInfo::Initialize()
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
MIPS_RegState[0] = STATE_CONST_32_SIGN;
|
MIPS_RegState[0] = STATE_CONST_32_SIGN;
|
||||||
MIPS_RegVal[0].DW = 0;
|
MIPS_RegVal[0].DW = 0;
|
||||||
for (count = 1; count < 32; count ++ ) {
|
for (count = 1; count < 32; count ++ ) {
|
||||||
MIPS_RegState[count] = STATE_UNKNOWN;
|
MIPS_RegState[count] = STATE_UNKNOWN;
|
||||||
MIPS_RegVal[count].DW = 0;
|
MIPS_RegVal[count].DW = 0;
|
||||||
}
|
}
|
||||||
for (count = 0; count < 10; count ++ ) {
|
for (count = 0; count < 10; count ++ ) {
|
||||||
x86reg_MappedTo[count] = NotMapped;
|
x86reg_MappedTo[count] = NotMapped;
|
||||||
x86reg_Protected[count] = false;
|
x86reg_Protected[count] = false;
|
||||||
x86reg_MapOrder[count] = 0;
|
x86reg_MapOrder[count] = 0;
|
||||||
}
|
}
|
||||||
CycleCount = 0;
|
CycleCount = 0;
|
||||||
RandomModifier = 0;
|
RandomModifier = 0;
|
||||||
|
|
||||||
Stack_TopPos = 0;
|
Stack_TopPos = 0;
|
||||||
for (count = 0; count < 8; count ++ ) {
|
for (count = 0; count < 8; count ++ ) {
|
||||||
x86fpu_MappedTo[count] = -1;
|
x86fpu_MappedTo[count] = -1;
|
||||||
x86fpu_State[count] = FPU_Unkown;
|
x86fpu_State[count] = FPU_Unkown;
|
||||||
x86fpu_RoundingModel[count] = RoundDefault;
|
x86fpu_RoundingModel[count] = RoundDefault;
|
||||||
}
|
}
|
||||||
Fpu_Used = false;
|
Fpu_Used = false;
|
||||||
RoundingModel = RoundUnknown;
|
RoundingModel = RoundUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,23 +1,23 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CCodeSection;
|
class CCodeSection;
|
||||||
class CCodeBlock;
|
class CCodeBlock;
|
||||||
struct CJumpInfo;
|
struct CJumpInfo;
|
||||||
|
|
||||||
struct BLOCK_PARENT
|
struct BLOCK_PARENT
|
||||||
{
|
{
|
||||||
CCodeSection * Parent;
|
CCodeSection * Parent;
|
||||||
CJumpInfo * JumpInfo;
|
CJumpInfo * JumpInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<BLOCK_PARENT> BLOCK_PARENT_LIST;
|
typedef std::vector<BLOCK_PARENT> BLOCK_PARENT_LIST;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,304 +1,304 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CX86Ops
|
class CX86Ops
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum x86Reg
|
enum x86Reg
|
||||||
{
|
{
|
||||||
x86_EAX = 0,
|
x86_EAX = 0,
|
||||||
x86_EBX = 3,
|
x86_EBX = 3,
|
||||||
x86_ECX = 1,
|
x86_ECX = 1,
|
||||||
x86_EDX = 2,
|
x86_EDX = 2,
|
||||||
x86_ESI = 6,
|
x86_ESI = 6,
|
||||||
x86_EDI = 7,
|
x86_EDI = 7,
|
||||||
x86_EBP = 5,
|
x86_EBP = 5,
|
||||||
x86_ESP = 4,
|
x86_ESP = 4,
|
||||||
x86_Any8Bit = -3,
|
x86_Any8Bit = -3,
|
||||||
x86_Any = -2,
|
x86_Any = -2,
|
||||||
x86_Unknown = -1,
|
x86_Unknown = -1,
|
||||||
|
|
||||||
x86_AL = 0, x86_BL = 3, x86_CL = 1, x86_DL = 2,
|
x86_AL = 0, x86_BL = 3, x86_CL = 1, x86_DL = 2,
|
||||||
x86_AH = 4, x86_BH = 7, x86_CH = 5, x86_DH = 6
|
x86_AH = 4, x86_BH = 7, x86_CH = 5, x86_DH = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
enum x86FpuValues
|
enum x86FpuValues
|
||||||
{
|
{
|
||||||
x86_ST_Unknown = -1,
|
x86_ST_Unknown = -1,
|
||||||
x86_ST0 = 0,
|
x86_ST0 = 0,
|
||||||
x86_ST1 = 1,
|
x86_ST1 = 1,
|
||||||
x86_ST2 = 2,
|
x86_ST2 = 2,
|
||||||
x86_ST3 = 3,
|
x86_ST3 = 3,
|
||||||
x86_ST4 = 4,
|
x86_ST4 = 4,
|
||||||
x86_ST5 = 5,
|
x86_ST5 = 5,
|
||||||
x86_ST6 = 6,
|
x86_ST6 = 6,
|
||||||
x86_ST7 = 7
|
x86_ST7 = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Multipler
|
enum Multipler
|
||||||
{
|
{
|
||||||
Multip_x1 = 1,
|
Multip_x1 = 1,
|
||||||
Multip_x2 = 2,
|
Multip_x2 = 2,
|
||||||
Multip_x4 = 4,
|
Multip_x4 = 4,
|
||||||
Multip_x8 = 8
|
Multip_x8 = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
static x86Reg x86_Registers[8];
|
static x86Reg x86_Registers[8];
|
||||||
static const char * x86_Name(x86Reg Reg);
|
static const char * x86_Name(x86Reg Reg);
|
||||||
static const char * x86_ByteName(x86Reg Reg);
|
static const char * x86_ByteName(x86Reg Reg);
|
||||||
static const char * x86_HalfName(x86Reg Reg);
|
static const char * x86_HalfName(x86Reg Reg);
|
||||||
static const char * fpu_Name(x86FpuValues Reg);
|
static const char * fpu_Name(x86FpuValues Reg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//Logging Functions
|
//Logging Functions
|
||||||
static void WriteX86Comment(const char * Comment);
|
static void WriteX86Comment(const char * Comment);
|
||||||
static void WriteX86Label(const char * Label);
|
static void WriteX86Label(const char * Label);
|
||||||
|
|
||||||
static void AdcX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
static void AdcX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void AdcConstToVariable(void *Variable, const char * VariableName, uint8_t Constant);
|
static void AdcConstToVariable(void *Variable, const char * VariableName, uint8_t Constant);
|
||||||
static void AdcConstToX86Reg(x86Reg Reg, uint32_t Const);
|
static void AdcConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||||
static void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
static void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void AddConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
static void AddConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||||
static void AddConstToX86Reg(x86Reg Reg, uint32_t Const);
|
static void AddConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||||
static void AddVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
static void AddVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void AddX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
static void AddX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void AddX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void AddX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void AndConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
static void AndConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||||
static void AndConstToX86Reg(x86Reg Reg, uint32_t Const);
|
static void AndConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||||
static void AndVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
static void AndVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
||||||
static void AndVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, Multipler Multiply);
|
static void AndVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, Multipler Multiply);
|
||||||
static void AndX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void AndX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void X86HardBreakPoint();
|
static void X86HardBreakPoint();
|
||||||
static void X86BreakPoint(const char * FileName, int32_t LineNumber);
|
static void X86BreakPoint(const char * FileName, int32_t LineNumber);
|
||||||
static void Call_Direct(void * FunctAddress, const char * FunctName);
|
static void Call_Direct(void * FunctAddress, const char * FunctName);
|
||||||
static void Call_Indirect(void * FunctAddress, const char * FunctName);
|
static void Call_Indirect(void * FunctAddress, const char * FunctName);
|
||||||
static void CompConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
static void CompConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||||
static void CompConstToX86reg(x86Reg Reg, uint32_t Const);
|
static void CompConstToX86reg(x86Reg Reg, uint32_t Const);
|
||||||
static void CompConstToX86regPointer(x86Reg Reg, uint32_t Const);
|
static void CompConstToX86regPointer(x86Reg Reg, uint32_t Const);
|
||||||
static void CompX86regToVariable(x86Reg Reg, void * Variable, const char * VariableName);
|
static void CompX86regToVariable(x86Reg Reg, void * Variable, const char * VariableName);
|
||||||
static void CompVariableToX86reg(x86Reg Reg, void * Variable, const char * VariableName);
|
static void CompVariableToX86reg(x86Reg Reg, void * Variable, const char * VariableName);
|
||||||
static void CompX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void CompX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void DecX86reg(x86Reg Reg);
|
static void DecX86reg(x86Reg Reg);
|
||||||
static void DivX86reg(x86Reg reg);
|
static void DivX86reg(x86Reg reg);
|
||||||
static void idivX86reg(x86Reg reg);
|
static void idivX86reg(x86Reg reg);
|
||||||
static void imulX86reg(x86Reg reg);
|
static void imulX86reg(x86Reg reg);
|
||||||
static void IncX86reg(x86Reg Reg);
|
static void IncX86reg(x86Reg Reg);
|
||||||
static void JaeLabel8(const char * Label, uint8_t Value);
|
static void JaeLabel8(const char * Label, uint8_t Value);
|
||||||
static void JaeLabel32(const char * Label, uint32_t Value);
|
static void JaeLabel32(const char * Label, uint32_t Value);
|
||||||
static void JaLabel8(const char * Label, uint8_t Value);
|
static void JaLabel8(const char * Label, uint8_t Value);
|
||||||
static void JaLabel32(const char * Label, uint32_t Value);
|
static void JaLabel32(const char * Label, uint32_t Value);
|
||||||
static void JbLabel8(const char * Label, uint8_t Value);
|
static void JbLabel8(const char * Label, uint8_t Value);
|
||||||
static void JbLabel32(const char * Label, uint32_t Value);
|
static void JbLabel32(const char * Label, uint32_t Value);
|
||||||
static void JecxzLabel8(const char * Label, uint8_t Value);
|
static void JecxzLabel8(const char * Label, uint8_t Value);
|
||||||
static void JeLabel8(const char * Label, uint8_t Value);
|
static void JeLabel8(const char * Label, uint8_t Value);
|
||||||
static void JeLabel32(const char * Label, uint32_t Value);
|
static void JeLabel32(const char * Label, uint32_t Value);
|
||||||
static void JgeLabel32(const char * Label, uint32_t Value);
|
static void JgeLabel32(const char * Label, uint32_t Value);
|
||||||
static void JgLabel8(const char * Label, uint8_t Value);
|
static void JgLabel8(const char * Label, uint8_t Value);
|
||||||
static void JgLabel32(const char * Label, uint32_t Value);
|
static void JgLabel32(const char * Label, uint32_t Value);
|
||||||
static void JleLabel8(const char * Label, uint8_t Value);
|
static void JleLabel8(const char * Label, uint8_t Value);
|
||||||
static void JleLabel32(const char * Label, uint32_t Value);
|
static void JleLabel32(const char * Label, uint32_t Value);
|
||||||
static void JlLabel8(const char * Label, uint8_t Value);
|
static void JlLabel8(const char * Label, uint8_t Value);
|
||||||
static void JlLabel32(const char * Label, uint32_t Value);
|
static void JlLabel32(const char * Label, uint32_t Value);
|
||||||
static void JmpDirectReg(x86Reg reg);
|
static void JmpDirectReg(x86Reg reg);
|
||||||
static void JmpIndirectLabel32(const char * Label, uint32_t location);
|
static void JmpIndirectLabel32(const char * Label, uint32_t location);
|
||||||
static void JmpIndirectReg(x86Reg reg);
|
static void JmpIndirectReg(x86Reg reg);
|
||||||
static void JmpLabel8(const char * Label, uint8_t Value);
|
static void JmpLabel8(const char * Label, uint8_t Value);
|
||||||
static void JmpLabel32(const char * Label, uint32_t Value);
|
static void JmpLabel32(const char * Label, uint32_t Value);
|
||||||
static void JneLabel8(const char * Label, uint8_t Value);
|
static void JneLabel8(const char * Label, uint8_t Value);
|
||||||
static void JneLabel32(const char * Label, uint32_t Value);
|
static void JneLabel32(const char * Label, uint32_t Value);
|
||||||
static void JnsLabel8(const char * Label, uint8_t Value);
|
static void JnsLabel8(const char * Label, uint8_t Value);
|
||||||
static void JnsLabel32(const char * Label, uint32_t Value);
|
static void JnsLabel32(const char * Label, uint32_t Value);
|
||||||
static void JnzLabel8(const char * Label, uint8_t Value);
|
static void JnzLabel8(const char * Label, uint8_t Value);
|
||||||
static void JnzLabel32(const char * Label, uint32_t Value);
|
static void JnzLabel32(const char * Label, uint32_t Value);
|
||||||
static void JsLabel32(const char * Label, uint32_t Value);
|
static void JsLabel32(const char * Label, uint32_t Value);
|
||||||
static void JzLabel8(const char * Label, uint8_t Value);
|
static void JzLabel8(const char * Label, uint8_t Value);
|
||||||
static void JzLabel32(const char * Label, uint32_t Value);
|
static void JzLabel32(const char * Label, uint32_t Value);
|
||||||
static void LeaRegReg(x86Reg RegDest, x86Reg RegSrc, uint32_t Const, Multipler multiplier);
|
static void LeaRegReg(x86Reg RegDest, x86Reg RegSrc, uint32_t Const, Multipler multiplier);
|
||||||
static void LeaRegReg2(x86Reg RegDest, x86Reg RegSrc, x86Reg RegSrc2, Multipler multiplier);
|
static void LeaRegReg2(x86Reg RegDest, x86Reg RegSrc, x86Reg RegSrc2, Multipler multiplier);
|
||||||
static void LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int32_t offset);
|
static void LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int32_t offset);
|
||||||
static void MoveConstByteToN64Mem(uint8_t Const, x86Reg AddrReg);
|
static void MoveConstByteToN64Mem(uint8_t Const, x86Reg AddrReg);
|
||||||
static void MoveConstHalfToN64Mem(uint16_t Const, x86Reg AddrReg);
|
static void MoveConstHalfToN64Mem(uint16_t Const, x86Reg AddrReg);
|
||||||
static void MoveConstByteToVariable(uint8_t Const, void * Variable, const char * VariableName);
|
static void MoveConstByteToVariable(uint8_t Const, void * Variable, const char * VariableName);
|
||||||
static void MoveConstByteToX86regPointer(uint8_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
static void MoveConstByteToX86regPointer(uint8_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||||
static void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
|
static void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
|
||||||
static void MoveConstHalfToX86regPointer(uint16_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
static void MoveConstHalfToX86regPointer(uint16_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||||
static void MoveConstToMemoryDisp(uint32_t Const, x86Reg AddrReg, uint32_t Disp);
|
static void MoveConstToMemoryDisp(uint32_t Const, x86Reg AddrReg, uint32_t Disp);
|
||||||
static void MoveConstToN64Mem(uint32_t Const, x86Reg AddrReg);
|
static void MoveConstToN64Mem(uint32_t Const, x86Reg AddrReg);
|
||||||
static void MoveConstToN64MemDisp(uint32_t Const, x86Reg AddrReg, uint8_t Disp);
|
static void MoveConstToN64MemDisp(uint32_t Const, x86Reg AddrReg, uint8_t Disp);
|
||||||
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||||
static void MoveConstToX86Pointer(uint32_t Const, x86Reg X86Pointer);
|
static void MoveConstToX86Pointer(uint32_t Const, x86Reg X86Pointer);
|
||||||
static void MoveConstToX86reg(uint32_t Const, x86Reg reg);
|
static void MoveConstToX86reg(uint32_t Const, x86Reg reg);
|
||||||
static void MoveConstToX86regPointer(uint32_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
static void MoveConstToX86regPointer(uint32_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||||
static void MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
static void MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||||
static void MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg);
|
static void MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
static void MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
static void MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
static void MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||||
static void MoveSxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
static void MoveSxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||||
static void MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
static void MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
static void MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveSxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveSxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MoveSxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveSxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MoveVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, int32_t Multiplier);
|
static void MoveVariableDispToX86Reg(void * Variable, const char * VariableName, x86Reg Reg, x86Reg AddrReg, int32_t Multiplier);
|
||||||
static void MoveVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MoveVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MoveVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MoveX86PointerToX86reg(x86Reg reg, x86Reg X86Pointer);
|
static void MoveX86PointerToX86reg(x86Reg reg, x86Reg X86Pointer);
|
||||||
static void MoveX86PointerToX86regDisp(x86Reg reg, x86Reg X86Pointer, uint8_t Disp);
|
static void MoveX86PointerToX86regDisp(x86Reg reg, x86Reg X86Pointer, uint8_t Disp);
|
||||||
static void MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg);
|
static void MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
static void MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void MoveX86regByteToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
static void MoveX86regByteToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||||
static void MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg);
|
static void MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
static void MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void MoveX86regHalfToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
static void MoveX86regHalfToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||||
static void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
static void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||||
static void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg, uint8_t offset);
|
static void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg, uint8_t offset);
|
||||||
static void MoveX86regToMemory(x86Reg reg, x86Reg AddrReg, uint32_t Disp);
|
static void MoveX86regToMemory(x86Reg reg, x86Reg AddrReg, uint32_t Disp);
|
||||||
static void MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg);
|
static void MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
static void MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||||
static void MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
static void MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
static void MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||||
static void MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer);
|
static void MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer);
|
||||||
static void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
static void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||||
static void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
static void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||||
static void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
static void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||||
static void MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
static void MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
static void MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||||
static void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
static void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
static void MulX86reg(x86Reg reg);
|
static void MulX86reg(x86Reg reg);
|
||||||
static void NotX86Reg(x86Reg Reg);
|
static void NotX86Reg(x86Reg Reg);
|
||||||
static void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
static void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||||
static void OrConstToX86Reg(uint32_t Const, x86Reg reg);
|
static void OrConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||||
static void OrVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
static void OrVariableToX86Reg(void * Variable, const char * VariableName, x86Reg Reg);
|
||||||
static void OrX86RegToVariable(void * Variable, const char * VariableName, x86Reg Reg);
|
static void OrX86RegToVariable(void * Variable, const char * VariableName, x86Reg Reg);
|
||||||
static void OrX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void OrX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void Push(x86Reg reg);
|
static void Push(x86Reg reg);
|
||||||
static void Pushad();
|
static void Pushad();
|
||||||
static void PushImm32(uint32_t Value);
|
static void PushImm32(uint32_t Value);
|
||||||
static void PushImm32(const char * String, uint32_t Value);
|
static void PushImm32(const char * String, uint32_t Value);
|
||||||
static void Pop(x86Reg reg);
|
static void Pop(x86Reg reg);
|
||||||
static void Popad();
|
static void Popad();
|
||||||
static void Ret();
|
static void Ret();
|
||||||
static void Seta(x86Reg reg);
|
static void Seta(x86Reg reg);
|
||||||
static void Setae(x86Reg reg);
|
static void Setae(x86Reg reg);
|
||||||
static void SetaVariable(void * Variable, const char * VariableName);
|
static void SetaVariable(void * Variable, const char * VariableName);
|
||||||
static void Setb(x86Reg reg);
|
static void Setb(x86Reg reg);
|
||||||
static void SetbVariable(void * Variable, const char * VariableName);
|
static void SetbVariable(void * Variable, const char * VariableName);
|
||||||
static void Setg(x86Reg reg);
|
static void Setg(x86Reg reg);
|
||||||
static void SetgVariable(void * Variable, const char * VariableName);
|
static void SetgVariable(void * Variable, const char * VariableName);
|
||||||
static void Setl(x86Reg reg);
|
static void Setl(x86Reg reg);
|
||||||
static void SetlVariable(void * Variable, const char * VariableName);
|
static void SetlVariable(void * Variable, const char * VariableName);
|
||||||
static void Setz(x86Reg reg);
|
static void Setz(x86Reg reg);
|
||||||
static void Setnz(x86Reg reg);
|
static void Setnz(x86Reg reg);
|
||||||
static void ShiftLeftDouble(x86Reg Destination, x86Reg Source);
|
static void ShiftLeftDouble(x86Reg Destination, x86Reg Source);
|
||||||
static void ShiftLeftDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
static void ShiftLeftDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||||
static void ShiftLeftSign(x86Reg reg);
|
static void ShiftLeftSign(x86Reg reg);
|
||||||
static void ShiftLeftSignImmed(x86Reg reg, uint8_t Immediate);
|
static void ShiftLeftSignImmed(x86Reg reg, uint8_t Immediate);
|
||||||
static void ShiftRightDouble(x86Reg Destination, x86Reg Source);
|
static void ShiftRightDouble(x86Reg Destination, x86Reg Source);
|
||||||
static void ShiftRightDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
static void ShiftRightDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||||
static void ShiftRightSign(x86Reg reg);
|
static void ShiftRightSign(x86Reg reg);
|
||||||
static void ShiftRightSignImmed(x86Reg reg, uint8_t Immediate);
|
static void ShiftRightSignImmed(x86Reg reg, uint8_t Immediate);
|
||||||
static void ShiftRightUnsign(x86Reg reg);
|
static void ShiftRightUnsign(x86Reg reg);
|
||||||
static void ShiftRightUnsignImmed(x86Reg reg, uint8_t Immediate);
|
static void ShiftRightUnsignImmed(x86Reg reg, uint8_t Immediate);
|
||||||
static void SbbConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
static void SbbConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||||
static void SbbVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
static void SbbVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void SbbX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void SbbX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
|
static void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||||
static void SubConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
static void SubConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||||
static void SubVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
static void SubVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||||
static void SubX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void SubX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void TestConstToX86Reg(uint32_t Const, x86Reg reg);
|
static void TestConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||||
static void TestVariable(uint32_t Const, void * Variable, const char * VariableName);
|
static void TestVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||||
static void TestX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
static void TestX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||||
static void XorConstToX86Reg(x86Reg Reg, uint32_t Const);
|
static void XorConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||||
static void XorX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
static void XorX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||||
static void XorVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
static void XorVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||||
|
|
||||||
static void fpuAbs();
|
static void fpuAbs();
|
||||||
static void fpuAddDword(void * Variable, const char * VariableName);
|
static void fpuAddDword(void * Variable, const char * VariableName);
|
||||||
static void fpuAddDwordRegPointer(x86Reg x86Pointer);
|
static void fpuAddDwordRegPointer(x86Reg x86Pointer);
|
||||||
static void fpuAddQword(void * Variable, const char * VariableName);
|
static void fpuAddQword(void * Variable, const char * VariableName);
|
||||||
static void fpuAddQwordRegPointer(x86Reg X86Pointer);
|
static void fpuAddQwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuAddReg(x86FpuValues reg);
|
static void fpuAddReg(x86FpuValues reg);
|
||||||
static void fpuAddRegPop(int32_t * StackPos, x86FpuValues reg);
|
static void fpuAddRegPop(int32_t * StackPos, x86FpuValues reg);
|
||||||
static void fpuComDword(void * Variable, const char * VariableName, bool Pop);
|
static void fpuComDword(void * Variable, const char * VariableName, bool Pop);
|
||||||
static void fpuComDwordRegPointer(x86Reg X86Pointer, bool Pop);
|
static void fpuComDwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||||
static void fpuComQword(void * Variable, const char * VariableName, bool Pop);
|
static void fpuComQword(void * Variable, const char * VariableName, bool Pop);
|
||||||
static void fpuComQwordRegPointer(x86Reg X86Pointer, bool Pop);
|
static void fpuComQwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||||
static void fpuComReg(x86FpuValues reg, bool Pop);
|
static void fpuComReg(x86FpuValues reg, bool Pop);
|
||||||
static void fpuDivDword(void * Variable, const char * VariableName);
|
static void fpuDivDword(void * Variable, const char * VariableName);
|
||||||
static void fpuDivDwordRegPointer(x86Reg X86Pointer);
|
static void fpuDivDwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuDivQword(void * Variable, const char * VariableName);
|
static void fpuDivQword(void * Variable, const char * VariableName);
|
||||||
static void fpuDivQwordRegPointer(x86Reg X86Pointer);
|
static void fpuDivQwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuDivReg(x86FpuValues Reg);
|
static void fpuDivReg(x86FpuValues Reg);
|
||||||
static void fpuDivRegPop(x86FpuValues reg);
|
static void fpuDivRegPop(x86FpuValues reg);
|
||||||
static void fpuExchange(x86FpuValues Reg);
|
static void fpuExchange(x86FpuValues Reg);
|
||||||
static void fpuFree(x86FpuValues Reg);
|
static void fpuFree(x86FpuValues Reg);
|
||||||
static void fpuDecStack(int32_t * StackPos);
|
static void fpuDecStack(int32_t * StackPos);
|
||||||
static void fpuIncStack(int32_t * StackPos);
|
static void fpuIncStack(int32_t * StackPos);
|
||||||
static void fpuLoadControl(void * Variable, const char * VariableName);
|
static void fpuLoadControl(void * Variable, const char * VariableName);
|
||||||
static void fpuLoadDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
static void fpuLoadDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||||
static void fpuLoadDwordFromX86Reg(int32_t * StackPos, x86Reg reg);
|
static void fpuLoadDwordFromX86Reg(int32_t * StackPos, x86Reg reg);
|
||||||
static void fpuLoadDwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
static void fpuLoadDwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||||
static void fpuLoadInt32bFromN64Mem(int32_t * StackPos, x86Reg reg);
|
static void fpuLoadInt32bFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||||
static void fpuLoadIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
static void fpuLoadIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||||
static void fpuLoadIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
static void fpuLoadIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||||
static void fpuLoadIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
static void fpuLoadIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||||
static void fpuLoadIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
static void fpuLoadIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||||
static void fpuLoadQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
static void fpuLoadQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||||
static void fpuLoadQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
static void fpuLoadQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||||
static void fpuLoadQwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
static void fpuLoadQwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||||
static void fpuLoadReg(int32_t * StackPos, x86FpuValues Reg);
|
static void fpuLoadReg(int32_t * StackPos, x86FpuValues Reg);
|
||||||
static void fpuMulDword(void * Variable, const char * VariableName);
|
static void fpuMulDword(void * Variable, const char * VariableName);
|
||||||
static void fpuMulDwordRegPointer(x86Reg X86Pointer);
|
static void fpuMulDwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuMulQword(void * Variable, const char * VariableName);
|
static void fpuMulQword(void * Variable, const char * VariableName);
|
||||||
static void fpuMulQwordRegPointer(x86Reg X86Pointer);
|
static void fpuMulQwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuMulReg(x86FpuValues reg);
|
static void fpuMulReg(x86FpuValues reg);
|
||||||
static void fpuMulRegPop(x86FpuValues reg);
|
static void fpuMulRegPop(x86FpuValues reg);
|
||||||
static void fpuNeg();
|
static void fpuNeg();
|
||||||
static void fpuRound();
|
static void fpuRound();
|
||||||
static void fpuSqrt();
|
static void fpuSqrt();
|
||||||
static void fpuStoreControl(void * Variable, const char * VariableName);
|
static void fpuStoreControl(void * Variable, const char * VariableName);
|
||||||
static void fpuStoreDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
static void fpuStoreDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||||
static void fpuStoreDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
static void fpuStoreDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||||
static void fpuStoreDwordToN64Mem(int32_t * StackPos, x86Reg reg, bool Pop);
|
static void fpuStoreDwordToN64Mem(int32_t * StackPos, x86Reg reg, bool Pop);
|
||||||
static void fpuStoreIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
static void fpuStoreIntegerDword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||||
static void fpuStoreIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
static void fpuStoreIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||||
static void fpuStoreIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
static void fpuStoreIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||||
static void fpuStoreIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
static void fpuStoreIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||||
static void fpuStoreQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
static void fpuStoreQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||||
static void fpuStoreStatus();
|
static void fpuStoreStatus();
|
||||||
static void fpuSubDword(void * Variable, const char * VariableName);
|
static void fpuSubDword(void * Variable, const char * VariableName);
|
||||||
static void fpuSubDwordRegPointer(x86Reg X86Pointer);
|
static void fpuSubDwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuSubDwordReverse(void * Variable, const char * VariableName);
|
static void fpuSubDwordReverse(void * Variable, const char * VariableName);
|
||||||
static void fpuSubQword(void * Variable, const char * VariableName);
|
static void fpuSubQword(void * Variable, const char * VariableName);
|
||||||
static void fpuSubQwordRegPointer(x86Reg X86Pointer);
|
static void fpuSubQwordRegPointer(x86Reg X86Pointer);
|
||||||
static void fpuSubQwordReverse(void * Variable, const char * VariableName);
|
static void fpuSubQwordReverse(void * Variable, const char * VariableName);
|
||||||
static void fpuSubReg(x86FpuValues reg);
|
static void fpuSubReg(x86FpuValues reg);
|
||||||
static void fpuSubRegPop(x86FpuValues reg);
|
static void fpuSubRegPop(x86FpuValues reg);
|
||||||
|
|
||||||
static bool Is8BitReg(x86Reg Reg);
|
static bool Is8BitReg(x86Reg Reg);
|
||||||
static uint8_t CalcMultiplyCode(Multipler Multiply);
|
static uint8_t CalcMultiplyCode(Multipler Multiply);
|
||||||
static uint8_t * m_RecompPos;
|
static uint8_t * m_RecompPos;
|
||||||
|
|
||||||
static void * GetAddressOf(int32_t value, ...);
|
static void * GetAddressOf(int32_t value, ...);
|
||||||
static void SetJump32(uint32_t * Loc, uint32_t * JumpLoc);
|
static void SetJump32(uint32_t * Loc, uint32_t * JumpLoc);
|
||||||
static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
|
static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void BreakPointNotification(const char * FileName, int32_t LineNumber);
|
static void BreakPointNotification(const char * FileName, int32_t LineNumber);
|
||||||
static char m_fpupop[2][2];
|
static char m_fpupop[2][2];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr))
|
#define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr))
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "x86CodeLog.h"
|
#include "x86CodeLog.h"
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
static HANDLE hCPULogFile = NULL;
|
static HANDLE hCPULogFile = NULL;
|
||||||
bool bX86Logging = false;
|
bool bX86Logging = false;
|
||||||
|
|
||||||
void x86_Log_Message (const char * Message, ...)
|
void x86_Log_Message (const char * Message, ...)
|
||||||
{
|
{
|
||||||
DWORD dwWritten;
|
DWORD dwWritten;
|
||||||
char Msg[400];
|
char Msg[400];
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start( ap, Message );
|
va_start( ap, Message );
|
||||||
vsprintf( Msg, Message, ap );
|
vsprintf( Msg, Message, ap );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
strcat(Msg,"\r\n");
|
strcat(Msg,"\r\n");
|
||||||
|
|
||||||
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start_x86_Log (void)
|
void Start_x86_Log (void)
|
||||||
{
|
{
|
||||||
CPath LogFileName(CPath::MODULE_DIRECTORY);
|
CPath LogFileName(CPath::MODULE_DIRECTORY);
|
||||||
LogFileName.AppendDirectory("Logs");
|
LogFileName.AppendDirectory("Logs");
|
||||||
LogFileName.SetNameExtension("CPUoutput.log");
|
LogFileName.SetNameExtension("CPUoutput.log");
|
||||||
|
|
||||||
if (hCPULogFile) { Stop_x86_Log(); }
|
if (hCPULogFile) { Stop_x86_Log(); }
|
||||||
hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
|
hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
|
||||||
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||||
if (hCPULogFile)
|
if (hCPULogFile)
|
||||||
{
|
{
|
||||||
bX86Logging = true;
|
bX86Logging = true;
|
||||||
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
|
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop_x86_Log (void)
|
void Stop_x86_Log (void)
|
||||||
{
|
{
|
||||||
if (hCPULogFile)
|
if (hCPULogFile)
|
||||||
{
|
{
|
||||||
CloseHandle(hCPULogFile);
|
CloseHandle(hCPULogFile);
|
||||||
hCPULogFile = NULL;
|
hCPULogFile = NULL;
|
||||||
bX86Logging = false;
|
bX86Logging = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,135 +1,135 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SpeedLimiterClass.h"
|
#include "SpeedLimiterClass.h"
|
||||||
#include <Common/Util.h>
|
#include <Common/Util.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <Mmsystem.h>
|
#include <Mmsystem.h>
|
||||||
#pragma comment(lib, "winmm.lib")
|
#pragma comment(lib, "winmm.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CSpeedLimiter::CSpeedLimiter()
|
CSpeedLimiter::CSpeedLimiter()
|
||||||
{
|
{
|
||||||
m_Frames = 0;
|
m_Frames = 0;
|
||||||
m_LastTime = 0;
|
m_LastTime = 0;
|
||||||
m_Speed = 60;
|
m_Speed = 60;
|
||||||
m_BaseSpeed = 60;
|
m_BaseSpeed = 60;
|
||||||
m_Ratio = 1000.0F / (float)m_Speed;
|
m_Ratio = 1000.0F / (float)m_Speed;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
TIMECAPS Caps;
|
TIMECAPS Caps;
|
||||||
timeGetDevCaps(&Caps, sizeof(Caps));
|
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||||
if (timeBeginPeriod(Caps.wPeriodMin) == TIMERR_NOCANDO)
|
if (timeBeginPeriod(Caps.wPeriodMin) == TIMERR_NOCANDO)
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError("Error during timer begin");
|
g_Notify->DisplayError("Error during timer begin");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CSpeedLimiter::~CSpeedLimiter()
|
CSpeedLimiter::~CSpeedLimiter()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
TIMECAPS Caps;
|
TIMECAPS Caps;
|
||||||
timeGetDevCaps(&Caps, sizeof(Caps));
|
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||||
timeEndPeriod(Caps.wPeriodMin);
|
timeEndPeriod(Caps.wPeriodMin);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpeedLimiter::SetHertz(uint32_t Hertz)
|
void CSpeedLimiter::SetHertz(uint32_t Hertz)
|
||||||
{
|
{
|
||||||
m_Speed = Hertz;
|
m_Speed = Hertz;
|
||||||
m_BaseSpeed = Hertz;
|
m_BaseSpeed = Hertz;
|
||||||
FixSpeedRatio();
|
FixSpeedRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpeedLimiter::FixSpeedRatio()
|
void CSpeedLimiter::FixSpeedRatio()
|
||||||
{
|
{
|
||||||
m_Ratio = 1000.0f / static_cast<double>(m_Speed);
|
m_Ratio = 1000.0f / static_cast<double>(m_Speed);
|
||||||
m_Frames = 0;
|
m_Frames = 0;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_LastTime = timeGetTime();
|
m_LastTime = timeGetTime();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSpeedLimiter::Timer_Process(uint32_t * FrameRate)
|
bool CSpeedLimiter::Timer_Process(uint32_t * FrameRate)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_Frames += 1;
|
m_Frames += 1;
|
||||||
uint32_t CurrentTime = timeGetTime();
|
uint32_t CurrentTime = timeGetTime();
|
||||||
|
|
||||||
/* Calculate time that should of elapsed for this frame */
|
/* Calculate time that should of elapsed for this frame */
|
||||||
double CalculatedTime = (double)m_LastTime + (m_Ratio * (double)m_Frames);
|
double CalculatedTime = (double)m_LastTime + (m_Ratio * (double)m_Frames);
|
||||||
if ((double)CurrentTime < CalculatedTime)
|
if ((double)CurrentTime < CalculatedTime)
|
||||||
{
|
{
|
||||||
int32_t time = (int)(CalculatedTime - (double)CurrentTime);
|
int32_t time = (int)(CalculatedTime - (double)CurrentTime);
|
||||||
if (time > 0)
|
if (time > 0)
|
||||||
{
|
{
|
||||||
pjutil::Sleep(time);
|
pjutil::Sleep(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Refresh current time */
|
/* Refresh current time */
|
||||||
CurrentTime = timeGetTime();
|
CurrentTime = timeGetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentTime - m_LastTime >= 1000)
|
if (CurrentTime - m_LastTime >= 1000)
|
||||||
{
|
{
|
||||||
/* Output FPS */
|
/* Output FPS */
|
||||||
if (FrameRate != NULL) { *FrameRate = m_Frames; }
|
if (FrameRate != NULL) { *FrameRate = m_Frames; }
|
||||||
m_Frames = 0;
|
m_Frames = 0;
|
||||||
m_LastTime = CurrentTime;
|
m_LastTime = CurrentTime;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpeedLimiter::IncreaseSpeed()
|
void CSpeedLimiter::IncreaseSpeed()
|
||||||
{
|
{
|
||||||
if (m_Speed >= 60)
|
if (m_Speed >= 60)
|
||||||
{
|
{
|
||||||
m_Speed += 10;
|
m_Speed += 10;
|
||||||
}
|
}
|
||||||
else if (m_Speed >= 15)
|
else if (m_Speed >= 15)
|
||||||
{
|
{
|
||||||
m_Speed += 5;
|
m_Speed += 5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Speed += 1;
|
m_Speed += 1;
|
||||||
}
|
}
|
||||||
SpeedChanged(m_Speed);
|
SpeedChanged(m_Speed);
|
||||||
FixSpeedRatio();
|
FixSpeedRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpeedLimiter::DecreaseSpeed()
|
void CSpeedLimiter::DecreaseSpeed()
|
||||||
{
|
{
|
||||||
if (m_Speed > 60)
|
if (m_Speed > 60)
|
||||||
{
|
{
|
||||||
m_Speed -= 10;
|
m_Speed -= 10;
|
||||||
}
|
}
|
||||||
else if (m_Speed > 15)
|
else if (m_Speed > 15)
|
||||||
{
|
{
|
||||||
m_Speed -= 5;
|
m_Speed -= 5;
|
||||||
}
|
}
|
||||||
else if (m_Speed > 1)
|
else if (m_Speed > 1)
|
||||||
{
|
{
|
||||||
m_Speed -= 1;
|
m_Speed -= 1;
|
||||||
}
|
}
|
||||||
SpeedChanged(m_Speed);
|
SpeedChanged(m_Speed);
|
||||||
FixSpeedRatio();
|
FixSpeedRatio();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/GameSettings.h>
|
#include <Project64-core/Settings/GameSettings.h>
|
||||||
|
|
||||||
class CSpeedLimiter :
|
class CSpeedLimiter :
|
||||||
private CGameSettings
|
private CGameSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSpeedLimiter();
|
CSpeedLimiter();
|
||||||
~CSpeedLimiter();
|
~CSpeedLimiter();
|
||||||
|
|
||||||
void SetHertz(const uint32_t Hertz);
|
void SetHertz(const uint32_t Hertz);
|
||||||
bool Timer_Process(uint32_t* const FrameRate);
|
bool Timer_Process(uint32_t* const FrameRate);
|
||||||
void IncreaseSpeed();
|
void IncreaseSpeed();
|
||||||
void DecreaseSpeed();
|
void DecreaseSpeed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSpeedLimiter(const CSpeedLimiter&); // Disable copy constructor
|
CSpeedLimiter(const CSpeedLimiter&); // Disable copy constructor
|
||||||
CSpeedLimiter& operator=(const CSpeedLimiter&); // Disable assignment
|
CSpeedLimiter& operator=(const CSpeedLimiter&); // Disable assignment
|
||||||
|
|
||||||
void FixSpeedRatio();
|
void FixSpeedRatio();
|
||||||
|
|
||||||
uint32_t m_Speed, m_BaseSpeed, m_Frames, m_LastTime;
|
uint32_t m_Speed, m_BaseSpeed, m_Frames, m_LastTime;
|
||||||
double m_Ratio;
|
double m_Ratio;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SystemGlobals.h"
|
#include "SystemGlobals.h"
|
||||||
|
|
||||||
CN64System * g_System = NULL;
|
CN64System * g_System = NULL;
|
||||||
CN64System * g_BaseSystem = NULL;
|
CN64System * g_BaseSystem = NULL;
|
||||||
CN64System * g_SyncSystem = NULL;
|
CN64System * g_SyncSystem = NULL;
|
||||||
CRecompiler * g_Recompiler = NULL;
|
CRecompiler * g_Recompiler = NULL;
|
||||||
CMipsMemoryVM * g_MMU = NULL; //Memory of the n64
|
CMipsMemoryVM * g_MMU = NULL; //Memory of the n64
|
||||||
CTLB * g_TLB = NULL; //TLB Unit
|
CTLB * g_TLB = NULL; //TLB Unit
|
||||||
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
|
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
|
||||||
CNotification * g_Notify = NULL;
|
CNotification * g_Notify = NULL;
|
||||||
CPlugins * g_Plugins = NULL;
|
CPlugins * g_Plugins = NULL;
|
||||||
CN64Rom * g_Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
|
CN64Rom * g_Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
|
||||||
CN64Rom * g_DDRom = NULL; //64DD IPL ROM
|
CN64Rom * g_DDRom = NULL; //64DD IPL ROM
|
||||||
CN64Disk * g_Disk = NULL; //64DD DISK
|
CN64Disk * g_Disk = NULL; //64DD DISK
|
||||||
CAudio * g_Audio = NULL;
|
CAudio * g_Audio = NULL;
|
||||||
CSystemTimer * g_SystemTimer = NULL;
|
CSystemTimer * g_SystemTimer = NULL;
|
||||||
CTransVaddr * g_TransVaddr = NULL;
|
CTransVaddr * g_TransVaddr = NULL;
|
||||||
CSystemEvents * g_SystemEvents = NULL;
|
CSystemEvents * g_SystemEvents = NULL;
|
||||||
uint32_t * g_TLBLoadAddress = NULL;
|
uint32_t * g_TLBLoadAddress = NULL;
|
||||||
uint32_t * g_TLBStoreAddress = NULL;
|
uint32_t * g_TLBStoreAddress = NULL;
|
||||||
CDebugger * g_Debugger = NULL;
|
CDebugger * g_Debugger = NULL;
|
||||||
|
|
||||||
int * g_NextTimer;
|
int * g_NextTimer;
|
|
@ -1,60 +1,60 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettings;
|
class CSettings;
|
||||||
extern CSettings * g_Settings;
|
extern CSettings * g_Settings;
|
||||||
|
|
||||||
class CN64System;
|
class CN64System;
|
||||||
extern CN64System * g_System;
|
extern CN64System * g_System;
|
||||||
extern CN64System * g_BaseSystem;
|
extern CN64System * g_BaseSystem;
|
||||||
extern CN64System * g_SyncSystem;
|
extern CN64System * g_SyncSystem;
|
||||||
|
|
||||||
class CRecompiler;
|
class CRecompiler;
|
||||||
extern CRecompiler * g_Recompiler;
|
extern CRecompiler * g_Recompiler;
|
||||||
|
|
||||||
class CMipsMemoryVM;
|
class CMipsMemoryVM;
|
||||||
extern CMipsMemoryVM * g_MMU; //Memory of the n64
|
extern CMipsMemoryVM * g_MMU; //Memory of the n64
|
||||||
|
|
||||||
class CTLB;
|
class CTLB;
|
||||||
extern CTLB * g_TLB; //TLB Unit
|
extern CTLB * g_TLB; //TLB Unit
|
||||||
|
|
||||||
class CRegisters;
|
class CRegisters;
|
||||||
extern CRegisters * g_Reg; //Current Register Set attached to the g_MMU
|
extern CRegisters * g_Reg; //Current Register Set attached to the g_MMU
|
||||||
|
|
||||||
class CPlugins;
|
class CPlugins;
|
||||||
extern CPlugins * g_Plugins;
|
extern CPlugins * g_Plugins;
|
||||||
|
|
||||||
class CN64Rom;
|
class CN64Rom;
|
||||||
extern CN64Rom * g_Rom; //The current rom that this system is executing.. it can only execute one file at the time
|
extern CN64Rom * g_Rom; //The current rom that this system is executing.. it can only execute one file at the time
|
||||||
extern CN64Rom * g_DDRom; //64DD IPL ROM
|
extern CN64Rom * g_DDRom; //64DD IPL ROM
|
||||||
|
|
||||||
class CN64Disk;
|
class CN64Disk;
|
||||||
extern CN64Disk * g_Disk; //64DD DISK
|
extern CN64Disk * g_Disk; //64DD DISK
|
||||||
|
|
||||||
class CAudio;
|
class CAudio;
|
||||||
extern CAudio * g_Audio;
|
extern CAudio * g_Audio;
|
||||||
|
|
||||||
class CSystemTimer;
|
class CSystemTimer;
|
||||||
extern CSystemTimer * g_SystemTimer;
|
extern CSystemTimer * g_SystemTimer;
|
||||||
|
|
||||||
__interface CTransVaddr;
|
__interface CTransVaddr;
|
||||||
extern CTransVaddr * g_TransVaddr;
|
extern CTransVaddr * g_TransVaddr;
|
||||||
|
|
||||||
class CSystemEvents;
|
class CSystemEvents;
|
||||||
extern CSystemEvents * g_SystemEvents;
|
extern CSystemEvents * g_SystemEvents;
|
||||||
|
|
||||||
extern int32_t * g_NextTimer;
|
extern int32_t * g_NextTimer;
|
||||||
extern uint32_t * g_TLBLoadAddress;
|
extern uint32_t * g_TLBLoadAddress;
|
||||||
extern uint32_t * g_TLBStoreAddress;
|
extern uint32_t * g_TLBStoreAddress;
|
||||||
|
|
||||||
__interface CDebugger;
|
__interface CDebugger;
|
||||||
extern CDebugger * g_Debugger;
|
extern CDebugger * g_Debugger;
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//Plugin controller
|
//Plugin controller
|
||||||
#include "Plugins/PluginClass.h"
|
#include "Plugins/PluginClass.h"
|
||||||
|
|
||||||
//Base Plugin class, all plugin derive from this, handles core functions
|
//Base Plugin class, all plugin derive from this, handles core functions
|
||||||
#include "Plugins/PluginBase.h"
|
#include "Plugins/PluginBase.h"
|
||||||
|
|
||||||
#include "Plugins/GFXPlugin.h"
|
#include "Plugins/GFXPlugin.h"
|
||||||
#include "Plugins/AudioPlugin.h"
|
#include "Plugins/AudioPlugin.h"
|
||||||
#include "Plugins/ControllerPlugin.h"
|
#include "Plugins/ControllerPlugin.h"
|
||||||
#include "Plugins/RSPPlugin.h"
|
#include "Plugins/RSPPlugin.h"
|
||||||
|
|
|
@ -1,208 +1,208 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/N64RomClass.h>
|
#include <Project64-core/N64System/N64RomClass.h>
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CAudioPlugin::CAudioPlugin() :
|
CAudioPlugin::CAudioPlugin() :
|
||||||
AiLenChanged(NULL),
|
AiLenChanged(NULL),
|
||||||
AiReadLength(NULL),
|
AiReadLength(NULL),
|
||||||
ProcessAList(NULL),
|
ProcessAList(NULL),
|
||||||
m_hAudioThread(NULL),
|
m_hAudioThread(NULL),
|
||||||
AiUpdate(NULL),
|
AiUpdate(NULL),
|
||||||
AiDacrateChanged(NULL)
|
AiDacrateChanged(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CAudioPlugin::~CAudioPlugin()
|
CAudioPlugin::~CAudioPlugin()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioPlugin::LoadFunctions(void)
|
bool CAudioPlugin::LoadFunctions(void)
|
||||||
{
|
{
|
||||||
// Find entries for functions in DLL
|
// Find entries for functions in DLL
|
||||||
void(CALL *InitiateAudio)(void);
|
void(CALL *InitiateAudio)(void);
|
||||||
LoadFunction(InitiateAudio);
|
LoadFunction(InitiateAudio);
|
||||||
LoadFunction(AiDacrateChanged);
|
LoadFunction(AiDacrateChanged);
|
||||||
LoadFunction(AiLenChanged);
|
LoadFunction(AiLenChanged);
|
||||||
LoadFunction(AiReadLength);
|
LoadFunction(AiReadLength);
|
||||||
LoadFunction(AiUpdate);
|
LoadFunction(AiUpdate);
|
||||||
LoadFunction(ProcessAList);
|
LoadFunction(ProcessAList);
|
||||||
|
|
||||||
// Make sure dll has all needed functions
|
// Make sure dll has all needed functions
|
||||||
if (AiDacrateChanged == NULL) { UnloadPlugin(); return false; }
|
if (AiDacrateChanged == NULL) { UnloadPlugin(); return false; }
|
||||||
if (AiLenChanged == NULL) { UnloadPlugin(); return false; }
|
if (AiLenChanged == NULL) { UnloadPlugin(); return false; }
|
||||||
if (AiReadLength == NULL) { UnloadPlugin(); return false; }
|
if (AiReadLength == NULL) { UnloadPlugin(); return false; }
|
||||||
if (InitiateAudio == NULL) { UnloadPlugin(); return false; }
|
if (InitiateAudio == NULL) { UnloadPlugin(); return false; }
|
||||||
if (ProcessAList == NULL) { UnloadPlugin(); return false; }
|
if (ProcessAList == NULL) { UnloadPlugin(); return false; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
{
|
{
|
||||||
struct AUDIO_INFO
|
struct AUDIO_INFO
|
||||||
{
|
{
|
||||||
void * hwnd;
|
void * hwnd;
|
||||||
void * hinst;
|
void * hinst;
|
||||||
|
|
||||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
||||||
|
|
||||||
// bswap on a dword (32 bits) boundry
|
// bswap on a dword (32 bits) boundry
|
||||||
// eg. the first 8 bytes are stored like this:
|
// eg. the first 8 bytes are stored like this:
|
||||||
// 4 3 2 1 8 7 6 5
|
// 4 3 2 1 8 7 6 5
|
||||||
uint8_t * HEADER; // This is the rom header (first 40h bytes of the rom
|
uint8_t * HEADER; // This is the rom header (first 40h bytes of the rom
|
||||||
// This will be in the same memory format as the rest of the memory.
|
// This will be in the same memory format as the rest of the memory.
|
||||||
uint8_t * RDRAM;
|
uint8_t * RDRAM;
|
||||||
uint8_t * DMEM;
|
uint8_t * DMEM;
|
||||||
uint8_t * IMEM;
|
uint8_t * IMEM;
|
||||||
|
|
||||||
uint32_t * MI__INTR_REG;
|
uint32_t * MI__INTR_REG;
|
||||||
|
|
||||||
uint32_t * AI__DRAM_ADDR_REG;
|
uint32_t * AI__DRAM_ADDR_REG;
|
||||||
uint32_t * AI__LEN_REG;
|
uint32_t * AI__LEN_REG;
|
||||||
uint32_t * AI__CONTROL_REG;
|
uint32_t * AI__CONTROL_REG;
|
||||||
uint32_t * AI__STATUS_REG;
|
uint32_t * AI__STATUS_REG;
|
||||||
uint32_t * AI__DACRATE_REG;
|
uint32_t * AI__DACRATE_REG;
|
||||||
uint32_t * AI__BITRATE_REG;
|
uint32_t * AI__BITRATE_REG;
|
||||||
|
|
||||||
void(CALL *CheckInterrupts)(void);
|
void(CALL *CheckInterrupts)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
|
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
|
||||||
LoadFunction(InitiateAudio);
|
LoadFunction(InitiateAudio);
|
||||||
if (InitiateAudio == NULL) { return false; }
|
if (InitiateAudio == NULL) { return false; }
|
||||||
|
|
||||||
AUDIO_INFO Info = { 0 };
|
AUDIO_INFO Info = { 0 };
|
||||||
|
|
||||||
Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
|
Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
|
||||||
Info.hinst = Window ? Window->GetModuleInstance() : NULL;;
|
Info.hinst = Window ? Window->GetModuleInstance() : NULL;;
|
||||||
Info.MemoryBswaped = true;
|
Info.MemoryBswaped = true;
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
|
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. just needed to we can config the DLL.
|
// parameters here.. just needed to we can config the DLL.
|
||||||
if (System == NULL)
|
if (System == NULL)
|
||||||
{
|
{
|
||||||
uint8_t Buffer[100];
|
uint8_t Buffer[100];
|
||||||
uint32_t Value = 0;
|
uint32_t Value = 0;
|
||||||
|
|
||||||
Info.HEADER = Buffer;
|
Info.HEADER = Buffer;
|
||||||
Info.RDRAM = Buffer;
|
Info.RDRAM = Buffer;
|
||||||
Info.DMEM = Buffer;
|
Info.DMEM = Buffer;
|
||||||
Info.IMEM = Buffer;
|
Info.IMEM = Buffer;
|
||||||
Info.MI__INTR_REG = &Value;
|
Info.MI__INTR_REG = &Value;
|
||||||
Info.AI__DRAM_ADDR_REG = &Value;
|
Info.AI__DRAM_ADDR_REG = &Value;
|
||||||
Info.AI__LEN_REG = &Value;
|
Info.AI__LEN_REG = &Value;
|
||||||
Info.AI__CONTROL_REG = &Value;
|
Info.AI__CONTROL_REG = &Value;
|
||||||
Info.AI__STATUS_REG = &Value;
|
Info.AI__STATUS_REG = &Value;
|
||||||
Info.AI__DACRATE_REG = &Value;
|
Info.AI__DACRATE_REG = &Value;
|
||||||
Info.AI__BITRATE_REG = &Value;
|
Info.AI__BITRATE_REG = &Value;
|
||||||
}
|
}
|
||||||
// Send initialization information to the DLL
|
// Send initialization information to the DLL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
Info.RDRAM = g_MMU->Rdram();
|
Info.RDRAM = g_MMU->Rdram();
|
||||||
Info.DMEM = g_MMU->Dmem();
|
Info.DMEM = g_MMU->Dmem();
|
||||||
Info.IMEM = g_MMU->Imem();
|
Info.IMEM = g_MMU->Imem();
|
||||||
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
|
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
|
||||||
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
|
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
|
||||||
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
|
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
|
||||||
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
|
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
|
||||||
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
|
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
|
||||||
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
|
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
|
||||||
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
|
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Initialized = InitiateAudio(Info) != 0;
|
m_Initialized = InitiateAudio(Info) != 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||||
pjutil::DynLibCallDllMain();
|
pjutil::DynLibCallDllMain();
|
||||||
|
|
||||||
if (System != NULL)
|
if (System != NULL)
|
||||||
{
|
{
|
||||||
if (AiUpdate)
|
if (AiUpdate)
|
||||||
{
|
{
|
||||||
if (m_hAudioThread)
|
if (m_hAudioThread)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||||
TerminateThread(m_hAudioThread, 0);
|
TerminateThread(m_hAudioThread, 0);
|
||||||
}
|
}
|
||||||
DWORD ThreadID;
|
DWORD ThreadID;
|
||||||
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Reg->AI_DACRATE_REG != 0)
|
if (g_Reg->AI_DACRATE_REG != 0)
|
||||||
{
|
{
|
||||||
DacrateChanged(System->SystemType());
|
DacrateChanged(System->SystemType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return m_Initialized;
|
return m_Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioPlugin::UnloadPluginDetails(void)
|
void CAudioPlugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (m_hAudioThread)
|
if (m_hAudioThread)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||||
TerminateThread(m_hAudioThread, 0);
|
TerminateThread(m_hAudioThread, 0);
|
||||||
m_hAudioThread = NULL;
|
m_hAudioThread = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
AiDacrateChanged = NULL;
|
AiDacrateChanged = NULL;
|
||||||
AiLenChanged = NULL;
|
AiLenChanged = NULL;
|
||||||
AiReadLength = NULL;
|
AiReadLength = NULL;
|
||||||
AiUpdate = NULL;
|
AiUpdate = NULL;
|
||||||
ProcessAList = NULL;
|
ProcessAList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
||||||
{
|
{
|
||||||
if (!Initialized()) { return; }
|
if (!Initialized()) { return; }
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
||||||
|
|
||||||
//uint32_t Frequency = g_Reg->AI_DACRATE_REG * 30;
|
//uint32_t Frequency = g_Reg->AI_DACRATE_REG * 30;
|
||||||
//uint32_t CountsPerSecond = (g_Reg->VI_V_SYNC_REG != 0 ? (g_Reg->VI_V_SYNC_REG + 1) * g_Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60;
|
//uint32_t CountsPerSecond = (g_Reg->VI_V_SYNC_REG != 0 ? (g_Reg->VI_V_SYNC_REG + 1) * g_Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60;
|
||||||
AiDacrateChanged(Type);
|
AiDacrateChanged(Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void CAudioPlugin::AudioThread(CAudioPlugin * _this)
|
void CAudioPlugin::AudioThread(CAudioPlugin * _this)
|
||||||
{
|
{
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
|
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
|
||||||
{
|
{
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||||
}
|
}
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
_this->AiUpdate(true);
|
_this->AiUpdate(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
|
||||||
class CAudioPlugin : public CPlugin
|
class CAudioPlugin : public CPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CAudioPlugin(void);
|
CAudioPlugin(void);
|
||||||
~CAudioPlugin();
|
~CAudioPlugin();
|
||||||
|
|
||||||
void DacrateChanged(SYSTEM_TYPE Type);
|
void DacrateChanged(SYSTEM_TYPE Type);
|
||||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||||
|
|
||||||
void(CALL *AiLenChanged)(void);
|
void(CALL *AiLenChanged)(void);
|
||||||
uint32_t(CALL *AiReadLength)(void);
|
uint32_t(CALL *AiReadLength)(void);
|
||||||
void(CALL *ProcessAList)(void);
|
void(CALL *ProcessAList)(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CAudioPlugin(const CAudioPlugin&); // Disable copy constructor
|
CAudioPlugin(const CAudioPlugin&); // Disable copy constructor
|
||||||
CAudioPlugin& operator=(const CAudioPlugin&); // Disable assignment
|
CAudioPlugin& operator=(const CAudioPlugin&); // Disable assignment
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstAudioDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const { return FirstAudioDefaultSet; }
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstAudioSettings; }
|
virtual int32_t GetSettingStartRange() const { return FirstAudioSettings; }
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_AUDIO; }
|
PLUGIN_TYPE type() { return PLUGIN_TYPE_AUDIO; }
|
||||||
|
|
||||||
void * m_hAudioThread;
|
void * m_hAudioThread;
|
||||||
|
|
||||||
bool LoadFunctions(void);
|
bool LoadFunctions(void);
|
||||||
void UnloadPluginDetails(void);
|
void UnloadPluginDetails(void);
|
||||||
|
|
||||||
void(CALL *AiUpdate) (int32_t Wait);
|
void(CALL *AiUpdate) (int32_t Wait);
|
||||||
void(CALL *AiDacrateChanged)(SYSTEM_TYPE Type);
|
void(CALL *AiDacrateChanged)(SYSTEM_TYPE Type);
|
||||||
|
|
||||||
// Function used in a thread for using audio
|
// Function used in a thread for using audio
|
||||||
static void AudioThread(CAudioPlugin * _this);
|
static void AudioThread(CAudioPlugin * _this);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,183 +1,183 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/N64RomClass.h>
|
#include <Project64-core/N64System/N64RomClass.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include "ControllerPlugin.h"
|
#include "ControllerPlugin.h"
|
||||||
|
|
||||||
CControl_Plugin::CControl_Plugin(void) :
|
CControl_Plugin::CControl_Plugin(void) :
|
||||||
WM_KeyDown(NULL),
|
WM_KeyDown(NULL),
|
||||||
WM_KeyUp(NULL),
|
WM_KeyUp(NULL),
|
||||||
RumbleCommand(NULL),
|
RumbleCommand(NULL),
|
||||||
GetKeys(NULL),
|
GetKeys(NULL),
|
||||||
ReadController(NULL),
|
ReadController(NULL),
|
||||||
ControllerCommand(NULL),
|
ControllerCommand(NULL),
|
||||||
m_AllocatedControllers(false)
|
m_AllocatedControllers(false)
|
||||||
{
|
{
|
||||||
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
|
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
|
||||||
memset(&m_Controllers, 0, sizeof(m_Controllers));
|
memset(&m_Controllers, 0, sizeof(m_Controllers));
|
||||||
}
|
}
|
||||||
|
|
||||||
CControl_Plugin::~CControl_Plugin()
|
CControl_Plugin::~CControl_Plugin()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CControl_Plugin::LoadFunctions(void)
|
bool CControl_Plugin::LoadFunctions(void)
|
||||||
{
|
{
|
||||||
// Find entries for functions in DLL
|
// Find entries for functions in DLL
|
||||||
void(CALL *InitiateControllers)(void);
|
void(CALL *InitiateControllers)(void);
|
||||||
LoadFunction(InitiateControllers);
|
LoadFunction(InitiateControllers);
|
||||||
LoadFunction(ControllerCommand);
|
LoadFunction(ControllerCommand);
|
||||||
LoadFunction(GetKeys);
|
LoadFunction(GetKeys);
|
||||||
LoadFunction(ReadController);
|
LoadFunction(ReadController);
|
||||||
LoadFunction(WM_KeyDown);
|
LoadFunction(WM_KeyDown);
|
||||||
LoadFunction(WM_KeyUp);
|
LoadFunction(WM_KeyUp);
|
||||||
LoadFunction(RumbleCommand);
|
LoadFunction(RumbleCommand);
|
||||||
|
|
||||||
//Make sure dll had all needed functions
|
//Make sure dll had all needed functions
|
||||||
if (InitiateControllers == NULL) { UnloadPlugin(); return false; }
|
if (InitiateControllers == NULL) { UnloadPlugin(); return false; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate our own controller
|
// Allocate our own controller
|
||||||
m_AllocatedControllers = true;
|
m_AllocatedControllers = true;
|
||||||
for (int32_t i = 0; i < 4; i++)
|
for (int32_t i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
m_Controllers[i] = new CCONTROL(m_PluginControllers[i].Present, m_PluginControllers[i].RawData, m_PluginControllers[i].Plugin);
|
m_Controllers[i] = new CCONTROL(m_PluginControllers[i].Present, m_PluginControllers[i].RawData, m_PluginControllers[i].Plugin);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
{
|
{
|
||||||
uint8_t Buffer[100];
|
uint8_t Buffer[100];
|
||||||
|
|
||||||
for (int32_t i = 0; i < 4; i++)
|
for (int32_t i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
m_PluginControllers[i].Present = false;
|
m_PluginControllers[i].Present = false;
|
||||||
m_PluginControllers[i].RawData = false;
|
m_PluginControllers[i].RawData = false;
|
||||||
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Plugin version
|
// Test Plugin version
|
||||||
if (m_PluginInfo.Version == 0x0100)
|
if (m_PluginInfo.Version == 0x0100)
|
||||||
{
|
{
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
||||||
_LoadFunction("InitiateControllers",InitiateControllers_1_0);
|
_LoadFunction("InitiateControllers",InitiateControllers_1_0);
|
||||||
if (InitiateControllers_1_0 == NULL) { return false; }
|
if (InitiateControllers_1_0 == NULL) { return false; }
|
||||||
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
else if (m_PluginInfo.Version >= 0x0101)
|
else if (m_PluginInfo.Version >= 0x0101)
|
||||||
{
|
{
|
||||||
CONTROL_INFO ControlInfo;
|
CONTROL_INFO ControlInfo;
|
||||||
ControlInfo.Controls = m_PluginControllers;
|
ControlInfo.Controls = m_PluginControllers;
|
||||||
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
|
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
|
||||||
ControlInfo.hinst = Window ? Window->GetModuleInstance() : NULL;
|
ControlInfo.hinst = Window ? Window->GetModuleInstance() : NULL;
|
||||||
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : NULL;
|
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : NULL;
|
||||||
ControlInfo.MemoryBswaped = true;
|
ControlInfo.MemoryBswaped = true;
|
||||||
|
|
||||||
if (m_PluginInfo.Version == 0x0101)
|
if (m_PluginInfo.Version == 0x0101)
|
||||||
{
|
{
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
||||||
_LoadFunction("InitiateControllers",InitiateControllers_1_1);
|
_LoadFunction("InitiateControllers",InitiateControllers_1_1);
|
||||||
if (InitiateControllers_1_1 == NULL) { return false; }
|
if (InitiateControllers_1_1 == NULL) { return false; }
|
||||||
|
|
||||||
InitiateControllers_1_1(ControlInfo);
|
InitiateControllers_1_1(ControlInfo);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
else if (m_PluginInfo.Version >= 0x0102)
|
else if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
||||||
_LoadFunction("InitiateControllers",InitiateControllers_1_2);
|
_LoadFunction("InitiateControllers",InitiateControllers_1_2);
|
||||||
if (InitiateControllers_1_2 == NULL) { return false; }
|
if (InitiateControllers_1_2 == NULL) { return false; }
|
||||||
|
|
||||||
InitiateControllers_1_2(&ControlInfo);
|
InitiateControllers_1_2(&ControlInfo);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||||
pjutil::DynLibCallDllMain();
|
pjutil::DynLibCallDllMain();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return m_Initialized;
|
return m_Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControl_Plugin::UnloadPluginDetails(void)
|
void CControl_Plugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
if (m_AllocatedControllers)
|
if (m_AllocatedControllers)
|
||||||
{
|
{
|
||||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||||
{
|
{
|
||||||
delete m_Controllers[count];
|
delete m_Controllers[count];
|
||||||
m_Controllers[count] = NULL;
|
m_Controllers[count] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_AllocatedControllers = false;
|
m_AllocatedControllers = false;
|
||||||
ControllerCommand = NULL;
|
ControllerCommand = NULL;
|
||||||
GetKeys = NULL;
|
GetKeys = NULL;
|
||||||
ReadController = NULL;
|
ReadController = NULL;
|
||||||
WM_KeyDown = NULL;
|
WM_KeyDown = NULL;
|
||||||
WM_KeyUp = NULL;
|
WM_KeyUp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControl_Plugin::UpdateKeys(void)
|
void CControl_Plugin::UpdateKeys(void)
|
||||||
{
|
{
|
||||||
if (!m_AllocatedControllers) { return; }
|
if (!m_AllocatedControllers) { return; }
|
||||||
for (int32_t cont = 0; cont < sizeof(m_Controllers) / sizeof(m_Controllers[0]); cont++)
|
for (int32_t cont = 0; cont < sizeof(m_Controllers) / sizeof(m_Controllers[0]); cont++)
|
||||||
{
|
{
|
||||||
if (!m_Controllers[cont]->m_Present) { continue; }
|
if (!m_Controllers[cont]->m_Present) { continue; }
|
||||||
if (!m_Controllers[cont]->m_RawData)
|
if (!m_Controllers[cont]->m_RawData)
|
||||||
{
|
{
|
||||||
GetKeys(cont, &m_Controllers[cont]->m_Buttons);
|
GetKeys(cont, &m_Controllers[cont]->m_Buttons);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ReadController) { ReadController(-1, NULL); }
|
if (ReadController) { ReadController(-1, NULL); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
||||||
{
|
{
|
||||||
if (m_AllocatedControllers)
|
if (m_AllocatedControllers)
|
||||||
{
|
{
|
||||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||||
{
|
{
|
||||||
delete m_Controllers[count];
|
delete m_Controllers[count];
|
||||||
m_Controllers[count] = NULL;
|
m_Controllers[count] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_AllocatedControllers = false;
|
m_AllocatedControllers = false;
|
||||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||||
{
|
{
|
||||||
m_Controllers[count] = Plugin->m_Controllers[count];
|
m_Controllers[count] = Plugin->m_Controllers[count];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CCONTROL::CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType) :
|
CCONTROL::CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType) :
|
||||||
m_Present(Present), m_RawData(RawData), m_PlugType(PlugType)
|
m_Present(Present), m_RawData(RawData), m_PlugType(PlugType)
|
||||||
{
|
{
|
||||||
m_Buttons.Value = 0;
|
m_Buttons.Value = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,130 +1,130 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
uint32_t Value;
|
uint32_t Value;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned R_DPAD : 1;
|
unsigned R_DPAD : 1;
|
||||||
unsigned L_DPAD : 1;
|
unsigned L_DPAD : 1;
|
||||||
unsigned D_DPAD : 1;
|
unsigned D_DPAD : 1;
|
||||||
unsigned U_DPAD : 1;
|
unsigned U_DPAD : 1;
|
||||||
unsigned START_BUTTON : 1;
|
unsigned START_BUTTON : 1;
|
||||||
unsigned Z_TRIG : 1;
|
unsigned Z_TRIG : 1;
|
||||||
unsigned B_BUTTON : 1;
|
unsigned B_BUTTON : 1;
|
||||||
unsigned A_BUTTON : 1;
|
unsigned A_BUTTON : 1;
|
||||||
|
|
||||||
unsigned R_CBUTTON : 1;
|
unsigned R_CBUTTON : 1;
|
||||||
unsigned L_CBUTTON : 1;
|
unsigned L_CBUTTON : 1;
|
||||||
unsigned D_CBUTTON : 1;
|
unsigned D_CBUTTON : 1;
|
||||||
unsigned U_CBUTTON : 1;
|
unsigned U_CBUTTON : 1;
|
||||||
unsigned R_TRIG : 1;
|
unsigned R_TRIG : 1;
|
||||||
unsigned L_TRIG : 1;
|
unsigned L_TRIG : 1;
|
||||||
unsigned Reserved1 : 1;
|
unsigned Reserved1 : 1;
|
||||||
unsigned Reserved2 : 1;
|
unsigned Reserved2 : 1;
|
||||||
|
|
||||||
signed Y_AXIS : 8;
|
signed Y_AXIS : 8;
|
||||||
|
|
||||||
signed X_AXIS : 8;
|
signed X_AXIS : 8;
|
||||||
};
|
};
|
||||||
} BUTTONS;
|
} BUTTONS;
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int32_t Present;
|
int32_t Present;
|
||||||
int32_t RawData;
|
int32_t RawData;
|
||||||
int32_t Plugin;
|
int32_t Plugin;
|
||||||
} CONTROL;
|
} CONTROL;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void * hMainWindow;
|
void * hMainWindow;
|
||||||
void * hinst;
|
void * hinst;
|
||||||
|
|
||||||
int32_t MemoryBswaped; // memory in client- or server-native endian
|
int32_t MemoryBswaped; // memory in client- or server-native endian
|
||||||
uint8_t * HEADER; // the ROM header (first 40h bytes of the ROM)
|
uint8_t * HEADER; // the ROM header (first 40h bytes of the ROM)
|
||||||
CONTROL * Controls; // pointer to array of 4 controllers, i.e.: CONTROL Controls[4];
|
CONTROL * Controls; // pointer to array of 4 controllers, i.e.: CONTROL Controls[4];
|
||||||
} CONTROL_INFO;
|
} CONTROL_INFO;
|
||||||
|
|
||||||
enum PluginType
|
enum PluginType
|
||||||
{
|
{
|
||||||
PLUGIN_NONE = 1,
|
PLUGIN_NONE = 1,
|
||||||
PLUGIN_MEMPAK = 2,
|
PLUGIN_MEMPAK = 2,
|
||||||
PLUGIN_RUMBLE_PAK = 3,
|
PLUGIN_RUMBLE_PAK = 3,
|
||||||
PLUGIN_TANSFER_PAK = 4, // not implemeted for non raw data
|
PLUGIN_TANSFER_PAK = 4, // not implemeted for non raw data
|
||||||
PLUGIN_RAW = 5, // the controller plugin is passed in raw data
|
PLUGIN_RAW = 5, // the controller plugin is passed in raw data
|
||||||
};
|
};
|
||||||
|
|
||||||
class CControl_Plugin;
|
class CControl_Plugin;
|
||||||
|
|
||||||
class CCONTROL
|
class CCONTROL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType);
|
CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType);
|
||||||
inline bool Present(void) const { return m_Present != 0; }
|
inline bool Present(void) const { return m_Present != 0; }
|
||||||
inline uint32_t Buttons(void) const { return m_Buttons.Value; }
|
inline uint32_t Buttons(void) const { return m_Buttons.Value; }
|
||||||
inline PluginType Plugin(void) const { return static_cast<PluginType>(m_PlugType); }
|
inline PluginType Plugin(void) const { return static_cast<PluginType>(m_PlugType); }
|
||||||
private:
|
private:
|
||||||
friend CControl_Plugin; //controller plugin class has full access
|
friend CControl_Plugin; //controller plugin class has full access
|
||||||
|
|
||||||
int32_t & m_Present;
|
int32_t & m_Present;
|
||||||
int32_t & m_RawData;
|
int32_t & m_RawData;
|
||||||
int32_t & m_PlugType;
|
int32_t & m_PlugType;
|
||||||
BUTTONS m_Buttons;
|
BUTTONS m_Buttons;
|
||||||
|
|
||||||
CCONTROL(void); // Disable default constructor
|
CCONTROL(void); // Disable default constructor
|
||||||
CCONTROL(const CCONTROL&); // Disable copy constructor
|
CCONTROL(const CCONTROL&); // Disable copy constructor
|
||||||
CCONTROL& operator=(const CCONTROL&); // Disable assignment
|
CCONTROL& operator=(const CCONTROL&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
||||||
class CControl_Plugin : public CPlugin
|
class CControl_Plugin : public CPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CControl_Plugin(void);
|
CControl_Plugin(void);
|
||||||
~CControl_Plugin();
|
~CControl_Plugin();
|
||||||
|
|
||||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||||
void SetControl(CControl_Plugin const * const Plugin);
|
void SetControl(CControl_Plugin const * const Plugin);
|
||||||
void UpdateKeys(void);
|
void UpdateKeys(void);
|
||||||
|
|
||||||
void(CALL *WM_KeyDown) (uint32_t wParam, uint32_t lParam);
|
void(CALL *WM_KeyDown) (uint32_t wParam, uint32_t lParam);
|
||||||
void(CALL *WM_KeyUp) (uint32_t wParam, uint32_t lParam);
|
void(CALL *WM_KeyUp) (uint32_t wParam, uint32_t lParam);
|
||||||
void(CALL *RumbleCommand) (int32_t Control, int32_t bRumble);
|
void(CALL *RumbleCommand) (int32_t Control, int32_t bRumble);
|
||||||
void(CALL *GetKeys) (int32_t Control, BUTTONS * Keys);
|
void(CALL *GetKeys) (int32_t Control, BUTTONS * Keys);
|
||||||
void(CALL *ReadController) (int32_t Control, uint8_t * Command);
|
void(CALL *ReadController) (int32_t Control, uint8_t * Command);
|
||||||
void(CALL *ControllerCommand) (int32_t Control, uint8_t * Command);
|
void(CALL *ControllerCommand) (int32_t Control, uint8_t * Command);
|
||||||
|
|
||||||
inline CCONTROL const * Controller(int32_t control) { return m_Controllers[control]; }
|
inline CCONTROL const * Controller(int32_t control) { return m_Controllers[control]; }
|
||||||
inline CONTROL * PluginControllers(void) { return m_PluginControllers; }
|
inline CONTROL * PluginControllers(void) { return m_PluginControllers; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CControl_Plugin(const CControl_Plugin&); // Disable copy constructor
|
CControl_Plugin(const CControl_Plugin&); // Disable copy constructor
|
||||||
CControl_Plugin& operator=(const CControl_Plugin&); // Disable assignment
|
CControl_Plugin& operator=(const CControl_Plugin&); // Disable assignment
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstCtrlDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const { return FirstCtrlDefaultSet; }
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstCtrlSettings; }
|
virtual int32_t GetSettingStartRange() const { return FirstCtrlSettings; }
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_CONTROLLER; }
|
PLUGIN_TYPE type() { return PLUGIN_TYPE_CONTROLLER; }
|
||||||
bool LoadFunctions(void);
|
bool LoadFunctions(void);
|
||||||
void UnloadPluginDetails(void);
|
void UnloadPluginDetails(void);
|
||||||
|
|
||||||
bool m_AllocatedControllers;
|
bool m_AllocatedControllers;
|
||||||
|
|
||||||
// What the different controls are set up as
|
// What the different controls are set up as
|
||||||
CONTROL m_PluginControllers[4];
|
CONTROL m_PluginControllers[4];
|
||||||
CCONTROL * m_Controllers[4];
|
CCONTROL * m_Controllers[4];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,269 +1,269 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/N64RomClass.h>
|
#include <Project64-core/N64System/N64RomClass.h>
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include "GFXPlugin.h"
|
#include "GFXPlugin.h"
|
||||||
|
|
||||||
CGfxPlugin::CGfxPlugin() :
|
CGfxPlugin::CGfxPlugin() :
|
||||||
CaptureScreen(NULL),
|
CaptureScreen(NULL),
|
||||||
ChangeWindow(NULL),
|
ChangeWindow(NULL),
|
||||||
DrawScreen(NULL),
|
DrawScreen(NULL),
|
||||||
DrawStatus(NULL),
|
DrawStatus(NULL),
|
||||||
MoveScreen(NULL),
|
MoveScreen(NULL),
|
||||||
ProcessDList(NULL),
|
ProcessDList(NULL),
|
||||||
ProcessRDPList(NULL),
|
ProcessRDPList(NULL),
|
||||||
ShowCFB(NULL),
|
ShowCFB(NULL),
|
||||||
UpdateScreen(NULL),
|
UpdateScreen(NULL),
|
||||||
ViStatusChanged(NULL),
|
ViStatusChanged(NULL),
|
||||||
ViWidthChanged(NULL),
|
ViWidthChanged(NULL),
|
||||||
SoftReset(NULL),
|
SoftReset(NULL),
|
||||||
GetRomBrowserMenu(NULL),
|
GetRomBrowserMenu(NULL),
|
||||||
OnRomBrowserMenuItem(NULL),
|
OnRomBrowserMenuItem(NULL),
|
||||||
GetDebugInfo(NULL),
|
GetDebugInfo(NULL),
|
||||||
InitiateDebugger(NULL)
|
InitiateDebugger(NULL)
|
||||||
{
|
{
|
||||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGfxPlugin::~CGfxPlugin()
|
CGfxPlugin::~CGfxPlugin()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGfxPlugin::LoadFunctions(void)
|
bool CGfxPlugin::LoadFunctions(void)
|
||||||
{
|
{
|
||||||
// Find entries for functions in DLL
|
// Find entries for functions in DLL
|
||||||
int32_t(CALL *InitiateGFX) (void * Gfx_Info);
|
int32_t(CALL *InitiateGFX) (void * Gfx_Info);
|
||||||
LoadFunction(InitiateGFX);
|
LoadFunction(InitiateGFX);
|
||||||
LoadFunction(ChangeWindow);
|
LoadFunction(ChangeWindow);
|
||||||
LoadFunction(DrawScreen);
|
LoadFunction(DrawScreen);
|
||||||
LoadFunction(MoveScreen);
|
LoadFunction(MoveScreen);
|
||||||
LoadFunction(ProcessDList);
|
LoadFunction(ProcessDList);
|
||||||
LoadFunction(UpdateScreen);
|
LoadFunction(UpdateScreen);
|
||||||
LoadFunction(ViStatusChanged);
|
LoadFunction(ViStatusChanged);
|
||||||
LoadFunction(ViWidthChanged);
|
LoadFunction(ViWidthChanged);
|
||||||
LoadFunction(SoftReset);
|
LoadFunction(SoftReset);
|
||||||
|
|
||||||
// version 0x104 functions
|
// version 0x104 functions
|
||||||
_LoadFunction("DrawFullScreenStatus", DrawStatus);
|
_LoadFunction("DrawFullScreenStatus", DrawStatus);
|
||||||
|
|
||||||
// Rom Browser
|
// Rom Browser
|
||||||
LoadFunction(GetRomBrowserMenu);
|
LoadFunction(GetRomBrowserMenu);
|
||||||
LoadFunction(OnRomBrowserMenuItem);
|
LoadFunction(OnRomBrowserMenuItem);
|
||||||
|
|
||||||
//Make sure dll had all needed functions
|
//Make sure dll had all needed functions
|
||||||
if (ChangeWindow == NULL) { UnloadPlugin(); return false; }
|
if (ChangeWindow == NULL) { UnloadPlugin(); return false; }
|
||||||
if (DrawScreen == NULL) { DrawScreen = DummyDrawScreen; }
|
if (DrawScreen == NULL) { DrawScreen = DummyDrawScreen; }
|
||||||
if (InitiateGFX == NULL) { UnloadPlugin(); return false; }
|
if (InitiateGFX == NULL) { UnloadPlugin(); return false; }
|
||||||
if (MoveScreen == NULL) { MoveScreen = DummyMoveScreen; }
|
if (MoveScreen == NULL) { MoveScreen = DummyMoveScreen; }
|
||||||
if (ProcessDList == NULL) { UnloadPlugin(); return false; }
|
if (ProcessDList == NULL) { UnloadPlugin(); return false; }
|
||||||
if (UpdateScreen == NULL) { UnloadPlugin(); return false; }
|
if (UpdateScreen == NULL) { UnloadPlugin(); return false; }
|
||||||
if (ViStatusChanged == NULL) { ViStatusChanged = DummyViStatusChanged; }
|
if (ViStatusChanged == NULL) { ViStatusChanged = DummyViStatusChanged; }
|
||||||
if (ViWidthChanged == NULL) { ViWidthChanged = DummyViWidthChanged; }
|
if (ViWidthChanged == NULL) { ViWidthChanged = DummyViWidthChanged; }
|
||||||
if (SoftReset == NULL) { SoftReset = DummySoftReset; }
|
if (SoftReset == NULL) { SoftReset = DummySoftReset; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0103)
|
if (m_PluginInfo.Version >= 0x0103)
|
||||||
{
|
{
|
||||||
LoadFunction(ProcessRDPList);
|
LoadFunction(ProcessRDPList);
|
||||||
LoadFunction(CaptureScreen);
|
LoadFunction(CaptureScreen);
|
||||||
LoadFunction(ShowCFB);
|
LoadFunction(ShowCFB);
|
||||||
LoadFunction(GetDebugInfo);
|
LoadFunction(GetDebugInfo);
|
||||||
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
||||||
|
|
||||||
if (ProcessRDPList == NULL) { UnloadPlugin(); return false; }
|
if (ProcessRDPList == NULL) { UnloadPlugin(); return false; }
|
||||||
if (CaptureScreen == NULL) { UnloadPlugin(); return false; }
|
if (CaptureScreen == NULL) { UnloadPlugin(); return false; }
|
||||||
if (ShowCFB == NULL) { UnloadPlugin(); return false; }
|
if (ShowCFB == NULL) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0104)
|
if (m_PluginInfo.Version >= 0x0104)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetDebugInfo != NULL)
|
if (GetDebugInfo != NULL)
|
||||||
{
|
{
|
||||||
GetDebugInfo(&m_GFXDebug);
|
GetDebugInfo(&m_GFXDebug);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
{
|
{
|
||||||
if (m_Initialized)
|
if (m_Initialized)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void * hWnd; /* Render window */
|
void * hWnd; /* Render window */
|
||||||
void * hStatusBar; /* if render window does not have a status bar then this is NULL */
|
void * hStatusBar; /* if render window does not have a status bar then this is NULL */
|
||||||
|
|
||||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
||||||
// bswap on a dword (32 bits) boundry
|
// bswap on a dword (32 bits) boundry
|
||||||
// eg. the first 8 bytes are stored like this:
|
// eg. the first 8 bytes are stored like this:
|
||||||
// 4 3 2 1 8 7 6 5
|
// 4 3 2 1 8 7 6 5
|
||||||
|
|
||||||
uint8_t * HEADER; // This is the rom header (first 40h bytes of the rom
|
uint8_t * HEADER; // This is the rom header (first 40h bytes of the rom
|
||||||
// This will be in the same memory format as the rest of the memory.
|
// This will be in the same memory format as the rest of the memory.
|
||||||
uint8_t * RDRAM;
|
uint8_t * RDRAM;
|
||||||
uint8_t * DMEM;
|
uint8_t * DMEM;
|
||||||
uint8_t * IMEM;
|
uint8_t * IMEM;
|
||||||
|
|
||||||
uint32_t * MI__INTR_REG;
|
uint32_t * MI__INTR_REG;
|
||||||
|
|
||||||
uint32_t * DPC__START_REG;
|
uint32_t * DPC__START_REG;
|
||||||
uint32_t * DPC__END_REG;
|
uint32_t * DPC__END_REG;
|
||||||
uint32_t * DPC__CURRENT_REG;
|
uint32_t * DPC__CURRENT_REG;
|
||||||
uint32_t * DPC__STATUS_REG;
|
uint32_t * DPC__STATUS_REG;
|
||||||
uint32_t * DPC__CLOCK_REG;
|
uint32_t * DPC__CLOCK_REG;
|
||||||
uint32_t * DPC__BUFBUSY_REG;
|
uint32_t * DPC__BUFBUSY_REG;
|
||||||
uint32_t * DPC__PIPEBUSY_REG;
|
uint32_t * DPC__PIPEBUSY_REG;
|
||||||
uint32_t * DPC__TMEM_REG;
|
uint32_t * DPC__TMEM_REG;
|
||||||
|
|
||||||
uint32_t * VI__STATUS_REG;
|
uint32_t * VI__STATUS_REG;
|
||||||
uint32_t * VI__ORIGIN_REG;
|
uint32_t * VI__ORIGIN_REG;
|
||||||
uint32_t * VI__WIDTH_REG;
|
uint32_t * VI__WIDTH_REG;
|
||||||
uint32_t * VI__INTR_REG;
|
uint32_t * VI__INTR_REG;
|
||||||
uint32_t * VI__V_CURRENT_LINE_REG;
|
uint32_t * VI__V_CURRENT_LINE_REG;
|
||||||
uint32_t * VI__TIMING_REG;
|
uint32_t * VI__TIMING_REG;
|
||||||
uint32_t * VI__V_SYNC_REG;
|
uint32_t * VI__V_SYNC_REG;
|
||||||
uint32_t * VI__H_SYNC_REG;
|
uint32_t * VI__H_SYNC_REG;
|
||||||
uint32_t * VI__LEAP_REG;
|
uint32_t * VI__LEAP_REG;
|
||||||
uint32_t * VI__H_START_REG;
|
uint32_t * VI__H_START_REG;
|
||||||
uint32_t * VI__V_START_REG;
|
uint32_t * VI__V_START_REG;
|
||||||
uint32_t * VI__V_BURST_REG;
|
uint32_t * VI__V_BURST_REG;
|
||||||
uint32_t * VI__X_SCALE_REG;
|
uint32_t * VI__X_SCALE_REG;
|
||||||
uint32_t * VI__Y_SCALE_REG;
|
uint32_t * VI__Y_SCALE_REG;
|
||||||
|
|
||||||
void(CALL *CheckInterrupts)(void);
|
void(CALL *CheckInterrupts)(void);
|
||||||
} GFX_INFO;
|
} GFX_INFO;
|
||||||
|
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
|
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
|
||||||
_LoadFunction("InitiateGFX",InitiateGFX);
|
_LoadFunction("InitiateGFX",InitiateGFX);
|
||||||
if (InitiateGFX == NULL) { return false; }
|
if (InitiateGFX == NULL) { return false; }
|
||||||
|
|
||||||
GFX_INFO Info = { 0 };
|
GFX_INFO Info = { 0 };
|
||||||
|
|
||||||
Info.MemoryBswaped = true;
|
Info.MemoryBswaped = true;
|
||||||
Info.hWnd = Window->GetWindowHandle();
|
Info.hWnd = Window->GetWindowHandle();
|
||||||
Info.hStatusBar = Window->GetStatusBar();
|
Info.hStatusBar = Window->GetStatusBar();
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
|
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. it's just needed so we can config the DLL.
|
// parameters here.. it's just needed so we can config the DLL.
|
||||||
if (System == NULL)
|
if (System == NULL)
|
||||||
{
|
{
|
||||||
uint8_t Buffer[100];
|
uint8_t Buffer[100];
|
||||||
uint32_t Value = 0;
|
uint32_t Value = 0;
|
||||||
|
|
||||||
Info.HEADER = Buffer;
|
Info.HEADER = Buffer;
|
||||||
Info.RDRAM = Buffer;
|
Info.RDRAM = Buffer;
|
||||||
Info.DMEM = Buffer;
|
Info.DMEM = Buffer;
|
||||||
Info.IMEM = Buffer;
|
Info.IMEM = Buffer;
|
||||||
Info.MI__INTR_REG = &Value;
|
Info.MI__INTR_REG = &Value;
|
||||||
Info.VI__STATUS_REG = &Value;
|
Info.VI__STATUS_REG = &Value;
|
||||||
Info.VI__ORIGIN_REG = &Value;
|
Info.VI__ORIGIN_REG = &Value;
|
||||||
Info.VI__WIDTH_REG = &Value;
|
Info.VI__WIDTH_REG = &Value;
|
||||||
Info.VI__INTR_REG = &Value;
|
Info.VI__INTR_REG = &Value;
|
||||||
Info.VI__V_CURRENT_LINE_REG = &Value;
|
Info.VI__V_CURRENT_LINE_REG = &Value;
|
||||||
Info.VI__TIMING_REG = &Value;
|
Info.VI__TIMING_REG = &Value;
|
||||||
Info.VI__V_SYNC_REG = &Value;
|
Info.VI__V_SYNC_REG = &Value;
|
||||||
Info.VI__H_SYNC_REG = &Value;
|
Info.VI__H_SYNC_REG = &Value;
|
||||||
Info.VI__LEAP_REG = &Value;
|
Info.VI__LEAP_REG = &Value;
|
||||||
Info.VI__H_START_REG = &Value;
|
Info.VI__H_START_REG = &Value;
|
||||||
Info.VI__V_START_REG = &Value;
|
Info.VI__V_START_REG = &Value;
|
||||||
Info.VI__V_BURST_REG = &Value;
|
Info.VI__V_BURST_REG = &Value;
|
||||||
Info.VI__X_SCALE_REG = &Value;
|
Info.VI__X_SCALE_REG = &Value;
|
||||||
Info.VI__Y_SCALE_REG = &Value;
|
Info.VI__Y_SCALE_REG = &Value;
|
||||||
}
|
}
|
||||||
// Send initialization information to the DLL
|
// Send initialization information to the DLL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info.HEADER = g_Rom->GetRomAddress();
|
Info.HEADER = g_Rom->GetRomAddress();
|
||||||
Info.RDRAM = g_MMU->Rdram();
|
Info.RDRAM = g_MMU->Rdram();
|
||||||
Info.DMEM = g_MMU->Dmem();
|
Info.DMEM = g_MMU->Dmem();
|
||||||
Info.IMEM = g_MMU->Imem();
|
Info.IMEM = g_MMU->Imem();
|
||||||
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
|
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
|
||||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||||
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
|
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
|
||||||
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
|
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
|
||||||
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
|
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
|
||||||
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
|
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
|
||||||
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
|
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
|
||||||
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_REG;
|
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_REG;
|
||||||
Info.VI__V_SYNC_REG = &g_Reg->VI_V_SYNC_REG;
|
Info.VI__V_SYNC_REG = &g_Reg->VI_V_SYNC_REG;
|
||||||
Info.VI__H_SYNC_REG = &g_Reg->VI_H_SYNC_REG;
|
Info.VI__H_SYNC_REG = &g_Reg->VI_H_SYNC_REG;
|
||||||
Info.VI__LEAP_REG = &g_Reg->VI_LEAP_REG;
|
Info.VI__LEAP_REG = &g_Reg->VI_LEAP_REG;
|
||||||
Info.VI__H_START_REG = &g_Reg->VI_H_START_REG;
|
Info.VI__H_START_REG = &g_Reg->VI_H_START_REG;
|
||||||
Info.VI__V_START_REG = &g_Reg->VI_V_START_REG;
|
Info.VI__V_START_REG = &g_Reg->VI_V_START_REG;
|
||||||
Info.VI__V_BURST_REG = &g_Reg->VI_V_BURST_REG;
|
Info.VI__V_BURST_REG = &g_Reg->VI_V_BURST_REG;
|
||||||
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
|
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
|
||||||
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
|
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Initialized = InitiateGFX(Info) != 0;
|
m_Initialized = InitiateGFX(Info) != 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||||
pjutil::DynLibCallDllMain();
|
pjutil::DynLibCallDllMain();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return m_Initialized;
|
return m_Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGfxPlugin::UnloadPluginDetails(void)
|
void CGfxPlugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
if (m_LibHandle != NULL)
|
if (m_LibHandle != NULL)
|
||||||
{
|
{
|
||||||
pjutil::DynLibClose(m_LibHandle);
|
pjutil::DynLibClose(m_LibHandle);
|
||||||
m_LibHandle = NULL;
|
m_LibHandle = NULL;
|
||||||
}
|
}
|
||||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||||
|
|
||||||
// CaptureScreen = NULL;
|
// CaptureScreen = NULL;
|
||||||
ChangeWindow = NULL;
|
ChangeWindow = NULL;
|
||||||
GetDebugInfo = NULL;
|
GetDebugInfo = NULL;
|
||||||
DrawScreen = NULL;
|
DrawScreen = NULL;
|
||||||
DrawStatus = NULL;
|
DrawStatus = NULL;
|
||||||
// FrameBufferRead = NULL;
|
// FrameBufferRead = NULL;
|
||||||
// FrameBufferWrite = NULL;
|
// FrameBufferWrite = NULL;
|
||||||
InitiateDebugger = NULL;
|
InitiateDebugger = NULL;
|
||||||
MoveScreen = NULL;
|
MoveScreen = NULL;
|
||||||
ProcessDList = NULL;
|
ProcessDList = NULL;
|
||||||
ProcessRDPList = NULL;
|
ProcessRDPList = NULL;
|
||||||
ShowCFB = NULL;
|
ShowCFB = NULL;
|
||||||
UpdateScreen = NULL;
|
UpdateScreen = NULL;
|
||||||
ViStatusChanged = NULL;
|
ViStatusChanged = NULL;
|
||||||
ViWidthChanged = NULL;
|
ViWidthChanged = NULL;
|
||||||
GetRomBrowserMenu = NULL;
|
GetRomBrowserMenu = NULL;
|
||||||
OnRomBrowserMenuItem = NULL;
|
OnRomBrowserMenuItem = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGfxPlugin::ProcessMenuItem(int32_t id)
|
void CGfxPlugin::ProcessMenuItem(int32_t id)
|
||||||
{
|
{
|
||||||
if (m_GFXDebug.ProcessMenuItem)
|
if (m_GFXDebug.ProcessMenuItem)
|
||||||
{
|
{
|
||||||
m_GFXDebug.ProcessMenuItem(id);
|
m_GFXDebug.ProcessMenuItem(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,98 +1,98 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
|
||||||
class CGfxPlugin : public CPlugin
|
class CGfxPlugin : public CPlugin
|
||||||
{
|
{
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/* Menu */
|
/* Menu */
|
||||||
/* Items should have an ID between 5101 and 5200 */
|
/* Items should have an ID between 5101 and 5200 */
|
||||||
void * hGFXMenu;
|
void * hGFXMenu;
|
||||||
void(CALL *ProcessMenuItem)(int32_t ID);
|
void(CALL *ProcessMenuItem)(int32_t ID);
|
||||||
|
|
||||||
/* Break Points */
|
/* Break Points */
|
||||||
int32_t UseBPoints;
|
int32_t UseBPoints;
|
||||||
char BPPanelName[20];
|
char BPPanelName[20];
|
||||||
void(CALL *Add_BPoint) (void);
|
void(CALL *Add_BPoint) (void);
|
||||||
void(CALL *CreateBPPanel) (void * hDlg, void * rcBox);
|
void(CALL *CreateBPPanel) (void * hDlg, void * rcBox);
|
||||||
void(CALL *HideBPPanel) (void);
|
void(CALL *HideBPPanel) (void);
|
||||||
void(CALL *PaintBPPanel) (void * ps);
|
void(CALL *PaintBPPanel) (void * ps);
|
||||||
void(CALL *ShowBPPanel) (void);
|
void(CALL *ShowBPPanel) (void);
|
||||||
void(CALL *RefreshBpoints) (void * hList);
|
void(CALL *RefreshBpoints) (void * hList);
|
||||||
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
||||||
void(CALL *RemoveAllBpoint) (void);
|
void(CALL *RemoveAllBpoint) (void);
|
||||||
|
|
||||||
/* GFX command Window */
|
/* GFX command Window */
|
||||||
void(CALL *Enter_GFX_Commands_Window)(void);
|
void(CALL *Enter_GFX_Commands_Window)(void);
|
||||||
} GFXDEBUG_INFO;
|
} GFXDEBUG_INFO;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void(CALL *UpdateBreakPoints)(void);
|
void(CALL *UpdateBreakPoints)(void);
|
||||||
void(CALL *UpdateMemory)(void);
|
void(CALL *UpdateMemory)(void);
|
||||||
void(CALL *UpdateR4300iRegisters)(void);
|
void(CALL *UpdateR4300iRegisters)(void);
|
||||||
void(CALL *Enter_BPoint_Window)(void);
|
void(CALL *Enter_BPoint_Window)(void);
|
||||||
void(CALL *Enter_R4300i_Commands_Window)(void);
|
void(CALL *Enter_R4300i_Commands_Window)(void);
|
||||||
void(CALL *Enter_R4300i_Register_Window)(void);
|
void(CALL *Enter_R4300i_Register_Window)(void);
|
||||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||||
void(CALL *Enter_Memory_Window)(void);
|
void(CALL *Enter_Memory_Window)(void);
|
||||||
} DEBUG_INFO;
|
} DEBUG_INFO;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGfxPlugin(void);
|
CGfxPlugin(void);
|
||||||
~CGfxPlugin();
|
~CGfxPlugin();
|
||||||
|
|
||||||
bool LoadFunctions(void);
|
bool LoadFunctions(void);
|
||||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||||
|
|
||||||
void(CALL *CaptureScreen) (const char *);
|
void(CALL *CaptureScreen) (const char *);
|
||||||
void(CALL *ChangeWindow) (void);
|
void(CALL *ChangeWindow) (void);
|
||||||
void(CALL *DrawScreen) (void);
|
void(CALL *DrawScreen) (void);
|
||||||
void(CALL *DrawStatus) (const char * lpString, int32_t RightAlign);
|
void(CALL *DrawStatus) (const char * lpString, int32_t RightAlign);
|
||||||
void(CALL *MoveScreen) (int32_t xpos, int32_t ypos);
|
void(CALL *MoveScreen) (int32_t xpos, int32_t ypos);
|
||||||
void(CALL *ProcessDList) (void);
|
void(CALL *ProcessDList) (void);
|
||||||
void(CALL *ProcessRDPList) (void);
|
void(CALL *ProcessRDPList) (void);
|
||||||
void(CALL *ShowCFB) (void);
|
void(CALL *ShowCFB) (void);
|
||||||
void(CALL *UpdateScreen) (void);
|
void(CALL *UpdateScreen) (void);
|
||||||
void(CALL *ViStatusChanged) (void);
|
void(CALL *ViStatusChanged) (void);
|
||||||
void(CALL *ViWidthChanged) (void);
|
void(CALL *ViWidthChanged) (void);
|
||||||
void(CALL *SoftReset) (void);
|
void(CALL *SoftReset) (void);
|
||||||
|
|
||||||
//Rom Browser
|
//Rom Browser
|
||||||
void *(CALL * GetRomBrowserMenu)(void); /* Items should have an ID between 4101 and 4200 */
|
void *(CALL * GetRomBrowserMenu)(void); /* Items should have an ID between 4101 and 4200 */
|
||||||
void(CALL * OnRomBrowserMenuItem)(int32_t MenuID, void * hParent, uint8_t * HEADER);
|
void(CALL * OnRomBrowserMenuItem)(int32_t MenuID, void * hParent, uint8_t * HEADER);
|
||||||
|
|
||||||
void * GetDebugMenu(void) { return m_GFXDebug.hGFXMenu; }
|
void * GetDebugMenu(void) { return m_GFXDebug.hGFXMenu; }
|
||||||
void ProcessMenuItem(int32_t id);
|
void ProcessMenuItem(int32_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CGfxPlugin(const CGfxPlugin&); // Disable copy constructor
|
CGfxPlugin(const CGfxPlugin&); // Disable copy constructor
|
||||||
CGfxPlugin& operator=(const CGfxPlugin&); // Disable assignment
|
CGfxPlugin& operator=(const CGfxPlugin&); // Disable assignment
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; }
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; }
|
virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; }
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_GFX; }
|
PLUGIN_TYPE type() { return PLUGIN_TYPE_GFX; }
|
||||||
|
|
||||||
void UnloadPluginDetails(void);
|
void UnloadPluginDetails(void);
|
||||||
|
|
||||||
GFXDEBUG_INFO m_GFXDebug;
|
GFXDEBUG_INFO m_GFXDebug;
|
||||||
|
|
||||||
void(CALL *GetDebugInfo) (GFXDEBUG_INFO * GFXDebugInfo);
|
void(CALL *GetDebugInfo) (GFXDEBUG_INFO * GFXDebugInfo);
|
||||||
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
||||||
|
|
||||||
static void CALL DummyDrawScreen(void) {}
|
static void CALL DummyDrawScreen(void) {}
|
||||||
static void CALL DummyMoveScreen(int32_t /*xpos*/, int32_t /*ypos*/) {}
|
static void CALL DummyMoveScreen(int32_t /*xpos*/, int32_t /*ypos*/) {}
|
||||||
static void CALL DummyViStatusChanged(void) {}
|
static void CALL DummyViStatusChanged(void) {}
|
||||||
static void CALL DummyViWidthChanged(void) {}
|
static void CALL DummyViWidthChanged(void) {}
|
||||||
static void CALL DummySoftReset(void) {}
|
static void CALL DummySoftReset(void) {}
|
||||||
};
|
};
|
|
@ -1,426 +1,426 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include <Project64-core/Plugins/PluginClass.h>
|
#include <Project64-core/Plugins/PluginClass.h>
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CPlugins::CPlugins(const stdstr & PluginDir) :
|
CPlugins::CPlugins(const stdstr & PluginDir) :
|
||||||
m_MainWindow(NULL),
|
m_MainWindow(NULL),
|
||||||
m_SyncWindow(NULL),
|
m_SyncWindow(NULL),
|
||||||
m_PluginDir(PluginDir),
|
m_PluginDir(PluginDir),
|
||||||
m_Gfx(NULL),
|
m_Gfx(NULL),
|
||||||
m_Audio(NULL),
|
m_Audio(NULL),
|
||||||
m_RSP(NULL),
|
m_RSP(NULL),
|
||||||
m_Control(NULL)
|
m_Control(NULL)
|
||||||
{
|
{
|
||||||
CreatePlugins();
|
CreatePlugins();
|
||||||
g_Settings->RegisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Plugin_GFX_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_GFX_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Plugin_AUDIO_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_AUDIO_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Plugin_CONT_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_CONT_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Plugin_UseHleGfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_UseHleGfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Plugin_UseHleAudio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Plugin_UseHleAudio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Game_EditPlugin_Gfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Game_EditPlugin_Gfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Game_EditPlugin_Audio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Game_EditPlugin_Audio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Game_EditPlugin_Contr, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Game_EditPlugin_Contr, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->RegisterChangeCB(Game_EditPlugin_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->RegisterChangeCB(Game_EditPlugin_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlugins::~CPlugins(void)
|
CPlugins::~CPlugins(void)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Plugin_RSP_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Plugin_GFX_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Plugin_GFX_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Plugin_AUDIO_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Plugin_AUDIO_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Plugin_CONT_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Plugin_CONT_Current, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Plugin_UseHleGfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Plugin_UseHleGfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Plugin_UseHleAudio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Plugin_UseHleAudio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Game_EditPlugin_Gfx, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Game_EditPlugin_Audio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Game_EditPlugin_Audio, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Game_EditPlugin_Contr, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Game_EditPlugin_Contr, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
g_Settings->UnregisterChangeCB(Game_EditPlugin_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
g_Settings->UnregisterChangeCB(Game_EditPlugin_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||||
|
|
||||||
DestroyGfxPlugin();
|
DestroyGfxPlugin();
|
||||||
DestroyAudioPlugin();
|
DestroyAudioPlugin();
|
||||||
DestroyRspPlugin();
|
DestroyRspPlugin();
|
||||||
DestroyControlPlugin();
|
DestroyControlPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::PluginChanged(CPlugins * _this)
|
void CPlugins::PluginChanged(CPlugins * _this)
|
||||||
{
|
{
|
||||||
if (g_Settings->LoadBool(Game_TempLoaded) == true)
|
if (g_Settings->LoadBool(Game_TempLoaded) == true)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool bGfxChange = _stricmp(_this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
|
bool bGfxChange = _stricmp(_this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
|
||||||
bool bAudioChange = _stricmp(_this->m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
|
bool bAudioChange = _stricmp(_this->m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
|
||||||
bool bRspChange = _stricmp(_this->m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
|
bool bRspChange = _stricmp(_this->m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
|
||||||
bool bContChange = _stricmp(_this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
bool bContChange = _stricmp(_this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
||||||
|
|
||||||
if (bGfxChange || bAudioChange || bRspChange || bContChange)
|
if (bGfxChange || bAudioChange || bRspChange || bContChange)
|
||||||
{
|
{
|
||||||
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
||||||
{
|
{
|
||||||
//Ensure that base system actually exists before we go triggering the event
|
//Ensure that base system actually exists before we go triggering the event
|
||||||
if (g_BaseSystem)
|
if (g_BaseSystem)
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ChangePlugins);
|
g_BaseSystem->ExternalEvent(SysEvent_ChangePlugins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_this->Reset(NULL);
|
_this->Reset(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename plugin_type>
|
template <typename plugin_type>
|
||||||
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type)
|
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type)
|
||||||
{
|
{
|
||||||
if (plugin != NULL)
|
if (plugin != NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FileName = g_Settings->LoadStringVal(PluginSettingID);
|
FileName = g_Settings->LoadStringVal(PluginSettingID);
|
||||||
CPath PluginFileName(PluginDir, FileName.c_str());
|
CPath PluginFileName(PluginDir, FileName.c_str());
|
||||||
plugin = new plugin_type();
|
plugin = new plugin_type();
|
||||||
if (plugin)
|
if (plugin)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading (%s): Starting", type, (const char *)PluginFileName);
|
WriteTrace(TraceLevel, TraceDebug, "%s Loading (%s): Starting", type, (const char *)PluginFileName);
|
||||||
if (plugin->Load(PluginFileName))
|
if (plugin->Load(PluginFileName))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceLevel, TraceDebug, "%s Current Ver: %s", type, plugin->PluginName());
|
WriteTrace(TraceLevel, TraceDebug, "%s Current Ver: %s", type, plugin->PluginName());
|
||||||
g_Settings->SaveString(PluginVerSettingID, plugin->PluginName());
|
g_Settings->SaveString(PluginVerSettingID, plugin->PluginName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteTrace(TraceError, TraceDebug, "Failed to load %s", (const char *)PluginFileName);
|
WriteTrace(TraceError, TraceDebug, "Failed to load %s", (const char *)PluginFileName);
|
||||||
delete plugin;
|
delete plugin;
|
||||||
plugin = NULL;
|
plugin = NULL;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
|
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteTrace(TraceError, TraceDebug, "Failed to allocate %s plugin", type);
|
WriteTrace(TraceError, TraceDebug, "Failed to allocate %s plugin", type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::CreatePlugins(void)
|
void CPlugins::CreatePlugins(void)
|
||||||
{
|
{
|
||||||
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX");
|
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX");
|
||||||
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio");
|
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio");
|
||||||
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP");
|
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP");
|
||||||
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control");
|
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control");
|
||||||
|
|
||||||
//Enable debugger
|
//Enable debugger
|
||||||
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
|
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
|
||||||
m_RSP->EnableDebugging(bHaveDebugger());
|
m_RSP->EnableDebugging(bHaveDebugger());
|
||||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging done");
|
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::GameReset(void)
|
void CPlugins::GameReset(void)
|
||||||
{
|
{
|
||||||
if (m_Gfx)
|
if (m_Gfx)
|
||||||
{
|
{
|
||||||
m_Gfx->GameReset();
|
m_Gfx->GameReset();
|
||||||
}
|
}
|
||||||
if (m_Audio)
|
if (m_Audio)
|
||||||
{
|
{
|
||||||
m_Audio->GameReset();
|
m_Audio->GameReset();
|
||||||
}
|
}
|
||||||
if (m_RSP)
|
if (m_RSP)
|
||||||
{
|
{
|
||||||
m_RSP->GameReset();
|
m_RSP->GameReset();
|
||||||
}
|
}
|
||||||
if (m_Control)
|
if (m_Control)
|
||||||
{
|
{
|
||||||
m_Control->GameReset();
|
m_Control->GameReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyGfxPlugin(void)
|
void CPlugins::DestroyGfxPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_Gfx == NULL)
|
if (m_Gfx == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceGFXPlugin, TraceInfo, "before delete m_Gfx");
|
WriteTrace(TraceGFXPlugin, TraceInfo, "before delete m_Gfx");
|
||||||
delete m_Gfx;
|
delete m_Gfx;
|
||||||
WriteTrace(TraceGFXPlugin, TraceInfo, "after delete m_Gfx");
|
WriteTrace(TraceGFXPlugin, TraceInfo, "after delete m_Gfx");
|
||||||
m_Gfx = NULL;
|
m_Gfx = NULL;
|
||||||
// g_Settings->UnknownSetting_GFX = NULL;
|
// g_Settings->UnknownSetting_GFX = NULL;
|
||||||
DestroyRspPlugin();
|
DestroyRspPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyAudioPlugin(void)
|
void CPlugins::DestroyAudioPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_Audio == NULL)
|
if (m_Audio == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before close");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "before close");
|
||||||
m_Audio->Close();
|
m_Audio->Close();
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
|
||||||
delete m_Audio;
|
delete m_Audio;
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
|
||||||
m_Audio = NULL;
|
m_Audio = NULL;
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
|
||||||
// g_Settings->UnknownSetting_AUDIO = NULL;
|
// g_Settings->UnknownSetting_AUDIO = NULL;
|
||||||
DestroyRspPlugin();
|
DestroyRspPlugin();
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyRspPlugin(void)
|
void CPlugins::DestroyRspPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_RSP == NULL)
|
if (m_RSP == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before close");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "before close");
|
||||||
m_RSP->Close();
|
m_RSP->Close();
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
|
||||||
delete m_RSP;
|
delete m_RSP;
|
||||||
m_RSP = NULL;
|
m_RSP = NULL;
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
|
||||||
// g_Settings->UnknownSetting_RSP = NULL;
|
// g_Settings->UnknownSetting_RSP = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::DestroyControlPlugin(void)
|
void CPlugins::DestroyControlPlugin(void)
|
||||||
{
|
{
|
||||||
if (m_Control == NULL)
|
if (m_Control == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before close");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "before close");
|
||||||
m_Control->Close();
|
m_Control->Close();
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
|
||||||
delete m_Control;
|
delete m_Control;
|
||||||
m_Control = NULL;
|
m_Control = NULL;
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
|
||||||
// g_Settings->UnknownSetting_CTRL = NULL;
|
// g_Settings->UnknownSetting_CTRL = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
||||||
{
|
{
|
||||||
m_MainWindow = MainWindow;
|
m_MainWindow = MainWindow;
|
||||||
m_SyncWindow = SyncWindow;
|
m_SyncWindow = SyncWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::RomOpened(void)
|
void CPlugins::RomOpened(void)
|
||||||
{
|
{
|
||||||
m_Gfx->RomOpened();
|
m_Gfx->RomOpened();
|
||||||
m_RSP->RomOpened();
|
m_RSP->RomOpened();
|
||||||
m_Audio->RomOpened();
|
m_Audio->RomOpened();
|
||||||
m_Control->RomOpened();
|
m_Control->RomOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::RomClosed(void)
|
void CPlugins::RomClosed(void)
|
||||||
{
|
{
|
||||||
m_Gfx->RomClose();
|
m_Gfx->RomClose();
|
||||||
m_RSP->RomClose();
|
m_RSP->RomClose();
|
||||||
m_Audio->RomClose();
|
m_Audio->RomClose();
|
||||||
m_Control->RomClose();
|
m_Control->RomClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlugins::Initiate(CN64System * System)
|
bool CPlugins::Initiate(CN64System * System)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||||
//Check to make sure we have the plugin available to be used
|
//Check to make sure we have the plugin available to be used
|
||||||
if (m_Gfx == NULL) { return false; }
|
if (m_Gfx == NULL) { return false; }
|
||||||
if (m_Audio == NULL) { return false; }
|
if (m_Audio == NULL) { return false; }
|
||||||
if (m_RSP == NULL) { return false; }
|
if (m_RSP == NULL) { return false; }
|
||||||
if (m_Control == NULL) { return false; }
|
if (m_Control == NULL) { return false; }
|
||||||
|
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
||||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
||||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
||||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlugins::ResetInUiThread(CN64System * System)
|
bool CPlugins::ResetInUiThread(CN64System * System)
|
||||||
{
|
{
|
||||||
return m_MainWindow->ResetPluginsInUiThread(this, System);
|
return m_MainWindow->ResetPluginsInUiThread(this, System);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlugins::Reset(CN64System * System)
|
bool CPlugins::Reset(CN64System * System)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||||
|
|
||||||
bool bGfxChange = _stricmp(m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
|
bool bGfxChange = _stricmp(m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str()) != 0;
|
||||||
bool bAudioChange = _stricmp(m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
|
bool bAudioChange = _stricmp(m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
|
||||||
bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
|
bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
|
||||||
bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
||||||
|
|
||||||
//if GFX and Audio has changed we also need to force reset of RSP
|
//if GFX and Audio has changed we also need to force reset of RSP
|
||||||
if (bGfxChange || bAudioChange)
|
if (bGfxChange || bAudioChange)
|
||||||
bRspChange = true;
|
bRspChange = true;
|
||||||
|
|
||||||
if (bGfxChange) { DestroyGfxPlugin(); }
|
if (bGfxChange) { DestroyGfxPlugin(); }
|
||||||
if (bAudioChange) { DestroyAudioPlugin(); }
|
if (bAudioChange) { DestroyAudioPlugin(); }
|
||||||
if (bRspChange) { DestroyRspPlugin(); }
|
if (bRspChange) { DestroyRspPlugin(); }
|
||||||
if (bContChange) { DestroyControlPlugin(); }
|
if (bContChange) { DestroyControlPlugin(); }
|
||||||
|
|
||||||
CreatePlugins();
|
CreatePlugins();
|
||||||
|
|
||||||
if (m_Gfx && bGfxChange)
|
if (m_Gfx && bGfxChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
||||||
}
|
}
|
||||||
if (m_Audio && bAudioChange)
|
if (m_Audio && bAudioChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
||||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
||||||
}
|
}
|
||||||
if (m_Control && bContChange)
|
if (m_Control && bContChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
||||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
||||||
}
|
}
|
||||||
if (m_RSP && bRspChange)
|
if (m_RSP && bRspChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
||||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||||
}
|
}
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
{
|
{
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_RSP:
|
case PLUGIN_TYPE_RSP:
|
||||||
if (m_RSP == NULL || m_RSP->DllConfig == NULL) { break; }
|
if (m_RSP == NULL || m_RSP->DllConfig == NULL) { break; }
|
||||||
if (!m_RSP->Initialized())
|
if (!m_RSP->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_RSP->Initiate(this, NULL))
|
if (!m_RSP->Initiate(this, NULL))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_RSP->DllConfig(hParent);
|
m_RSP->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_GFX:
|
case PLUGIN_TYPE_GFX:
|
||||||
if (m_Gfx == NULL || m_Gfx->DllConfig == NULL) { break; }
|
if (m_Gfx == NULL || m_Gfx->DllConfig == NULL) { break; }
|
||||||
if (!m_Gfx->Initialized())
|
if (!m_Gfx->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Gfx->Initiate(NULL, m_MainWindow))
|
if (!m_Gfx->Initiate(NULL, m_MainWindow))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Gfx->DllConfig(hParent);
|
m_Gfx->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_AUDIO:
|
case PLUGIN_TYPE_AUDIO:
|
||||||
if (m_Audio == NULL || m_Audio->DllConfig == NULL) { break; }
|
if (m_Audio == NULL || m_Audio->DllConfig == NULL) { break; }
|
||||||
if (!m_Audio->Initialized())
|
if (!m_Audio->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Audio->Initiate(NULL, m_MainWindow))
|
if (!m_Audio->Initiate(NULL, m_MainWindow))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Audio->DllConfig(hParent);
|
m_Audio->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_CONTROLLER:
|
case PLUGIN_TYPE_CONTROLLER:
|
||||||
if (m_Control == NULL || m_Control->DllConfig == NULL) { break; }
|
if (m_Control == NULL || m_Control->DllConfig == NULL) { break; }
|
||||||
if (!m_Control->Initialized())
|
if (!m_Control->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Control->Initiate(NULL, m_MainWindow))
|
if (!m_Control->Initiate(NULL, m_MainWindow))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Control->DllConfig(hParent);
|
m_Control->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DummyCheckInterrupts(void)
|
void DummyCheckInterrupts(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DummyFunction(void)
|
void DummyFunction(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
{
|
{
|
||||||
//Copy GFX Plugin
|
//Copy GFX Plugin
|
||||||
CPath srcGfxPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
CPath srcGfxPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
||||||
CPath dstGfxPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
CPath dstGfxPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
||||||
|
|
||||||
if (!dstGfxPlugin.DirectoryExists())
|
if (!dstGfxPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstGfxPlugin.DirectoryCreate();
|
dstGfxPlugin.DirectoryCreate();
|
||||||
}
|
}
|
||||||
if (!srcGfxPlugin.CopyTo(dstGfxPlugin))
|
if (!srcGfxPlugin.CopyTo(dstGfxPlugin))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy m_Audio Plugin
|
//Copy m_Audio Plugin
|
||||||
CPath srcAudioPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
CPath srcAudioPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
||||||
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
||||||
if (!dstAudioPlugin.DirectoryExists())
|
if (!dstAudioPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstAudioPlugin.DirectoryCreate();
|
dstAudioPlugin.DirectoryCreate();
|
||||||
}
|
}
|
||||||
if (!srcAudioPlugin.CopyTo(dstAudioPlugin))
|
if (!srcAudioPlugin.CopyTo(dstAudioPlugin))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy RSP Plugin
|
//Copy RSP Plugin
|
||||||
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
||||||
CPath dstRSPPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
CPath dstRSPPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
||||||
if (!dstRSPPlugin.DirectoryExists())
|
if (!dstRSPPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstRSPPlugin.DirectoryCreate();
|
dstRSPPlugin.DirectoryCreate();
|
||||||
}
|
}
|
||||||
if (!srcRSPPlugin.CopyTo(dstRSPPlugin))
|
if (!srcRSPPlugin.CopyTo(dstRSPPlugin))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy Controller Plugin
|
//Copy Controller Plugin
|
||||||
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
||||||
CPath dstContPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
CPath dstContPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
||||||
if (!dstContPlugin.DirectoryExists())
|
if (!dstContPlugin.DirectoryExists())
|
||||||
{
|
{
|
||||||
dstContPlugin.DirectoryCreate();
|
dstContPlugin.DirectoryCreate();
|
||||||
}
|
}
|
||||||
if (!srcContPlugin.CopyTo(dstContPlugin))
|
if (!srcContPlugin.CopyTo(dstContPlugin))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -1,154 +1,154 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <Project64-core/Settings/DebugSettings.h>
|
#include <Project64-core/Settings/DebugSettings.h>
|
||||||
|
|
||||||
#ifndef PLUGIN_INFO_STRUCT
|
#ifndef PLUGIN_INFO_STRUCT
|
||||||
#define PLUGIN_INFO_STRUCT
|
#define PLUGIN_INFO_STRUCT
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint16_t Version; /* Should be set to 1 */
|
uint16_t Version; /* Should be set to 1 */
|
||||||
uint16_t Type; /* Set to PLUGIN_TYPE_GFX */
|
uint16_t Type; /* Set to PLUGIN_TYPE_GFX */
|
||||||
char Name[100]; /* Name of the DLL */
|
char Name[100]; /* Name of the DLL */
|
||||||
|
|
||||||
/* If DLL supports memory these memory options then set them to TRUE or FALSE
|
/* If DLL supports memory these memory options then set them to TRUE or FALSE
|
||||||
if it does not support it */
|
if it does not support it */
|
||||||
int32_t NormalMemory; /* a normal BYTE array */
|
int32_t NormalMemory; /* a normal BYTE array */
|
||||||
int32_t MemoryBswaped; /* a normal BYTE array where the memory has been pre
|
int32_t MemoryBswaped; /* a normal BYTE array where the memory has been pre
|
||||||
bswap on a dword (32 bits) boundry */
|
bswap on a dword (32 bits) boundry */
|
||||||
} PLUGIN_INFO;
|
} PLUGIN_INFO;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// enum's
|
// enum's
|
||||||
enum SETTING_DATA_TYPE
|
enum SETTING_DATA_TYPE
|
||||||
{
|
{
|
||||||
Data_DWORD_General = 0, // A uint32_t setting used anywhere
|
Data_DWORD_General = 0, // A uint32_t setting used anywhere
|
||||||
Data_String_General = 1, // A string setting used anywhere
|
Data_String_General = 1, // A string setting used anywhere
|
||||||
Data_DWORD_Game = 2, // A uint32_t associated with the current game
|
Data_DWORD_Game = 2, // A uint32_t associated with the current game
|
||||||
Data_String_Game = 3, // A string associated with the current game
|
Data_String_Game = 3, // A string associated with the current game
|
||||||
Data_DWORD_RDB = 4, // A uint32_t associated with the current game in the rom database
|
Data_DWORD_RDB = 4, // A uint32_t associated with the current game in the rom database
|
||||||
Data_String_RDB = 5, // A string associated with the current game in the rom database
|
Data_String_RDB = 5, // A string associated with the current game in the rom database
|
||||||
Data_DWORD_RDB_Setting = 6, // A uint32_t read from the rom database, with config file
|
Data_DWORD_RDB_Setting = 6, // A uint32_t read from the rom database, with config file
|
||||||
Data_String_RDB_Setting = 7, // A string read from the rom database, with config file
|
Data_String_RDB_Setting = 7, // A string read from the rom database, with config file
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t dwSize;
|
uint32_t dwSize;
|
||||||
int32_t DefaultStartRange;
|
int32_t DefaultStartRange;
|
||||||
int32_t SettingStartRange;
|
int32_t SettingStartRange;
|
||||||
int32_t MaximumSettings;
|
int32_t MaximumSettings;
|
||||||
int32_t NoDefault;
|
int32_t NoDefault;
|
||||||
int32_t DefaultLocation;
|
int32_t DefaultLocation;
|
||||||
void * handle;
|
void * handle;
|
||||||
uint32_t(*GetSetting) (void * handle, int32_t ID);
|
uint32_t(*GetSetting) (void * handle, int32_t ID);
|
||||||
const char * (*GetSettingSz) (void * handle, int32_t ID, char * Buffer, int32_t BufferLen);
|
const char * (*GetSettingSz) (void * handle, int32_t ID, char * Buffer, int32_t BufferLen);
|
||||||
void(*SetSetting) (void * handle, int32_t ID, uint32_t Value);
|
void(*SetSetting) (void * handle, int32_t ID, uint32_t Value);
|
||||||
void(*SetSettingSz) (void * handle, int32_t ID, const char * Value);
|
void(*SetSettingSz) (void * handle, int32_t ID, const char * Value);
|
||||||
void(*RegisterSetting) (void * handle, int32_t ID, int32_t DefaultID, SettingDataType Type,
|
void(*RegisterSetting) (void * handle, int32_t ID, int32_t DefaultID, SettingDataType Type,
|
||||||
SettingType Location, const char * Category, const char * DefaultStr, uint32_t Value);
|
SettingType Location, const char * Category, const char * DefaultStr, uint32_t Value);
|
||||||
void(*UseUnregisteredSetting) (int32_t ID);
|
void(*UseUnregisteredSetting) (int32_t ID);
|
||||||
} PLUGIN_SETTINGS;
|
} PLUGIN_SETTINGS;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t(*FindSystemSettingId) (void * handle, const char * Name);
|
uint32_t(*FindSystemSettingId) (void * handle, const char * Name);
|
||||||
} PLUGIN_SETTINGS2;
|
} PLUGIN_SETTINGS2;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void(*FlushSettings) (void * handle);
|
void(*FlushSettings) (void * handle);
|
||||||
} PLUGIN_SETTINGS3;
|
} PLUGIN_SETTINGS3;
|
||||||
|
|
||||||
enum PLUGIN_TYPE
|
enum PLUGIN_TYPE
|
||||||
{
|
{
|
||||||
PLUGIN_TYPE_NONE = 0,
|
PLUGIN_TYPE_NONE = 0,
|
||||||
PLUGIN_TYPE_RSP = 1,
|
PLUGIN_TYPE_RSP = 1,
|
||||||
PLUGIN_TYPE_GFX = 2,
|
PLUGIN_TYPE_GFX = 2,
|
||||||
PLUGIN_TYPE_AUDIO = 3,
|
PLUGIN_TYPE_AUDIO = 3,
|
||||||
PLUGIN_TYPE_CONTROLLER = 4,
|
PLUGIN_TYPE_CONTROLLER = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSettings;
|
class CSettings;
|
||||||
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
||||||
class CN64System;
|
class CN64System;
|
||||||
class CPlugins;
|
class CPlugins;
|
||||||
|
|
||||||
__interface RenderWindow
|
__interface RenderWindow
|
||||||
{
|
{
|
||||||
virtual bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) = 0;
|
virtual bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) = 0;
|
||||||
virtual void * GetWindowHandle(void) const = 0;
|
virtual void * GetWindowHandle(void) const = 0;
|
||||||
virtual void * GetStatusBar(void) const = 0;
|
virtual void * GetStatusBar(void) const = 0;
|
||||||
virtual void * GetModuleInstance(void) const = 0;
|
virtual void * GetModuleInstance(void) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPlugins :
|
class CPlugins :
|
||||||
private CDebugSettings
|
private CDebugSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Functions
|
//Functions
|
||||||
CPlugins(const stdstr & PluginDir);
|
CPlugins(const stdstr & PluginDir);
|
||||||
~CPlugins();
|
~CPlugins();
|
||||||
|
|
||||||
bool Initiate(CN64System * System);
|
bool Initiate(CN64System * System);
|
||||||
void RomOpened(void);
|
void RomOpened(void);
|
||||||
void RomClosed(void);
|
void RomClosed(void);
|
||||||
void SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow);
|
void SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow);
|
||||||
void ConfigPlugin(void * hParent, PLUGIN_TYPE Type);
|
void ConfigPlugin(void * hParent, PLUGIN_TYPE Type);
|
||||||
bool CopyPlugins(const stdstr & DstDir) const;
|
bool CopyPlugins(const stdstr & DstDir) const;
|
||||||
void CreatePlugins(void);
|
void CreatePlugins(void);
|
||||||
bool Reset(CN64System * System);
|
bool Reset(CN64System * System);
|
||||||
bool ResetInUiThread(CN64System * System);
|
bool ResetInUiThread(CN64System * System);
|
||||||
void GameReset(void);
|
void GameReset(void);
|
||||||
|
|
||||||
inline CGfxPlugin * Gfx(void) const { return m_Gfx; }
|
inline CGfxPlugin * Gfx(void) const { return m_Gfx; }
|
||||||
inline CAudioPlugin * Audio(void) const { return m_Audio; }
|
inline CAudioPlugin * Audio(void) const { return m_Audio; }
|
||||||
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
||||||
inline CControl_Plugin * Control(void) const { return m_Control; }
|
inline CControl_Plugin * Control(void) const { return m_Control; }
|
||||||
|
|
||||||
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
||||||
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPlugins(void); // Disable default constructor
|
CPlugins(void); // Disable default constructor
|
||||||
CPlugins(const CPlugins&); // Disable copy constructor
|
CPlugins(const CPlugins&); // Disable copy constructor
|
||||||
CPlugins& operator=(const CPlugins&); // Disable assignment
|
CPlugins& operator=(const CPlugins&); // Disable assignment
|
||||||
|
|
||||||
void DestroyGfxPlugin(void);
|
void DestroyGfxPlugin(void);
|
||||||
void DestroyAudioPlugin(void);
|
void DestroyAudioPlugin(void);
|
||||||
void DestroyRspPlugin(void);
|
void DestroyRspPlugin(void);
|
||||||
void DestroyControlPlugin(void);
|
void DestroyControlPlugin(void);
|
||||||
|
|
||||||
static void PluginChanged(CPlugins * _this);
|
static void PluginChanged(CPlugins * _this);
|
||||||
|
|
||||||
RenderWindow * m_MainWindow;
|
RenderWindow * m_MainWindow;
|
||||||
RenderWindow * m_SyncWindow;
|
RenderWindow * m_SyncWindow;
|
||||||
|
|
||||||
stdstr const m_PluginDir;
|
stdstr const m_PluginDir;
|
||||||
|
|
||||||
//Plugins
|
//Plugins
|
||||||
CGfxPlugin * m_Gfx;
|
CGfxPlugin * m_Gfx;
|
||||||
CAudioPlugin * m_Audio;
|
CAudioPlugin * m_Audio;
|
||||||
CRSP_Plugin * m_RSP;
|
CRSP_Plugin * m_RSP;
|
||||||
CControl_Plugin * m_Control;
|
CControl_Plugin * m_Control;
|
||||||
|
|
||||||
stdstr m_GfxFile;
|
stdstr m_GfxFile;
|
||||||
stdstr m_AudioFile;
|
stdstr m_AudioFile;
|
||||||
stdstr m_RSPFile;
|
stdstr m_RSPFile;
|
||||||
stdstr m_ControlFile;
|
stdstr m_ControlFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Dummy Functions
|
//Dummy Functions
|
||||||
void DummyCheckInterrupts(void);
|
void DummyCheckInterrupts(void);
|
||||||
void DummyFunction(void);
|
void DummyFunction(void);
|
||||||
|
|
|
@ -1,218 +1,218 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include "RSPPlugin.h"
|
#include "RSPPlugin.h"
|
||||||
#include "GFXPlugin.h"
|
#include "GFXPlugin.h"
|
||||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||||
|
|
||||||
void DummyFunc1(int a) { a += 1; }
|
void DummyFunc1(int a) { a += 1; }
|
||||||
|
|
||||||
CRSP_Plugin::CRSP_Plugin(void) :
|
CRSP_Plugin::CRSP_Plugin(void) :
|
||||||
DoRspCycles(NULL),
|
DoRspCycles(NULL),
|
||||||
EnableDebugging(NULL),
|
EnableDebugging(NULL),
|
||||||
m_CycleCount(0),
|
m_CycleCount(0),
|
||||||
GetDebugInfo(NULL),
|
GetDebugInfo(NULL),
|
||||||
InitiateDebugger(NULL)
|
InitiateDebugger(NULL)
|
||||||
{
|
{
|
||||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||||
}
|
}
|
||||||
|
|
||||||
CRSP_Plugin::~CRSP_Plugin()
|
CRSP_Plugin::~CRSP_Plugin()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
UnloadPlugin();
|
UnloadPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRSP_Plugin::LoadFunctions(void)
|
bool CRSP_Plugin::LoadFunctions(void)
|
||||||
{
|
{
|
||||||
// Find entries for functions in DLL
|
// Find entries for functions in DLL
|
||||||
void(CALL *InitiateRSP)(void);
|
void(CALL *InitiateRSP)(void);
|
||||||
LoadFunction(InitiateRSP);
|
LoadFunction(InitiateRSP);
|
||||||
LoadFunction(DoRspCycles);
|
LoadFunction(DoRspCycles);
|
||||||
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
|
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
|
||||||
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
|
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
|
||||||
LoadFunction(EnableDebugging);
|
LoadFunction(EnableDebugging);
|
||||||
if (EnableDebugging == NULL) { EnableDebugging = DummyFunc1; }
|
if (EnableDebugging == NULL) { EnableDebugging = DummyFunc1; }
|
||||||
|
|
||||||
//Make sure dll had all needed functions
|
//Make sure dll had all needed functions
|
||||||
if (DoRspCycles == NULL) { UnloadPlugin(); return false; }
|
if (DoRspCycles == NULL) { UnloadPlugin(); return false; }
|
||||||
if (InitiateRSP == NULL) { UnloadPlugin(); return false; }
|
if (InitiateRSP == NULL) { UnloadPlugin(); return false; }
|
||||||
if (RomClosed == NULL) { UnloadPlugin(); return false; }
|
if (RomClosed == NULL) { UnloadPlugin(); return false; }
|
||||||
if (CloseDLL == NULL) { UnloadPlugin(); return false; }
|
if (CloseDLL == NULL) { UnloadPlugin(); return false; }
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get debug info if able
|
// Get debug info if able
|
||||||
if (GetDebugInfo != NULL)
|
if (GetDebugInfo != NULL)
|
||||||
{
|
{
|
||||||
GetDebugInfo(&m_RSPDebug);
|
GetDebugInfo(&m_RSPDebug);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||||
{
|
{
|
||||||
if (m_PluginInfo.Version == 1 || m_PluginInfo.Version == 0x100)
|
if (m_PluginInfo.Version == 1 || m_PluginInfo.Version == 0x100)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void * hInst;
|
void * hInst;
|
||||||
int MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
|
int MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
|
||||||
bswap on a dword (32 bits) boundry */
|
bswap on a dword (32 bits) boundry */
|
||||||
uint8_t * RDRAM;
|
uint8_t * RDRAM;
|
||||||
uint8_t * DMEM;
|
uint8_t * DMEM;
|
||||||
uint8_t * IMEM;
|
uint8_t * IMEM;
|
||||||
|
|
||||||
uint32_t * MI__INTR_REG;
|
uint32_t * MI__INTR_REG;
|
||||||
|
|
||||||
uint32_t * SP__MEM_ADDR_REG;
|
uint32_t * SP__MEM_ADDR_REG;
|
||||||
uint32_t * SP__DRAM_ADDR_REG;
|
uint32_t * SP__DRAM_ADDR_REG;
|
||||||
uint32_t * SP__RD_LEN_REG;
|
uint32_t * SP__RD_LEN_REG;
|
||||||
uint32_t * SP__WR_LEN_REG;
|
uint32_t * SP__WR_LEN_REG;
|
||||||
uint32_t * SP__STATUS_REG;
|
uint32_t * SP__STATUS_REG;
|
||||||
uint32_t * SP__DMA_FULL_REG;
|
uint32_t * SP__DMA_FULL_REG;
|
||||||
uint32_t * SP__DMA_BUSY_REG;
|
uint32_t * SP__DMA_BUSY_REG;
|
||||||
uint32_t * SP__PC_REG;
|
uint32_t * SP__PC_REG;
|
||||||
uint32_t * SP__SEMAPHORE_REG;
|
uint32_t * SP__SEMAPHORE_REG;
|
||||||
|
|
||||||
uint32_t * DPC__START_REG;
|
uint32_t * DPC__START_REG;
|
||||||
uint32_t * DPC__END_REG;
|
uint32_t * DPC__END_REG;
|
||||||
uint32_t * DPC__CURRENT_REG;
|
uint32_t * DPC__CURRENT_REG;
|
||||||
uint32_t * DPC__STATUS_REG;
|
uint32_t * DPC__STATUS_REG;
|
||||||
uint32_t * DPC__CLOCK_REG;
|
uint32_t * DPC__CLOCK_REG;
|
||||||
uint32_t * DPC__BUFBUSY_REG;
|
uint32_t * DPC__BUFBUSY_REG;
|
||||||
uint32_t * DPC__PIPEBUSY_REG;
|
uint32_t * DPC__PIPEBUSY_REG;
|
||||||
uint32_t * DPC__TMEM_REG;
|
uint32_t * DPC__TMEM_REG;
|
||||||
|
|
||||||
void(CALL *CheckInterrupts)(void);
|
void(CALL *CheckInterrupts)(void);
|
||||||
void(CALL *ProcessDlist)(void);
|
void(CALL *ProcessDlist)(void);
|
||||||
void(CALL *ProcessAlist)(void);
|
void(CALL *ProcessAlist)(void);
|
||||||
void(CALL *ProcessRdpList)(void);
|
void(CALL *ProcessRdpList)(void);
|
||||||
void(CALL *ShowCFB)(void);
|
void(CALL *ShowCFB)(void);
|
||||||
} RSP_INFO_1_1;
|
} RSP_INFO_1_1;
|
||||||
|
|
||||||
RSP_INFO_1_1 Info = { 0 };
|
RSP_INFO_1_1 Info = { 0 };
|
||||||
|
|
||||||
Info.hInst = Plugins->MainWindow()->GetModuleInstance();
|
Info.hInst = Plugins->MainWindow()->GetModuleInstance();
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
|
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
|
||||||
|
|
||||||
//Get Function from DLL
|
//Get Function from DLL
|
||||||
void(CALL *InitiateRSP) (RSP_INFO_1_1 Audio_Info, uint32_t * Cycles);
|
void(CALL *InitiateRSP) (RSP_INFO_1_1 Audio_Info, uint32_t * Cycles);
|
||||||
LoadFunction(InitiateRSP);
|
LoadFunction(InitiateRSP);
|
||||||
if (InitiateRSP == NULL) { return false; }
|
if (InitiateRSP == NULL) { return false; }
|
||||||
|
|
||||||
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
// We are initializing the plugin before any rom is loaded so we do not have any correct
|
||||||
// parameters here.. just needed to we can config the DLL.
|
// parameters here.. just needed to we can config the DLL.
|
||||||
if (System == NULL)
|
if (System == NULL)
|
||||||
{
|
{
|
||||||
uint8_t Buffer[100];
|
uint8_t Buffer[100];
|
||||||
uint32_t Value = 0;
|
uint32_t Value = 0;
|
||||||
|
|
||||||
Info.ProcessDlist = DummyCheckInterrupts;
|
Info.ProcessDlist = DummyCheckInterrupts;
|
||||||
Info.ProcessRdpList = DummyCheckInterrupts;
|
Info.ProcessRdpList = DummyCheckInterrupts;
|
||||||
Info.ShowCFB = DummyCheckInterrupts;
|
Info.ShowCFB = DummyCheckInterrupts;
|
||||||
Info.ProcessAlist = DummyCheckInterrupts;
|
Info.ProcessAlist = DummyCheckInterrupts;
|
||||||
|
|
||||||
Info.RDRAM = Buffer;
|
Info.RDRAM = Buffer;
|
||||||
Info.DMEM = Buffer;
|
Info.DMEM = Buffer;
|
||||||
Info.IMEM = Buffer;
|
Info.IMEM = Buffer;
|
||||||
|
|
||||||
Info.MI__INTR_REG = &Value;
|
Info.MI__INTR_REG = &Value;
|
||||||
|
|
||||||
Info.SP__MEM_ADDR_REG = &Value;
|
Info.SP__MEM_ADDR_REG = &Value;
|
||||||
Info.SP__DRAM_ADDR_REG = &Value;
|
Info.SP__DRAM_ADDR_REG = &Value;
|
||||||
Info.SP__RD_LEN_REG = &Value;
|
Info.SP__RD_LEN_REG = &Value;
|
||||||
Info.SP__WR_LEN_REG = &Value;
|
Info.SP__WR_LEN_REG = &Value;
|
||||||
Info.SP__STATUS_REG = &Value;
|
Info.SP__STATUS_REG = &Value;
|
||||||
Info.SP__DMA_FULL_REG = &Value;
|
Info.SP__DMA_FULL_REG = &Value;
|
||||||
Info.SP__DMA_BUSY_REG = &Value;
|
Info.SP__DMA_BUSY_REG = &Value;
|
||||||
Info.SP__PC_REG = &Value;
|
Info.SP__PC_REG = &Value;
|
||||||
Info.SP__SEMAPHORE_REG = &Value;
|
Info.SP__SEMAPHORE_REG = &Value;
|
||||||
|
|
||||||
Info.DPC__START_REG = &Value;
|
Info.DPC__START_REG = &Value;
|
||||||
Info.DPC__END_REG = &Value;
|
Info.DPC__END_REG = &Value;
|
||||||
Info.DPC__CURRENT_REG = &Value;
|
Info.DPC__CURRENT_REG = &Value;
|
||||||
Info.DPC__STATUS_REG = &Value;
|
Info.DPC__STATUS_REG = &Value;
|
||||||
Info.DPC__CLOCK_REG = &Value;
|
Info.DPC__CLOCK_REG = &Value;
|
||||||
Info.DPC__BUFBUSY_REG = &Value;
|
Info.DPC__BUFBUSY_REG = &Value;
|
||||||
Info.DPC__PIPEBUSY_REG = &Value;
|
Info.DPC__PIPEBUSY_REG = &Value;
|
||||||
Info.DPC__TMEM_REG = &Value;
|
Info.DPC__TMEM_REG = &Value;
|
||||||
}
|
}
|
||||||
// Send initialization information to the DLL
|
// Send initialization information to the DLL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info.ProcessDlist = Plugins->Gfx()->ProcessDList;
|
Info.ProcessDlist = Plugins->Gfx()->ProcessDList;
|
||||||
Info.ProcessRdpList = Plugins->Gfx()->ProcessRDPList;
|
Info.ProcessRdpList = Plugins->Gfx()->ProcessRDPList;
|
||||||
Info.ShowCFB = Plugins->Gfx()->ShowCFB;
|
Info.ShowCFB = Plugins->Gfx()->ShowCFB;
|
||||||
Info.ProcessAlist = Plugins->Audio()->ProcessAList;
|
Info.ProcessAlist = Plugins->Audio()->ProcessAList;
|
||||||
|
|
||||||
Info.RDRAM = g_MMU->Rdram();
|
Info.RDRAM = g_MMU->Rdram();
|
||||||
Info.DMEM = g_MMU->Dmem();
|
Info.DMEM = g_MMU->Dmem();
|
||||||
Info.IMEM = g_MMU->Imem();
|
Info.IMEM = g_MMU->Imem();
|
||||||
|
|
||||||
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
|
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
|
||||||
|
|
||||||
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_ADDR_REG;
|
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_ADDR_REG;
|
||||||
Info.SP__DRAM_ADDR_REG = &g_Reg->SP_DRAM_ADDR_REG;
|
Info.SP__DRAM_ADDR_REG = &g_Reg->SP_DRAM_ADDR_REG;
|
||||||
Info.SP__RD_LEN_REG = &g_Reg->SP_RD_LEN_REG;
|
Info.SP__RD_LEN_REG = &g_Reg->SP_RD_LEN_REG;
|
||||||
Info.SP__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
|
Info.SP__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
|
||||||
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_REG;
|
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_REG;
|
||||||
Info.SP__DMA_FULL_REG = &g_Reg->SP_DMA_FULL_REG;
|
Info.SP__DMA_FULL_REG = &g_Reg->SP_DMA_FULL_REG;
|
||||||
Info.SP__DMA_BUSY_REG = &g_Reg->SP_DMA_BUSY_REG;
|
Info.SP__DMA_BUSY_REG = &g_Reg->SP_DMA_BUSY_REG;
|
||||||
Info.SP__PC_REG = &g_Reg->SP_PC_REG;
|
Info.SP__PC_REG = &g_Reg->SP_PC_REG;
|
||||||
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
|
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
|
||||||
|
|
||||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitiateRSP(Info, &m_CycleCount);
|
InitiateRSP(Info, &m_CycleCount);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||||
pjutil::DynLibCallDllMain();
|
pjutil::DynLibCallDllMain();
|
||||||
#endif
|
#endif
|
||||||
return m_Initialized;
|
return m_Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRSP_Plugin::UnloadPluginDetails(void)
|
void CRSP_Plugin::UnloadPluginDetails(void)
|
||||||
{
|
{
|
||||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||||
DoRspCycles = NULL;
|
DoRspCycles = NULL;
|
||||||
EnableDebugging = NULL;
|
EnableDebugging = NULL;
|
||||||
GetDebugInfo = NULL;
|
GetDebugInfo = NULL;
|
||||||
InitiateDebugger = NULL;
|
InitiateDebugger = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRSP_Plugin::ProcessMenuItem(int id)
|
void CRSP_Plugin::ProcessMenuItem(int id)
|
||||||
{
|
{
|
||||||
if (m_RSPDebug.ProcessMenuItem)
|
if (m_RSPDebug.ProcessMenuItem)
|
||||||
{
|
{
|
||||||
m_RSPDebug.ProcessMenuItem(id);
|
m_RSPDebug.ProcessMenuItem(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,77 +1,77 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
|
||||||
class CRSP_Plugin : public CPlugin
|
class CRSP_Plugin : public CPlugin
|
||||||
{
|
{
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Menu */
|
/* Menu */
|
||||||
/* Items should have an ID between 5001 and 5100 */
|
/* Items should have an ID between 5001 and 5100 */
|
||||||
void * hRSPMenu;
|
void * hRSPMenu;
|
||||||
void(CALL *ProcessMenuItem) (int32_t ID);
|
void(CALL *ProcessMenuItem) (int32_t ID);
|
||||||
|
|
||||||
/* Break Points */
|
/* Break Points */
|
||||||
int32_t UseBPoints;
|
int32_t UseBPoints;
|
||||||
char BPPanelName[20];
|
char BPPanelName[20];
|
||||||
void(CALL *Add_BPoint) (void);
|
void(CALL *Add_BPoint) (void);
|
||||||
void(CALL *CreateBPPanel) (void);
|
void(CALL *CreateBPPanel) (void);
|
||||||
void(CALL *HideBPPanel) (void);
|
void(CALL *HideBPPanel) (void);
|
||||||
void(CALL *PaintBPPanel) (void);
|
void(CALL *PaintBPPanel) (void);
|
||||||
void(CALL *ShowBPPanel) (void);
|
void(CALL *ShowBPPanel) (void);
|
||||||
void(CALL *RefreshBpoints) (void * hList);
|
void(CALL *RefreshBpoints) (void * hList);
|
||||||
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
||||||
void(CALL *RemoveAllBpoint) (void);
|
void(CALL *RemoveAllBpoint) (void);
|
||||||
|
|
||||||
/* RSP command Window */
|
/* RSP command Window */
|
||||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||||
} RSPDEBUG_INFO;
|
} RSPDEBUG_INFO;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void(CALL *UpdateBreakPoints)(void);
|
void(CALL *UpdateBreakPoints)(void);
|
||||||
void(CALL *UpdateMemory)(void);
|
void(CALL *UpdateMemory)(void);
|
||||||
void(CALL *UpdateR4300iRegisters)(void);
|
void(CALL *UpdateR4300iRegisters)(void);
|
||||||
void(CALL *Enter_BPoint_Window)(void);
|
void(CALL *Enter_BPoint_Window)(void);
|
||||||
void(CALL *Enter_R4300i_Commands_Window)(void);
|
void(CALL *Enter_R4300i_Commands_Window)(void);
|
||||||
void(CALL *Enter_R4300i_Register_Window)(void);
|
void(CALL *Enter_R4300i_Register_Window)(void);
|
||||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||||
void(CALL *Enter_Memory_Window)(void);
|
void(CALL *Enter_Memory_Window)(void);
|
||||||
} DEBUG_INFO;
|
} DEBUG_INFO;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRSP_Plugin(void);
|
CRSP_Plugin(void);
|
||||||
~CRSP_Plugin();
|
~CRSP_Plugin();
|
||||||
|
|
||||||
bool Initiate(CPlugins * Plugins, CN64System * System);
|
bool Initiate(CPlugins * Plugins, CN64System * System);
|
||||||
|
|
||||||
uint32_t(CALL *DoRspCycles)(uint32_t);
|
uint32_t(CALL *DoRspCycles)(uint32_t);
|
||||||
void(CALL *EnableDebugging)(int32_t Enable);
|
void(CALL *EnableDebugging)(int32_t Enable);
|
||||||
|
|
||||||
void * GetDebugMenu(void) { return m_RSPDebug.hRSPMenu; }
|
void * GetDebugMenu(void) { return m_RSPDebug.hRSPMenu; }
|
||||||
void ProcessMenuItem(int32_t id);
|
void ProcessMenuItem(int32_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CRSP_Plugin(const CRSP_Plugin&); // Disable copy constructor
|
CRSP_Plugin(const CRSP_Plugin&); // Disable copy constructor
|
||||||
CRSP_Plugin& operator=(const CRSP_Plugin&); // Disable assignment
|
CRSP_Plugin& operator=(const CRSP_Plugin&); // Disable assignment
|
||||||
|
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_RSP; }
|
PLUGIN_TYPE type() { return PLUGIN_TYPE_RSP; }
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstRSPDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const { return FirstRSPDefaultSet; }
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstRSPSettings; }
|
virtual int32_t GetSettingStartRange() const { return FirstRSPSettings; }
|
||||||
|
|
||||||
bool LoadFunctions(void);
|
bool LoadFunctions(void);
|
||||||
void UnloadPluginDetails(void);
|
void UnloadPluginDetails(void);
|
||||||
|
|
||||||
RSPDEBUG_INFO m_RSPDebug;
|
RSPDEBUG_INFO m_RSPDebug;
|
||||||
uint32_t m_CycleCount;
|
uint32_t m_CycleCount;
|
||||||
|
|
||||||
void(CALL *GetDebugInfo) (RSPDEBUG_INFO * GFXDebugInfo);
|
void(CALL *GetDebugInfo) (RSPDEBUG_INFO * GFXDebugInfo);
|
||||||
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DebugSettings.h"
|
#include "DebugSettings.h"
|
||||||
|
|
||||||
int CDebugSettings::m_RefCount = 0;
|
int CDebugSettings::m_RefCount = 0;
|
||||||
|
|
||||||
bool CDebugSettings::m_bHaveDebugger = false;
|
bool CDebugSettings::m_bHaveDebugger = false;
|
||||||
bool CDebugSettings::m_bLogX86Code = false;
|
bool CDebugSettings::m_bLogX86Code = false;
|
||||||
bool CDebugSettings::m_bShowTLBMisses = false;
|
bool CDebugSettings::m_bShowTLBMisses = false;
|
||||||
bool CDebugSettings::m_bShowDivByZero = false;
|
bool CDebugSettings::m_bShowDivByZero = false;
|
||||||
bool CDebugSettings::m_Registered = false;
|
bool CDebugSettings::m_Registered = false;
|
||||||
|
|
||||||
CDebugSettings::CDebugSettings()
|
CDebugSettings::CDebugSettings()
|
||||||
{
|
{
|
||||||
m_RefCount += 1;
|
m_RefCount += 1;
|
||||||
if (!m_Registered && g_Settings)
|
if (!m_Registered && g_Settings)
|
||||||
{
|
{
|
||||||
m_Registered = true;
|
m_Registered = true;
|
||||||
g_Settings->RegisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
|
|
||||||
RefreshSettings();
|
RefreshSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebugSettings::~CDebugSettings()
|
CDebugSettings::~CDebugSettings()
|
||||||
{
|
{
|
||||||
m_RefCount -= 1;
|
m_RefCount -= 1;
|
||||||
if (m_RefCount == 0 && g_Settings)
|
if (m_RefCount == 0 && g_Settings)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugSettings::RefreshSettings()
|
void CDebugSettings::RefreshSettings()
|
||||||
{
|
{
|
||||||
m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
|
m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
|
||||||
m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles);
|
m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles);
|
||||||
m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses);
|
m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses);
|
||||||
m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
|
m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
|
||||||
}
|
}
|
|
@ -1,42 +1,42 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
|
|
||||||
class CDebugSettings
|
class CDebugSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CDebugSettings();
|
CDebugSettings();
|
||||||
virtual ~CDebugSettings();
|
virtual ~CDebugSettings();
|
||||||
|
|
||||||
static inline bool bHaveDebugger(void) { return m_bHaveDebugger; }
|
static inline bool bHaveDebugger(void) { return m_bHaveDebugger; }
|
||||||
static inline bool bLogX86Code(void) { return m_bLogX86Code; }
|
static inline bool bLogX86Code(void) { return m_bLogX86Code; }
|
||||||
static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; }
|
static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; }
|
||||||
static inline bool bShowDivByZero(void) { return m_bShowDivByZero; }
|
static inline bool bShowDivByZero(void) { return m_bShowDivByZero; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void StaticRefreshSettings(CDebugSettings * _this)
|
static void StaticRefreshSettings(CDebugSettings * _this)
|
||||||
{
|
{
|
||||||
_this->RefreshSettings();
|
_this->RefreshSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshSettings(void);
|
void RefreshSettings(void);
|
||||||
|
|
||||||
//Settings that can be changed on the fly
|
//Settings that can be changed on the fly
|
||||||
static bool m_bHaveDebugger;
|
static bool m_bHaveDebugger;
|
||||||
static bool m_bLogX86Code;
|
static bool m_bLogX86Code;
|
||||||
static bool m_bShowTLBMisses;
|
static bool m_bShowTLBMisses;
|
||||||
static bool m_bShowDivByZero;
|
static bool m_bShowDivByZero;
|
||||||
|
|
||||||
static int32_t m_RefCount;
|
static int32_t m_RefCount;
|
||||||
static bool m_Registered;
|
static bool m_Registered;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,78 +1,78 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include <Project64-core/Settings/GameSettings.h>
|
#include <Project64-core/Settings/GameSettings.h>
|
||||||
|
|
||||||
bool CGameSettings::m_bSMM_StoreInstruc;
|
bool CGameSettings::m_bSMM_StoreInstruc;
|
||||||
bool CGameSettings::m_bSMM_Protect;
|
bool CGameSettings::m_bSMM_Protect;
|
||||||
bool CGameSettings::m_bSMM_ValidFunc;
|
bool CGameSettings::m_bSMM_ValidFunc;
|
||||||
bool CGameSettings::m_bSMM_PIDMA;
|
bool CGameSettings::m_bSMM_PIDMA;
|
||||||
bool CGameSettings::m_bSMM_TLB;
|
bool CGameSettings::m_bSMM_TLB;
|
||||||
bool CGameSettings::m_bUseTlb;
|
bool CGameSettings::m_bUseTlb;
|
||||||
uint32_t CGameSettings::m_CountPerOp = 2;
|
uint32_t CGameSettings::m_CountPerOp = 2;
|
||||||
uint32_t CGameSettings::m_ViRefreshRate = 1500;
|
uint32_t CGameSettings::m_ViRefreshRate = 1500;
|
||||||
uint32_t CGameSettings::m_AiCountPerBytes = 500;
|
uint32_t CGameSettings::m_AiCountPerBytes = 500;
|
||||||
bool CGameSettings::m_DelayDP = false;
|
bool CGameSettings::m_DelayDP = false;
|
||||||
bool CGameSettings::m_DelaySI = false;
|
bool CGameSettings::m_DelaySI = false;
|
||||||
uint32_t CGameSettings::m_RdramSize = 0;
|
uint32_t CGameSettings::m_RdramSize = 0;
|
||||||
bool CGameSettings::m_bFixedAudio = true;
|
bool CGameSettings::m_bFixedAudio = true;
|
||||||
bool CGameSettings::m_bSyncingToAudio = true;
|
bool CGameSettings::m_bSyncingToAudio = true;
|
||||||
bool CGameSettings::m_bSyncToAudio = true;
|
bool CGameSettings::m_bSyncToAudio = true;
|
||||||
bool CGameSettings::m_bFastSP = true;
|
bool CGameSettings::m_bFastSP = true;
|
||||||
bool CGameSettings::m_b32Bit = true;
|
bool CGameSettings::m_b32Bit = true;
|
||||||
bool CGameSettings::m_RspAudioSignal;
|
bool CGameSettings::m_RspAudioSignal;
|
||||||
bool CGameSettings::m_bRomInMemory;
|
bool CGameSettings::m_bRomInMemory;
|
||||||
bool CGameSettings::m_RegCaching;
|
bool CGameSettings::m_RegCaching;
|
||||||
bool CGameSettings::m_bLinkBlocks;
|
bool CGameSettings::m_bLinkBlocks;
|
||||||
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
|
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
|
||||||
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
|
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
|
||||||
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;
|
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;
|
||||||
|
|
||||||
void CGameSettings::RefreshGameSettings()
|
void CGameSettings::RefreshGameSettings()
|
||||||
{
|
{
|
||||||
m_bSMM_StoreInstruc = false /*g_Settings->LoadBool(Game_SMM_StoreInstruc)*/;
|
m_bSMM_StoreInstruc = false /*g_Settings->LoadBool(Game_SMM_StoreInstruc)*/;
|
||||||
m_bSMM_Protect = g_Settings->LoadBool(Game_SMM_Protect);
|
m_bSMM_Protect = g_Settings->LoadBool(Game_SMM_Protect);
|
||||||
m_bSMM_ValidFunc = g_Settings->LoadBool(Game_SMM_ValidFunc);
|
m_bSMM_ValidFunc = g_Settings->LoadBool(Game_SMM_ValidFunc);
|
||||||
m_bSMM_PIDMA = g_Settings->LoadBool(Game_SMM_PIDMA);
|
m_bSMM_PIDMA = g_Settings->LoadBool(Game_SMM_PIDMA);
|
||||||
m_bSMM_TLB = g_Settings->LoadBool(Game_SMM_TLB);
|
m_bSMM_TLB = g_Settings->LoadBool(Game_SMM_TLB);
|
||||||
m_bUseTlb = g_Settings->LoadBool(Game_UseTlb);
|
m_bUseTlb = g_Settings->LoadBool(Game_UseTlb);
|
||||||
m_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
|
m_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
|
||||||
m_AiCountPerBytes = g_Settings->LoadDword(Game_AiCountPerBytes);
|
m_AiCountPerBytes = g_Settings->LoadDword(Game_AiCountPerBytes);
|
||||||
m_CountPerOp = g_Settings->LoadDword(Game_CounterFactor);
|
m_CountPerOp = g_Settings->LoadDword(Game_CounterFactor);
|
||||||
m_RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
m_RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
||||||
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
||||||
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
||||||
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
||||||
m_bSyncToAudio = m_bFixedAudio ? g_Settings->LoadBool(Game_SyncViaAudio) : false;
|
m_bSyncToAudio = m_bFixedAudio ? g_Settings->LoadBool(Game_SyncViaAudio) : false;
|
||||||
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
||||||
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
|
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
|
||||||
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
|
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
|
||||||
m_bRomInMemory = g_Settings->LoadBool(Game_LoadRomToMemory);
|
m_bRomInMemory = g_Settings->LoadBool(Game_LoadRomToMemory);
|
||||||
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
|
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
|
||||||
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
|
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
|
||||||
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
|
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
|
||||||
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
|
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
|
||||||
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
|
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
|
||||||
|
|
||||||
m_bSyncingToAudio = m_bSyncToAudio;
|
m_bSyncingToAudio = m_bSyncToAudio;
|
||||||
if (m_CountPerOp == 0)
|
if (m_CountPerOp == 0)
|
||||||
{
|
{
|
||||||
m_CountPerOp = 2;
|
m_CountPerOp = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameSettings::SpeedChanged(int SpeedLimit)
|
void CGameSettings::SpeedChanged(int SpeedLimit)
|
||||||
{
|
{
|
||||||
int FullSpeed = g_System->m_SystemType == SYSTEM_PAL ? 50 : 60;
|
int FullSpeed = g_System->m_SystemType == SYSTEM_PAL ? 50 : 60;
|
||||||
m_bSyncingToAudio = SpeedLimit == FullSpeed ? m_bSyncToAudio : false;
|
m_bSyncingToAudio = SpeedLimit == FullSpeed ? m_bSyncToAudio : false;
|
||||||
}
|
}
|
|
@ -1,73 +1,73 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
|
|
||||||
class CGameSettings
|
class CGameSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void RefreshGameSettings(void);
|
void RefreshGameSettings(void);
|
||||||
|
|
||||||
inline static bool bRomInMemory(void) { return m_bRomInMemory; }
|
inline static bool bRomInMemory(void) { return m_bRomInMemory; }
|
||||||
inline static bool bRegCaching(void) { return m_RegCaching; }
|
inline static bool bRegCaching(void) { return m_RegCaching; }
|
||||||
inline static bool bLinkBlocks(void) { return m_bLinkBlocks; }
|
inline static bool bLinkBlocks(void) { return m_bLinkBlocks; }
|
||||||
inline static FUNC_LOOKUP_METHOD LookUpMode(void) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
|
inline static FUNC_LOOKUP_METHOD LookUpMode(void) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
|
||||||
inline static bool bUseTlb(void) { return m_bUseTlb; }
|
inline static bool bUseTlb(void) { return m_bUseTlb; }
|
||||||
inline static uint32_t CountPerOp(void) { return m_CountPerOp; }
|
inline static uint32_t CountPerOp(void) { return m_CountPerOp; }
|
||||||
inline static uint32_t ViRefreshRate(void) { return m_ViRefreshRate; }
|
inline static uint32_t ViRefreshRate(void) { return m_ViRefreshRate; }
|
||||||
inline static uint32_t AiCountPerBytes(void) { return m_AiCountPerBytes; }
|
inline static uint32_t AiCountPerBytes(void) { return m_AiCountPerBytes; }
|
||||||
inline static bool bDelayDP(void) { return m_DelayDP; }
|
inline static bool bDelayDP(void) { return m_DelayDP; }
|
||||||
inline static bool bDelaySI(void) { return m_DelaySI; }
|
inline static bool bDelaySI(void) { return m_DelaySI; }
|
||||||
inline static uint32_t RdramSize(void) { return m_RdramSize; }
|
inline static uint32_t RdramSize(void) { return m_RdramSize; }
|
||||||
inline static bool bFixedAudio(void) { return m_bFixedAudio; }
|
inline static bool bFixedAudio(void) { return m_bFixedAudio; }
|
||||||
inline static bool bSyncToAudio(void) { return m_bSyncingToAudio; }
|
inline static bool bSyncToAudio(void) { return m_bSyncingToAudio; }
|
||||||
inline static bool bFastSP(void) { return m_bFastSP; }
|
inline static bool bFastSP(void) { return m_bFastSP; }
|
||||||
inline static bool b32BitCore(void) { return m_b32Bit; }
|
inline static bool b32BitCore(void) { return m_b32Bit; }
|
||||||
inline static bool RspAudioSignal(void) { return m_RspAudioSignal; }
|
inline static bool RspAudioSignal(void) { return m_RspAudioSignal; }
|
||||||
inline static bool bSMM_StoreInstruc(void) { return m_bSMM_StoreInstruc; }
|
inline static bool bSMM_StoreInstruc(void) { return m_bSMM_StoreInstruc; }
|
||||||
inline static bool bSMM_Protect(void) { return m_bSMM_Protect; }
|
inline static bool bSMM_Protect(void) { return m_bSMM_Protect; }
|
||||||
inline static bool bSMM_ValidFunc(void) { return m_bSMM_ValidFunc; }
|
inline static bool bSMM_ValidFunc(void) { return m_bSMM_ValidFunc; }
|
||||||
inline static bool bSMM_PIDMA(void) { return m_bSMM_PIDMA; }
|
inline static bool bSMM_PIDMA(void) { return m_bSMM_PIDMA; }
|
||||||
inline static bool bSMM_TLB(void) { return m_bSMM_TLB; }
|
inline static bool bSMM_TLB(void) { return m_bSMM_TLB; }
|
||||||
inline static SYSTEM_TYPE SystemType(void) { return m_SystemType; }
|
inline static SYSTEM_TYPE SystemType(void) { return m_SystemType; }
|
||||||
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void SpeedChanged(int32_t SpeedLimit);
|
static void SpeedChanged(int32_t SpeedLimit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//Settings that can be changed on the fly
|
//Settings that can be changed on the fly
|
||||||
static bool m_bRomInMemory;
|
static bool m_bRomInMemory;
|
||||||
static bool m_RegCaching;
|
static bool m_RegCaching;
|
||||||
static bool m_bLinkBlocks;
|
static bool m_bLinkBlocks;
|
||||||
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
|
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
|
||||||
static bool m_bUseTlb;
|
static bool m_bUseTlb;
|
||||||
static uint32_t m_CountPerOp;
|
static uint32_t m_CountPerOp;
|
||||||
static uint32_t m_ViRefreshRate;
|
static uint32_t m_ViRefreshRate;
|
||||||
static uint32_t m_AiCountPerBytes;
|
static uint32_t m_AiCountPerBytes;
|
||||||
static bool m_DelayDP;
|
static bool m_DelayDP;
|
||||||
static bool m_DelaySI;
|
static bool m_DelaySI;
|
||||||
static uint32_t m_RdramSize;
|
static uint32_t m_RdramSize;
|
||||||
static bool m_bFixedAudio;
|
static bool m_bFixedAudio;
|
||||||
static bool m_bSyncingToAudio;
|
static bool m_bSyncingToAudio;
|
||||||
static bool m_bSyncToAudio;
|
static bool m_bSyncToAudio;
|
||||||
static bool m_bFastSP;
|
static bool m_bFastSP;
|
||||||
static bool m_b32Bit;
|
static bool m_b32Bit;
|
||||||
static bool m_RspAudioSignal;
|
static bool m_RspAudioSignal;
|
||||||
static bool m_bSMM_StoreInstruc;
|
static bool m_bSMM_StoreInstruc;
|
||||||
static bool m_bSMM_Protect;
|
static bool m_bSMM_Protect;
|
||||||
static bool m_bSMM_ValidFunc;
|
static bool m_bSMM_ValidFunc;
|
||||||
static bool m_bSMM_PIDMA;
|
static bool m_bSMM_PIDMA;
|
||||||
static bool m_bSMM_TLB;
|
static bool m_bSMM_TLB;
|
||||||
static SYSTEM_TYPE m_SystemType;
|
static SYSTEM_TYPE m_SystemType;
|
||||||
static CPU_TYPE m_CpuType;
|
static CPU_TYPE m_CpuType;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,66 +1,66 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "N64SystemSettings.h"
|
#include "N64SystemSettings.h"
|
||||||
|
|
||||||
int32_t CN64SystemSettings::m_RefCount = 0;
|
int32_t CN64SystemSettings::m_RefCount = 0;
|
||||||
|
|
||||||
bool CN64SystemSettings::m_bShowCPUPer;
|
bool CN64SystemSettings::m_bShowCPUPer;
|
||||||
bool CN64SystemSettings::m_bProfiling;
|
bool CN64SystemSettings::m_bProfiling;
|
||||||
bool CN64SystemSettings::m_bBasicMode;
|
bool CN64SystemSettings::m_bBasicMode;
|
||||||
bool CN64SystemSettings::m_bLimitFPS;
|
bool CN64SystemSettings::m_bLimitFPS;
|
||||||
bool CN64SystemSettings::m_bShowDListAListCount;
|
bool CN64SystemSettings::m_bShowDListAListCount;
|
||||||
bool CN64SystemSettings::m_bDisplayFrameRate;
|
bool CN64SystemSettings::m_bDisplayFrameRate;
|
||||||
|
|
||||||
CN64SystemSettings::CN64SystemSettings()
|
CN64SystemSettings::CN64SystemSettings()
|
||||||
{
|
{
|
||||||
m_RefCount += 1;
|
m_RefCount += 1;
|
||||||
if (m_RefCount == 1)
|
if (m_RefCount == 1)
|
||||||
{
|
{
|
||||||
g_Settings->RegisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
||||||
|
|
||||||
g_Settings->RegisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
||||||
|
|
||||||
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
||||||
|
|
||||||
RefreshSettings(NULL);
|
RefreshSettings(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CN64SystemSettings::~CN64SystemSettings()
|
CN64SystemSettings::~CN64SystemSettings()
|
||||||
{
|
{
|
||||||
m_RefCount -= 1;
|
m_RefCount -= 1;
|
||||||
if (m_RefCount == 0)
|
if (m_RefCount == 0)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
||||||
|
|
||||||
g_Settings->UnregisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
||||||
|
|
||||||
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CN64SystemSettings::RefreshSettings(void *)
|
void CN64SystemSettings::RefreshSettings(void *)
|
||||||
{
|
{
|
||||||
m_bBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
|
m_bBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
|
||||||
m_bDisplayFrameRate = g_Settings->LoadBool(UserInterface_DisplayFrameRate);
|
m_bDisplayFrameRate = g_Settings->LoadBool(UserInterface_DisplayFrameRate);
|
||||||
|
|
||||||
m_bShowCPUPer = g_Settings->LoadBool(UserInterface_ShowCPUPer);
|
m_bShowCPUPer = g_Settings->LoadBool(UserInterface_ShowCPUPer);
|
||||||
m_bProfiling = g_Settings->LoadBool(Debugger_ProfileCode);
|
m_bProfiling = g_Settings->LoadBool(Debugger_ProfileCode);
|
||||||
m_bShowDListAListCount = g_Settings->LoadBool(Debugger_ShowDListAListCount);
|
m_bShowDListAListCount = g_Settings->LoadBool(Debugger_ShowDListAListCount);
|
||||||
m_bLimitFPS = g_Settings->LoadBool(GameRunning_LimitFPS);
|
m_bLimitFPS = g_Settings->LoadBool(GameRunning_LimitFPS);
|
||||||
}
|
}
|
|
@ -1,37 +1,37 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CN64SystemSettings
|
class CN64SystemSettings
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CN64SystemSettings();
|
CN64SystemSettings();
|
||||||
virtual ~CN64SystemSettings();
|
virtual ~CN64SystemSettings();
|
||||||
|
|
||||||
inline static bool bBasicMode(void) { return m_bBasicMode; }
|
inline static bool bBasicMode(void) { return m_bBasicMode; }
|
||||||
inline static bool bDisplayFrameRate(void) { return m_bDisplayFrameRate; }
|
inline static bool bDisplayFrameRate(void) { return m_bDisplayFrameRate; }
|
||||||
inline static bool bShowCPUPer(void) { return m_bShowCPUPer; }
|
inline static bool bShowCPUPer(void) { return m_bShowCPUPer; }
|
||||||
inline static bool bProfiling(void) { return m_bProfiling; }
|
inline static bool bProfiling(void) { return m_bProfiling; }
|
||||||
inline static bool bShowDListAListCount(void) { return m_bShowDListAListCount; }
|
inline static bool bShowDListAListCount(void) { return m_bShowDListAListCount; }
|
||||||
inline static bool bLimitFPS(void) { return m_bLimitFPS; }
|
inline static bool bLimitFPS(void) { return m_bLimitFPS; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void RefreshSettings(void *);
|
static void RefreshSettings(void *);
|
||||||
|
|
||||||
static bool m_bShowCPUPer;
|
static bool m_bShowCPUPer;
|
||||||
static bool m_bProfiling;
|
static bool m_bProfiling;
|
||||||
static bool m_bBasicMode;
|
static bool m_bBasicMode;
|
||||||
static bool m_bLimitFPS;
|
static bool m_bLimitFPS;
|
||||||
static bool m_bShowDListAListCount;
|
static bool m_bShowDListAListCount;
|
||||||
static bool m_bDisplayFrameRate;
|
static bool m_bDisplayFrameRate;
|
||||||
|
|
||||||
static int32_t m_RefCount;
|
static int32_t m_RefCount;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
|
|
||||||
class CRecompilerSettings
|
class CRecompilerSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CRecompilerSettings();
|
CRecompilerSettings();
|
||||||
virtual ~CRecompilerSettings();
|
virtual ~CRecompilerSettings();
|
||||||
|
|
||||||
static bool bShowRecompMemSize(void) { return m_bShowRecompMemSize; }
|
static bool bShowRecompMemSize(void) { return m_bShowRecompMemSize; }
|
||||||
|
|
||||||
static bool bProfiling(void) { return m_bProfiling; }
|
static bool bProfiling(void) { return m_bProfiling; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void StaticRefreshSettings(CRecompilerSettings * _this)
|
static void StaticRefreshSettings(CRecompilerSettings * _this)
|
||||||
{
|
{
|
||||||
_this->RefreshSettings();
|
_this->RefreshSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshSettings(void);
|
void RefreshSettings(void);
|
||||||
|
|
||||||
//Settings that can be changed on the fly
|
//Settings that can be changed on the fly
|
||||||
static bool m_bShowRecompMemSize;
|
static bool m_bShowRecompMemSize;
|
||||||
static bool m_bProfiling;
|
static bool m_bProfiling;
|
||||||
|
|
||||||
static int32_t m_RefCount;
|
static int32_t m_RefCount;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,260 +1,260 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-Application.h"
|
#include "SettingsType-Application.h"
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
|
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
|
||||||
|
|
||||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
m_DefaultValue(DefaultValue),
|
m_DefaultValue(DefaultValue),
|
||||||
m_DefaultSetting(Default_Constant),
|
m_DefaultSetting(Default_Constant),
|
||||||
m_Section(FixSectionName(Section)),
|
m_Section(FixSectionName(Section)),
|
||||||
m_KeyName(Name),
|
m_KeyName(Name),
|
||||||
m_KeyNameIdex(m_KeyName)
|
m_KeyNameIdex(m_KeyName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue ) :
|
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue ) :
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
m_DefaultValue(DefaultValue),
|
m_DefaultValue(DefaultValue),
|
||||||
m_DefaultSetting(Default_Constant),
|
m_DefaultSetting(Default_Constant),
|
||||||
m_Section(FixSectionName(Section)),
|
m_Section(FixSectionName(Section)),
|
||||||
m_KeyName(Name),
|
m_KeyName(Name),
|
||||||
m_KeyNameIdex(m_KeyName)
|
m_KeyNameIdex(m_KeyName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue ) :
|
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue ) :
|
||||||
m_DefaultStr(DefaultValue),
|
m_DefaultStr(DefaultValue),
|
||||||
m_DefaultValue(0),
|
m_DefaultValue(0),
|
||||||
m_DefaultSetting(Default_Constant),
|
m_DefaultSetting(Default_Constant),
|
||||||
m_Section(FixSectionName(Section)),
|
m_Section(FixSectionName(Section)),
|
||||||
m_KeyName(Name),
|
m_KeyName(Name),
|
||||||
m_KeyNameIdex(m_KeyName)
|
m_KeyNameIdex(m_KeyName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
m_DefaultValue(0),
|
m_DefaultValue(0),
|
||||||
m_DefaultSetting(DefaultSetting),
|
m_DefaultSetting(DefaultSetting),
|
||||||
m_Section(FixSectionName(Section)),
|
m_Section(FixSectionName(Section)),
|
||||||
m_KeyName(Name),
|
m_KeyName(Name),
|
||||||
m_KeyNameIdex(m_KeyName)
|
m_KeyNameIdex(m_KeyName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplication::~CSettingTypeApplication()
|
CSettingTypeApplication::~CSettingTypeApplication()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
|
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
|
||||||
{
|
{
|
||||||
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
||||||
if (!BaseDir.DirectoryExists())
|
if (!BaseDir.DirectoryExists())
|
||||||
{
|
{
|
||||||
printf("BaseDir does not exists, doing nothing");
|
printf("BaseDir does not exists, doing nothing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stdstr SettingsFile, OrigSettingsFile;
|
stdstr SettingsFile, OrigSettingsFile;
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
OrigSettingsFile = SettingsFile;
|
OrigSettingsFile = SettingsFile;
|
||||||
if (!g_Settings->LoadStringVal(SupportFile_Settings,SettingsFile) && i > 0)
|
if (!g_Settings->LoadStringVal(SupportFile_Settings,SettingsFile) && i > 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SettingsFile == OrigSettingsFile)
|
if (SettingsFile == OrigSettingsFile)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
|
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
|
||||||
#else
|
#else
|
||||||
CPath SettingsDir(CPath(SettingsFile).GetDirectory(), "");
|
CPath SettingsDir(CPath(SettingsFile).GetDirectory(), "");
|
||||||
#endif
|
#endif
|
||||||
if (!SettingsDir.DirectoryExists())
|
if (!SettingsDir.DirectoryExists())
|
||||||
{
|
{
|
||||||
SettingsDir.DirectoryCreate();
|
SettingsDir.DirectoryCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
|
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SettingsIniFile->SetAutoFlush(false);
|
m_SettingsIniFile->SetAutoFlush(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Flush()
|
void CSettingTypeApplication::Flush()
|
||||||
{
|
{
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->FlushChanges();
|
m_SettingsIniFile->FlushChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::CleanUp()
|
void CSettingTypeApplication::CleanUp()
|
||||||
{
|
{
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SetAutoFlush(true);
|
m_SettingsIniFile->SetAutoFlush(true);
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
m_SettingsIniFile = NULL;
|
m_SettingsIniFile = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplication::Load ( int /*Index*/, bool & Value ) const
|
bool CSettingTypeApplication::Load ( int /*Index*/, bool & Value ) const
|
||||||
{
|
{
|
||||||
bool bRes = false;
|
bool bRes = false;
|
||||||
|
|
||||||
uint32_t dwValue;
|
uint32_t dwValue;
|
||||||
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
|
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
|
||||||
if (bRes)
|
if (bRes)
|
||||||
{
|
{
|
||||||
Value = dwValue != 0;
|
Value = dwValue != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bRes && m_DefaultSetting != Default_None)
|
if (!bRes && m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue != 0;
|
Value = m_DefaultValue != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplication::Load ( int /*Index*/, uint32_t & Value ) const
|
bool CSettingTypeApplication::Load ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
bool bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value);
|
bool bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value);
|
||||||
if (!bRes && m_DefaultSetting != Default_None)
|
if (!bRes && m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue;
|
Value = m_DefaultValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * CSettingTypeApplication::SectionName ( void ) const
|
const char * CSettingTypeApplication::SectionName ( void ) const
|
||||||
{
|
{
|
||||||
return m_Section.c_str();
|
return m_Section.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
bool bRes = m_SettingsIniFile ? m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value) : false;
|
bool bRes = m_SettingsIniFile ? m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value) : false;
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||||
}
|
}
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeApplication::LoadDefault ( int /*Index*/, bool & Value ) const
|
void CSettingTypeApplication::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue != 0;
|
Value = m_DefaultValue != 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::LoadDefault(int /*Index*/, uint32_t & Value) const
|
void CSettingTypeApplication::LoadDefault(int /*Index*/, uint32_t & Value) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue;
|
Value = m_DefaultValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
void CSettingTypeApplication::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultStr;
|
Value = m_DefaultStr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeApplication::Save ( int /*Index*/, bool Value )
|
void CSettingTypeApplication::Save ( int /*Index*/, bool Value )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Save ( int /*Index*/, uint32_t Value )
|
void CSettingTypeApplication::Save ( int /*Index*/, uint32_t Value )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Save ( int /*Index*/, const stdstr & Value )
|
void CSettingTypeApplication::Save ( int /*Index*/, const stdstr & Value )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str());
|
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Save ( int /*Index*/, const char * Value )
|
void CSettingTypeApplication::Save ( int /*Index*/, const char * Value )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value);
|
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
stdstr CSettingTypeApplication::FixSectionName(const char * Section)
|
stdstr CSettingTypeApplication::FixSectionName(const char * Section)
|
||||||
{
|
{
|
||||||
stdstr SectionName(Section);
|
stdstr SectionName(Section);
|
||||||
|
|
||||||
if (SectionName.empty())
|
if (SectionName.empty())
|
||||||
{
|
{
|
||||||
SectionName = "default";
|
SectionName = "default";
|
||||||
}
|
}
|
||||||
SectionName.Replace("\\","-");
|
SectionName.Replace("\\","-");
|
||||||
return SectionName;
|
return SectionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplication::Delete( int /*Index*/ )
|
void CSettingTypeApplication::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL);
|
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +1,72 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Common/IniFileClass.h>
|
#include <Common/IniFileClass.h>
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeApplication :
|
class CSettingTypeApplication :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue);
|
CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue);
|
||||||
CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue);
|
CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue);
|
||||||
CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue);
|
CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue);
|
||||||
CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting);
|
CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting);
|
||||||
virtual ~CSettingTypeApplication();
|
virtual ~CSettingTypeApplication();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting(void) const { return false; }
|
virtual bool IndexBasedSetting(void) const { return false; }
|
||||||
virtual SettingType GetSettingType(void) const { return SettingType_CfgFile; }
|
virtual SettingType GetSettingType(void) const { return SettingType_CfgFile; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load(int32_t Index, bool & Value) const;
|
virtual bool Load(int32_t Index, bool & Value) const;
|
||||||
virtual bool Load(int32_t Index, uint32_t & Value) const;
|
virtual bool Load(int32_t Index, uint32_t & Value) const;
|
||||||
virtual bool Load(int32_t Index, stdstr & Value) const;
|
virtual bool Load(int32_t Index, stdstr & Value) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault(int32_t Index, bool & Value) const;
|
virtual void LoadDefault(int32_t Index, bool & Value) const;
|
||||||
virtual void LoadDefault(int32_t Index, uint32_t & Value) const;
|
virtual void LoadDefault(int32_t Index, uint32_t & Value) const;
|
||||||
virtual void LoadDefault(int32_t Index, stdstr & Value) const;
|
virtual void LoadDefault(int32_t Index, stdstr & Value) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save(int32_t Index, bool Value);
|
virtual void Save(int32_t Index, bool Value);
|
||||||
virtual void Save(int32_t Index, uint32_t Value);
|
virtual void Save(int32_t Index, uint32_t Value);
|
||||||
virtual void Save(int32_t Index, const stdstr & Value);
|
virtual void Save(int32_t Index, const stdstr & Value);
|
||||||
virtual void Save(int32_t Index, const char * Value);
|
virtual void Save(int32_t Index, const char * Value);
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete(int32_t Index);
|
virtual void Delete(int32_t Index);
|
||||||
|
|
||||||
// Initialize this class to use ini or registry
|
// Initialize this class to use ini or registry
|
||||||
static void Initialize(const char * AppName);
|
static void Initialize(const char * AppName);
|
||||||
static void CleanUp(void);
|
static void CleanUp(void);
|
||||||
static void Flush(void);
|
static void Flush(void);
|
||||||
|
|
||||||
const char * GetKeyName(void) const { return m_KeyName.c_str(); }
|
const char * GetKeyName(void) const { return m_KeyName.c_str(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const char * m_DefaultStr;
|
const char * m_DefaultStr;
|
||||||
const uint32_t m_DefaultValue;
|
const uint32_t m_DefaultValue;
|
||||||
const SettingID m_DefaultSetting;
|
const SettingID m_DefaultSetting;
|
||||||
|
|
||||||
stdstr FixSectionName(const char * Section);
|
stdstr FixSectionName(const char * Section);
|
||||||
|
|
||||||
static CIniFile * m_SettingsIniFile;
|
static CIniFile * m_SettingsIniFile;
|
||||||
const stdstr m_Section;
|
const stdstr m_Section;
|
||||||
const stdstr m_KeyName;
|
const stdstr m_KeyName;
|
||||||
mutable stdstr m_KeyNameIdex;
|
mutable stdstr m_KeyNameIdex;
|
||||||
|
|
||||||
virtual const char * SectionName(void) const;
|
virtual const char * SectionName(void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeApplication(const CSettingTypeApplication&); // Disable copy constructor
|
CSettingTypeApplication(const CSettingTypeApplication&); // Disable copy constructor
|
||||||
CSettingTypeApplication& operator=(const CSettingTypeApplication&); // Disable assignment
|
CSettingTypeApplication& operator=(const CSettingTypeApplication&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,105 +1,105 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-Application.h"
|
#include "SettingsType-Application.h"
|
||||||
#include "SettingsType-ApplicationIndex.h"
|
#include "SettingsType-ApplicationIndex.h"
|
||||||
|
|
||||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
||||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue ) :
|
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue ) :
|
||||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue ) :
|
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue ) :
|
||||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeApplication(Section,Name,DefaultSetting)
|
CSettingTypeApplication(Section,Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplicationIndex::~CSettingTypeApplicationIndex ( void )
|
CSettingTypeApplicationIndex::~CSettingTypeApplicationIndex ( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const
|
bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
return CSettingTypeApplication::Load(0,Value);
|
return CSettingTypeApplication::Load(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplicationIndex::Load ( int Index, uint32_t & Value ) const
|
bool CSettingTypeApplicationIndex::Load ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
return CSettingTypeApplication::Load(0,Value);
|
return CSettingTypeApplication::Load(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplicationIndex::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeApplicationIndex::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
return CSettingTypeApplication::Load(0,Value);
|
return CSettingTypeApplication::Load(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, bool & Value ) const
|
void CSettingTypeApplicationIndex::LoadDefault ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::LoadDefault(0,Value);
|
CSettingTypeApplication::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
void CSettingTypeApplicationIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::LoadDefault(0,Value);
|
CSettingTypeApplication::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, stdstr & Value ) const
|
void CSettingTypeApplicationIndex::LoadDefault ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::LoadDefault(0,Value);
|
CSettingTypeApplication::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeApplicationIndex::Save ( int Index, bool Value )
|
void CSettingTypeApplicationIndex::Save ( int Index, bool Value )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::Save(0,Value);
|
CSettingTypeApplication::Save(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplicationIndex::Save ( int Index, uint32_t Value )
|
void CSettingTypeApplicationIndex::Save ( int Index, uint32_t Value )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::Save(0,Value);
|
CSettingTypeApplication::Save(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplicationIndex::Save ( int Index, const stdstr & Value )
|
void CSettingTypeApplicationIndex::Save ( int Index, const stdstr & Value )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::Save(0,Value);
|
CSettingTypeApplication::Save(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplicationIndex::Save ( int Index, const char * Value )
|
void CSettingTypeApplicationIndex::Save ( int Index, const char * Value )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::Save(0,Value);
|
CSettingTypeApplication::Save(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeApplicationIndex::Delete ( int Index )
|
void CSettingTypeApplicationIndex::Delete ( int Index )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||||
CSettingTypeApplication::Save(0,(const char *)NULL);
|
CSettingTypeApplication::Save(0,(const char *)NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeApplicationIndex :
|
class CSettingTypeApplicationIndex :
|
||||||
public CSettingTypeApplication
|
public CSettingTypeApplication
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue );
|
CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue );
|
||||||
CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue );
|
CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue );
|
||||||
CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue );
|
CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue );
|
||||||
CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting );
|
CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||||
~CSettingTypeApplicationIndex();
|
~CSettingTypeApplicationIndex();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeApplicationIndex(void); // Disable default constructor
|
CSettingTypeApplicationIndex(void); // Disable default constructor
|
||||||
CSettingTypeApplicationIndex(const CSettingTypeApplicationIndex&); // Disable copy constructor
|
CSettingTypeApplicationIndex(const CSettingTypeApplicationIndex&); // Disable copy constructor
|
||||||
CSettingTypeApplicationIndex& operator=(const CSettingTypeApplicationIndex&); // Disable assignment
|
CSettingTypeApplicationIndex& operator=(const CSettingTypeApplicationIndex&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-Application.h"
|
#include "SettingsType-Application.h"
|
||||||
#include "SettingsType-ApplicationPath.h"
|
#include "SettingsType-ApplicationPath.h"
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
|
||||||
CSettingTypeApplicationPath::CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeApplicationPath::CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeApplication(Section,Name,DefaultSetting)
|
CSettingTypeApplication(Section,Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeApplicationPath::~CSettingTypeApplicationPath()
|
CSettingTypeApplicationPath::~CSettingTypeApplicationPath()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeApplicationPath::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeApplicationPath::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
bool bRes = CSettingTypeApplication::Load(Index,Value);
|
bool bRes = CSettingTypeApplication::Load(Index,Value);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (bRes)
|
if (bRes)
|
||||||
{
|
{
|
||||||
if (Value.substr(0,2) == ".\\" || Value.substr(0,2) == "./" ||
|
if (Value.substr(0,2) == ".\\" || Value.substr(0,2) == "./" ||
|
||||||
Value.substr(0,3) == "..\\" || Value.substr(0,3) == "../")
|
Value.substr(0,3) == "..\\" || Value.substr(0,3) == "../")
|
||||||
{
|
{
|
||||||
CPath FullFilePath(CPath::MODULE_DIRECTORY), RelativePath(Value);
|
CPath FullFilePath(CPath::MODULE_DIRECTORY), RelativePath(Value);
|
||||||
FullFilePath.SetNameExtension(RelativePath.GetNameExtension().c_str());
|
FullFilePath.SetNameExtension(RelativePath.GetNameExtension().c_str());
|
||||||
FullFilePath.AppendDirectory(RelativePath.GetDirectory().c_str());
|
FullFilePath.AppendDirectory(RelativePath.GetDirectory().c_str());
|
||||||
|
|
||||||
Value = (const std::string &)FullFilePath;
|
Value = (const std::string &)FullFilePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeApplicationPath :
|
class CSettingTypeApplicationPath :
|
||||||
public CSettingTypeApplication
|
public CSettingTypeApplication
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CSettingTypeApplicationPath();
|
virtual ~CSettingTypeApplicationPath();
|
||||||
|
|
||||||
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
|
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeApplicationPath(void); // Disable default constructor
|
CSettingTypeApplicationPath(void); // Disable default constructor
|
||||||
CSettingTypeApplicationPath(const CSettingTypeApplicationPath&); // Disable copy constructor
|
CSettingTypeApplicationPath(const CSettingTypeApplicationPath&); // Disable copy constructor
|
||||||
CSettingTypeApplicationPath& operator=(const CSettingTypeApplicationPath&); // Disable assignment
|
CSettingTypeApplicationPath& operator=(const CSettingTypeApplicationPath&); // Disable assignment
|
||||||
|
|
||||||
CSettingTypeApplicationPath(const char * Section, const char * Name, const char * DefaultValue );
|
CSettingTypeApplicationPath(const char * Section, const char * Name, const char * DefaultValue );
|
||||||
CSettingTypeApplicationPath(const char * Section, const char * Name, bool DefaultValue );
|
CSettingTypeApplicationPath(const char * Section, const char * Name, bool DefaultValue );
|
||||||
CSettingTypeApplicationPath(const char * Section, const char * Name, uint32_t DefaultValue );
|
CSettingTypeApplicationPath(const char * Section, const char * Name, uint32_t DefaultValue );
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/Settings.h>
|
#include <Project64-core/Settings/Settings.h>
|
||||||
#include <Common/StdString.h>
|
#include <Common/StdString.h>
|
||||||
|
|
||||||
enum SettingType
|
enum SettingType
|
||||||
{
|
{
|
||||||
SettingType_Unknown = -1,
|
SettingType_Unknown = -1,
|
||||||
SettingType_ConstString = 0,
|
SettingType_ConstString = 0,
|
||||||
SettingType_ConstValue = 1,
|
SettingType_ConstValue = 1,
|
||||||
SettingType_CfgFile = 2,
|
SettingType_CfgFile = 2,
|
||||||
SettingType_Registry = 3,
|
SettingType_Registry = 3,
|
||||||
SettingType_RelativePath = 4,
|
SettingType_RelativePath = 4,
|
||||||
TemporarySetting = 5,
|
TemporarySetting = 5,
|
||||||
SettingType_RomDatabase = 6,
|
SettingType_RomDatabase = 6,
|
||||||
SettingType_CheatSetting = 7,
|
SettingType_CheatSetting = 7,
|
||||||
SettingType_GameSetting = 8,
|
SettingType_GameSetting = 8,
|
||||||
SettingType_BoolVariable = 9,
|
SettingType_BoolVariable = 9,
|
||||||
SettingType_NumberVariable = 10,
|
SettingType_NumberVariable = 10,
|
||||||
SettingType_StringVariable = 11,
|
SettingType_StringVariable = 11,
|
||||||
SettingType_SelectedDirectory = 12,
|
SettingType_SelectedDirectory = 12,
|
||||||
SettingType_RdbSetting = 13,
|
SettingType_RdbSetting = 13,
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSettingType
|
class CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CSettingType() {};
|
virtual ~CSettingType() {};
|
||||||
|
|
||||||
virtual SettingType GetSettingType ( void ) const = 0;
|
virtual SettingType GetSettingType ( void ) const = 0;
|
||||||
virtual bool IndexBasedSetting ( void ) const = 0;
|
virtual bool IndexBasedSetting ( void ) const = 0;
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const = 0;
|
virtual bool Load ( int32_t Index, bool & Value ) const = 0;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const = 0;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const = 0;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const = 0;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const = 0;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const = 0;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const = 0;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const = 0;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const = 0;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const = 0;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const = 0;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value ) = 0;
|
virtual void Save ( int32_t Index, bool Value ) = 0;
|
||||||
virtual void Save ( int32_t Index, uint32_t Value ) = 0;
|
virtual void Save ( int32_t Index, uint32_t Value ) = 0;
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value ) = 0;
|
virtual void Save ( int32_t Index, const stdstr & Value ) = 0;
|
||||||
virtual void Save ( int32_t Index, const char * Value ) = 0;
|
virtual void Save ( int32_t Index, const char * Value ) = 0;
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index ) = 0;
|
virtual void Delete ( int32_t Index ) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,148 +1,148 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-Cheats.h"
|
#include "SettingsType-Cheats.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;
|
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;
|
||||||
stdstr * CSettingTypeCheats::m_SectionIdent = NULL;
|
stdstr * CSettingTypeCheats::m_SectionIdent = NULL;
|
||||||
|
|
||||||
CSettingTypeCheats::CSettingTypeCheats(const char * PostFix ) :
|
CSettingTypeCheats::CSettingTypeCheats(const char * PostFix ) :
|
||||||
m_PostFix(PostFix)
|
m_PostFix(PostFix)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeCheats::~CSettingTypeCheats ( void )
|
CSettingTypeCheats::~CSettingTypeCheats ( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::Initialize ( void )
|
void CSettingTypeCheats::Initialize ( void )
|
||||||
{
|
{
|
||||||
m_CheatIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
|
m_CheatIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
|
||||||
m_CheatIniFile->SetAutoFlush(false);
|
m_CheatIniFile->SetAutoFlush(false);
|
||||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||||
GameChanged(NULL);
|
GameChanged(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::CleanUp ( void )
|
void CSettingTypeCheats::CleanUp ( void )
|
||||||
{
|
{
|
||||||
if (m_CheatIniFile)
|
if (m_CheatIniFile)
|
||||||
{
|
{
|
||||||
m_CheatIniFile->SetAutoFlush(true);
|
m_CheatIniFile->SetAutoFlush(true);
|
||||||
delete m_CheatIniFile;
|
delete m_CheatIniFile;
|
||||||
m_CheatIniFile = NULL;
|
m_CheatIniFile = NULL;
|
||||||
}
|
}
|
||||||
if (m_SectionIdent)
|
if (m_SectionIdent)
|
||||||
{
|
{
|
||||||
delete m_SectionIdent;
|
delete m_SectionIdent;
|
||||||
m_SectionIdent = NULL;
|
m_SectionIdent = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::FlushChanges( void )
|
void CSettingTypeCheats::FlushChanges( void )
|
||||||
{
|
{
|
||||||
if (m_CheatIniFile)
|
if (m_CheatIniFile)
|
||||||
{
|
{
|
||||||
m_CheatIniFile->FlushChanges();
|
m_CheatIniFile->FlushChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::GameChanged ( void * /*Data */ )
|
void CSettingTypeCheats::GameChanged ( void * /*Data */ )
|
||||||
{
|
{
|
||||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*stdstr CSettingTypeCheats::FixName ( const char * Section, const char * Name )
|
/*stdstr CSettingTypeCheats::FixName ( const char * Section, const char * Name )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * CSettingTypeCheats::SectionName ( void ) const
|
const char * CSettingTypeCheats::SectionName ( void ) const
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::UpdateSettings ( void * )
|
void CSettingTypeCheats::UpdateSettings ( void * )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeCheats::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeCheats::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
if (m_CheatIniFile == NULL)
|
if (m_CheatIniFile == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||||
return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
|
return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeCheats::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeCheats::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeCheats::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeCheats::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeCheats::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::Save ( int /*Index*/, uint32_t /*Value*/ )
|
void CSettingTypeCheats::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::Save ( int Index, const stdstr & Value )
|
void CSettingTypeCheats::Save ( int Index, const stdstr & Value )
|
||||||
{
|
{
|
||||||
if (m_CheatIniFile == NULL) { return; }
|
if (m_CheatIniFile == NULL) { return; }
|
||||||
|
|
||||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
|
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::Save ( int Index, const char * Value )
|
void CSettingTypeCheats::Save ( int Index, const char * Value )
|
||||||
{
|
{
|
||||||
if (m_CheatIniFile == NULL) { return; }
|
if (m_CheatIniFile == NULL) { return; }
|
||||||
|
|
||||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
|
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeCheats::Delete ( int Index )
|
void CSettingTypeCheats::Delete ( int Index )
|
||||||
{
|
{
|
||||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
|
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
#include <Common/IniFileClass.h>
|
#include <Common/IniFileClass.h>
|
||||||
|
|
||||||
class CSettingTypeCheats :
|
class CSettingTypeCheats :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeCheats(const char * PostFix );
|
CSettingTypeCheats(const char * PostFix );
|
||||||
~CSettingTypeCheats();
|
~CSettingTypeCheats();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
// Initialize this class to use ini or registry
|
// Initialize this class to use ini or registry
|
||||||
static void Initialize ( void );
|
static void Initialize ( void );
|
||||||
static void CleanUp ( void );
|
static void CleanUp ( void );
|
||||||
static void FlushChanges ( void );
|
static void FlushChanges ( void );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static CIniFile * m_CheatIniFile;
|
static CIniFile * m_CheatIniFile;
|
||||||
static stdstr * m_SectionIdent;
|
static stdstr * m_SectionIdent;
|
||||||
const char * const m_PostFix;
|
const char * const m_PostFix;
|
||||||
static void GameChanged ( void * /*Data */ );
|
static void GameChanged ( void * /*Data */ );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeCheats(void); // Disable default constructor
|
CSettingTypeCheats(void); // Disable default constructor
|
||||||
CSettingTypeCheats(const CSettingTypeCheats&); // Disable copy constructor
|
CSettingTypeCheats(const CSettingTypeCheats&); // Disable copy constructor
|
||||||
CSettingTypeCheats& operator=(const CSettingTypeCheats&); // Disable assignment
|
CSettingTypeCheats& operator=(const CSettingTypeCheats&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,259 +1,259 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-Application.h"
|
#include "SettingsType-Application.h"
|
||||||
#include "SettingsType-GameSetting.h"
|
#include "SettingsType-GameSetting.h"
|
||||||
|
|
||||||
bool CSettingTypeGame::m_RdbEditor = false;
|
bool CSettingTypeGame::m_RdbEditor = false;
|
||||||
bool CSettingTypeGame::m_EraseDefaults = true;
|
bool CSettingTypeGame::m_EraseDefaults = true;
|
||||||
stdstr * CSettingTypeGame::m_SectionIdent = NULL;
|
stdstr * CSettingTypeGame::m_SectionIdent = NULL;
|
||||||
|
|
||||||
CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue ) :
|
CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue ) :
|
||||||
CSettingTypeApplication("",Name,DefaultValue)
|
CSettingTypeApplication("",Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeGame::CSettingTypeGame(const char * Name, uint32_t DefaultValue ) :
|
CSettingTypeGame::CSettingTypeGame(const char * Name, uint32_t DefaultValue ) :
|
||||||
CSettingTypeApplication("",Name,DefaultValue)
|
CSettingTypeApplication("",Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeGame::CSettingTypeGame(const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeGame::CSettingTypeGame(const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeApplication("",Name,DefaultSetting)
|
CSettingTypeApplication("",Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeGame::~CSettingTypeGame()
|
CSettingTypeGame::~CSettingTypeGame()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::Initialize ( void )
|
void CSettingTypeGame::Initialize ( void )
|
||||||
{
|
{
|
||||||
UpdateSettings(NULL);
|
UpdateSettings(NULL);
|
||||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::CleanUp ( void )
|
void CSettingTypeGame::CleanUp ( void )
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
||||||
if (m_SectionIdent)
|
if (m_SectionIdent)
|
||||||
{
|
{
|
||||||
delete m_SectionIdent;
|
delete m_SectionIdent;
|
||||||
m_SectionIdent = NULL;
|
m_SectionIdent = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * CSettingTypeGame::SectionName ( void ) const
|
const char * CSettingTypeGame::SectionName ( void ) const
|
||||||
{
|
{
|
||||||
return m_SectionIdent ? m_SectionIdent->c_str() : "";
|
return m_SectionIdent ? m_SectionIdent->c_str() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
|
void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
|
||||||
{
|
{
|
||||||
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
|
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
|
||||||
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
|
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
|
||||||
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||||
|
|
||||||
if (m_SectionIdent == NULL)
|
if (m_SectionIdent == NULL)
|
||||||
{
|
{
|
||||||
m_SectionIdent = new stdstr;
|
m_SectionIdent = new stdstr;
|
||||||
}
|
}
|
||||||
if (SectionIdent != *m_SectionIdent)
|
if (SectionIdent != *m_SectionIdent)
|
||||||
{
|
{
|
||||||
*m_SectionIdent = SectionIdent;
|
*m_SectionIdent = SectionIdent;
|
||||||
g_Settings->SettingTypeChanged(SettingType_GameSetting);
|
g_Settings->SettingTypeChanged(SettingType_GameSetting);
|
||||||
g_Settings->SettingTypeChanged(SettingType_RomDatabase);
|
g_Settings->SettingTypeChanged(SettingType_RomDatabase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeGame::Load ( int Index, bool & Value ) const
|
bool CSettingTypeGame::Load ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
|
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
return g_Settings->LoadBool(m_DefaultSetting,Value);
|
return g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CSettingTypeApplication::Load(Index,Value);
|
return CSettingTypeApplication::Load(Index,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeGame::Load ( int Index, uint32_t & Value ) const
|
bool CSettingTypeGame::Load ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
|
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
return g_Settings->LoadDword(m_DefaultSetting,Value);
|
return g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CSettingTypeApplication::Load(Index,Value);
|
return CSettingTypeApplication::Load(Index,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
|
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
return g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
return g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CSettingTypeApplication::Load(Index,Value);
|
return CSettingTypeApplication::Load(Index,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const
|
void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
|
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
|
g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::LoadDefault ( int Index, uint32_t & Value ) const
|
void CSettingTypeGame::LoadDefault ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
|
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
|
g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
|
void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
|
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadDefaultString(m_DefaultSetting,Value);
|
g_Settings->LoadDefaultString(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeGame::Save ( int Index, bool Value )
|
void CSettingTypeGame::Save ( int Index, bool Value )
|
||||||
{
|
{
|
||||||
if (m_EraseDefaults)
|
if (m_EraseDefaults)
|
||||||
{
|
{
|
||||||
bool bDefault;
|
bool bDefault;
|
||||||
LoadDefault(Index,bDefault);
|
LoadDefault(Index,bDefault);
|
||||||
if (bDefault == Value)
|
if (bDefault == Value)
|
||||||
{
|
{
|
||||||
Delete(Index);
|
Delete(Index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
|
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->SaveBool(m_DefaultSetting,Value);
|
g_Settings->SaveBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::Save(Index,Value);
|
CSettingTypeApplication::Save(Index,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::Save ( int Index, uint32_t Value )
|
void CSettingTypeGame::Save ( int Index, uint32_t Value )
|
||||||
{
|
{
|
||||||
if (m_EraseDefaults)
|
if (m_EraseDefaults)
|
||||||
{
|
{
|
||||||
uint32_t ulDefault;
|
uint32_t ulDefault;
|
||||||
CSettingTypeGame::LoadDefault(Index,ulDefault);
|
CSettingTypeGame::LoadDefault(Index,ulDefault);
|
||||||
if (ulDefault == Value)
|
if (ulDefault == Value)
|
||||||
{
|
{
|
||||||
Delete(Index);
|
Delete(Index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
|
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->SaveDword(m_DefaultSetting,Value);
|
g_Settings->SaveDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::Save(Index,Value);
|
CSettingTypeApplication::Save(Index,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::Save ( int Index, const stdstr & Value )
|
void CSettingTypeGame::Save ( int Index, const stdstr & Value )
|
||||||
{
|
{
|
||||||
Save(Index,Value.c_str());
|
Save(Index,Value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::Save ( int Index, const char * Value )
|
void CSettingTypeGame::Save ( int Index, const char * Value )
|
||||||
{
|
{
|
||||||
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
|
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
|
||||||
{
|
{
|
||||||
stdstr szDefault;
|
stdstr szDefault;
|
||||||
CSettingTypeGame::LoadDefault(Index,szDefault);
|
CSettingTypeGame::LoadDefault(Index,szDefault);
|
||||||
if (_stricmp(szDefault.c_str(),Value) == 0)
|
if (_stricmp(szDefault.c_str(),Value) == 0)
|
||||||
{
|
{
|
||||||
Delete(Index);
|
Delete(Index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
|
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->SaveString(m_DefaultSetting,Value);
|
g_Settings->SaveString(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::Save(Index,Value);
|
CSettingTypeApplication::Save(Index,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGame::Delete ( int Index )
|
void CSettingTypeGame::Delete ( int Index )
|
||||||
{
|
{
|
||||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||||
{
|
{
|
||||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||||
{
|
{
|
||||||
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
|
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
|
||||||
} else {
|
} else {
|
||||||
g_Settings->DeleteSetting(m_DefaultSetting);
|
g_Settings->DeleteSetting(m_DefaultSetting);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CSettingTypeApplication::Delete(Index);
|
CSettingTypeApplication::Delete(Index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeGame :
|
class CSettingTypeGame :
|
||||||
public CSettingTypeApplication
|
public CSettingTypeApplication
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
static bool m_RdbEditor;
|
static bool m_RdbEditor;
|
||||||
static bool m_EraseDefaults;
|
static bool m_EraseDefaults;
|
||||||
static stdstr * m_SectionIdent;
|
static stdstr * m_SectionIdent;
|
||||||
|
|
||||||
static void UpdateSettings ( void * /*Data */ );
|
static void UpdateSettings ( void * /*Data */ );
|
||||||
|
|
||||||
virtual const char * SectionName ( void ) const;
|
virtual const char * SectionName ( void ) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSettingTypeGame(const char * Name, const char * DefaultValue );
|
CSettingTypeGame(const char * Name, const char * DefaultValue );
|
||||||
CSettingTypeGame(const char * Name, uint32_t DefaultValue );
|
CSettingTypeGame(const char * Name, uint32_t DefaultValue );
|
||||||
CSettingTypeGame(const char * Name, SettingID DefaultSetting );
|
CSettingTypeGame(const char * Name, SettingID DefaultSetting );
|
||||||
virtual ~CSettingTypeGame();
|
virtual ~CSettingTypeGame();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
||||||
|
|
||||||
static void Initialize( void );
|
static void Initialize( void );
|
||||||
static void CleanUp ( void );
|
static void CleanUp ( void );
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeGame(void); // Disable default constructor
|
CSettingTypeGame(void); // Disable default constructor
|
||||||
CSettingTypeGame(const CSettingTypeGame&); // Disable copy constructor
|
CSettingTypeGame(const CSettingTypeGame&); // Disable copy constructor
|
||||||
CSettingTypeGame& operator=(const CSettingTypeGame&); // Disable assignment
|
CSettingTypeGame& operator=(const CSettingTypeGame&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,104 +1,104 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-Application.h"
|
#include "SettingsType-Application.h"
|
||||||
#include "SettingsType-GameSetting.h"
|
#include "SettingsType-GameSetting.h"
|
||||||
#include "SettingsType-GameSettingIndex.h"
|
#include "SettingsType-GameSettingIndex.h"
|
||||||
|
|
||||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
||||||
CSettingTypeGame("", DefaultSetting),
|
CSettingTypeGame("", DefaultSetting),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue ) :
|
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue ) :
|
||||||
CSettingTypeGame("", DefaultValue),
|
CSettingTypeGame("", DefaultValue),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
||||||
CSettingTypeGame("", DefaultValue),
|
CSettingTypeGame("", DefaultValue),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeGameIndex::~CSettingTypeGameIndex()
|
CSettingTypeGameIndex::~CSettingTypeGameIndex()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const
|
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
return CSettingTypeGame::Load(Index,Value);
|
return CSettingTypeGame::Load(Index,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeGameIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeGameIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
return CSettingTypeGame::Load(0,Value);
|
return CSettingTypeGame::Load(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const
|
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeGame::LoadDefault(0,Value);
|
CSettingTypeGame::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeGameIndex::Save ( int Index, bool Value )
|
void CSettingTypeGameIndex::Save ( int Index, bool Value )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeGame::Save(Index,Value);
|
CSettingTypeGame::Save(Index,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGameIndex::Save(int Index, uint32_t Value)
|
void CSettingTypeGameIndex::Save(int Index, uint32_t Value)
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeGame::Save(0,Value);
|
CSettingTypeGame::Save(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGameIndex::Save ( int Index, const char * Value )
|
void CSettingTypeGameIndex::Save ( int Index, const char * Value )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeGame::Save(0,Value);
|
CSettingTypeGame::Save(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeGameIndex::Delete ( int Index )
|
void CSettingTypeGameIndex::Delete ( int Index )
|
||||||
{
|
{
|
||||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeGame::Delete(0);
|
CSettingTypeGame::Delete(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,50 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeGameIndex :
|
class CSettingTypeGameIndex :
|
||||||
public CSettingTypeGame
|
public CSettingTypeGame
|
||||||
{
|
{
|
||||||
stdstr m_PreIndex, m_PostIndex;
|
stdstr m_PreIndex, m_PostIndex;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
|
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
|
||||||
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue );
|
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue );
|
||||||
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
|
CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
|
||||||
~CSettingTypeGameIndex();
|
~CSettingTypeGameIndex();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeGameIndex(void); // Disable default constructor
|
CSettingTypeGameIndex(void); // Disable default constructor
|
||||||
CSettingTypeGameIndex(const CSettingTypeGameIndex&); // Disable copy constructor
|
CSettingTypeGameIndex(const CSettingTypeGameIndex&); // Disable copy constructor
|
||||||
CSettingTypeGameIndex& operator=(const CSettingTypeGameIndex&); // Disable assignment
|
CSettingTypeGameIndex& operator=(const CSettingTypeGameIndex&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,123 +1,123 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
#include "SettingsType-RDBCpuType.h"
|
#include "SettingsType-RDBCpuType.h"
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
|
|
||||||
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, int DefaultValue ) :
|
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, int DefaultValue ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType()
|
CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBCpuType::Load ( int Index, uint32_t & Value ) const
|
bool CSettingTypeRDBCpuType::Load ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
stdstr strValue;
|
stdstr strValue;
|
||||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char * String = strValue.c_str();
|
const char * String = strValue.c_str();
|
||||||
|
|
||||||
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
|
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
|
||||||
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
|
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
|
||||||
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
|
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
|
||||||
else if (_stricmp(String,"default") == 0)
|
else if (_stricmp(String,"default") == 0)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue;
|
Value = m_DefaultValue;
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeRDBCpuType::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, uint32_t Value )
|
void CSettingTypeRDBCpuType::Save ( int /*Index*/, uint32_t Value )
|
||||||
{
|
{
|
||||||
stdstr strValue;
|
stdstr strValue;
|
||||||
switch (Value)
|
switch (Value)
|
||||||
{
|
{
|
||||||
case CPU_Interpreter: strValue = "Interpreter"; break;
|
case CPU_Interpreter: strValue = "Interpreter"; break;
|
||||||
case CPU_Recompiler: strValue = "Recompiler"; break;
|
case CPU_Recompiler: strValue = "Recompiler"; break;
|
||||||
case CPU_SyncCores: strValue = "SyncCores"; break;
|
case CPU_SyncCores: strValue = "SyncCores"; break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBCpuType::Delete( int /*Index*/ )
|
void CSettingTypeRDBCpuType::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRDBCpuType :
|
class CSettingTypeRDBCpuType :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
|
CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
|
||||||
CSettingTypeRDBCpuType(const char * Name, int32_t DefaultValue );
|
CSettingTypeRDBCpuType(const char * Name, int32_t DefaultValue );
|
||||||
~CSettingTypeRDBCpuType();
|
~CSettingTypeRDBCpuType();
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRDBCpuType(void); // Disable default constructor
|
CSettingTypeRDBCpuType(void); // Disable default constructor
|
||||||
CSettingTypeRDBCpuType(const CSettingTypeRDBCpuType&); // Disable copy constructor
|
CSettingTypeRDBCpuType(const CSettingTypeRDBCpuType&); // Disable copy constructor
|
||||||
CSettingTypeRDBCpuType& operator=(const CSettingTypeRDBCpuType&); // Disable assignment
|
CSettingTypeRDBCpuType& operator=(const CSettingTypeRDBCpuType&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,112 +1,112 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
#include "SettingsType-RDBOnOff.h"
|
#include "SettingsType-RDBOnOff.h"
|
||||||
|
|
||||||
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, int DefaultValue ) :
|
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, int DefaultValue ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBOnOff::~CSettingTypeRDBOnOff()
|
CSettingTypeRDBOnOff::~CSettingTypeRDBOnOff()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const
|
bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
stdstr strValue;
|
stdstr strValue;
|
||||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char * String = strValue.c_str();
|
const char * String = strValue.c_str();
|
||||||
|
|
||||||
if (_stricmp(String,"On") == 0) { Value = true; }
|
if (_stricmp(String,"On") == 0) { Value = true; }
|
||||||
else if (_stricmp(String,"Off") == 0) { Value = false; }
|
else if (_stricmp(String,"Off") == 0) { Value = false; }
|
||||||
else if (_stricmp(String,"Global") == 0 || _stricmp(String,"default"))
|
else if (_stricmp(String,"Global") == 0 || _stricmp(String,"default"))
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, bool & Value ) const
|
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue != 0;
|
Value = m_DefaultValue != 0;
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, bool Value )
|
void CSettingTypeRDBOnOff::Save ( int /*Index*/, bool Value )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "On" : "Off");
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "On" : "Off");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, uint32_t /*Value*/ )
|
void CSettingTypeRDBOnOff::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBOnOff::Delete( int /*Index*/ )
|
void CSettingTypeRDBOnOff::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRDBOnOff :
|
class CSettingTypeRDBOnOff :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting );
|
CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting );
|
||||||
CSettingTypeRDBOnOff(const char * Name, int32_t DefaultValue );
|
CSettingTypeRDBOnOff(const char * Name, int32_t DefaultValue );
|
||||||
~CSettingTypeRDBOnOff();
|
~CSettingTypeRDBOnOff();
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRDBOnOff(void); // Disable default constructor
|
CSettingTypeRDBOnOff(void); // Disable default constructor
|
||||||
CSettingTypeRDBOnOff(const CSettingTypeRDBOnOff&); // Disable copy constructor
|
CSettingTypeRDBOnOff(const CSettingTypeRDBOnOff&); // Disable copy constructor
|
||||||
CSettingTypeRDBOnOff& operator=(const CSettingTypeRDBOnOff&); // Disable assignment
|
CSettingTypeRDBOnOff& operator=(const CSettingTypeRDBOnOff&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,99 +1,99 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
#include "SettingsType-RDBRamSize.h"
|
#include "SettingsType-RDBRamSize.h"
|
||||||
|
|
||||||
// == 8 ? 0x800000 : 0x400000
|
// == 8 ? 0x800000 : 0x400000
|
||||||
|
|
||||||
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue ) :
|
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize()
|
CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBRDRamSize::Load ( int Index, uint32_t & Value ) const
|
bool CSettingTypeRDBRDRamSize::Load ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
uint32_t ulValue;
|
uint32_t ulValue;
|
||||||
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
|
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,ulValue);
|
LoadDefault(Index,ulValue);
|
||||||
}
|
}
|
||||||
Value = 0x400000;
|
Value = 0x400000;
|
||||||
if (ulValue == 8)
|
if (ulValue == 8)
|
||||||
{
|
{
|
||||||
Value = 0x800000;
|
Value = 0x800000;
|
||||||
}
|
}
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue;
|
Value = m_DefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, uint32_t Value )
|
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, uint32_t Value )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4);
|
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBRDRamSize::Delete( int /*Index*/ )
|
void CSettingTypeRDBRDRamSize::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRDBRDRamSize :
|
class CSettingTypeRDBRDRamSize :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
|
CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
|
||||||
CSettingTypeRDBRDRamSize(const char * Name, int32_t DefaultValue );
|
CSettingTypeRDBRDRamSize(const char * Name, int32_t DefaultValue );
|
||||||
~CSettingTypeRDBRDRamSize();
|
~CSettingTypeRDBRDRamSize();
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRDBRDRamSize(void); // Disable default constructor
|
CSettingTypeRDBRDRamSize(void); // Disable default constructor
|
||||||
CSettingTypeRDBRDRamSize(const CSettingTypeRDBRDRamSize&); // Disable copy constructor
|
CSettingTypeRDBRDRamSize(const CSettingTypeRDBRDRamSize&); // Disable copy constructor
|
||||||
CSettingTypeRDBRDRamSize& operator=(const CSettingTypeRDBRDRamSize&); // Disable assignment
|
CSettingTypeRDBRDRamSize& operator=(const CSettingTypeRDBRDRamSize&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,126 +1,126 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
#include "SettingsType-RDBSaveChip.h"
|
#include "SettingsType-RDBSaveChip.h"
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
|
|
||||||
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting ) :
|
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, int DefaultValue ) :
|
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, int DefaultValue ) :
|
||||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
|
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBSaveChip::Load ( int Index, uint32_t & Value ) const
|
bool CSettingTypeRDBSaveChip::Load ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
stdstr strValue;
|
stdstr strValue;
|
||||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char * String = strValue.c_str();
|
const char * String = strValue.c_str();
|
||||||
|
|
||||||
if (_stricmp(String,"First Save Type") == 0) { Value = (uint32_t)SaveChip_Auto; }
|
if (_stricmp(String,"First Save Type") == 0) { Value = (uint32_t)SaveChip_Auto; }
|
||||||
else if (_stricmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
|
else if (_stricmp(String,"4kbit Eeprom") == 0) { Value = SaveChip_Eeprom_4K; }
|
||||||
else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
|
else if (_stricmp(String,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
|
||||||
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
|
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
|
||||||
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
|
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
|
||||||
else if (_stricmp(String,"default") == 0)
|
else if (_stricmp(String,"default") == 0)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue;
|
Value = m_DefaultValue;
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, uint32_t Value )
|
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, uint32_t Value )
|
||||||
{
|
{
|
||||||
switch (Value)
|
switch (Value)
|
||||||
{
|
{
|
||||||
case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"First Save Type"); break;
|
case SaveChip_Auto: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"First Save Type"); break;
|
||||||
case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break;
|
case SaveChip_Eeprom_4K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"4kbit Eeprom"); break;
|
||||||
case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break;
|
case SaveChip_Eeprom_16K: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"16kbit Eeprom"); break;
|
||||||
case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"Sram"); break;
|
case SaveChip_Sram: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"Sram"); break;
|
||||||
case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
|
case SaveChip_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
|
||||||
default:
|
default:
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBSaveChip::Delete( int /*Index*/ )
|
void CSettingTypeRDBSaveChip::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRDBSaveChip :
|
class CSettingTypeRDBSaveChip :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
|
CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
|
||||||
CSettingTypeRDBSaveChip(const char * Name, int32_t DefaultValue );
|
CSettingTypeRDBSaveChip(const char * Name, int32_t DefaultValue );
|
||||||
~CSettingTypeRDBSaveChip();
|
~CSettingTypeRDBSaveChip();
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRDBSaveChip(void); // Disable default constructor
|
CSettingTypeRDBSaveChip(void); // Disable default constructor
|
||||||
CSettingTypeRDBSaveChip(const CSettingTypeRDBSaveChip&); // Disable copy constructor
|
CSettingTypeRDBSaveChip(const CSettingTypeRDBSaveChip&); // Disable copy constructor
|
||||||
CSettingTypeRDBSaveChip& operator=(const CSettingTypeRDBSaveChip&); // Disable assignment
|
CSettingTypeRDBSaveChip& operator=(const CSettingTypeRDBSaveChip&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,124 +1,124 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
#include "SettingsType-RDBYesNo.h"
|
#include "SettingsType-RDBYesNo.h"
|
||||||
|
|
||||||
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting) :
|
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting) :
|
||||||
CSettingTypeRomDatabase(Name, DefaultSetting)
|
CSettingTypeRomDatabase(Name, DefaultSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, int DefaultValue) :
|
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, int DefaultValue) :
|
||||||
CSettingTypeRomDatabase(Name, DefaultValue)
|
CSettingTypeRomDatabase(Name, DefaultValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo()
|
CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBYesNo::Load(int Index, bool & Value) const
|
bool CSettingTypeRDBYesNo::Load(int Index, bool & Value) const
|
||||||
{
|
{
|
||||||
stdstr strValue;
|
stdstr strValue;
|
||||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(), m_KeyName.c_str(), m_DefaultStr, strValue);
|
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(), m_KeyName.c_str(), m_DefaultStr, strValue);
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
LoadDefault(Index, Value);
|
LoadDefault(Index, Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char * String = strValue.c_str();
|
const char * String = strValue.c_str();
|
||||||
|
|
||||||
if (_stricmp(String, "Yes") == 0)
|
if (_stricmp(String, "Yes") == 0)
|
||||||
{
|
{
|
||||||
Value = true;
|
Value = true;
|
||||||
}
|
}
|
||||||
else if (_stricmp(String, "No") == 0)
|
else if (_stricmp(String, "No") == 0)
|
||||||
{
|
{
|
||||||
Value = false;
|
Value = false;
|
||||||
}
|
}
|
||||||
else if (_stricmp(String, "default") == 0)
|
else if (_stricmp(String, "default") == 0)
|
||||||
{
|
{
|
||||||
LoadDefault(Index, Value);
|
LoadDefault(Index, Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteTrace(TraceSettings, TraceError, "Invalid Yes/No setting value (Section: %s Key: %s Value: %s)", m_SectionIdent->c_str(), String, m_KeyName.c_str(), strValue.c_str());
|
WriteTrace(TraceSettings, TraceError, "Invalid Yes/No setting value (Section: %s Key: %s Value: %s)", m_SectionIdent->c_str(), String, m_KeyName.c_str(), strValue.c_str());
|
||||||
LoadDefault(Index, Value);
|
LoadDefault(Index, Value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBYesNo::Load(int /*Index*/, uint32_t & /*Value*/) const
|
bool CSettingTypeRDBYesNo::Load(int /*Index*/, uint32_t & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRDBYesNo::Load(int /*Index*/, stdstr & /*Value*/) const
|
bool CSettingTypeRDBYesNo::Load(int /*Index*/, stdstr & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, bool & Value) const
|
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, bool & Value) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue != 0;
|
Value = m_DefaultValue != 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g_Settings->LoadBool(m_DefaultSetting, Value);
|
g_Settings->LoadBool(m_DefaultSetting, Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, bool Value)
|
void CSettingTypeRDBYesNo::Save(int /*Index*/, bool Value)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, uint32_t Value)
|
void CSettingTypeRDBYesNo::Save(int /*Index*/, uint32_t Value)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, const stdstr & /*Value*/)
|
void CSettingTypeRDBYesNo::Save(int /*Index*/, const stdstr & /*Value*/)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, const char * /*Value*/)
|
void CSettingTypeRDBYesNo::Save(int /*Index*/, const char * /*Value*/)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRDBYesNo::Delete(int /*Index*/)
|
void CSettingTypeRDBYesNo::Delete(int /*Index*/)
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
|
||||||
}
|
}
|
|
@ -1,44 +1,44 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRDBYesNo :
|
class CSettingTypeRDBYesNo :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting );
|
CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting );
|
||||||
CSettingTypeRDBYesNo(const char * Name, int32_t DefaultValue );
|
CSettingTypeRDBYesNo(const char * Name, int32_t DefaultValue );
|
||||||
~CSettingTypeRDBYesNo();
|
~CSettingTypeRDBYesNo();
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRDBYesNo(void); // Disable default constructor
|
CSettingTypeRDBYesNo(void); // Disable default constructor
|
||||||
CSettingTypeRDBYesNo(const CSettingTypeRDBYesNo&); // Disable copy constructor
|
CSettingTypeRDBYesNo(const CSettingTypeRDBYesNo&); // Disable copy constructor
|
||||||
CSettingTypeRDBYesNo& operator=(const CSettingTypeRDBYesNo&); // Disable assignment
|
CSettingTypeRDBYesNo& operator=(const CSettingTypeRDBYesNo&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,89 +1,89 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RelativePath.h"
|
#include "SettingsType-RelativePath.h"
|
||||||
|
|
||||||
CSettingTypeRelativePath::CSettingTypeRelativePath(const char * Directory, const char * FileName) :
|
CSettingTypeRelativePath::CSettingTypeRelativePath(const char * Directory, const char * FileName) :
|
||||||
m_Directory(Directory),
|
m_Directory(Directory),
|
||||||
m_FileName(FileName)
|
m_FileName(FileName)
|
||||||
{
|
{
|
||||||
BuildPath();
|
BuildPath();
|
||||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRelativePath::~CSettingTypeRelativePath(void)
|
CSettingTypeRelativePath::~CSettingTypeRelativePath(void)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRelativePath::Load(int /*Index*/, stdstr & value) const
|
bool CSettingTypeRelativePath::Load(int /*Index*/, stdstr & value) const
|
||||||
{
|
{
|
||||||
value = m_FullPath;
|
value = m_FullPath;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, bool & /*Value*/) const
|
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, bool & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::Save(int /*Index*/, bool /*Value*/)
|
void CSettingTypeRelativePath::Save(int /*Index*/, bool /*Value*/)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::Save(int /*Index*/, uint32_t /*Value*/)
|
void CSettingTypeRelativePath::Save(int /*Index*/, uint32_t /*Value*/)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::Save(int /*Index*/, const stdstr & Value)
|
void CSettingTypeRelativePath::Save(int /*Index*/, const stdstr & Value)
|
||||||
{
|
{
|
||||||
m_Directory = "";
|
m_Directory = "";
|
||||||
m_FileName = Value;
|
m_FileName = Value;
|
||||||
BuildPath();
|
BuildPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::Save(int /*Index*/, const char * Value)
|
void CSettingTypeRelativePath::Save(int /*Index*/, const char * Value)
|
||||||
{
|
{
|
||||||
m_Directory = "";
|
m_Directory = "";
|
||||||
m_FileName = Value;
|
m_FileName = Value;
|
||||||
BuildPath();
|
BuildPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::Delete(int /*Index*/)
|
void CSettingTypeRelativePath::Delete(int /*Index*/)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::BuildPath(void)
|
void CSettingTypeRelativePath::BuildPath(void)
|
||||||
{
|
{
|
||||||
CPath FullPath(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
CPath FullPath(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
||||||
FullPath.AppendDirectory(m_Directory.c_str());
|
FullPath.AppendDirectory(m_Directory.c_str());
|
||||||
FullPath.SetNameExtension(m_FileName.c_str());
|
FullPath.SetNameExtension(m_FileName.c_str());
|
||||||
m_FullPath = (const char *)FullPath;
|
m_FullPath = (const char *)FullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRelativePath::RefreshSettings(void * _this)
|
void CSettingTypeRelativePath::RefreshSettings(void * _this)
|
||||||
{
|
{
|
||||||
((CSettingTypeRelativePath *)_this)->BuildPath();
|
((CSettingTypeRelativePath *)_this)->BuildPath();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeRelativePath :
|
class CSettingTypeRelativePath :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRelativePath(const char * Directory, const char * FileName);
|
CSettingTypeRelativePath(const char * Directory, const char * FileName);
|
||||||
~CSettingTypeRelativePath();
|
~CSettingTypeRelativePath();
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
|
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t /*Index*/, bool & /*Value*/ ) const { return false; };
|
bool Load ( int32_t /*Index*/, bool & /*Value*/ ) const { return false; };
|
||||||
bool Load ( int32_t /*Index*/, uint32_t & /*Value*/ ) const { return false; };
|
bool Load ( int32_t /*Index*/, uint32_t & /*Value*/ ) const { return false; };
|
||||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void Save ( int32_t Index, bool Value );
|
void Save ( int32_t Index, bool Value );
|
||||||
void Save ( int32_t Index, uint32_t Value );
|
void Save ( int32_t Index, uint32_t Value );
|
||||||
void Save ( int32_t Index, const stdstr & Value );
|
void Save ( int32_t Index, const stdstr & Value );
|
||||||
void Save ( int32_t Index, const char * Value );
|
void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
void Delete ( int32_t Index );
|
void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRelativePath(void); // Disable default constructor
|
CSettingTypeRelativePath(void); // Disable default constructor
|
||||||
CSettingTypeRelativePath(const CSettingTypeRelativePath&); // Disable copy constructor
|
CSettingTypeRelativePath(const CSettingTypeRelativePath&); // Disable copy constructor
|
||||||
CSettingTypeRelativePath& operator=(const CSettingTypeRelativePath&); // Disable assignment
|
CSettingTypeRelativePath& operator=(const CSettingTypeRelativePath&); // Disable assignment
|
||||||
|
|
||||||
static void RefreshSettings(void * _this);
|
static void RefreshSettings(void * _this);
|
||||||
void BuildPath ( void );
|
void BuildPath ( void );
|
||||||
|
|
||||||
std::string m_FullPath;
|
std::string m_FullPath;
|
||||||
std::string m_Directory;
|
std::string m_Directory;
|
||||||
std::string m_FileName;
|
std::string m_FileName;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,318 +1,318 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
|
|
||||||
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
|
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
|
||||||
CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
|
CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
|
||||||
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
|
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
|
||||||
|
|
||||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
||||||
m_KeyName(StripNameSection(Name)),
|
m_KeyName(StripNameSection(Name)),
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
m_DefaultValue(DefaultValue),
|
m_DefaultValue(DefaultValue),
|
||||||
m_DefaultSetting(Default_Constant),
|
m_DefaultSetting(Default_Constant),
|
||||||
m_DeleteOnDefault(DeleteOnDefault),
|
m_DeleteOnDefault(DeleteOnDefault),
|
||||||
m_GlideSetting(IsGlideSetting(Name))
|
m_GlideSetting(IsGlideSetting(Name))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
||||||
m_KeyName(StripNameSection(Name)),
|
m_KeyName(StripNameSection(Name)),
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
m_DefaultValue(DefaultValue),
|
m_DefaultValue(DefaultValue),
|
||||||
m_DefaultSetting(Default_Constant),
|
m_DefaultSetting(Default_Constant),
|
||||||
m_DeleteOnDefault(DeleteOnDefault),
|
m_DeleteOnDefault(DeleteOnDefault),
|
||||||
m_GlideSetting(IsGlideSetting(Name))
|
m_GlideSetting(IsGlideSetting(Name))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
||||||
m_KeyName(StripNameSection(Name)),
|
m_KeyName(StripNameSection(Name)),
|
||||||
m_DefaultStr(DefaultValue),
|
m_DefaultStr(DefaultValue),
|
||||||
m_DefaultValue(0),
|
m_DefaultValue(0),
|
||||||
m_DefaultSetting(Default_Constant),
|
m_DefaultSetting(Default_Constant),
|
||||||
m_DeleteOnDefault(DeleteOnDefault),
|
m_DeleteOnDefault(DeleteOnDefault),
|
||||||
m_GlideSetting(IsGlideSetting(Name))
|
m_GlideSetting(IsGlideSetting(Name))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
||||||
m_KeyName(Name),
|
m_KeyName(Name),
|
||||||
m_DefaultStr(""),
|
m_DefaultStr(""),
|
||||||
m_DefaultValue(0),
|
m_DefaultValue(0),
|
||||||
m_DefaultSetting(DefaultSetting),
|
m_DefaultSetting(DefaultSetting),
|
||||||
m_DeleteOnDefault(DeleteOnDefault),
|
m_DeleteOnDefault(DeleteOnDefault),
|
||||||
m_GlideSetting(IsGlideSetting(Name))
|
m_GlideSetting(IsGlideSetting(Name))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
|
CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::Initialize( void )
|
void CSettingTypeRomDatabase::Initialize( void )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||||
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
||||||
|
|
||||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
g_Settings->RegisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
||||||
|
|
||||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::CleanUp( void )
|
void CSettingTypeRomDatabase::CleanUp( void )
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
||||||
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
|
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
m_SettingsIniFile = NULL;
|
m_SettingsIniFile = NULL;
|
||||||
}
|
}
|
||||||
if (m_GlideIniFile)
|
if (m_GlideIniFile)
|
||||||
{
|
{
|
||||||
delete m_GlideIniFile;
|
delete m_GlideIniFile;
|
||||||
m_GlideIniFile = NULL;
|
m_GlideIniFile = NULL;
|
||||||
}
|
}
|
||||||
if (m_SectionIdent)
|
if (m_SectionIdent)
|
||||||
{
|
{
|
||||||
delete m_SectionIdent;
|
delete m_SectionIdent;
|
||||||
m_SectionIdent = NULL;
|
m_SectionIdent = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::BaseDirChanged ( void * /*Data */ )
|
void CSettingTypeRomDatabase::BaseDirChanged ( void * /*Data */ )
|
||||||
{
|
{
|
||||||
if (m_SettingsIniFile)
|
if (m_SettingsIniFile)
|
||||||
{
|
{
|
||||||
delete m_SettingsIniFile;
|
delete m_SettingsIniFile;
|
||||||
m_SettingsIniFile = NULL;
|
m_SettingsIniFile = NULL;
|
||||||
}
|
}
|
||||||
if (m_GlideIniFile)
|
if (m_GlideIniFile)
|
||||||
{
|
{
|
||||||
delete m_GlideIniFile;
|
delete m_GlideIniFile;
|
||||||
m_GlideIniFile = NULL;
|
m_GlideIniFile = NULL;
|
||||||
}
|
}
|
||||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||||
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ )
|
void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ )
|
||||||
{
|
{
|
||||||
if (m_SectionIdent)
|
if (m_SectionIdent)
|
||||||
{
|
{
|
||||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
|
bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
uint32_t temp_value = Value;
|
uint32_t temp_value = Value;
|
||||||
bool bRes = Load(Index,temp_value);
|
bool bRes = Load(Index,temp_value);
|
||||||
Value = temp_value != 0;
|
Value = temp_value != 0;
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabase::Load ( int Index, uint32_t & Value ) const
|
bool CSettingTypeRomDatabase::Load ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
bool bRes = false;
|
bool bRes = false;
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
||||||
}
|
}
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
}
|
}
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
stdstr temp_value;
|
stdstr temp_value;
|
||||||
bool bRes = false;
|
bool bRes = false;
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
||||||
}
|
}
|
||||||
if (bRes)
|
if (bRes)
|
||||||
{
|
{
|
||||||
Value = temp_value;
|
Value = temp_value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadDefault(Index,Value);
|
LoadDefault(Index,Value);
|
||||||
}
|
}
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const
|
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue != 0;
|
Value = m_DefaultValue != 0;
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultValue;
|
Value = m_DefaultValue;
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting != Default_None)
|
if (m_DefaultSetting != Default_None)
|
||||||
{
|
{
|
||||||
if (m_DefaultSetting == Default_Constant)
|
if (m_DefaultSetting == Default_Constant)
|
||||||
{
|
{
|
||||||
Value = m_DefaultStr;
|
Value = m_DefaultStr;
|
||||||
} else {
|
} else {
|
||||||
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
|
void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
|
||||||
{
|
{
|
||||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_DeleteOnDefault)
|
if (m_DeleteOnDefault)
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::Save ( int Index, uint32_t Value )
|
void CSettingTypeRomDatabase::Save ( int Index, uint32_t Value )
|
||||||
{
|
{
|
||||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_DeleteOnDefault)
|
if (m_DeleteOnDefault)
|
||||||
{
|
{
|
||||||
uint32_t defaultValue = 0;
|
uint32_t defaultValue = 0;
|
||||||
LoadDefault(Index,defaultValue);
|
LoadDefault(Index,defaultValue);
|
||||||
if (defaultValue == Value)
|
if (defaultValue == Value)
|
||||||
{
|
{
|
||||||
Delete(Index);
|
Delete(Index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
|
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
|
||||||
{
|
{
|
||||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
|
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
|
||||||
{
|
{
|
||||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
|
void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
|
||||||
{
|
{
|
||||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_GlideSetting)
|
if (m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabase::IsGlideSetting (const char * Name)
|
bool CSettingTypeRomDatabase::IsGlideSetting (const char * Name)
|
||||||
{
|
{
|
||||||
if (_strnicmp(Name,"Glide64-",8) == 0)
|
if (_strnicmp(Name,"Glide64-",8) == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * CSettingTypeRomDatabase::StripNameSection (const char * Name)
|
const char * CSettingTypeRomDatabase::StripNameSection (const char * Name)
|
||||||
{
|
{
|
||||||
if (_strnicmp(Name,"Glide64-",8) == 0)
|
if (_strnicmp(Name,"Glide64-",8) == 0)
|
||||||
{
|
{
|
||||||
return &Name[8];
|
return &Name[8];
|
||||||
}
|
}
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Common/IniFileClass.h>
|
#include <Common/IniFileClass.h>
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeRomDatabase :
|
class CSettingTypeRomDatabase :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
|
||||||
CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
|
||||||
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue, bool DeleteOnDefault = false );
|
||||||
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
||||||
|
|
||||||
virtual ~CSettingTypeRomDatabase();
|
virtual ~CSettingTypeRomDatabase();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
static void Initialize( void );
|
static void Initialize( void );
|
||||||
static void CleanUp ( void );
|
static void CleanUp ( void );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void GameChanged ( void * /*Data */ );
|
static void GameChanged ( void * /*Data */ );
|
||||||
static void BaseDirChanged ( void * /*Data */ );
|
static void BaseDirChanged ( void * /*Data */ );
|
||||||
|
|
||||||
static bool IsGlideSetting (const char * Name);
|
static bool IsGlideSetting (const char * Name);
|
||||||
static const char * StripNameSection (const char * Name);
|
static const char * StripNameSection (const char * Name);
|
||||||
virtual const char * Section ( void ) const { return m_SectionIdent->c_str(); }
|
virtual const char * Section ( void ) const { return m_SectionIdent->c_str(); }
|
||||||
|
|
||||||
mutable stdstr m_KeyName;
|
mutable stdstr m_KeyName;
|
||||||
const char *const m_DefaultStr;
|
const char *const m_DefaultStr;
|
||||||
const int32_t m_DefaultValue;
|
const int32_t m_DefaultValue;
|
||||||
const SettingID m_DefaultSetting;
|
const SettingID m_DefaultSetting;
|
||||||
const bool m_DeleteOnDefault;
|
const bool m_DeleteOnDefault;
|
||||||
bool m_GlideSetting;
|
bool m_GlideSetting;
|
||||||
|
|
||||||
static stdstr * m_SectionIdent;
|
static stdstr * m_SectionIdent;
|
||||||
static CIniFile * m_SettingsIniFile;
|
static CIniFile * m_SettingsIniFile;
|
||||||
static CIniFile * m_GlideIniFile;
|
static CIniFile * m_GlideIniFile;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRomDatabase(); // Disable default constructor
|
CSettingTypeRomDatabase(); // Disable default constructor
|
||||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,106 +1,106 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
#include "SettingsType-RomDatabaseIndex.h"
|
#include "SettingsType-RomDatabaseIndex.h"
|
||||||
|
|
||||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
||||||
CSettingTypeRomDatabase("",DefaultValue),
|
CSettingTypeRomDatabase("",DefaultValue),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue ) :
|
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue ) :
|
||||||
CSettingTypeRomDatabase("",DefaultValue),
|
CSettingTypeRomDatabase("",DefaultValue),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue ) :
|
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue ) :
|
||||||
CSettingTypeRomDatabase("",DefaultValue),
|
CSettingTypeRomDatabase("",DefaultValue),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
||||||
CSettingTypeRomDatabase("",DefaultSetting),
|
CSettingTypeRomDatabase("",DefaultSetting),
|
||||||
m_PreIndex(PreIndex),
|
m_PreIndex(PreIndex),
|
||||||
m_PostIndex(PostIndex)
|
m_PostIndex(PostIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex()
|
CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const
|
bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
return CSettingTypeRomDatabase::Load(0,Value);
|
return CSettingTypeRomDatabase::Load(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const
|
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const
|
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, uint32_t /*Value*/ )
|
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeRomDatabaseIndex::Delete ( int /*Index*/ )
|
void CSettingTypeRomDatabaseIndex::Delete ( int /*Index*/ )
|
||||||
{
|
{
|
||||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRomDatabaseIndex :
|
class CSettingTypeRomDatabaseIndex :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
|
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue );
|
||||||
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue );
|
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue );
|
||||||
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int32_t DefaultValue );
|
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int32_t DefaultValue );
|
||||||
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
|
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
|
||||||
|
|
||||||
virtual ~CSettingTypeRomDatabaseIndex();
|
virtual ~CSettingTypeRomDatabaseIndex();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRomDatabaseIndex(void); // Disable default constructor
|
CSettingTypeRomDatabaseIndex(void); // Disable default constructor
|
||||||
CSettingTypeRomDatabaseIndex(const CSettingTypeRomDatabaseIndex&); // Disable copy constructor
|
CSettingTypeRomDatabaseIndex(const CSettingTypeRomDatabaseIndex&); // Disable copy constructor
|
||||||
CSettingTypeRomDatabaseIndex& operator=(const CSettingTypeRomDatabaseIndex&); // Disable assignment
|
CSettingTypeRomDatabaseIndex& operator=(const CSettingTypeRomDatabaseIndex&); // Disable assignment
|
||||||
|
|
||||||
stdstr m_PreIndex, m_PostIndex;
|
stdstr m_PreIndex, m_PostIndex;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-RomDatabaseSetting.h"
|
#include "SettingsType-RomDatabaseSetting.h"
|
||||||
|
|
||||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
||||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||||
m_SectionIdent(SectionIdent)
|
m_SectionIdent(SectionIdent)
|
||||||
{
|
{
|
||||||
m_SectionIdent.Replace("\\","-");
|
m_SectionIdent.Replace("\\","-");
|
||||||
if (!m_GlideSetting)
|
if (!m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
||||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||||
m_SectionIdent(SectionIdent)
|
m_SectionIdent(SectionIdent)
|
||||||
{
|
{
|
||||||
m_SectionIdent.Replace("\\","-");
|
m_SectionIdent.Replace("\\","-");
|
||||||
if (!m_GlideSetting)
|
if (!m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
||||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||||
m_SectionIdent(SectionIdent)
|
m_SectionIdent(SectionIdent)
|
||||||
{
|
{
|
||||||
m_SectionIdent.Replace("\\","-");
|
m_SectionIdent.Replace("\\","-");
|
||||||
if (!m_GlideSetting)
|
if (!m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
||||||
CSettingTypeRomDatabase(Name, DefaultSetting, DeleteOnDefault),
|
CSettingTypeRomDatabase(Name, DefaultSetting, DeleteOnDefault),
|
||||||
m_SectionIdent(SectionIdent)
|
m_SectionIdent(SectionIdent)
|
||||||
{
|
{
|
||||||
m_SectionIdent.Replace("\\","-");
|
m_SectionIdent.Replace("\\","-");
|
||||||
if (!m_GlideSetting)
|
if (!m_GlideSetting)
|
||||||
{
|
{
|
||||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
|
CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "SettingsType-RomDatabase.h"
|
#include "SettingsType-RomDatabase.h"
|
||||||
|
|
||||||
class CSettingTypeRomDatabaseSetting :
|
class CSettingTypeRomDatabaseSetting :
|
||||||
public CSettingTypeRomDatabase
|
public CSettingTypeRomDatabase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault = false );
|
||||||
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault = false );
|
||||||
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault = false );
|
||||||
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
||||||
|
|
||||||
virtual ~CSettingTypeRomDatabaseSetting();
|
virtual ~CSettingTypeRomDatabaseSetting();
|
||||||
|
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RdbSetting; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_RdbSetting; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual const char * Section ( void ) const { return m_SectionIdent.c_str(); }
|
virtual const char * Section ( void ) const { return m_SectionIdent.c_str(); }
|
||||||
|
|
||||||
stdstr m_SectionIdent;
|
stdstr m_SectionIdent;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRomDatabaseSetting(void); // Disable default constructor
|
CSettingTypeRomDatabaseSetting(void); // Disable default constructor
|
||||||
CSettingTypeRomDatabaseSetting(const CSettingTypeRomDatabaseSetting&); // Disable copy constructor
|
CSettingTypeRomDatabaseSetting(const CSettingTypeRomDatabaseSetting&); // Disable copy constructor
|
||||||
CSettingTypeRomDatabaseSetting& operator=(const CSettingTypeRomDatabaseSetting&); // Disable assignment
|
CSettingTypeRomDatabaseSetting& operator=(const CSettingTypeRomDatabaseSetting&); // Disable assignment
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CSettingTypeRomDatabase :
|
class CSettingTypeRomDatabase :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue );
|
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue );
|
||||||
CSettingTypeRomDatabase(const char * Name, bool DefaultValue );
|
CSettingTypeRomDatabase(const char * Name, bool DefaultValue );
|
||||||
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue );
|
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue );
|
||||||
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting );
|
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting );
|
||||||
~CSettingTypeRomDatabase();
|
~CSettingTypeRomDatabase();
|
||||||
|
|
||||||
virtual SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RomDatabase; }
|
virtual SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RomDatabase; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
static void Initilize ( void );
|
static void Initilize ( void );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeRomDatabase(void); // Disable default constructor
|
CSettingTypeRomDatabase(void); // Disable default constructor
|
||||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||||
|
|
||||||
const const char * m_KeyName;
|
const const char * m_KeyName;
|
||||||
const const char * m_DefaultStr;
|
const const char * m_DefaultStr;
|
||||||
const int32_t m_DefaultValue;
|
const int32_t m_DefaultValue;
|
||||||
const SettingID m_DefaultSetting;
|
const SettingID m_DefaultSetting;
|
||||||
|
|
||||||
static CIniFile * m_SettingsIniFile;
|
static CIniFile * m_SettingsIniFile;
|
||||||
stdstr m_SectionIdent;
|
stdstr m_SectionIdent;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-SelectedDirectory.h"
|
#include "SettingsType-SelectedDirectory.h"
|
||||||
|
|
||||||
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
|
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
|
||||||
m_Name(Name),
|
m_Name(Name),
|
||||||
m_InitialDir(InitialDir),
|
m_InitialDir(InitialDir),
|
||||||
m_SelectedDir(SelectedDir),
|
m_SelectedDir(SelectedDir),
|
||||||
m_UseSelected(UseSelected)
|
m_UseSelected(UseSelected)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
|
CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const
|
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
|
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
|
||||||
return g_Settings->LoadStringVal(DirSettingId, Value);
|
return g_Settings->LoadStringVal(DirSettingId, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, uint32_t /*Value*/ )
|
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const char * Value )
|
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const char * Value )
|
||||||
{
|
{
|
||||||
g_Settings->SaveBool(m_UseSelected,true);
|
g_Settings->SaveBool(m_UseSelected,true);
|
||||||
g_Settings->SaveString(m_SelectedDir,Value);
|
g_Settings->SaveString(m_SelectedDir,Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeSelectedDirectory::Delete( int /*Index*/ )
|
void CSettingTypeSelectedDirectory::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeSelectedDirectory :
|
class CSettingTypeSelectedDirectory :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
|
CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
|
||||||
~CSettingTypeSelectedDirectory();
|
~CSettingTypeSelectedDirectory();
|
||||||
|
|
||||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||||
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
|
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
|
||||||
|
|
||||||
const char * GetName ( void ) const { return m_Name.c_str(); }
|
const char * GetName ( void ) const { return m_Name.c_str(); }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
virtual bool Load ( int32_t Index, bool & Value ) const;
|
virtual bool Load ( int32_t Index, bool & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
virtual bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
virtual void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
virtual void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
virtual void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
virtual void Save ( int32_t Index, bool Value );
|
virtual void Save ( int32_t Index, bool Value );
|
||||||
virtual void Save ( int32_t Index, uint32_t Value );
|
virtual void Save ( int32_t Index, uint32_t Value );
|
||||||
virtual void Save ( int32_t Index, const stdstr & Value );
|
virtual void Save ( int32_t Index, const stdstr & Value );
|
||||||
virtual void Save ( int32_t Index, const char * Value );
|
virtual void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
virtual void Delete ( int32_t Index );
|
virtual void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeSelectedDirectory(void); // Disable default constructor
|
CSettingTypeSelectedDirectory(void); // Disable default constructor
|
||||||
CSettingTypeSelectedDirectory(const CSettingTypeSelectedDirectory&); // Disable copy constructor
|
CSettingTypeSelectedDirectory(const CSettingTypeSelectedDirectory&); // Disable copy constructor
|
||||||
CSettingTypeSelectedDirectory& operator=(const CSettingTypeSelectedDirectory&); // Disable assignment
|
CSettingTypeSelectedDirectory& operator=(const CSettingTypeSelectedDirectory&); // Disable assignment
|
||||||
|
|
||||||
std::string m_Name;
|
std::string m_Name;
|
||||||
SettingID m_InitialDir;
|
SettingID m_InitialDir;
|
||||||
SettingID m_SelectedDir;
|
SettingID m_SelectedDir;
|
||||||
SettingID m_UseSelected;
|
SettingID m_UseSelected;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,80 +1,80 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-TempBool.h"
|
#include "SettingsType-TempBool.h"
|
||||||
|
|
||||||
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) :
|
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) :
|
||||||
m_value(initialValue)
|
m_value(initialValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeTempBool::~CSettingTypeTempBool ( void )
|
CSettingTypeTempBool::~CSettingTypeTempBool ( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempBool::Load ( int /*Index*/, bool & Value ) const
|
bool CSettingTypeTempBool::Load ( int /*Index*/, bool & Value ) const
|
||||||
{
|
{
|
||||||
Value = m_value;
|
Value = m_value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempBool::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeTempBool::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::Save ( int /*Index*/, bool Value )
|
void CSettingTypeTempBool::Save ( int /*Index*/, bool Value )
|
||||||
{
|
{
|
||||||
m_value = Value;
|
m_value = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::Save ( int /*Index*/, uint32_t /*Value*/ )
|
void CSettingTypeTempBool::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeTempBool::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeTempBool::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempBool::Delete( int /*Index*/ )
|
void CSettingTypeTempBool::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,50 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeTempBool :
|
class CSettingTypeTempBool :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeTempBool(bool initialValue );
|
CSettingTypeTempBool(bool initialValue );
|
||||||
~CSettingTypeTempBool();
|
~CSettingTypeTempBool();
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
|
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t Index, bool & Value ) const;
|
bool Load ( int32_t Index, bool & Value ) const;
|
||||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void Save ( int32_t Index, bool Value );
|
void Save ( int32_t Index, bool Value );
|
||||||
void Save ( int32_t Index, uint32_t Value );
|
void Save ( int32_t Index, uint32_t Value );
|
||||||
void Save ( int32_t Index, const stdstr & Value );
|
void Save ( int32_t Index, const stdstr & Value );
|
||||||
void Save ( int32_t Index, const char * Value );
|
void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
void Delete ( int32_t Index );
|
void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeTempBool(void); // Disable default constructor
|
CSettingTypeTempBool(void); // Disable default constructor
|
||||||
CSettingTypeTempBool(const CSettingTypeTempBool&); // Disable copy constructor
|
CSettingTypeTempBool(const CSettingTypeTempBool&); // Disable copy constructor
|
||||||
CSettingTypeTempBool& operator=(const CSettingTypeTempBool&); // Disable assignment
|
CSettingTypeTempBool& operator=(const CSettingTypeTempBool&); // Disable assignment
|
||||||
|
|
||||||
bool m_value;
|
bool m_value;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,80 +1,80 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-TempNumber.h"
|
#include "SettingsType-TempNumber.h"
|
||||||
|
|
||||||
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
|
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
|
||||||
m_value(initialValue)
|
m_value(initialValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeTempNumber::~CSettingTypeTempNumber ( void )
|
CSettingTypeTempNumber::~CSettingTypeTempNumber ( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, uint32_t & Value ) const
|
bool CSettingTypeTempNumber::Load ( int /*Index*/, uint32_t & Value ) const
|
||||||
{
|
{
|
||||||
Value = m_value;
|
Value = m_value;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeTempNumber::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::Save ( int /*Index*/, uint32_t Value )
|
void CSettingTypeTempNumber::Save ( int /*Index*/, uint32_t Value )
|
||||||
{
|
{
|
||||||
m_value = Value;
|
m_value = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
void CSettingTypeTempNumber::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::Save ( int /*Index*/, const char * /*Value*/ )
|
void CSettingTypeTempNumber::Save ( int /*Index*/, const char * /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempNumber::Delete( int /*Index*/ )
|
void CSettingTypeTempNumber::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,50 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeTempNumber :
|
class CSettingTypeTempNumber :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeTempNumber(uint32_t initialValue);
|
CSettingTypeTempNumber(uint32_t initialValue);
|
||||||
~CSettingTypeTempNumber();
|
~CSettingTypeTempNumber();
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
|
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t Index, bool & Value ) const;
|
bool Load ( int32_t Index, bool & Value ) const;
|
||||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void Save ( int32_t Index, bool Value );
|
void Save ( int32_t Index, bool Value );
|
||||||
void Save ( int32_t Index, uint32_t Value );
|
void Save ( int32_t Index, uint32_t Value );
|
||||||
void Save ( int32_t Index, const stdstr & Value );
|
void Save ( int32_t Index, const stdstr & Value );
|
||||||
void Save ( int32_t Index, const char * Value );
|
void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
void Delete ( int32_t Index );
|
void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeTempNumber(void); // Disable default constructor
|
CSettingTypeTempNumber(void); // Disable default constructor
|
||||||
CSettingTypeTempNumber(const CSettingTypeTempNumber&); // Disable copy constructor
|
CSettingTypeTempNumber(const CSettingTypeTempNumber&); // Disable copy constructor
|
||||||
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
|
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
|
||||||
|
|
||||||
uint32_t m_value;
|
uint32_t m_value;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,80 +1,80 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "SettingsType-TempString.h"
|
#include "SettingsType-TempString.h"
|
||||||
|
|
||||||
CSettingTypeTempString::CSettingTypeTempString(const char * initialValue) :
|
CSettingTypeTempString::CSettingTypeTempString(const char * initialValue) :
|
||||||
m_value(initialValue)
|
m_value(initialValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingTypeTempString::~CSettingTypeTempString ( void )
|
CSettingTypeTempString::~CSettingTypeTempString ( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const
|
bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempString::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
bool CSettingTypeTempString::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const
|
bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const
|
||||||
{
|
{
|
||||||
Value = m_value;
|
Value = m_value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
void CSettingTypeTempString::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
void CSettingTypeTempString::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
void CSettingTypeTempString::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::Save ( int /*Index*/, bool /*Value*/ )
|
void CSettingTypeTempString::Save ( int /*Index*/, bool /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::Save ( int /*Index*/, uint32_t /*Value*/ )
|
void CSettingTypeTempString::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::Save ( int /*Index*/, const stdstr & Value )
|
void CSettingTypeTempString::Save ( int /*Index*/, const stdstr & Value )
|
||||||
{
|
{
|
||||||
m_value = Value;
|
m_value = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::Save ( int /*Index*/, const char * Value )
|
void CSettingTypeTempString::Save ( int /*Index*/, const char * Value )
|
||||||
{
|
{
|
||||||
m_value = Value;
|
m_value = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingTypeTempString::Delete( int /*Index*/ )
|
void CSettingTypeTempString::Delete( int /*Index*/ )
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +1,50 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||||
|
|
||||||
class CSettingTypeTempString :
|
class CSettingTypeTempString :
|
||||||
public CSettingType
|
public CSettingType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CSettingTypeTempString(const char * initialValue);
|
CSettingTypeTempString(const char * initialValue);
|
||||||
~CSettingTypeTempString();
|
~CSettingTypeTempString();
|
||||||
|
|
||||||
bool IndexBasedSetting ( void ) const { return false; }
|
bool IndexBasedSetting ( void ) const { return false; }
|
||||||
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
|
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
|
||||||
|
|
||||||
//return the values
|
//return the values
|
||||||
bool Load ( int32_t Index, bool & Value ) const;
|
bool Load ( int32_t Index, bool & Value ) const;
|
||||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//return the default values
|
//return the default values
|
||||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||||
|
|
||||||
//Update the settings
|
//Update the settings
|
||||||
void Save ( int32_t Index, bool Value );
|
void Save ( int32_t Index, bool Value );
|
||||||
void Save ( int32_t Index, uint32_t Value );
|
void Save ( int32_t Index, uint32_t Value );
|
||||||
void Save ( int32_t Index, const stdstr & Value );
|
void Save ( int32_t Index, const stdstr & Value );
|
||||||
void Save ( int32_t Index, const char * Value );
|
void Save ( int32_t Index, const char * Value );
|
||||||
|
|
||||||
// Delete the setting
|
// Delete the setting
|
||||||
void Delete ( int32_t Index );
|
void Delete ( int32_t Index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSettingTypeTempString(void); // Disable default constructor
|
CSettingTypeTempString(void); // Disable default constructor
|
||||||
CSettingTypeTempString(const CSettingTypeTempString&); // Disable copy constructor
|
CSettingTypeTempString(const CSettingTypeTempString&); // Disable copy constructor
|
||||||
CSettingTypeTempString& operator=(const CSettingTypeTempString&); // Disable assignment
|
CSettingTypeTempString& operator=(const CSettingTypeTempString&); // Disable assignment
|
||||||
|
|
||||||
stdstr m_value;
|
stdstr m_value;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,318 +1,318 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MaxPluginSetting = 65535
|
MaxPluginSetting = 65535
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SettingID
|
enum SettingID
|
||||||
{
|
{
|
||||||
//Default values
|
//Default values
|
||||||
Default_None,
|
Default_None,
|
||||||
Default_Constant,
|
Default_Constant,
|
||||||
|
|
||||||
//information - temp keys
|
//information - temp keys
|
||||||
Info_ShortCutsChanged,
|
Info_ShortCutsChanged,
|
||||||
|
|
||||||
//Command Settings
|
//Command Settings
|
||||||
Cmd_BaseDirectory,
|
Cmd_BaseDirectory,
|
||||||
Cmd_RomFile,
|
Cmd_RomFile,
|
||||||
Cmd_ShowHelp,
|
Cmd_ShowHelp,
|
||||||
|
|
||||||
//Support Files
|
//Support Files
|
||||||
SupportFile_Settings,
|
SupportFile_Settings,
|
||||||
SupportFile_SettingsDefault,
|
SupportFile_SettingsDefault,
|
||||||
SupportFile_RomDatabase,
|
SupportFile_RomDatabase,
|
||||||
SupportFile_RomDatabaseDefault,
|
SupportFile_RomDatabaseDefault,
|
||||||
SupportFile_Glide64RDB,
|
SupportFile_Glide64RDB,
|
||||||
SupportFile_Glide64RDBDefault,
|
SupportFile_Glide64RDBDefault,
|
||||||
SupportFile_Cheats,
|
SupportFile_Cheats,
|
||||||
SupportFile_CheatsDefault,
|
SupportFile_CheatsDefault,
|
||||||
SupportFile_Notes,
|
SupportFile_Notes,
|
||||||
SupportFile_NotesDefault,
|
SupportFile_NotesDefault,
|
||||||
SupportFile_ExtInfo,
|
SupportFile_ExtInfo,
|
||||||
SupportFile_ExtInfoDefault,
|
SupportFile_ExtInfoDefault,
|
||||||
SupportFile_ShortCuts,
|
SupportFile_ShortCuts,
|
||||||
SupportFile_ShortCutsDefault,
|
SupportFile_ShortCutsDefault,
|
||||||
SupportFile_RomListCache,
|
SupportFile_RomListCache,
|
||||||
SupportFile_RomListCacheDefault,
|
SupportFile_RomListCacheDefault,
|
||||||
SupportFile_7zipCache,
|
SupportFile_7zipCache,
|
||||||
SupportFile_7zipCacheDefault,
|
SupportFile_7zipCacheDefault,
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
Setting_ApplicationName,
|
Setting_ApplicationName,
|
||||||
Setting_UseFromRegistry,
|
Setting_UseFromRegistry,
|
||||||
Setting_RdbEditor,
|
Setting_RdbEditor,
|
||||||
Setting_CN64TimeCritical,
|
Setting_CN64TimeCritical,
|
||||||
Setting_PluginPageFirst,
|
Setting_PluginPageFirst,
|
||||||
Setting_DisableScrSaver,
|
Setting_DisableScrSaver,
|
||||||
Setting_AutoSleep,
|
Setting_AutoSleep,
|
||||||
Setting_AutoStart,
|
Setting_AutoStart,
|
||||||
Setting_AutoFullscreen,
|
Setting_AutoFullscreen,
|
||||||
Setting_CheckEmuRunning,
|
Setting_CheckEmuRunning,
|
||||||
Setting_EraseGameDefaults,
|
Setting_EraseGameDefaults,
|
||||||
|
|
||||||
Setting_AutoZipInstantSave,
|
Setting_AutoZipInstantSave,
|
||||||
Setting_RememberCheats,
|
Setting_RememberCheats,
|
||||||
Setting_LanguageDir,
|
Setting_LanguageDir,
|
||||||
Setting_LanguageDirDefault,
|
Setting_LanguageDirDefault,
|
||||||
Setting_CurrentLanguage,
|
Setting_CurrentLanguage,
|
||||||
Setting_EnableDisk,
|
Setting_EnableDisk,
|
||||||
|
|
||||||
//RDB TLB Settings
|
//RDB TLB Settings
|
||||||
Rdb_GoodName,
|
Rdb_GoodName,
|
||||||
Rdb_SaveChip,
|
Rdb_SaveChip,
|
||||||
Rdb_CpuType,
|
Rdb_CpuType,
|
||||||
Rdb_RDRamSize,
|
Rdb_RDRamSize,
|
||||||
Rdb_CounterFactor,
|
Rdb_CounterFactor,
|
||||||
Rdb_UseTlb,
|
Rdb_UseTlb,
|
||||||
Rdb_DelayDP,
|
Rdb_DelayDP,
|
||||||
Rdb_DelaySi,
|
Rdb_DelaySi,
|
||||||
Rdb_32Bit,
|
Rdb_32Bit,
|
||||||
Rdb_FastSP,
|
Rdb_FastSP,
|
||||||
Rdb_Status,
|
Rdb_Status,
|
||||||
Rdb_NotesCore,
|
Rdb_NotesCore,
|
||||||
Rdb_NotesPlugin,
|
Rdb_NotesPlugin,
|
||||||
Rdb_FixedAudio,
|
Rdb_FixedAudio,
|
||||||
Rdb_SyncViaAudio,
|
Rdb_SyncViaAudio,
|
||||||
Rdb_RspAudioSignal,
|
Rdb_RspAudioSignal,
|
||||||
Rdb_TLB_VAddrStart,
|
Rdb_TLB_VAddrStart,
|
||||||
Rdb_TLB_VAddrLen,
|
Rdb_TLB_VAddrLen,
|
||||||
Rdb_TLB_PAddrStart,
|
Rdb_TLB_PAddrStart,
|
||||||
Rdb_UseHleGfx,
|
Rdb_UseHleGfx,
|
||||||
Rdb_UseHleAudio,
|
Rdb_UseHleAudio,
|
||||||
Rdb_LoadRomToMemory,
|
Rdb_LoadRomToMemory,
|
||||||
Rdb_ScreenHertz,
|
Rdb_ScreenHertz,
|
||||||
Rdb_FuncLookupMode,
|
Rdb_FuncLookupMode,
|
||||||
Rdb_RegCache,
|
Rdb_RegCache,
|
||||||
Rdb_BlockLinking,
|
Rdb_BlockLinking,
|
||||||
Rdb_SMM_StoreInstruc,
|
Rdb_SMM_StoreInstruc,
|
||||||
Rdb_SMM_Cache,
|
Rdb_SMM_Cache,
|
||||||
Rdb_SMM_PIDMA,
|
Rdb_SMM_PIDMA,
|
||||||
Rdb_SMM_TLB,
|
Rdb_SMM_TLB,
|
||||||
Rdb_SMM_Protect,
|
Rdb_SMM_Protect,
|
||||||
Rdb_SMM_ValidFunc,
|
Rdb_SMM_ValidFunc,
|
||||||
Rdb_GameCheatFix,
|
Rdb_GameCheatFix,
|
||||||
Rdb_GameCheatFixPlugin,
|
Rdb_GameCheatFixPlugin,
|
||||||
Rdb_ViRefreshRate,
|
Rdb_ViRefreshRate,
|
||||||
Rdb_AiCountPerBytes,
|
Rdb_AiCountPerBytes,
|
||||||
Rdb_AudioResetOnLoad,
|
Rdb_AudioResetOnLoad,
|
||||||
Rdb_AllowROMWrites,
|
Rdb_AllowROMWrites,
|
||||||
Rdb_CRC_Recalc,
|
Rdb_CRC_Recalc,
|
||||||
|
|
||||||
//Individual Game Settings
|
//Individual Game Settings
|
||||||
Game_IniKey,
|
Game_IniKey,
|
||||||
Game_File,
|
Game_File,
|
||||||
Game_GameName,
|
Game_GameName,
|
||||||
Game_GoodName,
|
Game_GoodName,
|
||||||
Game_TempLoaded,
|
Game_TempLoaded,
|
||||||
Game_SystemType,
|
Game_SystemType,
|
||||||
Game_EditPlugin_Gfx,
|
Game_EditPlugin_Gfx,
|
||||||
Game_EditPlugin_Audio,
|
Game_EditPlugin_Audio,
|
||||||
Game_EditPlugin_Contr,
|
Game_EditPlugin_Contr,
|
||||||
Game_EditPlugin_RSP,
|
Game_EditPlugin_RSP,
|
||||||
Game_Plugin_Gfx,
|
Game_Plugin_Gfx,
|
||||||
Game_Plugin_Audio,
|
Game_Plugin_Audio,
|
||||||
Game_Plugin_Controller,
|
Game_Plugin_Controller,
|
||||||
Game_Plugin_RSP,
|
Game_Plugin_RSP,
|
||||||
Game_SaveChip,
|
Game_SaveChip,
|
||||||
Game_CpuType,
|
Game_CpuType,
|
||||||
Game_LastSaveSlot,
|
Game_LastSaveSlot,
|
||||||
Game_FixedAudio,
|
Game_FixedAudio,
|
||||||
Game_SyncViaAudio,
|
Game_SyncViaAudio,
|
||||||
Game_32Bit,
|
Game_32Bit,
|
||||||
Game_SMM_Cache,
|
Game_SMM_Cache,
|
||||||
Game_SMM_Protect,
|
Game_SMM_Protect,
|
||||||
Game_SMM_ValidFunc,
|
Game_SMM_ValidFunc,
|
||||||
Game_SMM_PIDMA,
|
Game_SMM_PIDMA,
|
||||||
Game_SMM_TLB,
|
Game_SMM_TLB,
|
||||||
Game_SMM_StoreInstruc,
|
Game_SMM_StoreInstruc,
|
||||||
Game_CurrentSaveState,
|
Game_CurrentSaveState,
|
||||||
Game_RDRamSize,
|
Game_RDRamSize,
|
||||||
Game_CounterFactor,
|
Game_CounterFactor,
|
||||||
Game_UseTlb,
|
Game_UseTlb,
|
||||||
Game_DelayDP,
|
Game_DelayDP,
|
||||||
Game_DelaySI,
|
Game_DelaySI,
|
||||||
Game_FastSP,
|
Game_FastSP,
|
||||||
Game_FuncLookupMode,
|
Game_FuncLookupMode,
|
||||||
Game_RegCache,
|
Game_RegCache,
|
||||||
Game_BlockLinking,
|
Game_BlockLinking,
|
||||||
Game_ScreenHertz,
|
Game_ScreenHertz,
|
||||||
Game_RspAudioSignal,
|
Game_RspAudioSignal,
|
||||||
Game_UseHleGfx,
|
Game_UseHleGfx,
|
||||||
Game_UseHleAudio,
|
Game_UseHleAudio,
|
||||||
Game_LoadRomToMemory,
|
Game_LoadRomToMemory,
|
||||||
Game_ViRefreshRate,
|
Game_ViRefreshRate,
|
||||||
Game_AiCountPerBytes,
|
Game_AiCountPerBytes,
|
||||||
Game_AudioResetOnLoad,
|
Game_AudioResetOnLoad,
|
||||||
Game_AllowROMWrites,
|
Game_AllowROMWrites,
|
||||||
Game_CRC_Recalc,
|
Game_CRC_Recalc,
|
||||||
|
|
||||||
// General Game running info
|
// General Game running info
|
||||||
GameRunning_LoadingInProgress,
|
GameRunning_LoadingInProgress,
|
||||||
GameRunning_CPU_Running,
|
GameRunning_CPU_Running,
|
||||||
GameRunning_CPU_Paused,
|
GameRunning_CPU_Paused,
|
||||||
GameRunning_CPU_PausedType,
|
GameRunning_CPU_PausedType,
|
||||||
GameRunning_InstantSaveFile,
|
GameRunning_InstantSaveFile,
|
||||||
GameRunning_LimitFPS,
|
GameRunning_LimitFPS,
|
||||||
GameRunning_ScreenHertz,
|
GameRunning_ScreenHertz,
|
||||||
GameRunning_InReset,
|
GameRunning_InReset,
|
||||||
|
|
||||||
//User Interface
|
//User Interface
|
||||||
UserInterface_BasicMode,
|
UserInterface_BasicMode,
|
||||||
UserInterface_ShowCPUPer,
|
UserInterface_ShowCPUPer,
|
||||||
UserInterface_DisplayFrameRate,
|
UserInterface_DisplayFrameRate,
|
||||||
UserInterface_InFullScreen,
|
UserInterface_InFullScreen,
|
||||||
UserInterface_FrameDisplayType,
|
UserInterface_FrameDisplayType,
|
||||||
UserInterface_MainWindowTop,
|
UserInterface_MainWindowTop,
|
||||||
UserInterface_MainWindowLeft,
|
UserInterface_MainWindowLeft,
|
||||||
UserInterface_AlwaysOnTop,
|
UserInterface_AlwaysOnTop,
|
||||||
|
|
||||||
RomBrowser_Enabled,
|
RomBrowser_Enabled,
|
||||||
RomBrowser_ColoumnsChanged,
|
RomBrowser_ColoumnsChanged,
|
||||||
RomBrowser_Top,
|
RomBrowser_Top,
|
||||||
RomBrowser_Left,
|
RomBrowser_Left,
|
||||||
RomBrowser_Width,
|
RomBrowser_Width,
|
||||||
RomBrowser_Height,
|
RomBrowser_Height,
|
||||||
RomBrowser_PosIndex,
|
RomBrowser_PosIndex,
|
||||||
RomBrowser_WidthIndex,
|
RomBrowser_WidthIndex,
|
||||||
RomBrowser_SortFieldIndex,
|
RomBrowser_SortFieldIndex,
|
||||||
RomBrowser_SortAscendingIndex,
|
RomBrowser_SortAscendingIndex,
|
||||||
RomBrowser_Recursive,
|
RomBrowser_Recursive,
|
||||||
RomBrowser_Maximized,
|
RomBrowser_Maximized,
|
||||||
|
|
||||||
//Directory Info
|
//Directory Info
|
||||||
Directory_LastSave,
|
Directory_LastSave,
|
||||||
Directory_RecentGameDirCount,
|
Directory_RecentGameDirCount,
|
||||||
Directory_RecentGameDirIndex,
|
Directory_RecentGameDirIndex,
|
||||||
Directory_Game,
|
Directory_Game,
|
||||||
Directory_GameInitial,
|
Directory_GameInitial,
|
||||||
Directory_GameSelected,
|
Directory_GameSelected,
|
||||||
Directory_GameUseSelected,
|
Directory_GameUseSelected,
|
||||||
Directory_Plugin,
|
Directory_Plugin,
|
||||||
Directory_PluginInitial,
|
Directory_PluginInitial,
|
||||||
Directory_PluginSelected,
|
Directory_PluginSelected,
|
||||||
Directory_PluginUseSelected,
|
Directory_PluginUseSelected,
|
||||||
Directory_PluginSync,
|
Directory_PluginSync,
|
||||||
Directory_SnapShot,
|
Directory_SnapShot,
|
||||||
Directory_SnapShotInitial,
|
Directory_SnapShotInitial,
|
||||||
Directory_SnapShotSelected,
|
Directory_SnapShotSelected,
|
||||||
Directory_SnapShotUseSelected,
|
Directory_SnapShotUseSelected,
|
||||||
Directory_NativeSave,
|
Directory_NativeSave,
|
||||||
Directory_NativeSaveInitial,
|
Directory_NativeSaveInitial,
|
||||||
Directory_NativeSaveSelected,
|
Directory_NativeSaveSelected,
|
||||||
Directory_NativeSaveUseSelected,
|
Directory_NativeSaveUseSelected,
|
||||||
Directory_InstantSave,
|
Directory_InstantSave,
|
||||||
Directory_InstantSaveInitial,
|
Directory_InstantSaveInitial,
|
||||||
Directory_InstantSaveSelected,
|
Directory_InstantSaveSelected,
|
||||||
Directory_InstantSaveUseSelected,
|
Directory_InstantSaveUseSelected,
|
||||||
Directory_Texture,
|
Directory_Texture,
|
||||||
Directory_TextureInitial,
|
Directory_TextureInitial,
|
||||||
Directory_TextureSelected,
|
Directory_TextureSelected,
|
||||||
Directory_TextureUseSelected,
|
Directory_TextureUseSelected,
|
||||||
|
|
||||||
//File Info
|
//File Info
|
||||||
File_RecentGameFileCount,
|
File_RecentGameFileCount,
|
||||||
File_RecentGameFileIndex,
|
File_RecentGameFileIndex,
|
||||||
File_DiskIPLPath,
|
File_DiskIPLPath,
|
||||||
|
|
||||||
//Debugger
|
//Debugger
|
||||||
Debugger_Enabled,
|
Debugger_Enabled,
|
||||||
Debugger_ShowTLBMisses,
|
Debugger_ShowTLBMisses,
|
||||||
Debugger_ShowUnhandledMemory,
|
Debugger_ShowUnhandledMemory,
|
||||||
Debugger_ShowPifErrors,
|
Debugger_ShowPifErrors,
|
||||||
Debugger_ShowDivByZero,
|
Debugger_ShowDivByZero,
|
||||||
Debugger_GenerateLogFiles,
|
Debugger_GenerateLogFiles,
|
||||||
Debugger_ProfileCode,
|
Debugger_ProfileCode,
|
||||||
Debugger_DisableGameFixes,
|
Debugger_DisableGameFixes,
|
||||||
Debugger_AppLogLevel,
|
Debugger_AppLogLevel,
|
||||||
Debugger_AppLogFlush,
|
Debugger_AppLogFlush,
|
||||||
Debugger_ShowDListAListCount,
|
Debugger_ShowDListAListCount,
|
||||||
Debugger_ShowRecompMemSize,
|
Debugger_ShowRecompMemSize,
|
||||||
|
|
||||||
//Trace
|
//Trace
|
||||||
Debugger_TraceMD5,
|
Debugger_TraceMD5,
|
||||||
Debugger_TraceSettings,
|
Debugger_TraceSettings,
|
||||||
Debugger_TraceUnknown,
|
Debugger_TraceUnknown,
|
||||||
Debugger_TraceAppInit,
|
Debugger_TraceAppInit,
|
||||||
Debugger_TraceAppCleanup,
|
Debugger_TraceAppCleanup,
|
||||||
Debugger_TraceN64System,
|
Debugger_TraceN64System,
|
||||||
Debugger_TracePlugins,
|
Debugger_TracePlugins,
|
||||||
Debugger_TraceGFXPlugin,
|
Debugger_TraceGFXPlugin,
|
||||||
Debugger_TraceAudioPlugin,
|
Debugger_TraceAudioPlugin,
|
||||||
Debugger_TraceControllerPlugin,
|
Debugger_TraceControllerPlugin,
|
||||||
Debugger_TraceRSPPlugin,
|
Debugger_TraceRSPPlugin,
|
||||||
Debugger_TraceRSP,
|
Debugger_TraceRSP,
|
||||||
Debugger_TraceAudio,
|
Debugger_TraceAudio,
|
||||||
Debugger_TraceRegisterCache,
|
Debugger_TraceRegisterCache,
|
||||||
Debugger_TraceRecompiler,
|
Debugger_TraceRecompiler,
|
||||||
Debugger_TraceTLB,
|
Debugger_TraceTLB,
|
||||||
Debugger_TraceProtectedMEM,
|
Debugger_TraceProtectedMEM,
|
||||||
Debugger_TraceUserInterface,
|
Debugger_TraceUserInterface,
|
||||||
|
|
||||||
//Plugins
|
//Plugins
|
||||||
Plugin_RSP_Current,
|
Plugin_RSP_Current,
|
||||||
Plugin_RSP_CurVer,
|
Plugin_RSP_CurVer,
|
||||||
Plugin_GFX_Current,
|
Plugin_GFX_Current,
|
||||||
Plugin_GFX_CurVer,
|
Plugin_GFX_CurVer,
|
||||||
Plugin_AUDIO_Current,
|
Plugin_AUDIO_Current,
|
||||||
Plugin_AUDIO_CurVer,
|
Plugin_AUDIO_CurVer,
|
||||||
Plugin_CONT_Current,
|
Plugin_CONT_Current,
|
||||||
Plugin_CONT_CurVer,
|
Plugin_CONT_CurVer,
|
||||||
Plugin_UseHleGfx,
|
Plugin_UseHleGfx,
|
||||||
Plugin_UseHleAudio,
|
Plugin_UseHleAudio,
|
||||||
|
|
||||||
Logging_GenerateLog,
|
Logging_GenerateLog,
|
||||||
Logging_LogRDRamRegisters,
|
Logging_LogRDRamRegisters,
|
||||||
Logging_LogSPRegisters,
|
Logging_LogSPRegisters,
|
||||||
Logging_LogDPCRegisters,
|
Logging_LogDPCRegisters,
|
||||||
Logging_LogDPSRegisters,
|
Logging_LogDPSRegisters,
|
||||||
Logging_LogMIPSInterface,
|
Logging_LogMIPSInterface,
|
||||||
Logging_LogVideoInterface,
|
Logging_LogVideoInterface,
|
||||||
Logging_LogAudioInterface,
|
Logging_LogAudioInterface,
|
||||||
Logging_LogPerInterface,
|
Logging_LogPerInterface,
|
||||||
Logging_LogRDRAMInterface,
|
Logging_LogRDRAMInterface,
|
||||||
Logging_LogSerialInterface,
|
Logging_LogSerialInterface,
|
||||||
Logging_LogPRDMAOperations,
|
Logging_LogPRDMAOperations,
|
||||||
Logging_LogPRDirectMemLoads,
|
Logging_LogPRDirectMemLoads,
|
||||||
Logging_LogPRDMAMemLoads,
|
Logging_LogPRDMAMemLoads,
|
||||||
Logging_LogPRDirectMemStores,
|
Logging_LogPRDirectMemStores,
|
||||||
Logging_LogPRDMAMemStores,
|
Logging_LogPRDMAMemStores,
|
||||||
Logging_LogControllerPak,
|
Logging_LogControllerPak,
|
||||||
Logging_LogCP0changes,
|
Logging_LogCP0changes,
|
||||||
Logging_LogCP0reads,
|
Logging_LogCP0reads,
|
||||||
Logging_LogTLB,
|
Logging_LogTLB,
|
||||||
Logging_LogExceptions,
|
Logging_LogExceptions,
|
||||||
Logging_NoInterrupts,
|
Logging_NoInterrupts,
|
||||||
Logging_LogCache,
|
Logging_LogCache,
|
||||||
Logging_LogRomHeader,
|
Logging_LogRomHeader,
|
||||||
Logging_LogUnknown,
|
Logging_LogUnknown,
|
||||||
|
|
||||||
//Cheats
|
//Cheats
|
||||||
Cheat_Entry,
|
Cheat_Entry,
|
||||||
Cheat_Active,
|
Cheat_Active,
|
||||||
Cheat_Extension,
|
Cheat_Extension,
|
||||||
Cheat_Notes,
|
Cheat_Notes,
|
||||||
Cheat_Options,
|
Cheat_Options,
|
||||||
Cheat_Range,
|
Cheat_Range,
|
||||||
Cheat_RangeNotes,
|
Cheat_RangeNotes,
|
||||||
|
|
||||||
FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting,
|
FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting,
|
||||||
FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting,
|
FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting,
|
||||||
FirstGfxDefaultSet, LastGfxDefaultSet = FirstGfxDefaultSet + MaxPluginSetting,
|
FirstGfxDefaultSet, LastGfxDefaultSet = FirstGfxDefaultSet + MaxPluginSetting,
|
||||||
FirstGfxSettings, LastGfxSettings = FirstGfxSettings + MaxPluginSetting,
|
FirstGfxSettings, LastGfxSettings = FirstGfxSettings + MaxPluginSetting,
|
||||||
FirstAudioDefaultSet, LastAudioDefaultSet = FirstAudioDefaultSet + MaxPluginSetting,
|
FirstAudioDefaultSet, LastAudioDefaultSet = FirstAudioDefaultSet + MaxPluginSetting,
|
||||||
FirstAudioSettings, LastAudioSettings = FirstAudioSettings + MaxPluginSetting,
|
FirstAudioSettings, LastAudioSettings = FirstAudioSettings + MaxPluginSetting,
|
||||||
FirstCtrlDefaultSet, LastCtrlDefaultSet = FirstCtrlDefaultSet + MaxPluginSetting,
|
FirstCtrlDefaultSet, LastCtrlDefaultSet = FirstCtrlDefaultSet + MaxPluginSetting,
|
||||||
FirstCtrlSettings, LastCtrlSettings = FirstCtrlSettings + MaxPluginSetting,
|
FirstCtrlSettings, LastCtrlSettings = FirstCtrlSettings + MaxPluginSetting,
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +1,29 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Support.h"
|
#include "Support.h"
|
||||||
#include <string> //needed for stl string (std::string)
|
#include <string> //needed for stl string (std::string)
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
#include <Project64-core/N64System/N64Types.h>
|
#include <Project64-core/N64System/N64Types.h>
|
||||||
|
|
||||||
#include <Project64-core/N64System/ProfilingClass.h>
|
#include <Project64-core/N64System/ProfilingClass.h>
|
||||||
|
|
||||||
//General Mips Information
|
//General Mips Information
|
||||||
#include <Project64-core/N64System/N64RomClass.h>
|
#include <Project64-core/N64System/N64RomClass.h>
|
||||||
#include <Project64-core/N64System/SpeedLimiterClass.h>
|
#include <Project64-core/N64System/SpeedLimiterClass.h>
|
||||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||||
#include <Project64-core/N64System/N64Class.h>
|
#include <Project64-core/N64System/N64Class.h>
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
|
|
|
@ -1,76 +1,76 @@
|
||||||
template <class T>
|
template <class T>
|
||||||
class CDebugDialog :
|
class CDebugDialog :
|
||||||
public CDialogImpl < T >
|
public CDialogImpl < T >
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CDebuggerUI * m_Debugger;
|
CDebuggerUI * m_Debugger;
|
||||||
HANDLE m_CreatedEvent;
|
HANDLE m_CreatedEvent;
|
||||||
HANDLE m_DialogThread;
|
HANDLE m_DialogThread;
|
||||||
|
|
||||||
static DWORD CreateDebuggerWindow(CDebugDialog<T> * pThis)
|
static DWORD CreateDebuggerWindow(CDebugDialog<T> * pThis)
|
||||||
{
|
{
|
||||||
pThis->DoModal(NULL);
|
pThis->DoModal(NULL);
|
||||||
pThis->WindowCreated();
|
pThis->WindowCreated();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowCreated(void)
|
void WindowCreated(void)
|
||||||
{
|
{
|
||||||
SetEvent(m_CreatedEvent);
|
SetEvent(m_CreatedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDebugDialog(CDebuggerUI * debugger) :
|
CDebugDialog(CDebuggerUI * debugger) :
|
||||||
m_Debugger(debugger),
|
m_Debugger(debugger),
|
||||||
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
|
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
|
||||||
m_DialogThread(NULL)
|
m_DialogThread(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~CDebugDialog(void)
|
virtual ~CDebugDialog(void)
|
||||||
{
|
{
|
||||||
HideWindow();
|
HideWindow();
|
||||||
CloseHandle(m_CreatedEvent);
|
CloseHandle(m_CreatedEvent);
|
||||||
if (m_DialogThread)
|
if (m_DialogThread)
|
||||||
{
|
{
|
||||||
CloseHandle(m_DialogThread);
|
CloseHandle(m_DialogThread);
|
||||||
m_DialogThread = NULL;
|
m_DialogThread = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HideWindow(void)
|
void HideWindow(void)
|
||||||
{
|
{
|
||||||
if (m_hWnd && ::IsWindow(m_hWnd))
|
if (m_hWnd && ::IsWindow(m_hWnd))
|
||||||
{
|
{
|
||||||
::EndDialog(m_hWnd, 0);
|
::EndDialog(m_hWnd, 0);
|
||||||
}
|
}
|
||||||
if (m_DialogThread)
|
if (m_DialogThread)
|
||||||
{
|
{
|
||||||
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
|
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceUserInterface, TraceError, "CDebugDialog - time out on close");
|
WriteTrace(TraceUserInterface, TraceError, "CDebugDialog - time out on close");
|
||||||
|
|
||||||
TerminateThread(m_DialogThread, 1);
|
TerminateThread(m_DialogThread, 1);
|
||||||
}
|
}
|
||||||
CloseHandle(m_DialogThread);
|
CloseHandle(m_DialogThread);
|
||||||
m_DialogThread = NULL;
|
m_DialogThread = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowWindow(void)
|
void ShowWindow(void)
|
||||||
{
|
{
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
{
|
{
|
||||||
SetForegroundWindow((HWND)m_hWnd);
|
SetForegroundWindow((HWND)m_hWnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD ThreadID;
|
DWORD ThreadID;
|
||||||
ResetEvent(m_CreatedEvent);
|
ResetEvent(m_CreatedEvent);
|
||||||
m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID);
|
m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID);
|
||||||
if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT)
|
if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification");
|
WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,157 +1,157 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "DebuggerUI.h"
|
#include "DebuggerUI.h"
|
||||||
|
|
||||||
CDumpMemory::CDumpMemory(CDebuggerUI * debugger) :
|
CDumpMemory::CDumpMemory(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDumpMemory>(debugger)
|
CDebugDialog<CDumpMemory>(debugger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CDumpMemory::~CDumpMemory()
|
CDumpMemory::~CDumpMemory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
m_StartAddress.Attach(GetDlgItem(IDC_E_START_ADDR));
|
m_StartAddress.Attach(GetDlgItem(IDC_E_START_ADDR));
|
||||||
m_EndAddress.Attach(GetDlgItem(IDC_E_END_ADDR));
|
m_EndAddress.Attach(GetDlgItem(IDC_E_END_ADDR));
|
||||||
m_PC.Attach(GetDlgItem(IDC_E_ALT_PC));
|
m_PC.Attach(GetDlgItem(IDC_E_ALT_PC));
|
||||||
|
|
||||||
m_StartAddress.SetDisplayType(CEditNumber::DisplayHex);
|
m_StartAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
m_EndAddress.SetDisplayType(CEditNumber::DisplayHex);
|
m_EndAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
m_PC.SetDisplayType(CEditNumber::DisplayHex);
|
m_PC.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
|
|
||||||
m_StartAddress.SetValue(0x80000000, true, true);
|
m_StartAddress.SetValue(0x80000000, true, true);
|
||||||
m_EndAddress.SetValue(0x803FFFF0, true, true);
|
m_EndAddress.SetValue(0x803FFFF0, true, true);
|
||||||
m_PC.SetValue(0x80000000);
|
m_PC.SetValue(0x80000000);
|
||||||
HWND hFormatList = GetDlgItem(IDC_FORMAT);
|
HWND hFormatList = GetDlgItem(IDC_FORMAT);
|
||||||
int pos = ::SendMessage(hFormatList, CB_ADDSTRING, (WPARAM)0, (LPARAM)"TEXT - Disassembly + PC");
|
int pos = ::SendMessage(hFormatList, CB_ADDSTRING, (WPARAM)0, (LPARAM)"TEXT - Disassembly + PC");
|
||||||
::SendMessage(hFormatList, CB_SETITEMDATA, (WPARAM)pos, (LPARAM)DisassemblyWithPC);
|
::SendMessage(hFormatList, CB_SETITEMDATA, (WPARAM)pos, (LPARAM)DisassemblyWithPC);
|
||||||
::SendMessage(hFormatList, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
::SendMessage(hFormatList, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||||
|
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch (wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
case IDC_BTN_CHOOSE_FILE:
|
case IDC_BTN_CHOOSE_FILE:
|
||||||
{
|
{
|
||||||
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||||
OPENFILENAME openfilename;
|
OPENFILENAME openfilename;
|
||||||
|
|
||||||
memset(&FileName, 0, sizeof(FileName));
|
memset(&FileName, 0, sizeof(FileName));
|
||||||
memset(&openfilename, 0, sizeof(openfilename));
|
memset(&openfilename, 0, sizeof(openfilename));
|
||||||
strcpy(Directory, CPath(CPath::MODULE_DIRECTORY));
|
strcpy(Directory, CPath(CPath::MODULE_DIRECTORY));
|
||||||
openfilename.lStructSize = sizeof(openfilename);
|
openfilename.lStructSize = sizeof(openfilename);
|
||||||
openfilename.hwndOwner = m_hWnd;
|
openfilename.hwndOwner = m_hWnd;
|
||||||
openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
||||||
openfilename.lpstrFile = FileName;
|
openfilename.lpstrFile = FileName;
|
||||||
openfilename.lpstrInitialDir = Directory;
|
openfilename.lpstrInitialDir = Directory;
|
||||||
openfilename.nMaxFile = MAX_PATH;
|
openfilename.nMaxFile = MAX_PATH;
|
||||||
openfilename.Flags = OFN_HIDEREADONLY;
|
openfilename.Flags = OFN_HIDEREADONLY;
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||||
if (GetOpenFileName(&openfilename))
|
if (GetOpenFileName(&openfilename))
|
||||||
{
|
{
|
||||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||||
_splitpath(FileName, drive, dir, fname, ext);
|
_splitpath(FileName, drive, dir, fname, ext);
|
||||||
if (strlen(ext) == 0)
|
if (strlen(ext) == 0)
|
||||||
{
|
{
|
||||||
strcat(FileName, ".txt");
|
strcat(FileName, ".txt");
|
||||||
}
|
}
|
||||||
SetDlgItemText(IDC_FILENAME, FileName);
|
SetDlgItemText(IDC_FILENAME, FileName);
|
||||||
}
|
}
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDOK:
|
case IDOK:
|
||||||
{
|
{
|
||||||
TCHAR FileName[MAX_PATH];
|
TCHAR FileName[MAX_PATH];
|
||||||
int CurrentFormatSel = SendDlgItemMessage(IDC_FORMAT, CB_GETCURSEL, 0, 0);
|
int CurrentFormatSel = SendDlgItemMessage(IDC_FORMAT, CB_GETCURSEL, 0, 0);
|
||||||
DumpFormat Format = (DumpFormat)SendDlgItemMessage(IDC_FORMAT, CB_GETITEMDATA, CurrentFormatSel, 0);
|
DumpFormat Format = (DumpFormat)SendDlgItemMessage(IDC_FORMAT, CB_GETITEMDATA, CurrentFormatSel, 0);
|
||||||
DWORD StartPC = m_StartAddress.GetValue();
|
DWORD StartPC = m_StartAddress.GetValue();
|
||||||
DWORD EndPC = m_EndAddress.GetValue();
|
DWORD EndPC = m_EndAddress.GetValue();
|
||||||
DWORD DumpPC = m_PC.GetValue();
|
DWORD DumpPC = m_PC.GetValue();
|
||||||
GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName));
|
GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName));
|
||||||
if (strlen(FileName) == 0)
|
if (strlen(FileName) == 0)
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError("Please Choose target file");
|
g_Notify->DisplayError("Please Choose target file");
|
||||||
::SetFocus(GetDlgItem(IDC_FILENAME));
|
::SetFocus(GetDlgItem(IDC_FILENAME));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (SendDlgItemMessage(IDC_USE_ALT_PC, BM_GETSTATE, 0, 0) != BST_CHECKED)
|
if (SendDlgItemMessage(IDC_USE_ALT_PC, BM_GETSTATE, 0, 0) != BST_CHECKED)
|
||||||
{
|
{
|
||||||
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
||||||
}
|
}
|
||||||
//disable buttons
|
//disable buttons
|
||||||
::EnableWindow(GetDlgItem(IDC_E_START_ADDR), FALSE);
|
::EnableWindow(GetDlgItem(IDC_E_START_ADDR), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_E_END_ADDR), FALSE);
|
::EnableWindow(GetDlgItem(IDC_E_END_ADDR), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_E_ALT_PC), FALSE);
|
::EnableWindow(GetDlgItem(IDC_E_ALT_PC), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_USE_ALT_PC), FALSE);
|
::EnableWindow(GetDlgItem(IDC_USE_ALT_PC), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_FILENAME), FALSE);
|
::EnableWindow(GetDlgItem(IDC_FILENAME), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_BTN_CHOOSE_FILE), FALSE);
|
::EnableWindow(GetDlgItem(IDC_BTN_CHOOSE_FILE), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDC_FORMAT), FALSE);
|
::EnableWindow(GetDlgItem(IDC_FORMAT), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDOK), FALSE);
|
::EnableWindow(GetDlgItem(IDOK), FALSE);
|
||||||
::EnableWindow(GetDlgItem(IDCANCEL), FALSE);
|
::EnableWindow(GetDlgItem(IDCANCEL), FALSE);
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||||
if (!DumpMemory(FileName, Format, StartPC, EndPC, DumpPC))
|
if (!DumpMemory(FileName, Format, StartPC, EndPC, DumpPC))
|
||||||
{
|
{
|
||||||
//enable buttons
|
//enable buttons
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||||
}
|
}
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
||||||
{
|
{
|
||||||
switch (Format)
|
switch (Format)
|
||||||
{
|
{
|
||||||
case DisassemblyWithPC:
|
case DisassemblyWithPC:
|
||||||
{
|
{
|
||||||
CLog LogFile;
|
CLog LogFile;
|
||||||
if (!LogFile.Open(FileName))
|
if (!LogFile.Open(FileName))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).c_str());
|
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LogFile.SetFlush(false);
|
LogFile.SetFlush(false);
|
||||||
LogFile.SetTruncateFile(false);
|
LogFile.SetTruncateFile(false);
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
#ifdef legacycode
|
#ifdef legacycode
|
||||||
char Command[200];
|
char Command[200];
|
||||||
for (COpcode OpCode(StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
for (COpcode OpCode(StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
||||||
{
|
{
|
||||||
const char * szOpName = OpCode.OpcodeName();
|
const char * szOpName = OpCode.OpcodeName();
|
||||||
OpCode.OpcodeParam(Command);
|
OpCode.OpcodeParam(Command);
|
||||||
LogFile.LogF("%X: %-15s%s\r\n",OpCode.PC(),szOpName,Command);
|
LogFile.LogF("%X: %-15s%s\r\n",OpCode.PC(),szOpName,Command);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_StartAddress.SetValue(StartPC, true, true);
|
m_StartAddress.SetValue(StartPC, true, true);
|
||||||
m_EndAddress.SetValue(EndPC, true, true);
|
m_EndAddress.SetValue(EndPC, true, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
|
@ -1,43 +1,43 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDumpMemory :
|
class CDumpMemory :
|
||||||
public CDebugDialog < CDumpMemory >
|
public CDebugDialog < CDumpMemory >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Cheats_DumpMemory };
|
enum { IDD = IDD_Cheats_DumpMemory };
|
||||||
|
|
||||||
CDumpMemory(CDebuggerUI * debugger);
|
CDumpMemory(CDebuggerUI * debugger);
|
||||||
virtual ~CDumpMemory(void);
|
virtual ~CDumpMemory(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CDumpMemory(void); // Disable default constructor
|
CDumpMemory(void); // Disable default constructor
|
||||||
CDumpMemory(const CDumpMemory&); // Disable copy constructor
|
CDumpMemory(const CDumpMemory&); // Disable copy constructor
|
||||||
CDumpMemory& operator=(const CDumpMemory&); // Disable assignment
|
CDumpMemory& operator=(const CDumpMemory&); // Disable assignment
|
||||||
|
|
||||||
enum DumpFormat
|
enum DumpFormat
|
||||||
{
|
{
|
||||||
DisassemblyWithPC
|
DisassemblyWithPC
|
||||||
};
|
};
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(CDumpMemory)
|
BEGIN_MSG_MAP_EX(CDumpMemory)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
|
|
||||||
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
|
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
|
||||||
|
|
||||||
CEditNumber m_StartAddress, m_EndAddress, m_PC;
|
CEditNumber m_StartAddress, m_EndAddress, m_PC;
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,86 +1,86 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDebugMemorySearch :
|
class CDebugMemorySearch :
|
||||||
public CDebugDialog < CDebugMemorySearch >
|
public CDebugDialog < CDebugMemorySearch >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Debugger_Search };
|
enum { IDD = IDD_Debugger_Search };
|
||||||
|
|
||||||
CDebugMemorySearch(CDebuggerUI * debugger);
|
CDebugMemorySearch(CDebuggerUI * debugger);
|
||||||
virtual ~CDebugMemorySearch(void);
|
virtual ~CDebugMemorySearch(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CDebugMemorySearch(void); // Disable default constructor
|
CDebugMemorySearch(void); // Disable default constructor
|
||||||
CDebugMemorySearch(const CDebugMemorySearch&); // Disable copy constructor
|
CDebugMemorySearch(const CDebugMemorySearch&); // Disable copy constructor
|
||||||
CDebugMemorySearch& operator=(const CDebugMemorySearch&); // Disable assignment
|
CDebugMemorySearch& operator=(const CDebugMemorySearch&); // Disable assignment
|
||||||
|
|
||||||
enum MemorySize
|
enum MemorySize
|
||||||
{
|
{
|
||||||
_8Bit,
|
_8Bit,
|
||||||
_16Bit,
|
_16Bit,
|
||||||
_32Bit,
|
_32Bit,
|
||||||
};
|
};
|
||||||
|
|
||||||
//Searching for value
|
//Searching for value
|
||||||
enum SearchMemChangeState
|
enum SearchMemChangeState
|
||||||
{
|
{
|
||||||
SearchChangeState_Reset,
|
SearchChangeState_Reset,
|
||||||
SearchChangeState_Changed,
|
SearchChangeState_Changed,
|
||||||
SearchChangeState_Unchanged,
|
SearchChangeState_Unchanged,
|
||||||
SearchChangeState_Greater,
|
SearchChangeState_Greater,
|
||||||
SearchChangeState_Lessthan,
|
SearchChangeState_Lessthan,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SearchResultItem
|
struct SearchResultItem
|
||||||
{
|
{
|
||||||
DWORD PAddr;
|
DWORD PAddr;
|
||||||
DWORD Value;
|
DWORD Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<SearchResultItem> SearchResult;
|
typedef std::vector<SearchResultItem> SearchResult;
|
||||||
|
|
||||||
BEGIN_MSG_MAP_EX(CDebugMemorySearch)
|
BEGIN_MSG_MAP_EX(CDebugMemorySearch)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
|
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
LRESULT OnResultRClick(LPNMHDR lpnmh);
|
LRESULT OnResultRClick(LPNMHDR lpnmh);
|
||||||
|
|
||||||
void EnableUnknownOptions(bool Enable);
|
void EnableUnknownOptions(bool Enable);
|
||||||
void EnableValueOptions(bool Enable);
|
void EnableValueOptions(bool Enable);
|
||||||
void EnableTextOptions(bool Enable);
|
void EnableTextOptions(bool Enable);
|
||||||
void EnableJalOptions(bool Enable);
|
void EnableJalOptions(bool Enable);
|
||||||
void AddAlignmentOptions(CComboBox & ctrl);
|
void AddAlignmentOptions(CComboBox & ctrl);
|
||||||
|
|
||||||
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
|
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
|
||||||
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
|
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
|
||||||
CListViewCtrl m_SearchResults;
|
CListViewCtrl m_SearchResults;
|
||||||
SearchResult m_SearchResult;
|
SearchResult m_SearchResult;
|
||||||
bool m_HaveResults;
|
bool m_HaveResults;
|
||||||
|
|
||||||
//Searching memory
|
//Searching memory
|
||||||
BYTE * m_MemoryState;
|
BYTE * m_MemoryState;
|
||||||
DWORD m_MemoryStateSize;
|
DWORD m_MemoryStateSize;
|
||||||
|
|
||||||
void FixUnknownOptions(bool Reset);
|
void FixUnknownOptions(bool Reset);
|
||||||
void SearchForUnknown(void);
|
void SearchForUnknown(void);
|
||||||
void SearchForValue(void);
|
void SearchForValue(void);
|
||||||
void SearchForText(void);
|
void SearchForText(void);
|
||||||
void Reset(void);
|
void Reset(void);
|
||||||
bool SearchSetBaseForChanges(void);
|
bool SearchSetBaseForChanges(void);
|
||||||
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
|
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
|
||||||
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
|
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,288 +1,288 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "DebuggerUI.h"
|
#include "DebuggerUI.h"
|
||||||
|
|
||||||
CDebugTlb::CDebugTlb(CDebuggerUI * debugger) :
|
CDebugTlb::CDebugTlb(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDebugTlb>(debugger)
|
CDebugDialog<CDebugTlb>(debugger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebugTlb::~CDebugTlb()
|
CDebugTlb::~CDebugTlb()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
LV_COLUMN col;
|
LV_COLUMN col;
|
||||||
|
|
||||||
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
||||||
col.fmt = LVCFMT_LEFT;
|
col.fmt = LVCFMT_LEFT;
|
||||||
|
|
||||||
col.pszText = "Index";
|
col.pszText = "Index";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 0;
|
col.iSubItem = 0;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
|
||||||
|
|
||||||
col.pszText = "Page Mask";
|
col.pszText = "Page Mask";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 1;
|
col.iSubItem = 1;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
|
||||||
|
|
||||||
col.pszText = "Entry Hi";
|
col.pszText = "Entry Hi";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 2;
|
col.iSubItem = 2;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
|
||||||
|
|
||||||
col.pszText = "Entry Lo0";
|
col.pszText = "Entry Lo0";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 3;
|
col.iSubItem = 3;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
|
||||||
|
|
||||||
col.pszText = "Entry Lo1";
|
col.pszText = "Entry Lo1";
|
||||||
col.cx = 90;
|
col.cx = 90;
|
||||||
col.iSubItem = 4;
|
col.iSubItem = 4;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
|
||||||
|
|
||||||
col.pszText = "Index";
|
col.pszText = "Index";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 0;
|
col.iSubItem = 0;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
|
||||||
|
|
||||||
col.pszText = "Valid";
|
col.pszText = "Valid";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 1;
|
col.iSubItem = 1;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
|
||||||
|
|
||||||
col.pszText = "Dirty";
|
col.pszText = "Dirty";
|
||||||
col.cx = 40;
|
col.cx = 40;
|
||||||
col.iSubItem = 2;
|
col.iSubItem = 2;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
|
||||||
|
|
||||||
col.pszText = "Rule";
|
col.pszText = "Rule";
|
||||||
col.cx = 270;
|
col.cx = 270;
|
||||||
col.iSubItem = 3;
|
col.iSubItem = 3;
|
||||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);
|
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);
|
||||||
|
|
||||||
RefreshTLBWindow();
|
RefreshTLBWindow();
|
||||||
SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0);
|
SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
// if (Settings().Load(TLBWindowLeft) <= 0)
|
// if (Settings().Load(TLBWindowLeft) <= 0)
|
||||||
// {
|
// {
|
||||||
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
|
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||||
// }
|
// }
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch (wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
case IDC_TLB_ENTRIES:
|
case IDC_TLB_ENTRIES:
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST), SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_LIST), SW_SHOW);
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST2), SW_HIDE);
|
::ShowWindow(GetDlgItem(IDC_LIST2), SW_HIDE);
|
||||||
break;
|
break;
|
||||||
case IDC_TLB_RULES:
|
case IDC_TLB_RULES:
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST), SW_HIDE);
|
::ShowWindow(GetDlgItem(IDC_LIST), SW_HIDE);
|
||||||
::ShowWindow(GetDlgItem(IDC_LIST2), SW_SHOW);
|
::ShowWindow(GetDlgItem(IDC_LIST2), SW_SHOW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugTlb::RefreshTLBWindow(void)
|
void CDebugTlb::RefreshTLBWindow(void)
|
||||||
{
|
{
|
||||||
if (m_hWnd == NULL)
|
if (m_hWnd == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND hList = GetDlgItem(IDC_LIST);
|
HWND hList = GetDlgItem(IDC_LIST);
|
||||||
char Output[100], OldText[100];
|
char Output[100], OldText[100];
|
||||||
LV_ITEM item, OldItem;
|
LV_ITEM item, OldItem;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
|
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
|
||||||
for (count = 0; count < 32; count++)
|
for (count = 0; count < 32; count++)
|
||||||
{
|
{
|
||||||
sprintf(Output, "0x%02X", count);
|
sprintf(Output, "0x%02X", count);
|
||||||
item.mask = LVIF_TEXT;
|
item.mask = LVIF_TEXT;
|
||||||
item.iItem = count;
|
item.iItem = count;
|
||||||
item.pszText = Output;
|
item.pszText = Output;
|
||||||
item.iSubItem = 0;
|
item.iSubItem = 0;
|
||||||
|
|
||||||
OldItem.mask = LVIF_TEXT;
|
OldItem.mask = LVIF_TEXT;
|
||||||
OldItem.iItem = count;
|
OldItem.iItem = count;
|
||||||
OldItem.pszText = OldText;
|
OldItem.pszText = OldText;
|
||||||
OldItem.cchTextMax = sizeof(OldText) - 1;
|
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||||
OldItem.iSubItem = 0;
|
OldItem.iSubItem = 0;
|
||||||
|
|
||||||
if (ListView_GetItemCount(hList) <= count)
|
if (ListView_GetItemCount(hList) <= count)
|
||||||
{
|
{
|
||||||
ListView_InsertItem(hList, &item);
|
ListView_InsertItem(hList, &item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output, "0x%08X", tlb[count].PageMask.Value);
|
sprintf(Output, "0x%08X", tlb[count].PageMask.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 1;
|
item.iSubItem = 1;
|
||||||
OldItem.iSubItem = 1;
|
OldItem.iSubItem = 1;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output, "0x%08X", tlb[count].EntryHi.Value);
|
sprintf(Output, "0x%08X", tlb[count].EntryHi.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 2;
|
item.iSubItem = 2;
|
||||||
OldItem.iSubItem = 2;
|
OldItem.iSubItem = 2;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output, "0x%08X", tlb[count].EntryLo0.Value);
|
sprintf(Output, "0x%08X", tlb[count].EntryLo0.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 3;
|
item.iSubItem = 3;
|
||||||
OldItem.iSubItem = 3;
|
OldItem.iSubItem = 3;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlb[count].EntryDefined)
|
if (tlb[count].EntryDefined)
|
||||||
{
|
{
|
||||||
sprintf(Output, "0x%08X", tlb[count].EntryLo1.Value);
|
sprintf(Output, "0x%08X", tlb[count].EntryLo1.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 4;
|
item.iSubItem = 4;
|
||||||
OldItem.iSubItem = 4;
|
OldItem.iSubItem = 4;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
|
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
|
||||||
hList = GetDlgItem(IDC_LIST2);
|
hList = GetDlgItem(IDC_LIST2);
|
||||||
for (count = 0; count < 64; count++)
|
for (count = 0; count < 64; count++)
|
||||||
{
|
{
|
||||||
sprintf(Output, "0x%02X", count);
|
sprintf(Output, "0x%02X", count);
|
||||||
item.mask = LVIF_TEXT;
|
item.mask = LVIF_TEXT;
|
||||||
item.iItem = count;
|
item.iItem = count;
|
||||||
item.pszText = Output;
|
item.pszText = Output;
|
||||||
item.iSubItem = 0;
|
item.iSubItem = 0;
|
||||||
|
|
||||||
OldItem.mask = LVIF_TEXT;
|
OldItem.mask = LVIF_TEXT;
|
||||||
OldItem.iItem = count;
|
OldItem.iItem = count;
|
||||||
OldItem.pszText = OldText;
|
OldItem.pszText = OldText;
|
||||||
OldItem.cchTextMax = sizeof(OldText) - 1;
|
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||||
OldItem.iSubItem = 0;
|
OldItem.iSubItem = 0;
|
||||||
|
|
||||||
if (ListView_GetItemCount(hList) <= count)
|
if (ListView_GetItemCount(hList) <= count)
|
||||||
{
|
{
|
||||||
item.iItem = ListView_InsertItem(hList, &item);
|
item.iItem = ListView_InsertItem(hList, &item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FastTlb[count].ValidEntry)
|
if (FastTlb[count].ValidEntry)
|
||||||
{
|
{
|
||||||
sprintf(Output, "%s", FastTlb[count].VALID ? "Yes" : "No");
|
sprintf(Output, "%s", FastTlb[count].VALID ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 1;
|
item.iSubItem = 1;
|
||||||
OldItem.iSubItem = 1;
|
OldItem.iSubItem = 1;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||||
{
|
{
|
||||||
sprintf(Output, "%s", FastTlb[count].DIRTY ? "Yes" : "No");
|
sprintf(Output, "%s", FastTlb[count].DIRTY ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 2;
|
item.iSubItem = 2;
|
||||||
OldItem.iSubItem = 2;
|
OldItem.iSubItem = 2;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||||
{
|
{
|
||||||
sprintf(Output, "%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND,
|
sprintf(Output, "%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND,
|
||||||
FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND);
|
FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(Output, "................");
|
strcpy(Output, "................");
|
||||||
}
|
}
|
||||||
item.iSubItem = 3;
|
item.iSubItem = 3;
|
||||||
OldItem.iSubItem = 3;
|
OldItem.iSubItem = 3;
|
||||||
ListView_GetItem(hList, &OldItem);
|
ListView_GetItem(hList, &OldItem);
|
||||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||||
{
|
{
|
||||||
ListView_SetItem(hList, &item);
|
ListView_SetItem(hList, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDebugTlb :
|
class CDebugTlb :
|
||||||
public CDebugDialog < CDebugTlb >
|
public CDebugDialog < CDebugTlb >
|
||||||
{
|
{
|
||||||
BEGIN_MSG_MAP_EX(CDebugTlb)
|
BEGIN_MSG_MAP_EX(CDebugTlb)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Debugger_TLB };
|
enum { IDD = IDD_Debugger_TLB };
|
||||||
|
|
||||||
CDebugTlb(CDebuggerUI * debugger);
|
CDebugTlb(CDebuggerUI * debugger);
|
||||||
virtual ~CDebugTlb(void);
|
virtual ~CDebugTlb(void);
|
||||||
|
|
||||||
void RefreshTLBWindow(void);
|
void RefreshTLBWindow(void);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,472 +1,472 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "DebuggerUI.h"
|
#include "DebuggerUI.h"
|
||||||
|
|
||||||
CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
|
CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
|
||||||
CDebugDialog<CDebugMemoryView>(debugger),
|
CDebugDialog<CDebugMemoryView>(debugger),
|
||||||
m_MemoryList(NULL)
|
m_MemoryList(NULL)
|
||||||
{
|
{
|
||||||
if (m_MemoryList == NULL)
|
if (m_MemoryList == NULL)
|
||||||
{
|
{
|
||||||
m_MemoryList = new CListCtrl;
|
m_MemoryList = new CListCtrl;
|
||||||
m_MemoryList->RegisterClass();
|
m_MemoryList->RegisterClass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebugMemoryView::~CDebugMemoryView()
|
CDebugMemoryView::~CDebugMemoryView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
m_DataStartLoc = (DWORD)-1;
|
m_DataStartLoc = (DWORD)-1;
|
||||||
m_CompareStartLoc = (DWORD)-1;
|
m_CompareStartLoc = (DWORD)-1;
|
||||||
memset(m_CompareData, 0, sizeof(m_CompareData));
|
memset(m_CompareData, 0, sizeof(m_CompareData));
|
||||||
memset(m_CompareValid, 0, sizeof(m_CompareValid));
|
memset(m_CompareValid, 0, sizeof(m_CompareValid));
|
||||||
|
|
||||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||||
if (hScrlBar)
|
if (hScrlBar)
|
||||||
{
|
{
|
||||||
SCROLLINFO si;
|
SCROLLINFO si;
|
||||||
|
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
||||||
si.nMin = 0;
|
si.nMin = 0;
|
||||||
si.nMax = 0xFFFF;
|
si.nMax = 0xFFFF;
|
||||||
si.nPos = 0x8000;
|
si.nPos = 0x8000;
|
||||||
si.nPage = 100;
|
si.nPage = 100;
|
||||||
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MemAddr.Attach(GetDlgItem(IDC_ADDR_EDIT));
|
m_MemAddr.Attach(GetDlgItem(IDC_ADDR_EDIT));
|
||||||
m_MemAddr.SetDisplayType(CEditNumber::DisplayHex);
|
m_MemAddr.SetDisplayType(CEditNumber::DisplayHex);
|
||||||
m_MemAddr.SetValue(0x80000000, true, true);
|
m_MemAddr.SetValue(0x80000000, true, true);
|
||||||
|
|
||||||
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, BST_CHECKED, 0);
|
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
|
||||||
if (m_MemoryList == NULL)
|
if (m_MemoryList == NULL)
|
||||||
{
|
{
|
||||||
m_MemoryList = new CListCtrl;
|
m_MemoryList = new CListCtrl;
|
||||||
m_MemoryList->RegisterClass();
|
m_MemoryList->RegisterClass();
|
||||||
}
|
}
|
||||||
m_MemoryList->SubclassWindow(GetDlgItem(IDC_MEM_DETAILS));
|
m_MemoryList->SubclassWindow(GetDlgItem(IDC_MEM_DETAILS));
|
||||||
m_MemoryList->ShowHeader(false);
|
m_MemoryList->ShowHeader(false);
|
||||||
m_MemoryList->SetSortEnabled(FALSE);
|
m_MemoryList->SetSortEnabled(FALSE);
|
||||||
m_MemoryList->AddColumn(_T("Address"), 90);
|
m_MemoryList->AddColumn(_T("Address"), 90);
|
||||||
m_MemoryList->AddColumn(_T("1"), 20);
|
m_MemoryList->AddColumn(_T("1"), 20);
|
||||||
m_MemoryList->AddColumn(_T("2"), 20);
|
m_MemoryList->AddColumn(_T("2"), 20);
|
||||||
m_MemoryList->AddColumn(_T("3"), 20);
|
m_MemoryList->AddColumn(_T("3"), 20);
|
||||||
m_MemoryList->AddColumn(_T("4"), 20);
|
m_MemoryList->AddColumn(_T("4"), 20);
|
||||||
m_MemoryList->AddColumn(_T("-"), 10);
|
m_MemoryList->AddColumn(_T("-"), 10);
|
||||||
m_MemoryList->AddColumn(_T("5"), 20);
|
m_MemoryList->AddColumn(_T("5"), 20);
|
||||||
m_MemoryList->AddColumn(_T("6"), 20);
|
m_MemoryList->AddColumn(_T("6"), 20);
|
||||||
m_MemoryList->AddColumn(_T("7"), 20);
|
m_MemoryList->AddColumn(_T("7"), 20);
|
||||||
m_MemoryList->AddColumn(_T("8"), 20);
|
m_MemoryList->AddColumn(_T("8"), 20);
|
||||||
m_MemoryList->AddColumn(_T("-"), 10);
|
m_MemoryList->AddColumn(_T("-"), 10);
|
||||||
m_MemoryList->AddColumn(_T("9"), 20);
|
m_MemoryList->AddColumn(_T("9"), 20);
|
||||||
m_MemoryList->AddColumn(_T("10"), 20);
|
m_MemoryList->AddColumn(_T("10"), 20);
|
||||||
m_MemoryList->AddColumn(_T("11"), 20);
|
m_MemoryList->AddColumn(_T("11"), 20);
|
||||||
m_MemoryList->AddColumn(_T("12"), 20);
|
m_MemoryList->AddColumn(_T("12"), 20);
|
||||||
m_MemoryList->AddColumn(_T("-"), 10);
|
m_MemoryList->AddColumn(_T("-"), 10);
|
||||||
m_MemoryList->AddColumn(_T("13"), 20);
|
m_MemoryList->AddColumn(_T("13"), 20);
|
||||||
m_MemoryList->AddColumn(_T("14"), 20);
|
m_MemoryList->AddColumn(_T("14"), 20);
|
||||||
m_MemoryList->AddColumn(_T("15"), 20);
|
m_MemoryList->AddColumn(_T("15"), 20);
|
||||||
m_MemoryList->AddColumn(_T("16"), 35);
|
m_MemoryList->AddColumn(_T("16"), 35);
|
||||||
m_MemoryList->AddColumn(_T("Memory Ascii"), 140);
|
m_MemoryList->AddColumn(_T("Memory Ascii"), 140);
|
||||||
::SetWindowLongPtr(m_MemoryList->m_hWnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
|
::SetWindowLongPtr(m_MemoryList->m_hWnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
|
||||||
RefreshMemory(false);
|
RefreshMemory(false);
|
||||||
int height = m_MemoryList->GetTotalHeight();
|
int height = m_MemoryList->GetTotalHeight();
|
||||||
|
|
||||||
RECT MemoryListRect = { 0 };
|
RECT MemoryListRect = { 0 };
|
||||||
::GetClientRect(GetDlgItem(IDC_MEM_DETAILS), &MemoryListRect);
|
::GetClientRect(GetDlgItem(IDC_MEM_DETAILS), &MemoryListRect);
|
||||||
|
|
||||||
if (height > MemoryListRect.bottom)
|
if (height > MemoryListRect.bottom)
|
||||||
{
|
{
|
||||||
RECT MemoryListWindow = { 0 };
|
RECT MemoryListWindow = { 0 };
|
||||||
GetWindowRect(&MemoryListWindow);
|
GetWindowRect(&MemoryListWindow);
|
||||||
SetWindowPos(NULL, 0, 0, MemoryListWindow.right - MemoryListWindow.left, (MemoryListWindow.bottom - MemoryListWindow.top) + (height - MemoryListRect.bottom), SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(NULL, 0, 0, MemoryListWindow.right - MemoryListWindow.left, (MemoryListWindow.bottom - MemoryListWindow.top) + (height - MemoryListRect.bottom), SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
RECT DlgItemRect = { 0 };
|
RECT DlgItemRect = { 0 };
|
||||||
::GetWindowRect(GetDlgItem(IDC_BORDER), &DlgItemRect);
|
::GetWindowRect(GetDlgItem(IDC_BORDER), &DlgItemRect);
|
||||||
::SetWindowPos(GetDlgItem(IDC_BORDER), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
::SetWindowPos(GetDlgItem(IDC_BORDER), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
||||||
|
|
||||||
::GetWindowRect(GetDlgItem(IDC_MEM_DETAILS), &DlgItemRect);
|
::GetWindowRect(GetDlgItem(IDC_MEM_DETAILS), &DlgItemRect);
|
||||||
::SetWindowPos(GetDlgItem(IDC_MEM_DETAILS), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
::SetWindowPos(GetDlgItem(IDC_MEM_DETAILS), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
||||||
|
|
||||||
::GetWindowRect(GetDlgItem(IDC_SCRL_BAR), &DlgItemRect);
|
::GetWindowRect(GetDlgItem(IDC_SCRL_BAR), &DlgItemRect);
|
||||||
::SetWindowPos(GetDlgItem(IDC_SCRL_BAR), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
::SetWindowPos(GetDlgItem(IDC_SCRL_BAR), NULL, 0, 0, DlgItemRect.right - DlgItemRect.left, (DlgItemRect.bottom - DlgItemRect.top) + (height - MemoryListRect.bottom), SWP_NOMOVE);
|
||||||
}
|
}
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnDestroy(void)
|
LRESULT CDebugMemoryView::OnDestroy(void)
|
||||||
{
|
{
|
||||||
if (m_MemoryList)
|
if (m_MemoryList)
|
||||||
{
|
{
|
||||||
m_MemoryList->UnsubclassWindow();
|
m_MemoryList->UnsubclassWindow();
|
||||||
delete m_MemoryList;
|
delete m_MemoryList;
|
||||||
m_MemoryList = NULL;
|
m_MemoryList = NULL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
switch (wID)
|
switch (wID)
|
||||||
{
|
{
|
||||||
case IDC_REFRSH_MEM:
|
case IDC_REFRSH_MEM:
|
||||||
RefreshMemory(true);
|
RefreshMemory(true);
|
||||||
break;
|
break;
|
||||||
case IDC_CHK_VADDR:
|
case IDC_CHK_VADDR:
|
||||||
RefreshMemory(false);
|
RefreshMemory(false);
|
||||||
break;
|
break;
|
||||||
case IDC_DUMP_MEM:
|
case IDC_DUMP_MEM:
|
||||||
m_Debugger->Debug_ShowMemoryDump();
|
m_Debugger->Debug_ShowMemoryDump();
|
||||||
break;
|
break;
|
||||||
case IDC_SEARCH_MEM:
|
case IDC_SEARCH_MEM:
|
||||||
m_Debugger->Debug_ShowMemorySearch();
|
m_Debugger->Debug_ShowMemorySearch();
|
||||||
break;
|
break;
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
||||||
{
|
{
|
||||||
CListNotify *pListNotify = reinterpret_cast<CListNotify *>(lpNMHDR);
|
CListNotify *pListNotify = reinterpret_cast<CListNotify *>(lpNMHDR);
|
||||||
int LineNumber = pListNotify->m_nItem;
|
int LineNumber = pListNotify->m_nItem;
|
||||||
int Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 1));
|
int Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 1));
|
||||||
if (pListNotify->m_nSubItem >= 6 && pListNotify->m_nSubItem < 10)
|
if (pListNotify->m_nSubItem >= 6 && pListNotify->m_nSubItem < 10)
|
||||||
{
|
{
|
||||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 2));
|
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 2));
|
||||||
}
|
}
|
||||||
if (pListNotify->m_nSubItem >= 11 && pListNotify->m_nSubItem < 15)
|
if (pListNotify->m_nSubItem >= 11 && pListNotify->m_nSubItem < 15)
|
||||||
{
|
{
|
||||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 3));
|
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 3));
|
||||||
}
|
}
|
||||||
if (pListNotify->m_nSubItem >= 16 && pListNotify->m_nSubItem < 20)
|
if (pListNotify->m_nSubItem >= 16 && pListNotify->m_nSubItem < 20)
|
||||||
{
|
{
|
||||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 4));
|
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem, pListNotify->m_nSubItem);
|
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem, pListNotify->m_nSubItem);
|
||||||
int Finish = strlen(strValue);
|
int Finish = strlen(strValue);
|
||||||
if (Finish > 8)
|
if (Finish > 8)
|
||||||
{
|
{
|
||||||
Finish = 8;
|
Finish = 8;
|
||||||
}
|
}
|
||||||
DWORD Value = 0;
|
DWORD Value = 0;
|
||||||
for (int i = 0; i < Finish; i++)
|
for (int i = 0; i < Finish; i++)
|
||||||
{
|
{
|
||||||
Value = (Value << 4);
|
Value = (Value << 4);
|
||||||
if (strValue[i] <= '9' && strValue[i] >= '0')
|
if (strValue[i] <= '9' && strValue[i] >= '0')
|
||||||
{
|
{
|
||||||
Value |= strValue[i] - '0';
|
Value |= strValue[i] - '0';
|
||||||
}
|
}
|
||||||
else if (strValue[i] <= 'f' && strValue[i] >= 'a')
|
else if (strValue[i] <= 'f' && strValue[i] >= 'a')
|
||||||
{
|
{
|
||||||
Value |= strValue[i] - 'a' + 10;
|
Value |= strValue[i] - 'a' + 10;
|
||||||
}
|
}
|
||||||
else if (strValue[i] <= 'F' && strValue[i] >= 'A')
|
else if (strValue[i] <= 'F' && strValue[i] >= 'A')
|
||||||
{
|
{
|
||||||
Value |= strValue[i] - 'A' + 10;
|
Value |= strValue[i] - 'A' + 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_CurrentData[Pos] == Value)
|
if (m_CurrentData[Pos] == Value)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_CompareStartLoc != m_DataStartLoc ||
|
if (m_CompareStartLoc != m_DataStartLoc ||
|
||||||
m_CompareVAddrr != m_DataVAddrr)
|
m_CompareVAddrr != m_DataVAddrr)
|
||||||
{
|
{
|
||||||
// copy current data for change comparison
|
// copy current data for change comparison
|
||||||
m_CompareStartLoc = m_DataStartLoc;
|
m_CompareStartLoc = m_DataStartLoc;
|
||||||
m_CompareVAddrr = m_DataVAddrr;
|
m_CompareVAddrr = m_DataVAddrr;
|
||||||
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||||
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CompareData[Pos] = m_CurrentData[Pos];
|
m_CompareData[Pos] = m_CurrentData[Pos];
|
||||||
m_CurrentData[Pos] = (BYTE)Value;
|
m_CurrentData[Pos] = (BYTE)Value;
|
||||||
|
|
||||||
//sb
|
//sb
|
||||||
if (m_DataVAddrr)
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Insert_MemoryLineDump(LineNumber);
|
Insert_MemoryLineDump(LineNumber);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::ShowAddress(DWORD Address, bool VAddr)
|
void CDebugMemoryView::ShowAddress(DWORD Address, bool VAddr)
|
||||||
{
|
{
|
||||||
if (m_hWnd == NULL)
|
if (m_hWnd == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, VAddr ? BST_CHECKED : BST_UNCHECKED, 0);
|
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, VAddr ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||||
m_MemAddr.SetValue(Address, true, true);
|
m_MemAddr.SetValue(Address, true, true);
|
||||||
RefreshMemory(true);
|
RefreshMemory(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::Insert_MemoryLineDump(int LineNumber)
|
void CDebugMemoryView::Insert_MemoryLineDump(int LineNumber)
|
||||||
{
|
{
|
||||||
if (m_MemoryList == NULL || m_MemoryList->GetColumnCount() == 0)
|
if (m_MemoryList == NULL || m_MemoryList->GetColumnCount() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char Output[20], Hex[60], Ascii[20], AsciiAddOn[15];
|
char Output[20], Hex[60], Ascii[20], AsciiAddOn[15];
|
||||||
sprintf(Output, "0x%08X", m_DataStartLoc + (LineNumber << 4));
|
sprintf(Output, "0x%08X", m_DataStartLoc + (LineNumber << 4));
|
||||||
if (m_MemoryList->GetItemCount() <= LineNumber)
|
if (m_MemoryList->GetItemCount() <= LineNumber)
|
||||||
{
|
{
|
||||||
HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
||||||
m_MemoryList->AddItemAt(LineNumber, Output);
|
m_MemoryList->AddItemAt(LineNumber, Output);
|
||||||
for (int i = 0; i < m_MemoryList->GetColumnCount(); i++)
|
for (int i = 0; i < m_MemoryList->GetColumnCount(); i++)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemFont(LineNumber, i, hFont);
|
m_MemoryList->SetItemFont(LineNumber, i, hFont);
|
||||||
if (i == 5 || i == 10 || i == 15)
|
if (i == 5 || i == 10 || i == 15)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber, i, "-");
|
m_MemoryList->SetItemText(LineNumber, i, "-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (strcmp(Output, m_MemoryList->GetItemText(LineNumber, 0)) != 0)
|
if (strcmp(Output, m_MemoryList->GetItemText(LineNumber, 0)) != 0)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber, 0, Output);
|
m_MemoryList->SetItemText(LineNumber, 0, Output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Hex[0] = 0;
|
Hex[0] = 0;
|
||||||
Ascii[0] = 0;
|
Ascii[0] = 0;
|
||||||
int CompareStartPos = m_DataStartLoc - m_CompareStartLoc;
|
int CompareStartPos = m_DataStartLoc - m_CompareStartLoc;
|
||||||
|
|
||||||
for (int i = 0, col = 1; i < 0x10; i++, col++)
|
for (int i = 0, col = 1; i < 0x10; i++, col++)
|
||||||
{
|
{
|
||||||
int Pos = ((LineNumber << 4) + i);
|
int Pos = ((LineNumber << 4) + i);
|
||||||
if (m_DataValid[Pos])
|
if (m_DataValid[Pos])
|
||||||
{
|
{
|
||||||
int ComparePos = CompareStartPos + Pos;
|
int ComparePos = CompareStartPos + Pos;
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
|
|
||||||
if (ComparePos >= 0 && ComparePos < MemoryToDisplay &&
|
if (ComparePos >= 0 && ComparePos < MemoryToDisplay &&
|
||||||
m_DataVAddrr == m_CompareVAddrr &&
|
m_DataVAddrr == m_CompareVAddrr &&
|
||||||
m_DataValid[ComparePos] &&
|
m_DataValid[ComparePos] &&
|
||||||
m_CurrentData[Pos] != m_CompareData[ComparePos])
|
m_CurrentData[Pos] != m_CompareData[ComparePos])
|
||||||
{
|
{
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
sprintf(Hex, "%02X", m_CurrentData[Pos]);
|
sprintf(Hex, "%02X", m_CurrentData[Pos]);
|
||||||
m_MemoryList->SetItemText(LineNumber, col, Hex);
|
m_MemoryList->SetItemText(LineNumber, col, Hex);
|
||||||
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_EDIT, ITEM_FLAGS_EDIT_HEX);
|
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_EDIT, ITEM_FLAGS_EDIT_HEX);
|
||||||
m_MemoryList->SetItemMaxEditLen(LineNumber, col, 2);
|
m_MemoryList->SetItemMaxEditLen(LineNumber, col, 2);
|
||||||
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW),
|
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW),
|
||||||
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_WINDOWTEXT));
|
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_WINDOWTEXT));
|
||||||
m_MemoryList->SetItemHighlightColours(LineNumber, col,
|
m_MemoryList->SetItemHighlightColours(LineNumber, col,
|
||||||
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_HIGHLIGHTTEXT));
|
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||||
if (m_CurrentData[Pos] < 30)
|
if (m_CurrentData[Pos] < 30)
|
||||||
{
|
{
|
||||||
strcat(Ascii, ".");
|
strcat(Ascii, ".");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(AsciiAddOn, "%c", m_CurrentData[Pos]);
|
sprintf(AsciiAddOn, "%c", m_CurrentData[Pos]);
|
||||||
strcat(Ascii, AsciiAddOn);
|
strcat(Ascii, AsciiAddOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber, col, "**");
|
m_MemoryList->SetItemText(LineNumber, col, "**");
|
||||||
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE);
|
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE);
|
||||||
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOWTEXT));
|
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOWTEXT));
|
||||||
strcat(Ascii, "*");
|
strcat(Ascii, "*");
|
||||||
}
|
}
|
||||||
if (i != 0xF)
|
if (i != 0xF)
|
||||||
{
|
{
|
||||||
if ((i & 3) == 3)
|
if ((i & 3) == 3)
|
||||||
{
|
{
|
||||||
col += 1;
|
col += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(Ascii, m_MemoryList->GetItemText(LineNumber, 20)) != 0)
|
if (strcmp(Ascii, m_MemoryList->GetItemText(LineNumber, 20)) != 0)
|
||||||
{
|
{
|
||||||
m_MemoryList->SetItemText(LineNumber, 20, Ascii);
|
m_MemoryList->SetItemText(LineNumber, 20, Ascii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::OnAddrChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
void CDebugMemoryView::OnAddrChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
{
|
{
|
||||||
RefreshMemory(false);
|
RefreshMemory(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl)
|
void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl)
|
||||||
{
|
{
|
||||||
if (ctrl != GetDlgItem(IDC_SCRL_BAR))
|
if (ctrl != GetDlgItem(IDC_SCRL_BAR))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DWORD Location = m_MemAddr.GetValue();
|
DWORD Location = m_MemAddr.GetValue();
|
||||||
switch (request)
|
switch (request)
|
||||||
{
|
{
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
m_MemAddr.SetValue(Location < 0xFFFFFFEF ? Location + 0x10 : 0xFFFFFFFF, true, true);
|
m_MemAddr.SetValue(Location < 0xFFFFFFEF ? Location + 0x10 : 0xFFFFFFFF, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
m_MemAddr.SetValue(Location > 0x10 ? Location - 0x10 : 0, true, true);
|
m_MemAddr.SetValue(Location > 0x10 ? Location - 0x10 : 0, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
m_MemAddr.SetValue(Location < 0xFFFFFEFF ? Location + 0x100 : 0xFFFFFFFF, true, true);
|
m_MemAddr.SetValue(Location < 0xFFFFFEFF ? Location + 0x100 : 0xFFFFFFFF, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
m_MemAddr.SetValue(Location > 0x100 ? Location - 0x100 : 0, true, true);
|
m_MemAddr.SetValue(Location > 0x100 ? Location - 0x100 : 0, true, true);
|
||||||
break;
|
break;
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
m_MemAddr.SetValue((DWORD)Pos << 0x10, true, true);
|
m_MemAddr.SetValue((DWORD)Pos << 0x10, true, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::RefreshMemory(bool ResetCompare)
|
void CDebugMemoryView::RefreshMemory(bool ResetCompare)
|
||||||
{
|
{
|
||||||
if (m_MemoryList && m_MemoryList->GetHasEditItem())
|
if (m_MemoryList && m_MemoryList->GetHasEditItem())
|
||||||
{
|
{
|
||||||
m_MemoryList->SetFocus();
|
m_MemoryList->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD NewAddress = m_MemAddr.GetValue();
|
DWORD NewAddress = m_MemAddr.GetValue();
|
||||||
if (NewAddress != m_DataStartLoc)
|
if (NewAddress != m_DataStartLoc)
|
||||||
{
|
{
|
||||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||||
if (hScrlBar)
|
if (hScrlBar)
|
||||||
{
|
{
|
||||||
SCROLLINFO si;
|
SCROLLINFO si;
|
||||||
|
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
si.fMask = SIF_POS;
|
si.fMask = SIF_POS;
|
||||||
si.nPos = NewAddress >> 0x10;
|
si.nPos = NewAddress >> 0x10;
|
||||||
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ResetCompare)
|
if (ResetCompare)
|
||||||
{
|
{
|
||||||
// copy current data for change comparison
|
// copy current data for change comparison
|
||||||
m_CompareStartLoc = m_DataStartLoc;
|
m_CompareStartLoc = m_DataStartLoc;
|
||||||
m_CompareVAddrr = m_DataVAddrr;
|
m_CompareVAddrr = m_DataVAddrr;
|
||||||
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||||
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DataStartLoc = m_MemAddr.GetValue();
|
m_DataStartLoc = m_MemAddr.GetValue();
|
||||||
if (m_DataStartLoc > 0xFFFFFF00) { m_DataStartLoc = 0xFFFFFF00; }
|
if (m_DataStartLoc > 0xFFFFFF00) { m_DataStartLoc = 0xFFFFFF00; }
|
||||||
int WritePos = 0;
|
int WritePos = 0;
|
||||||
|
|
||||||
m_DataVAddrr = (SendDlgItemMessage(IDC_CHK_VADDR, BM_GETCHECK, 0, 0) & BST_CHECKED) != 0;
|
m_DataVAddrr = (SendDlgItemMessage(IDC_CHK_VADDR, BM_GETCHECK, 0, 0) & BST_CHECKED) != 0;
|
||||||
|
|
||||||
if ((m_DataStartLoc & 3) != 0)
|
if ((m_DataStartLoc & 3) != 0)
|
||||||
{
|
{
|
||||||
MIPS_WORD word;
|
MIPS_WORD word;
|
||||||
bool ValidData = true;
|
bool ValidData = true;
|
||||||
|
|
||||||
if (m_DataVAddrr)
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW))
|
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW))
|
||||||
{
|
{
|
||||||
ValidData = false;
|
ValidData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW))
|
if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW))
|
||||||
{
|
{
|
||||||
ValidData = false;
|
ValidData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Offset = (m_DataStartLoc & 3);
|
int Offset = (m_DataStartLoc & 3);
|
||||||
for (int i = 0; i < (4 - Offset); i++)
|
for (int i = 0; i < (4 - Offset); i++)
|
||||||
{
|
{
|
||||||
if (WritePos >= MemoryToDisplay)
|
if (WritePos >= MemoryToDisplay)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_DataValid[WritePos + i] = ValidData;
|
m_DataValid[WritePos + i] = ValidData;
|
||||||
if (ValidData)
|
if (ValidData)
|
||||||
{
|
{
|
||||||
m_CurrentData[WritePos + i] = word.UB[3 - (i + Offset)];
|
m_CurrentData[WritePos + i] = word.UB[3 - (i + Offset)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WritePos = 4 - Offset;
|
WritePos = 4 - Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
|
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
|
||||||
{
|
{
|
||||||
MIPS_WORD word;
|
MIPS_WORD word;
|
||||||
bool ValidData = true;
|
bool ValidData = true;
|
||||||
|
|
||||||
if (m_DataVAddrr)
|
if (m_DataVAddrr)
|
||||||
{
|
{
|
||||||
if (!g_MMU->LW_VAddr(Pos, word.UW))
|
if (!g_MMU->LW_VAddr(Pos, word.UW))
|
||||||
{
|
{
|
||||||
ValidData = false;
|
ValidData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!g_MMU->LW_PAddr(Pos, word.UW))
|
if (!g_MMU->LW_PAddr(Pos, word.UW))
|
||||||
{
|
{
|
||||||
ValidData = false;
|
ValidData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if ((WritePos + i) >= MemoryToDisplay)
|
if ((WritePos + i) >= MemoryToDisplay)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_DataValid[WritePos + i] = ValidData;
|
m_DataValid[WritePos + i] = ValidData;
|
||||||
if (ValidData)
|
if (ValidData)
|
||||||
{
|
{
|
||||||
m_CurrentData[WritePos + i] = word.UB[3 - i];
|
m_CurrentData[WritePos + i] = word.UB[3 - i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int count = 0; count < 16; count++)
|
for (int count = 0; count < 16; count++)
|
||||||
{
|
{
|
||||||
Insert_MemoryLineDump(count);
|
Insert_MemoryLineDump(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,58 +1,58 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDebugMemoryView :
|
class CDebugMemoryView :
|
||||||
public CDebugDialog < CDebugMemoryView >
|
public CDebugDialog < CDebugMemoryView >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum { IDD = IDD_Debugger_Memory };
|
enum { IDD = IDD_Debugger_Memory };
|
||||||
|
|
||||||
CDebugMemoryView(CDebuggerUI * debugger);
|
CDebugMemoryView(CDebuggerUI * debugger);
|
||||||
virtual ~CDebugMemoryView(void);
|
virtual ~CDebugMemoryView(void);
|
||||||
|
|
||||||
void ShowAddress(DWORD Address, bool VAddr);
|
void ShowAddress(DWORD Address, bool VAddr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BEGIN_MSG_MAP_EX(CDebugMemoryView)
|
BEGIN_MSG_MAP_EX(CDebugMemoryView)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
|
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
|
||||||
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
|
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
|
||||||
MSG_WM_DESTROY(OnDestroy)
|
MSG_WM_DESTROY(OnDestroy)
|
||||||
MSG_WM_VSCROLL(OnVScroll)
|
MSG_WM_VSCROLL(OnVScroll)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
|
||||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
||||||
void OnVScroll(int request, short Pos, HWND ctrl);
|
void OnVScroll(int request, short Pos, HWND ctrl);
|
||||||
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
||||||
LRESULT OnDestroy(void);
|
LRESULT OnDestroy(void);
|
||||||
|
|
||||||
void Insert_MemoryLineDump(int LineNumber);
|
void Insert_MemoryLineDump(int LineNumber);
|
||||||
void RefreshMemory(bool ResetCompare);
|
void RefreshMemory(bool ResetCompare);
|
||||||
|
|
||||||
enum { MemoryToDisplay = 0x100 };
|
enum { MemoryToDisplay = 0x100 };
|
||||||
|
|
||||||
CEditNumber m_MemAddr;
|
CEditNumber m_MemAddr;
|
||||||
CListCtrl * m_MemoryList;
|
CListCtrl * m_MemoryList;
|
||||||
|
|
||||||
DWORD m_DataStartLoc;
|
DWORD m_DataStartLoc;
|
||||||
bool m_DataVAddrr;
|
bool m_DataVAddrr;
|
||||||
BYTE m_CurrentData[MemoryToDisplay];
|
BYTE m_CurrentData[MemoryToDisplay];
|
||||||
bool m_DataValid[MemoryToDisplay];
|
bool m_DataValid[MemoryToDisplay];
|
||||||
|
|
||||||
DWORD m_CompareStartLoc;
|
DWORD m_CompareStartLoc;
|
||||||
bool m_CompareVAddrr;
|
bool m_CompareVAddrr;
|
||||||
BYTE m_CompareData[MemoryToDisplay];
|
BYTE m_CompareData[MemoryToDisplay];
|
||||||
bool m_CompareValid[MemoryToDisplay];
|
bool m_CompareValid[MemoryToDisplay];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,149 +1,149 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "DebuggerUI.h"
|
#include "DebuggerUI.h"
|
||||||
|
|
||||||
CPj64Module _Module;
|
CPj64Module _Module;
|
||||||
|
|
||||||
CDebuggerUI::CDebuggerUI () :
|
CDebuggerUI::CDebuggerUI () :
|
||||||
m_MemoryDump(NULL),
|
m_MemoryDump(NULL),
|
||||||
m_MemoryView(NULL),
|
m_MemoryView(NULL),
|
||||||
m_MemorySearch(NULL),
|
m_MemorySearch(NULL),
|
||||||
m_DebugTLB(NULL)
|
m_DebugTLB(NULL)
|
||||||
{
|
{
|
||||||
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||||
g_Debugger = this;
|
g_Debugger = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebuggerUI::~CDebuggerUI (void)
|
CDebuggerUI::~CDebuggerUI (void)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||||
Debug_Reset();
|
Debug_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::GameReset ( CDebuggerUI * _this )
|
void CDebuggerUI::GameReset ( CDebuggerUI * _this )
|
||||||
{
|
{
|
||||||
if (!g_Settings->LoadBool(GameRunning_InReset))
|
if (!g_Settings->LoadBool(GameRunning_InReset))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_this->Debug_Reset();
|
_this->Debug_Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_Reset ( void )
|
void CDebuggerUI::Debug_Reset ( void )
|
||||||
{
|
{
|
||||||
if (m_MemoryDump)
|
if (m_MemoryDump)
|
||||||
{
|
{
|
||||||
m_MemoryDump->HideWindow();
|
m_MemoryDump->HideWindow();
|
||||||
delete m_MemoryDump;
|
delete m_MemoryDump;
|
||||||
m_MemoryDump = NULL;
|
m_MemoryDump = NULL;
|
||||||
}
|
}
|
||||||
if (m_MemoryView)
|
if (m_MemoryView)
|
||||||
{
|
{
|
||||||
m_MemoryView->HideWindow();
|
m_MemoryView->HideWindow();
|
||||||
delete m_MemoryView;
|
delete m_MemoryView;
|
||||||
m_MemoryView = NULL;
|
m_MemoryView = NULL;
|
||||||
}
|
}
|
||||||
if (m_MemorySearch)
|
if (m_MemorySearch)
|
||||||
{
|
{
|
||||||
m_MemorySearch->HideWindow();
|
m_MemorySearch->HideWindow();
|
||||||
delete m_MemorySearch;
|
delete m_MemorySearch;
|
||||||
m_MemorySearch = NULL;
|
m_MemorySearch = NULL;
|
||||||
}
|
}
|
||||||
if (m_DebugTLB)
|
if (m_DebugTLB)
|
||||||
{
|
{
|
||||||
m_DebugTLB->HideWindow();
|
m_DebugTLB->HideWindow();
|
||||||
delete m_DebugTLB;
|
delete m_DebugTLB;
|
||||||
m_DebugTLB = NULL;
|
m_DebugTLB = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_ShowMemoryDump()
|
void CDebuggerUI::Debug_ShowMemoryDump()
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_MemoryDump == NULL)
|
if (m_MemoryDump == NULL)
|
||||||
{
|
{
|
||||||
m_MemoryDump = new CDumpMemory(this);
|
m_MemoryDump = new CDumpMemory(this);
|
||||||
}
|
}
|
||||||
if (m_MemoryDump)
|
if (m_MemoryDump)
|
||||||
{
|
{
|
||||||
m_MemoryDump->ShowWindow();
|
m_MemoryDump->ShowWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_ShowMemoryWindow ( void )
|
void CDebuggerUI::Debug_ShowMemoryWindow ( void )
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_MemoryView == NULL)
|
if (m_MemoryView == NULL)
|
||||||
{
|
{
|
||||||
m_MemoryView = new CDebugMemoryView(this);
|
m_MemoryView = new CDebugMemoryView(this);
|
||||||
}
|
}
|
||||||
if (m_MemoryView)
|
if (m_MemoryView)
|
||||||
{
|
{
|
||||||
m_MemoryView->ShowWindow();
|
m_MemoryView->ShowWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
|
void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
|
||||||
{
|
{
|
||||||
Debug_ShowMemoryWindow();
|
Debug_ShowMemoryWindow();
|
||||||
if (m_MemoryView)
|
if (m_MemoryView)
|
||||||
{
|
{
|
||||||
m_MemoryView->ShowAddress(Address,VAddr);
|
m_MemoryView->ShowAddress(Address,VAddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_ShowTLBWindow (void)
|
void CDebuggerUI::Debug_ShowTLBWindow (void)
|
||||||
{
|
{
|
||||||
if (g_MMU == NULL)
|
if (g_MMU == NULL)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_DebugTLB == NULL)
|
if (m_DebugTLB == NULL)
|
||||||
{
|
{
|
||||||
m_DebugTLB = new CDebugTlb(this);
|
m_DebugTLB = new CDebugTlb(this);
|
||||||
}
|
}
|
||||||
if (m_DebugTLB)
|
if (m_DebugTLB)
|
||||||
{
|
{
|
||||||
m_DebugTLB->ShowWindow();
|
m_DebugTLB->ShowWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
||||||
{
|
{
|
||||||
if (m_DebugTLB)
|
if (m_DebugTLB)
|
||||||
{
|
{
|
||||||
m_DebugTLB->RefreshTLBWindow();
|
m_DebugTLB->RefreshTLBWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::Debug_ShowMemorySearch()
|
void CDebuggerUI::Debug_ShowMemorySearch()
|
||||||
{
|
{
|
||||||
if (m_MemorySearch == NULL)
|
if (m_MemorySearch == NULL)
|
||||||
{
|
{
|
||||||
m_MemorySearch = new CDebugMemorySearch(this);
|
m_MemorySearch = new CDebugMemorySearch(this);
|
||||||
}
|
}
|
||||||
if (m_MemorySearch)
|
if (m_MemorySearch)
|
||||||
{
|
{
|
||||||
m_MemorySearch->ShowWindow();
|
m_MemorySearch->ShowWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebuggerUI::TLBChanged()
|
void CDebuggerUI::TLBChanged()
|
||||||
{
|
{
|
||||||
Debug_RefreshTLBWindow();
|
Debug_RefreshTLBWindow();
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../WTLApp.h"
|
#include "../../WTLApp.h"
|
||||||
#include "../../N64System.h"
|
#include "../../N64System.h"
|
||||||
#include "DebugDialog.h"
|
#include "DebugDialog.h"
|
||||||
#include "Debugger-MemorySearch.h"
|
#include "Debugger-MemorySearch.h"
|
||||||
#include "Debugger-ViewMemory.h"
|
#include "Debugger-ViewMemory.h"
|
||||||
#include "Debugger-MemoryDump.h"
|
#include "Debugger-MemoryDump.h"
|
||||||
#include "Debugger-TLB.h"
|
#include "Debugger-TLB.h"
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CDumpMemory;
|
class CDumpMemory;
|
||||||
class CDebugMemoryView;
|
class CDebugMemoryView;
|
||||||
class CDebugMemorySearch;
|
class CDebugMemorySearch;
|
||||||
class CDebugTlb;
|
class CDebugTlb;
|
||||||
|
|
||||||
__interface CDebugger
|
__interface CDebugger
|
||||||
{
|
{
|
||||||
virtual void TLBChanged ( void ) = 0;
|
virtual void TLBChanged ( void ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDebuggerUI :
|
class CDebuggerUI :
|
||||||
public CDebugger
|
public CDebugger
|
||||||
{
|
{
|
||||||
CDumpMemory * m_MemoryDump;
|
CDumpMemory * m_MemoryDump;
|
||||||
CDebugMemoryView * m_MemoryView;
|
CDebugMemoryView * m_MemoryView;
|
||||||
CDebugMemorySearch * m_MemorySearch;
|
CDebugMemorySearch * m_MemorySearch;
|
||||||
CDebugTlb * m_DebugTLB;
|
CDebugTlb * m_DebugTLB;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CDebuggerUI();
|
CDebuggerUI();
|
||||||
virtual ~CDebuggerUI();
|
virtual ~CDebuggerUI();
|
||||||
|
|
||||||
void TLBChanged ( void );
|
void TLBChanged ( void );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Debug_Reset ( void );
|
void Debug_Reset ( void );
|
||||||
void Debug_ShowMemoryDump ( void );
|
void Debug_ShowMemoryDump ( void );
|
||||||
void Debug_ShowMemoryWindow ( void );
|
void Debug_ShowMemoryWindow ( void );
|
||||||
void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
|
void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
|
||||||
void Debug_ShowMemorySearch ( void );
|
void Debug_ShowMemorySearch ( void );
|
||||||
void Debug_ShowTLBWindow ( void );
|
void Debug_ShowTLBWindow ( void );
|
||||||
void Debug_RefreshTLBWindow ( void );
|
void Debug_RefreshTLBWindow ( void );
|
||||||
|
|
||||||
static void GameReset ( CDebuggerUI * _this );
|
static void GameReset ( CDebuggerUI * _this );
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,119 +1,119 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include "PluginList.h"
|
#include "PluginList.h"
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
|
||||||
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
||||||
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
|
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
|
||||||
{
|
{
|
||||||
if (bAutoFill)
|
if (bAutoFill)
|
||||||
{
|
{
|
||||||
LoadList();
|
LoadList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPluginList::~CPluginList()
|
CPluginList::~CPluginList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPluginList::GetPluginCount() const
|
int CPluginList::GetPluginCount() const
|
||||||
{
|
{
|
||||||
return m_PluginList.size();
|
return m_PluginList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
|
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
|
||||||
{
|
{
|
||||||
if (indx < 0 || indx >= (int)m_PluginList.size())
|
if (indx < 0 || indx >= (int)m_PluginList.size())
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return &m_PluginList[indx];
|
return &m_PluginList[indx];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPluginList::LoadList()
|
bool CPluginList::LoadList()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||||
m_PluginList.clear();
|
m_PluginList.clear();
|
||||||
AddPluginFromDir(m_PluginDir);
|
AddPluginFromDir(m_PluginDir);
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPluginList::AddPluginFromDir(CPath Dir)
|
void CPluginList::AddPluginFromDir(CPath Dir)
|
||||||
{
|
{
|
||||||
Dir.SetNameExtension("*.*");
|
Dir.SetNameExtension("*.*");
|
||||||
if (Dir.FindFirst(_A_SUBDIR))
|
if (Dir.FindFirst(_A_SUBDIR))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
AddPluginFromDir(Dir);
|
AddPluginFromDir(Dir);
|
||||||
} while (Dir.FindNext());
|
} while (Dir.FindNext());
|
||||||
Dir.UpDirectory();
|
Dir.UpDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
Dir.SetNameExtension("*.dll");
|
Dir.SetNameExtension("*.dll");
|
||||||
if (Dir.FindFirst())
|
if (Dir.FindFirst())
|
||||||
{
|
{
|
||||||
HMODULE hLib = NULL;
|
HMODULE hLib = NULL;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (hLib)
|
if (hLib)
|
||||||
{
|
{
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
hLib = NULL;
|
hLib = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS );
|
//UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS );
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir);
|
WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir);
|
||||||
hLib = LoadLibrary(Dir);
|
hLib = LoadLibrary(Dir);
|
||||||
//SetErrorMode(LastErrorMode);
|
//SetErrorMode(LastErrorMode);
|
||||||
|
|
||||||
if (hLib == NULL)
|
if (hLib == NULL)
|
||||||
{
|
{
|
||||||
DWORD LoadError = GetLastError();
|
DWORD LoadError = GetLastError();
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "failed to loadi %s (error: %d)", (LPCSTR)Dir, LoadError);
|
WriteTrace(TraceUserInterface, TraceDebug, "failed to loadi %s (error: %d)", (LPCSTR)Dir, LoadError);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
|
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
|
||||||
GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo");
|
GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo");
|
||||||
if (GetDllInfo == NULL)
|
if (GetDllInfo == NULL)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLUGIN Plugin = { 0 };
|
PLUGIN Plugin = { 0 };
|
||||||
Plugin.Info.MemoryBswaped = true;
|
Plugin.Info.MemoryBswaped = true;
|
||||||
GetDllInfo(&Plugin.Info);
|
GetDllInfo(&Plugin.Info);
|
||||||
if (!CPlugin::ValidPluginVersion(Plugin.Info))
|
if (!CPlugin::ValidPluginVersion(Plugin.Info))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin.FullPath = Dir;
|
Plugin.FullPath = Dir;
|
||||||
Plugin.FileName = stdstr((const char *)Dir).substr(strlen(m_PluginDir));
|
Plugin.FileName = stdstr((const char *)Dir).substr(strlen(m_PluginDir));
|
||||||
|
|
||||||
if (GetProcAddress(hLib, "DllAbout") != NULL)
|
if (GetProcAddress(hLib, "DllAbout") != NULL)
|
||||||
{
|
{
|
||||||
Plugin.AboutFunction = true;
|
Plugin.AboutFunction = true;
|
||||||
}
|
}
|
||||||
m_PluginList.push_back(Plugin);
|
m_PluginList.push_back(Plugin);
|
||||||
} while (Dir.FindNext());
|
} while (Dir.FindNext());
|
||||||
|
|
||||||
if (hLib)
|
if (hLib)
|
||||||
{
|
{
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
hLib = NULL;
|
hLib = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,41 +1,41 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Project64-core/Settings/Settings.h>
|
#include <Project64-core/Settings/Settings.h>
|
||||||
|
|
||||||
class CPluginList
|
class CPluginList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
PLUGIN_INFO Info;
|
PLUGIN_INFO Info;
|
||||||
bool AboutFunction;
|
bool AboutFunction;
|
||||||
CPath FullPath;
|
CPath FullPath;
|
||||||
stdstr FileName;
|
stdstr FileName;
|
||||||
} PLUGIN;
|
} PLUGIN;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPluginList(bool bAutoFill = true);
|
CPluginList(bool bAutoFill = true);
|
||||||
~CPluginList();
|
~CPluginList();
|
||||||
|
|
||||||
bool LoadList(void);
|
bool LoadList(void);
|
||||||
int GetPluginCount(void) const;
|
int GetPluginCount(void) const;
|
||||||
const PLUGIN * GetPluginInfo(int indx) const;
|
const PLUGIN * GetPluginInfo(int indx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<PLUGIN> PluginList;
|
typedef std::vector<PLUGIN> PluginList;
|
||||||
|
|
||||||
PluginList m_PluginList;
|
PluginList m_PluginList;
|
||||||
CPath m_PluginDir;
|
CPath m_PluginDir;
|
||||||
|
|
||||||
void AddPluginFromDir(CPath Dir);
|
void AddPluginFromDir(CPath Dir);
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,154 +1,154 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Release|x64">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}</ProjectGuid>
|
<ProjectGuid>{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}</ProjectGuid>
|
||||||
<RootNamespace>Project64</RootNamespace>
|
<RootNamespace>Project64</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Configuration">
|
<PropertyGroup Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
<Import Project="$(SolutionDir)PropertySheets\Platform.$(Configuration).props" />
|
<Import Project="$(SolutionDir)PropertySheets\Platform.$(Configuration).props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<MinimumRequiredVersion Condition="'$(Platform)'=='Win32'">5.01</MinimumRequiredVersion>
|
<MinimumRequiredVersion Condition="'$(Platform)'=='Win32'">5.01</MinimumRequiredVersion>
|
||||||
<MinimumRequiredVersion Condition="'$(Platform)'=='x64'">5.02</MinimumRequiredVersion>
|
<MinimumRequiredVersion Condition="'$(Platform)'=='x64'">5.02</MinimumRequiredVersion>
|
||||||
<StackReserveSize>1</StackReserveSize>
|
<StackReserveSize>1</StackReserveSize>
|
||||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||||
</Link>
|
</Link>
|
||||||
<Manifest Condition="'$(PlatformToolset)'!='v90'">
|
<Manifest Condition="'$(PlatformToolset)'!='v90'">
|
||||||
<EnableDPIAwareness>true</EnableDPIAwareness>
|
<EnableDPIAwareness>true</EnableDPIAwareness>
|
||||||
</Manifest>
|
</Manifest>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="Multilanguage\LanguageSelector.cpp" />
|
<ClCompile Include="Multilanguage\LanguageSelector.cpp" />
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp" />
|
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp" />
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp" />
|
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp" />
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp" />
|
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp" />
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp" />
|
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp" />
|
||||||
<ClCompile Include="N64System\Debugger\Debugger.cpp" />
|
<ClCompile Include="N64System\Debugger\Debugger.cpp" />
|
||||||
<ClCompile Include="Plugins\PluginList.cpp" />
|
<ClCompile Include="Plugins\PluginList.cpp" />
|
||||||
<ClCompile Include="Settings\GuiSettings.cpp" />
|
<ClCompile Include="Settings\GuiSettings.cpp" />
|
||||||
<ClCompile Include="Settings\NotificationSettings.cpp" />
|
<ClCompile Include="Settings\NotificationSettings.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\CheatClassUI.cpp" />
|
<ClCompile Include="UserInterface\CheatClassUI.cpp" />
|
||||||
<ClCompile Include="UserInterface\GuiClass.cpp" />
|
<ClCompile Include="UserInterface\GuiClass.cpp" />
|
||||||
<ClCompile Include="UserInterface\LoggingUI.cpp" />
|
<ClCompile Include="UserInterface\LoggingUI.cpp" />
|
||||||
<ClCompile Include="UserInterface\MainMenuClass.cpp" />
|
<ClCompile Include="UserInterface\MainMenuClass.cpp" />
|
||||||
<ClCompile Include="UserInterface\MenuClass.cpp" />
|
<ClCompile Include="UserInterface\MenuClass.cpp" />
|
||||||
<ClCompile Include="UserInterface\MenuShortCuts.cpp" />
|
<ClCompile Include="UserInterface\MenuShortCuts.cpp" />
|
||||||
<ClCompile Include="UserInterface\NotificationClass.cpp" />
|
<ClCompile Include="UserInterface\NotificationClass.cpp" />
|
||||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp" />
|
<ClCompile Include="UserInterface\RomBrowserClass.cpp" />
|
||||||
<ClCompile Include="UserInterface\RomInformationClass.cpp" />
|
<ClCompile Include="UserInterface\RomInformationClass.cpp" />
|
||||||
<ClCompile Include="UserInterface\SettingsConfig.cpp" />
|
<ClCompile Include="UserInterface\SettingsConfig.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp" />
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp" />
|
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp" />
|
||||||
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp" />
|
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp" />
|
||||||
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp" />
|
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Multilanguage\LanguageSelector.h" />
|
<ClInclude Include="Multilanguage\LanguageSelector.h" />
|
||||||
<ClInclude Include="N64System.h" />
|
<ClInclude Include="N64System.h" />
|
||||||
<ClInclude Include="N64System\Debugger\DebugDialog.h" />
|
<ClInclude Include="N64System\Debugger\DebugDialog.h" />
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h" />
|
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h" />
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h" />
|
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h" />
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-TLB.h" />
|
<ClInclude Include="N64System\Debugger\Debugger-TLB.h" />
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h" />
|
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h" />
|
||||||
<ClInclude Include="N64System\Debugger\debugger.h" />
|
<ClInclude Include="N64System\Debugger\debugger.h" />
|
||||||
<ClInclude Include="N64System\Debugger\DebuggerUI.h" />
|
<ClInclude Include="N64System\Debugger\DebuggerUI.h" />
|
||||||
<ClInclude Include="N64System\RomInformationClass.h" />
|
<ClInclude Include="N64System\RomInformationClass.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="Support.h" />
|
<ClInclude Include="Support.h" />
|
||||||
<ClInclude Include="UserInterface.h" />
|
<ClInclude Include="UserInterface.h" />
|
||||||
<ClInclude Include="UserInterface\CheatClassUI.h" />
|
<ClInclude Include="UserInterface\CheatClassUI.h" />
|
||||||
<ClInclude Include="UserInterface\GuiClass.h" />
|
<ClInclude Include="UserInterface\GuiClass.h" />
|
||||||
<ClInclude Include="UserInterface\LoggingUI.h" />
|
<ClInclude Include="UserInterface\LoggingUI.h" />
|
||||||
<ClInclude Include="UserInterface\MainMenuClass.h" />
|
<ClInclude Include="UserInterface\MainMenuClass.h" />
|
||||||
<ClInclude Include="UserInterface\MenuClass.h" />
|
<ClInclude Include="UserInterface\MenuClass.h" />
|
||||||
<ClInclude Include="UserInterface\MenuShortCuts.h" />
|
<ClInclude Include="UserInterface\MenuShortCuts.h" />
|
||||||
<ClInclude Include="UserInterface\NotificationClass.h" />
|
<ClInclude Include="UserInterface\NotificationClass.h" />
|
||||||
<ClInclude Include="UserInterface\resource.h" />
|
<ClInclude Include="UserInterface\resource.h" />
|
||||||
<ClInclude Include="UserInterface\RomBrowser.h" />
|
<ClInclude Include="UserInterface\RomBrowser.h" />
|
||||||
<ClInclude Include="UserInterface\RomInformationClass.h" />
|
<ClInclude Include="UserInterface\RomInformationClass.h" />
|
||||||
<ClInclude Include="UserInterface\SettingsConfig.h" />
|
<ClInclude Include="UserInterface\SettingsConfig.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h" />
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage.h" />
|
<ClInclude Include="UserInterface\Settings\SettingsPage.h" />
|
||||||
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h" />
|
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h" />
|
||||||
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h" />
|
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h" />
|
||||||
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h" />
|
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h" />
|
||||||
<ClInclude Include="UserInterface\WTLControls\numberctrl.h" />
|
<ClInclude Include="UserInterface\WTLControls\numberctrl.h" />
|
||||||
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h" />
|
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h" />
|
||||||
<ClInclude Include="WTLApp.h" />
|
<ClInclude Include="WTLApp.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\3rdParty\7zip\7zip.vcxproj">
|
<ProjectReference Include="..\3rdParty\7zip\7zip.vcxproj">
|
||||||
<Project>{3326e128-33af-422c-bb7c-67cc6b915610}</Project>
|
<Project>{3326e128-33af-422c-bb7c-67cc6b915610}</Project>
|
||||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\3rdParty\zlib\zlib.vcxproj">
|
<ProjectReference Include="..\3rdParty\zlib\zlib.vcxproj">
|
||||||
<Project>{731bd205-2826-4631-b7af-117658e88dbc}</Project>
|
<Project>{731bd205-2826-4631-b7af-117658e88dbc}</Project>
|
||||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||||
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
|
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
|
||||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Project64-core\Project64-core.vcxproj">
|
<ProjectReference Include="..\Project64-core\Project64-core.vcxproj">
|
||||||
<Project>{00c7b43a-ded7-4df0-b072-9a5783ef866d}</Project>
|
<Project>{00c7b43a-ded7-4df0-b072-9a5783ef866d}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="res\divider.cur" />
|
<None Include="res\divider.cur" />
|
||||||
<None Include="res\hand.cur" />
|
<None Include="res\hand.cur" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="res\ListItems.bmp" />
|
<Image Include="res\ListItems.bmp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="UserInterface\UIResources.rc" />
|
<ResourceCompile Include="UserInterface\UIResources.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,303 +1,303 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<Filter Include="Source Files">
|
||||||
<UniqueIdentifier>{994eee48-3b61-4493-9a7f-6340a5a47175}</UniqueIdentifier>
|
<UniqueIdentifier>{994eee48-3b61-4493-9a7f-6340a5a47175}</UniqueIdentifier>
|
||||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\Settings Files">
|
<Filter Include="Source Files\Settings Files">
|
||||||
<UniqueIdentifier>{60e2fd87-7b6b-4147-82fe-e12516efe43c}</UniqueIdentifier>
|
<UniqueIdentifier>{60e2fd87-7b6b-4147-82fe-e12516efe43c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\User Interface Source">
|
<Filter Include="Source Files\User Interface Source">
|
||||||
<UniqueIdentifier>{7b81a6a8-b20b-464e-8184-864886bb00fd}</UniqueIdentifier>
|
<UniqueIdentifier>{7b81a6a8-b20b-464e-8184-864886bb00fd}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\User Interface Source\Settings Source">
|
<Filter Include="Source Files\User Interface Source\Settings Source">
|
||||||
<UniqueIdentifier>{bbef87b7-814a-4c87-9713-a07a2de577d4}</UniqueIdentifier>
|
<UniqueIdentifier>{bbef87b7-814a-4c87-9713-a07a2de577d4}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\User Interface Source\WTL Controls Source">
|
<Filter Include="Source Files\User Interface Source\WTL Controls Source">
|
||||||
<UniqueIdentifier>{19f68e68-7068-4a3c-a11d-c3ff48fe78b2}</UniqueIdentifier>
|
<UniqueIdentifier>{19f68e68-7068-4a3c-a11d-c3ff48fe78b2}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\User Interface Source\Debugger Source">
|
<Filter Include="Source Files\User Interface Source\Debugger Source">
|
||||||
<UniqueIdentifier>{89244064-68f5-44d9-9021-7a592d910e43}</UniqueIdentifier>
|
<UniqueIdentifier>{89244064-68f5-44d9-9021-7a592d910e43}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\Multilanguage Source">
|
<Filter Include="Source Files\Multilanguage Source">
|
||||||
<UniqueIdentifier>{94e87bf5-3b11-4f61-8a4a-333690ecf588}</UniqueIdentifier>
|
<UniqueIdentifier>{94e87bf5-3b11-4f61-8a4a-333690ecf588}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\Plugin Source">
|
<Filter Include="Source Files\Plugin Source">
|
||||||
<UniqueIdentifier>{242ae4a5-b150-44e6-b31c-027acd6d38b0}</UniqueIdentifier>
|
<UniqueIdentifier>{242ae4a5-b150-44e6-b31c-027acd6d38b0}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
<Filter Include="Resource Files">
|
||||||
<UniqueIdentifier>{1e3eb4f7-a0b1-4d09-9e50-b5c699f24050}</UniqueIdentifier>
|
<UniqueIdentifier>{1e3eb4f7-a0b1-4d09-9e50-b5c699f24050}</UniqueIdentifier>
|
||||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
<UniqueIdentifier>{bc88015e-37f7-4320-8aa4-d5043d17a386}</UniqueIdentifier>
|
<UniqueIdentifier>{bc88015e-37f7-4320-8aa4-d5043d17a386}</UniqueIdentifier>
|
||||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\User Interface Headers">
|
<Filter Include="Header Files\User Interface Headers">
|
||||||
<UniqueIdentifier>{54e8f51f-d81d-4f8f-b4f1-76584c1b29a5}</UniqueIdentifier>
|
<UniqueIdentifier>{54e8f51f-d81d-4f8f-b4f1-76584c1b29a5}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\User Interface Headers\Settings Header">
|
<Filter Include="Header Files\User Interface Headers\Settings Header">
|
||||||
<UniqueIdentifier>{81b58fad-f73f-4098-8ebc-ffceaff53478}</UniqueIdentifier>
|
<UniqueIdentifier>{81b58fad-f73f-4098-8ebc-ffceaff53478}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\User Interface Headers\WTL Controls Headers">
|
<Filter Include="Header Files\User Interface Headers\WTL Controls Headers">
|
||||||
<UniqueIdentifier>{838a58e7-e1d2-45d3-bcf0-dcedad19610c}</UniqueIdentifier>
|
<UniqueIdentifier>{838a58e7-e1d2-45d3-bcf0-dcedad19610c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\Multilanguage Headers">
|
<Filter Include="Header Files\Multilanguage Headers">
|
||||||
<UniqueIdentifier>{5531af4d-33bb-4e84-8a55-c971a18ec7bf}</UniqueIdentifier>
|
<UniqueIdentifier>{5531af4d-33bb-4e84-8a55-c971a18ec7bf}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\N64 System Headers">
|
<Filter Include="Header Files\N64 System Headers">
|
||||||
<UniqueIdentifier>{6cfab019-2f8d-4e09-be41-1df513b5a680}</UniqueIdentifier>
|
<UniqueIdentifier>{6cfab019-2f8d-4e09-be41-1df513b5a680}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\N64 System Headers\Debugger Headers">
|
<Filter Include="Header Files\N64 System Headers\Debugger Headers">
|
||||||
<UniqueIdentifier>{c4249d55-df70-4453-b017-b548514ad094}</UniqueIdentifier>
|
<UniqueIdentifier>{c4249d55-df70-4453-b017-b548514ad094}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp">
|
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp">
|
||||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp">
|
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp">
|
||||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp">
|
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Plugins\PluginList.cpp">
|
<ClCompile Include="Plugins\PluginList.cpp">
|
||||||
<Filter>Source Files\Plugin Source</Filter>
|
<Filter>Source Files\Plugin Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\CheatClassUI.cpp">
|
<ClCompile Include="UserInterface\CheatClassUI.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\GuiClass.cpp">
|
<ClCompile Include="UserInterface\GuiClass.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\LoggingUI.cpp">
|
<ClCompile Include="UserInterface\LoggingUI.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\MainMenuClass.cpp">
|
<ClCompile Include="UserInterface\MainMenuClass.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\MenuClass.cpp">
|
<ClCompile Include="UserInterface\MenuClass.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\MenuShortCuts.cpp">
|
<ClCompile Include="UserInterface\MenuShortCuts.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\NotificationClass.cpp">
|
<ClCompile Include="UserInterface\NotificationClass.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp">
|
<ClCompile Include="UserInterface\RomBrowserClass.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\SettingsConfig.cpp">
|
<ClCompile Include="UserInterface\SettingsConfig.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="N64System\Debugger\Debugger.cpp">
|
<ClCompile Include="N64System\Debugger\Debugger.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp">
|
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp">
|
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp">
|
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp">
|
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp">
|
||||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Settings\GuiSettings.cpp">
|
<ClCompile Include="Settings\GuiSettings.cpp">
|
||||||
<Filter>Source Files\Settings Files</Filter>
|
<Filter>Source Files\Settings Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Settings\NotificationSettings.cpp">
|
<ClCompile Include="Settings\NotificationSettings.cpp">
|
||||||
<Filter>Source Files\Settings Files</Filter>
|
<Filter>Source Files\Settings Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Multilanguage\LanguageSelector.cpp">
|
<ClCompile Include="Multilanguage\LanguageSelector.cpp">
|
||||||
<Filter>Source Files\Multilanguage Source</Filter>
|
<Filter>Source Files\Multilanguage Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="UserInterface\RomInformationClass.cpp">
|
<ClCompile Include="UserInterface\RomInformationClass.cpp">
|
||||||
<Filter>Source Files\User Interface Source</Filter>
|
<Filter>Source Files\User Interface Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="UserInterface\resource.h">
|
<ClInclude Include="UserInterface\resource.h">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Multilanguage\LanguageSelector.h">
|
<ClInclude Include="Multilanguage\LanguageSelector.h">
|
||||||
<Filter>Header Files\Multilanguage Headers</Filter>
|
<Filter>Header Files\Multilanguage Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\RomInformationClass.h">
|
<ClInclude Include="N64System\RomInformationClass.h">
|
||||||
<Filter>Header Files\N64 System Headers</Filter>
|
<Filter>Header Files\N64 System Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\DebugDialog.h">
|
<ClInclude Include="N64System\Debugger\DebugDialog.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\debugger.h">
|
<ClInclude Include="N64System\Debugger\debugger.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h">
|
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h">
|
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-TLB.h">
|
<ClInclude Include="N64System\Debugger\Debugger-TLB.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\DebuggerUI.h">
|
<ClInclude Include="N64System\Debugger\DebuggerUI.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h">
|
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h">
|
||||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\CheatClassUI.h">
|
<ClInclude Include="UserInterface\CheatClassUI.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\GuiClass.h">
|
<ClInclude Include="UserInterface\GuiClass.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\LoggingUI.h">
|
<ClInclude Include="UserInterface\LoggingUI.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\MainMenuClass.h">
|
<ClInclude Include="UserInterface\MainMenuClass.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\MenuClass.h">
|
<ClInclude Include="UserInterface\MenuClass.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\MenuShortCuts.h">
|
<ClInclude Include="UserInterface\MenuShortCuts.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\NotificationClass.h">
|
<ClInclude Include="UserInterface\NotificationClass.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\RomBrowser.h">
|
<ClInclude Include="UserInterface\RomBrowser.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\SettingsConfig.h">
|
<ClInclude Include="UserInterface\SettingsConfig.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h">
|
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h">
|
||||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h">
|
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h">
|
||||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h">
|
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h">
|
||||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\WTLControls\numberctrl.h">
|
<ClInclude Include="UserInterface\WTLControls\numberctrl.h">
|
||||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h">
|
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h">
|
||||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h">
|
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h">
|
||||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="N64System.h">
|
<ClInclude Include="N64System.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Support.h">
|
<ClInclude Include="Support.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface.h">
|
<ClInclude Include="UserInterface.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="WTLApp.h">
|
<ClInclude Include="WTLApp.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="UserInterface\RomInformationClass.h">
|
<ClInclude Include="UserInterface\RomInformationClass.h">
|
||||||
<Filter>Header Files\User Interface Headers</Filter>
|
<Filter>Header Files\User Interface Headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="res\divider.cur">
|
<None Include="res\divider.cur">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="res\hand.cur">
|
<None Include="res\hand.cur">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="res\ListItems.bmp">
|
<Image Include="res\ListItems.bmp">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="UserInterface\UIResources.rc">
|
<ResourceCompile Include="UserInterface\UIResources.rc">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,43 +1,43 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* *
|
* *
|
||||||
* Project64 - A Nintendo 64 emulator. *
|
* Project64 - A Nintendo 64 emulator. *
|
||||||
* http://www.pj64-emu.com/ *
|
* http://www.pj64-emu.com/ *
|
||||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* License: *
|
* License: *
|
||||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
int CGuiSettings::m_RefCount = 0;
|
int CGuiSettings::m_RefCount = 0;
|
||||||
bool CGuiSettings::m_bCPURunning;
|
bool CGuiSettings::m_bCPURunning;
|
||||||
bool CGuiSettings::m_bAutoSleep;
|
bool CGuiSettings::m_bAutoSleep;
|
||||||
|
|
||||||
CGuiSettings::CGuiSettings()
|
CGuiSettings::CGuiSettings()
|
||||||
{
|
{
|
||||||
m_RefCount += 1;
|
m_RefCount += 1;
|
||||||
if (m_RefCount == 1)
|
if (m_RefCount == 1)
|
||||||
{
|
{
|
||||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
g_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||||
g_Settings->RegisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
g_Settings->RegisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||||
RefreshSettings(NULL);
|
RefreshSettings(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CGuiSettings::~CGuiSettings()
|
CGuiSettings::~CGuiSettings()
|
||||||
{
|
{
|
||||||
m_RefCount -= 1;
|
m_RefCount -= 1;
|
||||||
if (m_RefCount == 0)
|
if (m_RefCount == 0)
|
||||||
{
|
{
|
||||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||||
g_Settings->UnregisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
g_Settings->UnregisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiSettings::RefreshSettings(void *)
|
void CGuiSettings::RefreshSettings(void *)
|
||||||
{
|
{
|
||||||
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
|
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||||
m_bAutoSleep = g_Settings->LoadBool(Setting_AutoSleep);
|
m_bAutoSleep = g_Settings->LoadBool(Setting_AutoSleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue