line ends ?
This commit is contained in:
parent
2b2283d876
commit
a228a9d1f9
|
@ -1,35 +1,35 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/N64System/Recompiler/FunctionInfo.h>
|
||||
|
||||
class CFunctionMap
|
||||
{
|
||||
protected:
|
||||
typedef CCompiledFunc * PCCompiledFunc;
|
||||
typedef PCCompiledFunc * PCCompiledFunc_TABLE;
|
||||
|
||||
CFunctionMap();
|
||||
~CFunctionMap();
|
||||
|
||||
bool AllocateMemory();
|
||||
void Reset(bool bAllocate);
|
||||
|
||||
public:
|
||||
PCCompiledFunc_TABLE * FunctionTable() const { return m_FunctionTable; }
|
||||
PCCompiledFunc * JumpTable() const { return m_JumpTable; }
|
||||
|
||||
private:
|
||||
void CleanBuffers();
|
||||
|
||||
PCCompiledFunc * m_JumpTable;
|
||||
PCCompiledFunc_TABLE * m_FunctionTable;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/N64System/Recompiler/FunctionInfo.h>
|
||||
|
||||
class CFunctionMap
|
||||
{
|
||||
protected:
|
||||
typedef CCompiledFunc * PCCompiledFunc;
|
||||
typedef PCCompiledFunc * PCCompiledFunc_TABLE;
|
||||
|
||||
CFunctionMap();
|
||||
~CFunctionMap();
|
||||
|
||||
bool AllocateMemory();
|
||||
void Reset(bool bAllocate);
|
||||
|
||||
public:
|
||||
PCCompiledFunc_TABLE * FunctionTable() const { return m_FunctionTable; }
|
||||
PCCompiledFunc * JumpTable() const { return m_JumpTable; }
|
||||
|
||||
private:
|
||||
void CleanBuffers();
|
||||
|
||||
PCCompiledFunc * m_JumpTable;
|
||||
PCCompiledFunc_TABLE * m_FunctionTable;
|
||||
};
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/N64System/Recompiler/ExitInfo.h>
|
||||
|
||||
struct CJumpInfo
|
||||
{
|
||||
typedef CExitInfo::EXIT_REASON EXIT_REASON;
|
||||
CJumpInfo();
|
||||
|
||||
uint32_t TargetPC;
|
||||
uint32_t JumpPC;
|
||||
stdstr BranchLabel;
|
||||
uint32_t * LinkLocation;
|
||||
uint32_t * LinkLocation2;
|
||||
bool FallThrough;
|
||||
bool PermLoop;
|
||||
bool DoneDelaySlot; //maybe deletable
|
||||
CRegInfo RegSet;
|
||||
EXIT_REASON ExitReason;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/N64System/Recompiler/ExitInfo.h>
|
||||
|
||||
struct CJumpInfo
|
||||
{
|
||||
typedef CExitInfo::EXIT_REASON EXIT_REASON;
|
||||
CJumpInfo();
|
||||
|
||||
uint32_t TargetPC;
|
||||
uint32_t JumpPC;
|
||||
stdstr BranchLabel;
|
||||
uint32_t * LinkLocation;
|
||||
uint32_t * LinkLocation2;
|
||||
bool FallThrough;
|
||||
bool PermLoop;
|
||||
bool DoneDelaySlot; //maybe deletable
|
||||
CRegInfo RegSet;
|
||||
EXIT_REASON ExitReason;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,89 +1,89 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||
|
||||
class CCodeSection;
|
||||
class CCodeBlock;
|
||||
|
||||
class LoopAnalysis
|
||||
{
|
||||
public:
|
||||
LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section);
|
||||
~LoopAnalysis();
|
||||
|
||||
bool SetupRegisterForLoop();
|
||||
|
||||
private:
|
||||
LoopAnalysis(); // Disable default constructor
|
||||
LoopAnalysis(const LoopAnalysis&); // Disable copy constructor
|
||||
LoopAnalysis& operator=(const LoopAnalysis&); // Disable assignment
|
||||
|
||||
bool SetupEnterSection(CCodeSection * Section, bool & bChanged, bool & bSkipedSection);
|
||||
bool CheckLoopRegisterUsage(CCodeSection * Section);
|
||||
bool SyncRegState(CRegInfo & RegSet, const CRegInfo& SyncReg);
|
||||
void SetJumpRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
||||
void SetContinueRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
void SPECIAL_SLL();
|
||||
void SPECIAL_SRL();
|
||||
void SPECIAL_SRA();
|
||||
void SPECIAL_SLLV();
|
||||
void SPECIAL_SRLV();
|
||||
void SPECIAL_SRAV();
|
||||
void SPECIAL_JR();
|
||||
void SPECIAL_JALR();
|
||||
void SPECIAL_SYSCALL(CCodeSection * Section);
|
||||
void SPECIAL_BREAK(CCodeSection * Section);
|
||||
void SPECIAL_MFHI();
|
||||
void SPECIAL_MTHI();
|
||||
void SPECIAL_MFLO();
|
||||
void SPECIAL_MTLO();
|
||||
void SPECIAL_DSLLV();
|
||||
void SPECIAL_DSRLV();
|
||||
void SPECIAL_DSRAV();
|
||||
void SPECIAL_ADD();
|
||||
void SPECIAL_ADDU();
|
||||
void SPECIAL_SUB();
|
||||
void SPECIAL_SUBU();
|
||||
void SPECIAL_AND();
|
||||
void SPECIAL_OR();
|
||||
void SPECIAL_XOR();
|
||||
void SPECIAL_NOR();
|
||||
void SPECIAL_SLT();
|
||||
void SPECIAL_SLTU();
|
||||
void SPECIAL_DADD();
|
||||
void SPECIAL_DADDU();
|
||||
void SPECIAL_DSUB();
|
||||
void SPECIAL_DSUBU();
|
||||
void SPECIAL_DSLL();
|
||||
void SPECIAL_DSRL();
|
||||
void SPECIAL_DSRA();
|
||||
void SPECIAL_DSLL32();
|
||||
void SPECIAL_DSRL32();
|
||||
void SPECIAL_DSRA32();
|
||||
|
||||
typedef std::map<int32_t, CRegInfo *> RegisterMap;
|
||||
|
||||
RegisterMap m_EnterRegisters;
|
||||
RegisterMap m_ContinueRegisters;
|
||||
RegisterMap m_JumpRegisters;
|
||||
CCodeSection * m_EnterSection;
|
||||
CCodeBlock * m_BlockInfo;
|
||||
uint32_t m_PC;
|
||||
CRegInfo m_Reg;
|
||||
STEP_TYPE m_NextInstruction;
|
||||
OPCODE m_Command;
|
||||
uint32_t m_Test;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||
|
||||
class CCodeSection;
|
||||
class CCodeBlock;
|
||||
|
||||
class LoopAnalysis
|
||||
{
|
||||
public:
|
||||
LoopAnalysis(CCodeBlock * CodeBlock, CCodeSection * Section);
|
||||
~LoopAnalysis();
|
||||
|
||||
bool SetupRegisterForLoop();
|
||||
|
||||
private:
|
||||
LoopAnalysis(); // Disable default constructor
|
||||
LoopAnalysis(const LoopAnalysis&); // Disable copy constructor
|
||||
LoopAnalysis& operator=(const LoopAnalysis&); // Disable assignment
|
||||
|
||||
bool SetupEnterSection(CCodeSection * Section, bool & bChanged, bool & bSkipedSection);
|
||||
bool CheckLoopRegisterUsage(CCodeSection * Section);
|
||||
bool SyncRegState(CRegInfo & RegSet, const CRegInfo& SyncReg);
|
||||
void SetJumpRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
||||
void SetContinueRegSet(CCodeSection * Section, const CRegInfo &Reg);
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
void SPECIAL_SLL();
|
||||
void SPECIAL_SRL();
|
||||
void SPECIAL_SRA();
|
||||
void SPECIAL_SLLV();
|
||||
void SPECIAL_SRLV();
|
||||
void SPECIAL_SRAV();
|
||||
void SPECIAL_JR();
|
||||
void SPECIAL_JALR();
|
||||
void SPECIAL_SYSCALL(CCodeSection * Section);
|
||||
void SPECIAL_BREAK(CCodeSection * Section);
|
||||
void SPECIAL_MFHI();
|
||||
void SPECIAL_MTHI();
|
||||
void SPECIAL_MFLO();
|
||||
void SPECIAL_MTLO();
|
||||
void SPECIAL_DSLLV();
|
||||
void SPECIAL_DSRLV();
|
||||
void SPECIAL_DSRAV();
|
||||
void SPECIAL_ADD();
|
||||
void SPECIAL_ADDU();
|
||||
void SPECIAL_SUB();
|
||||
void SPECIAL_SUBU();
|
||||
void SPECIAL_AND();
|
||||
void SPECIAL_OR();
|
||||
void SPECIAL_XOR();
|
||||
void SPECIAL_NOR();
|
||||
void SPECIAL_SLT();
|
||||
void SPECIAL_SLTU();
|
||||
void SPECIAL_DADD();
|
||||
void SPECIAL_DADDU();
|
||||
void SPECIAL_DSUB();
|
||||
void SPECIAL_DSUBU();
|
||||
void SPECIAL_DSLL();
|
||||
void SPECIAL_DSRL();
|
||||
void SPECIAL_DSRA();
|
||||
void SPECIAL_DSLL32();
|
||||
void SPECIAL_DSRL32();
|
||||
void SPECIAL_DSRA32();
|
||||
|
||||
typedef std::map<int32_t, CRegInfo *> RegisterMap;
|
||||
|
||||
RegisterMap m_EnterRegisters;
|
||||
RegisterMap m_ContinueRegisters;
|
||||
RegisterMap m_JumpRegisters;
|
||||
CCodeSection * m_EnterSection;
|
||||
CCodeBlock * m_BlockInfo;
|
||||
uint32_t m_PC;
|
||||
CRegInfo m_Reg;
|
||||
STEP_TYPE m_NextInstruction;
|
||||
OPCODE m_Command;
|
||||
uint32_t m_Test;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,79 +1,79 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||
#include <Project64-core/N64System/Recompiler/FunctionMapClass.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
||||
#include <Project64-core/N64System/ProfilingClass.h>
|
||||
|
||||
class CRecompiler :
|
||||
protected CDebugSettings,
|
||||
public CRecompilerSettings,
|
||||
public CFunctionMap,
|
||||
private CRecompMemory,
|
||||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
|
||||
enum REMOVE_REASON
|
||||
{
|
||||
Remove_InitialCode,
|
||||
Remove_Cache,
|
||||
Remove_ProtectedMem,
|
||||
Remove_ValidateFunc,
|
||||
Remove_TLB,
|
||||
Remove_DMA,
|
||||
Remove_StoreInstruc,
|
||||
};
|
||||
|
||||
typedef void(*DelayFunc)();
|
||||
|
||||
public:
|
||||
CRecompiler(CRegisters & Registers, CProfiling & Profile, bool & EndEmulation);
|
||||
~CRecompiler();
|
||||
|
||||
void Run();
|
||||
void Reset();
|
||||
void ResetRecompCode(bool bAllocate);
|
||||
|
||||
//Self modifying code methods
|
||||
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 ResetMemoryStackPos();
|
||||
|
||||
uint32_t& MemoryStackPos() { return m_MemoryStack; }
|
||||
|
||||
private:
|
||||
CRecompiler(); // Disable default constructor
|
||||
CRecompiler(const CRecompiler&); // Disable copy constructor
|
||||
CRecompiler& operator=(const CRecompiler&); // Disable assignment
|
||||
|
||||
CCompiledFunc * CompilerCode();
|
||||
|
||||
// Main loops for the different look up methods
|
||||
void RecompilerMain_VirtualTable();
|
||||
void RecompilerMain_VirtualTable_validate();
|
||||
void RecompilerMain_ChangeMemory();
|
||||
void RecompilerMain_Lookup();
|
||||
void RecompilerMain_Lookup_TLB();
|
||||
void RecompilerMain_Lookup_validate();
|
||||
void RecompilerMain_Lookup_validate_TLB();
|
||||
|
||||
CCompiledFuncList m_Functions;
|
||||
CRegisters & m_Registers;
|
||||
CProfiling & m_Profile;
|
||||
bool & m_EndEmulation;
|
||||
uint32_t m_MemoryStack;
|
||||
|
||||
//Quick access to registers
|
||||
uint32_t & PROGRAM_COUNTER;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||
#include <Project64-core/N64System/Recompiler/FunctionMapClass.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
||||
#include <Project64-core/N64System/ProfilingClass.h>
|
||||
|
||||
class CRecompiler :
|
||||
protected CDebugSettings,
|
||||
public CRecompilerSettings,
|
||||
public CFunctionMap,
|
||||
private CRecompMemory,
|
||||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
|
||||
enum REMOVE_REASON
|
||||
{
|
||||
Remove_InitialCode,
|
||||
Remove_Cache,
|
||||
Remove_ProtectedMem,
|
||||
Remove_ValidateFunc,
|
||||
Remove_TLB,
|
||||
Remove_DMA,
|
||||
Remove_StoreInstruc,
|
||||
};
|
||||
|
||||
typedef void(*DelayFunc)();
|
||||
|
||||
public:
|
||||
CRecompiler(CRegisters & Registers, CProfiling & Profile, bool & EndEmulation);
|
||||
~CRecompiler();
|
||||
|
||||
void Run();
|
||||
void Reset();
|
||||
void ResetRecompCode(bool bAllocate);
|
||||
|
||||
//Self modifying code methods
|
||||
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 ResetMemoryStackPos();
|
||||
|
||||
uint32_t& MemoryStackPos() { return m_MemoryStack; }
|
||||
|
||||
private:
|
||||
CRecompiler(); // Disable default constructor
|
||||
CRecompiler(const CRecompiler&); // Disable copy constructor
|
||||
CRecompiler& operator=(const CRecompiler&); // Disable assignment
|
||||
|
||||
CCompiledFunc * CompilerCode();
|
||||
|
||||
// Main loops for the different look up methods
|
||||
void RecompilerMain_VirtualTable();
|
||||
void RecompilerMain_VirtualTable_validate();
|
||||
void RecompilerMain_ChangeMemory();
|
||||
void RecompilerMain_Lookup();
|
||||
void RecompilerMain_Lookup_TLB();
|
||||
void RecompilerMain_Lookup_validate();
|
||||
void RecompilerMain_Lookup_validate_TLB();
|
||||
|
||||
CCompiledFuncList m_Functions;
|
||||
CRegisters & m_Registers;
|
||||
CProfiling & m_Profile;
|
||||
bool & m_EndEmulation;
|
||||
uint32_t m_MemoryStack;
|
||||
|
||||
//Quick access to registers
|
||||
uint32_t & PROGRAM_COUNTER;
|
||||
};
|
||||
|
|
|
@ -1,95 +1,95 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerClass.h>
|
||||
#include <Common/MemoryManagement.h>
|
||||
|
||||
CRecompMemory::CRecompMemory() :
|
||||
m_RecompCode(NULL),
|
||||
m_RecompSize(0)
|
||||
{
|
||||
m_RecompPos = NULL;
|
||||
}
|
||||
|
||||
CRecompMemory::~CRecompMemory()
|
||||
{
|
||||
if (m_RecompCode)
|
||||
{
|
||||
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
|
||||
m_RecompCode = NULL;
|
||||
}
|
||||
m_RecompPos = NULL;
|
||||
}
|
||||
|
||||
bool CRecompMemory::AllocateMemory()
|
||||
{
|
||||
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
|
||||
if (RecompCodeBase == NULL)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
|
||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||
if (m_RecompCode == NULL)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
|
||||
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
|
||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||
return false;
|
||||
}
|
||||
m_RecompSize = InitialCompileBufferSize;
|
||||
m_RecompPos = m_RecompCode;
|
||||
memset(m_RecompCode, 0, InitialCompileBufferSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CRecompMemory::CheckRecompMem()
|
||||
{
|
||||
uint32_t Size = (uint32_t)((uint8_t *)m_RecompPos - (uint8_t *)m_RecompCode);
|
||||
if ((Size + 0x20000) < m_RecompSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_RecompSize == MaxCompileBufferSize)
|
||||
{
|
||||
g_Recompiler->ResetRecompCode(true);
|
||||
return;
|
||||
}
|
||||
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||
if (MemAddr == NULL)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
|
||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||
}
|
||||
m_RecompSize += IncreaseCompileBufferSize;
|
||||
}
|
||||
|
||||
void CRecompMemory::Reset()
|
||||
{
|
||||
m_RecompPos = m_RecompCode;
|
||||
}
|
||||
|
||||
void CRecompMemory::ShowMemUsed()
|
||||
{
|
||||
uint32_t Size = m_RecompPos - m_RecompCode;
|
||||
uint32_t MB = Size / 0x100000;
|
||||
Size -= MB * 0x100000;
|
||||
uint32_t KB = Size / 1024;
|
||||
Size -= KB * 1024;
|
||||
|
||||
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());
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerMemory.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Recompiler/RecompilerClass.h>
|
||||
#include <Common/MemoryManagement.h>
|
||||
|
||||
CRecompMemory::CRecompMemory() :
|
||||
m_RecompCode(NULL),
|
||||
m_RecompSize(0)
|
||||
{
|
||||
m_RecompPos = NULL;
|
||||
}
|
||||
|
||||
CRecompMemory::~CRecompMemory()
|
||||
{
|
||||
if (m_RecompCode)
|
||||
{
|
||||
FreeAddressSpace(m_RecompCode,MaxCompileBufferSize + 4);
|
||||
m_RecompCode = NULL;
|
||||
}
|
||||
m_RecompPos = NULL;
|
||||
}
|
||||
|
||||
bool CRecompMemory::AllocateMemory()
|
||||
{
|
||||
uint8_t * RecompCodeBase = (uint8_t *)AllocateAddressSpace(MaxCompileBufferSize + 4);
|
||||
if (RecompCodeBase == NULL)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to allocate RecompCodeBase");
|
||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_RecompCode = (uint8_t *)CommitMemory(RecompCodeBase, InitialCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||
if (m_RecompCode == NULL)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to commit initial buffer");
|
||||
FreeAddressSpace(RecompCodeBase,MaxCompileBufferSize + 4);
|
||||
g_Notify->DisplayError(MSG_MEM_ALLOC_ERROR);
|
||||
return false;
|
||||
}
|
||||
m_RecompSize = InitialCompileBufferSize;
|
||||
m_RecompPos = m_RecompCode;
|
||||
memset(m_RecompCode, 0, InitialCompileBufferSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CRecompMemory::CheckRecompMem()
|
||||
{
|
||||
uint32_t Size = (uint32_t)((uint8_t *)m_RecompPos - (uint8_t *)m_RecompCode);
|
||||
if ((Size + 0x20000) < m_RecompSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_RecompSize == MaxCompileBufferSize)
|
||||
{
|
||||
g_Recompiler->ResetRecompCode(true);
|
||||
return;
|
||||
}
|
||||
void * MemAddr = CommitMemory(m_RecompCode + m_RecompSize, IncreaseCompileBufferSize, MEM_EXECUTE_READWRITE);
|
||||
if (MemAddr == NULL)
|
||||
{
|
||||
WriteTrace(TraceRecompiler, TraceError, "failed to increase buffer");
|
||||
g_Notify->FatalError(MSG_MEM_ALLOC_ERROR);
|
||||
}
|
||||
m_RecompSize += IncreaseCompileBufferSize;
|
||||
}
|
||||
|
||||
void CRecompMemory::Reset()
|
||||
{
|
||||
m_RecompPos = m_RecompCode;
|
||||
}
|
||||
|
||||
void CRecompMemory::ShowMemUsed()
|
||||
{
|
||||
uint32_t Size = m_RecompPos - m_RecompCode;
|
||||
uint32_t MB = Size / 0x100000;
|
||||
Size -= MB * 0x100000;
|
||||
uint32_t KB = Size / 1024;
|
||||
Size -= KB * 1024;
|
||||
|
||||
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());
|
||||
}
|
|
@ -1,38 +1,38 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
|
||||
class CRecompMemory :
|
||||
protected CX86Ops
|
||||
{
|
||||
protected:
|
||||
CRecompMemory();
|
||||
~CRecompMemory();
|
||||
|
||||
bool AllocateMemory();
|
||||
void CheckRecompMem();
|
||||
void Reset();
|
||||
void ShowMemUsed();
|
||||
|
||||
uint8_t* RecompPos() const { return m_RecompPos; }
|
||||
|
||||
private:
|
||||
CRecompMemory(const CRecompMemory&); // Disable copy constructor
|
||||
CRecompMemory& operator=(const CRecompMemory&); // Disable assignment
|
||||
|
||||
uint8_t * m_RecompCode;
|
||||
uint32_t m_RecompSize;
|
||||
|
||||
enum { MaxCompileBufferSize = 0x03C00000 };
|
||||
enum { InitialCompileBufferSize = 0x00500000 };
|
||||
enum { IncreaseCompileBufferSize = 0x00100000 };
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
|
||||
class CRecompMemory :
|
||||
protected CX86Ops
|
||||
{
|
||||
protected:
|
||||
CRecompMemory();
|
||||
~CRecompMemory();
|
||||
|
||||
bool AllocateMemory();
|
||||
void CheckRecompMem();
|
||||
void Reset();
|
||||
void ShowMemUsed();
|
||||
|
||||
uint8_t* RecompPos() const { return m_RecompPos; }
|
||||
|
||||
private:
|
||||
CRecompMemory(const CRecompMemory&); // Disable copy constructor
|
||||
CRecompMemory& operator=(const CRecompMemory&); // Disable assignment
|
||||
|
||||
uint8_t * m_RecompCode;
|
||||
uint32_t m_RecompSize;
|
||||
|
||||
enum { MaxCompileBufferSize = 0x03C00000 };
|
||||
enum { InitialCompileBufferSize = 0x00500000 };
|
||||
enum { IncreaseCompileBufferSize = 0x00100000 };
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,335 +1,335 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
#include <Project64-core/Settings/N64SystemSettings.h>
|
||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||
|
||||
class CCodeSection;
|
||||
|
||||
class CRecompilerOps :
|
||||
protected CDebugSettings,
|
||||
protected CX86Ops,
|
||||
protected CSystemRegisters,
|
||||
protected CN64SystemSettings,
|
||||
protected CRecompilerSettings
|
||||
{
|
||||
protected:
|
||||
enum BRANCH_TYPE
|
||||
{
|
||||
BranchTypeCop1, BranchTypeRs, BranchTypeRsRt
|
||||
};
|
||||
|
||||
typedef void ( * BranchFunction )();
|
||||
|
||||
/************************** Branch functions ************************/
|
||||
static void Compile_Branch ( BranchFunction CompareFunc, BRANCH_TYPE BranchType, bool Link);
|
||||
static void Compile_BranchLikely ( BranchFunction CompareFunc, bool Link);
|
||||
static void BNE_Compare();
|
||||
static void BEQ_Compare();
|
||||
static void BGTZ_Compare();
|
||||
static void BLEZ_Compare();
|
||||
static void BLTZ_Compare();
|
||||
static void BGEZ_Compare();
|
||||
static void COP1_BCF_Compare();
|
||||
static void COP1_BCT_Compare();
|
||||
|
||||
/************************* OpCode functions *************************/
|
||||
static void J ();
|
||||
static void JAL ();
|
||||
static void ADDI ();
|
||||
static void ADDIU ();
|
||||
static void SLTI ();
|
||||
static void SLTIU ();
|
||||
static void ANDI ();
|
||||
static void ORI ();
|
||||
static void XORI ();
|
||||
static void LUI ();
|
||||
static void DADDIU ();
|
||||
// static void LDL ();
|
||||
// static void LDR ();
|
||||
// static void LB ();
|
||||
// static void LH ();
|
||||
// static void LWL ();
|
||||
// static void LW ();
|
||||
// static void LBU ();
|
||||
// static void LHU ();
|
||||
// static void LWR ();
|
||||
// static void LWU (); //added by Witten
|
||||
// static void SB ();
|
||||
// static void SH ();
|
||||
// static void SWL ();
|
||||
// static void SW ();
|
||||
// static void SWR ();
|
||||
// static void SDL ();
|
||||
// static void SDR ();
|
||||
static void CACHE ();
|
||||
// static void LL ();
|
||||
// static void LWC1 ();
|
||||
// static void LDC1 ();
|
||||
// static void LD ();
|
||||
// static void SC ();
|
||||
// static void SWC1 ();
|
||||
// static void SDC1 ();
|
||||
// static void SD ();
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
static void SPECIAL_SLL ();
|
||||
static void SPECIAL_SRL ();
|
||||
static void SPECIAL_SRA ();
|
||||
static void SPECIAL_SLLV ();
|
||||
static void SPECIAL_SRLV ();
|
||||
static void SPECIAL_SRAV ();
|
||||
static void SPECIAL_JR ();
|
||||
static void SPECIAL_JALR ();
|
||||
static void SPECIAL_SYSCALL();
|
||||
static void SPECIAL_MFLO ();
|
||||
static void SPECIAL_MTLO ();
|
||||
static void SPECIAL_MFHI ();
|
||||
static void SPECIAL_MTHI ();
|
||||
static void SPECIAL_DSLLV ();
|
||||
static void SPECIAL_DSRLV ();
|
||||
static void SPECIAL_DSRAV ();
|
||||
static void SPECIAL_MULT ();
|
||||
static void SPECIAL_MULTU ();
|
||||
static void SPECIAL_DIV ();
|
||||
static void SPECIAL_DIVU ();
|
||||
static void SPECIAL_DMULT ();
|
||||
static void SPECIAL_DMULTU ();
|
||||
static void SPECIAL_DDIV ();
|
||||
static void SPECIAL_DDIVU ();
|
||||
static void SPECIAL_ADD ();
|
||||
static void SPECIAL_ADDU ();
|
||||
static void SPECIAL_SUB ();
|
||||
static void SPECIAL_SUBU ();
|
||||
static void SPECIAL_AND ();
|
||||
static void SPECIAL_OR ();
|
||||
static void SPECIAL_XOR ();
|
||||
static void SPECIAL_NOR ();
|
||||
static void SPECIAL_SLT ();
|
||||
static void SPECIAL_SLTU ();
|
||||
static void SPECIAL_DADD ();
|
||||
static void SPECIAL_DADDU ();
|
||||
static void SPECIAL_DSUB ();
|
||||
static void SPECIAL_DSUBU ();
|
||||
static void SPECIAL_DSLL ();
|
||||
static void SPECIAL_DSRL ();
|
||||
static void SPECIAL_DSRA ();
|
||||
static void SPECIAL_DSLL32 ();
|
||||
static void SPECIAL_DSRL32 ();
|
||||
static void SPECIAL_DSRA32 ();
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
static void COP0_MF ();
|
||||
static void COP0_MT ();
|
||||
|
||||
/************************** COP0 CO functions ***********************/
|
||||
static void COP0_CO_TLBR ();
|
||||
static void COP0_CO_TLBWI ();
|
||||
static void COP0_CO_TLBWR ();
|
||||
static void COP0_CO_TLBP ();
|
||||
static void COP0_CO_ERET ();
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
static void COP1_MF ();
|
||||
static void COP1_DMF ();
|
||||
static void COP1_CF ();
|
||||
static void COP1_MT ();
|
||||
static void COP1_DMT ();
|
||||
static void COP1_CT ();
|
||||
|
||||
/************************** COP1: S functions ************************/
|
||||
static void COP1_S_ADD ();
|
||||
static void COP1_S_SUB ();
|
||||
static void COP1_S_MUL ();
|
||||
static void COP1_S_DIV ();
|
||||
static void COP1_S_ABS ();
|
||||
static void COP1_S_NEG ();
|
||||
static void COP1_S_SQRT ();
|
||||
static void COP1_S_MOV ();
|
||||
static void COP1_S_TRUNC_L ();
|
||||
static void COP1_S_CEIL_L (); //added by Witten
|
||||
static void COP1_S_FLOOR_L (); //added by Witten
|
||||
static void COP1_S_ROUND_W ();
|
||||
static void COP1_S_TRUNC_W ();
|
||||
static void COP1_S_CEIL_W (); //added by Witten
|
||||
static void COP1_S_FLOOR_W ();
|
||||
static void COP1_S_CVT_D ();
|
||||
static void COP1_S_CVT_W ();
|
||||
static void COP1_S_CVT_L ();
|
||||
static void COP1_S_CMP ();
|
||||
|
||||
/************************** COP1: D functions ************************/
|
||||
static void COP1_D_ADD ();
|
||||
static void COP1_D_SUB ();
|
||||
static void COP1_D_MUL ();
|
||||
static void COP1_D_DIV ();
|
||||
static void COP1_D_ABS ();
|
||||
static void COP1_D_NEG ();
|
||||
static void COP1_D_SQRT ();
|
||||
static void COP1_D_MOV ();
|
||||
static void COP1_D_TRUNC_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_ROUND_W ();
|
||||
static void COP1_D_TRUNC_W ();
|
||||
static void COP1_D_CEIL_W (); //added by Witten
|
||||
static void COP1_D_FLOOR_W (); //added by Witten
|
||||
static void COP1_D_CVT_S ();
|
||||
static void COP1_D_CVT_W ();
|
||||
static void COP1_D_CVT_L ();
|
||||
static void COP1_D_CMP ();
|
||||
|
||||
/************************** COP1: W functions ************************/
|
||||
static void COP1_W_CVT_S ();
|
||||
static void COP1_W_CVT_D ();
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
static void COP1_L_CVT_S ();
|
||||
static void COP1_L_CVT_D ();
|
||||
|
||||
/************************** Other functions **************************/
|
||||
static void UnknownOpcode ();
|
||||
|
||||
static void BeforeCallDirect(CRegInfo & RegSet);
|
||||
static void AfterCallDirect(CRegInfo & RegSet);
|
||||
static void EnterCodeBlock();
|
||||
static void ExitCodeBlock();
|
||||
static void CompileReadTLBMiss(uint32_t VirtualAddress, x86Reg LookUpReg);
|
||||
static void CompileReadTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||
static void CompileWriteTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
||||
static void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
|
||||
static void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
||||
static void ChangeDefaultRoundingModel();
|
||||
static void OverflowDelaySlot(bool TestTimer);
|
||||
|
||||
static STEP_TYPE m_NextInstruction;
|
||||
static uint32_t m_CompilePC;
|
||||
static OPCODE m_Opcode;
|
||||
static CRegInfo m_RegWorkingSet;
|
||||
static uint32_t m_BranchCompare;
|
||||
static CCodeSection * m_Section;
|
||||
|
||||
/********* Helper Functions *********/
|
||||
typedef CRegInfo::REG_STATE REG_STATE;
|
||||
|
||||
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 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 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 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 GetMipsRegMapHi ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegMapHi(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 IsMapped ( int32_t Reg ) { return m_RegWorkingSet.IsMapped(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 IsUnsigned ( int32_t Reg ) { return m_RegWorkingSet.IsUnsigned(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 Is32BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
||||
static bool Is64BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
||||
|
||||
static void FixRoundModel ( CRegInfo::FPU_ROUND RoundMethod )
|
||||
{
|
||||
m_RegWorkingSet.FixRoundModel(RoundMethod);
|
||||
}
|
||||
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);
|
||||
}
|
||||
static void Load_FPR_ToTop ( int32_t Reg, int32_t RegToLoad, CRegInfo::FPU_STATE Format)
|
||||
{
|
||||
m_RegWorkingSet.Load_FPR_ToTop(Reg,RegToLoad,Format);
|
||||
}
|
||||
static bool RegInStack ( int32_t Reg, CRegInfo::FPU_STATE Format )
|
||||
{
|
||||
return m_RegWorkingSet.RegInStack(Reg,Format);
|
||||
}
|
||||
static x86FpuValues StackPosition ( int32_t Reg )
|
||||
{
|
||||
return m_RegWorkingSet.StackPosition(Reg);
|
||||
}
|
||||
static void UnMap_AllFPRs()
|
||||
{
|
||||
m_RegWorkingSet.UnMap_AllFPRs();
|
||||
}
|
||||
static void UnMap_FPR ( uint32_t Reg, bool WriteBackValue )
|
||||
{
|
||||
m_RegWorkingSet.UnMap_FPR(Reg,WriteBackValue);
|
||||
}
|
||||
|
||||
static x86Reg FreeX86Reg()
|
||||
{
|
||||
return m_RegWorkingSet.FreeX86Reg();
|
||||
}
|
||||
static x86Reg Free8BitX86Reg()
|
||||
{
|
||||
return m_RegWorkingSet.Free8BitX86Reg();
|
||||
}
|
||||
static void Map_GPR_32bit ( int32_t Reg, bool SignValue, int32_t MipsRegToLoad )
|
||||
{
|
||||
m_RegWorkingSet.Map_GPR_32bit(Reg,SignValue,MipsRegToLoad);
|
||||
}
|
||||
static void Map_GPR_64bit ( int32_t Reg, int32_t MipsRegToLoad )
|
||||
{
|
||||
m_RegWorkingSet.Map_GPR_64bit(Reg,MipsRegToLoad);
|
||||
}
|
||||
static x86Reg Get_MemoryStack()
|
||||
{
|
||||
return m_RegWorkingSet.Get_MemoryStack();
|
||||
}
|
||||
static x86Reg Map_MemoryStack ( x86Reg Reg, bool bMapRegister, bool LoadValue = true )
|
||||
{
|
||||
return m_RegWorkingSet.Map_MemoryStack(Reg,bMapRegister,LoadValue);
|
||||
}
|
||||
static x86Reg Map_TempReg ( x86Reg Reg, int32_t MipsReg, bool LoadHiWord )
|
||||
{
|
||||
return m_RegWorkingSet.Map_TempReg(Reg,MipsReg,LoadHiWord);
|
||||
}
|
||||
static void ProtectGPR ( uint32_t Reg )
|
||||
{
|
||||
m_RegWorkingSet.ProtectGPR(Reg);
|
||||
}
|
||||
static void UnProtectGPR ( uint32_t Reg )
|
||||
{
|
||||
m_RegWorkingSet.UnProtectGPR(Reg);
|
||||
}
|
||||
static void ResetX86Protection()
|
||||
{
|
||||
m_RegWorkingSet.ResetX86Protection();
|
||||
}
|
||||
static x86Reg UnMap_TempReg()
|
||||
{
|
||||
return m_RegWorkingSet.UnMap_TempReg();
|
||||
}
|
||||
static void UnMap_GPR ( uint32_t Reg, bool WriteBackValue )
|
||||
{
|
||||
m_RegWorkingSet.UnMap_GPR(Reg,WriteBackValue);
|
||||
}
|
||||
static bool UnMap_X86reg ( x86Reg Reg )
|
||||
{
|
||||
return m_RegWorkingSet.UnMap_X86reg(Reg);
|
||||
}
|
||||
|
||||
public:
|
||||
static uint32_t CompilePC() { return m_CompilePC; }
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||
#include <Project64-core/N64System/Recompiler/RegInfo.h>
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
#include <Project64-core/Settings/N64SystemSettings.h>
|
||||
#include <Project64-core/Settings/RecompilerSettings.h>
|
||||
|
||||
class CCodeSection;
|
||||
|
||||
class CRecompilerOps :
|
||||
protected CDebugSettings,
|
||||
protected CX86Ops,
|
||||
protected CSystemRegisters,
|
||||
protected CN64SystemSettings,
|
||||
protected CRecompilerSettings
|
||||
{
|
||||
protected:
|
||||
enum BRANCH_TYPE
|
||||
{
|
||||
BranchTypeCop1, BranchTypeRs, BranchTypeRsRt
|
||||
};
|
||||
|
||||
typedef void ( * BranchFunction )();
|
||||
|
||||
/************************** Branch functions ************************/
|
||||
static void Compile_Branch ( BranchFunction CompareFunc, BRANCH_TYPE BranchType, bool Link);
|
||||
static void Compile_BranchLikely ( BranchFunction CompareFunc, bool Link);
|
||||
static void BNE_Compare();
|
||||
static void BEQ_Compare();
|
||||
static void BGTZ_Compare();
|
||||
static void BLEZ_Compare();
|
||||
static void BLTZ_Compare();
|
||||
static void BGEZ_Compare();
|
||||
static void COP1_BCF_Compare();
|
||||
static void COP1_BCT_Compare();
|
||||
|
||||
/************************* OpCode functions *************************/
|
||||
static void J ();
|
||||
static void JAL ();
|
||||
static void ADDI ();
|
||||
static void ADDIU ();
|
||||
static void SLTI ();
|
||||
static void SLTIU ();
|
||||
static void ANDI ();
|
||||
static void ORI ();
|
||||
static void XORI ();
|
||||
static void LUI ();
|
||||
static void DADDIU ();
|
||||
// static void LDL ();
|
||||
// static void LDR ();
|
||||
// static void LB ();
|
||||
// static void LH ();
|
||||
// static void LWL ();
|
||||
// static void LW ();
|
||||
// static void LBU ();
|
||||
// static void LHU ();
|
||||
// static void LWR ();
|
||||
// static void LWU (); //added by Witten
|
||||
// static void SB ();
|
||||
// static void SH ();
|
||||
// static void SWL ();
|
||||
// static void SW ();
|
||||
// static void SWR ();
|
||||
// static void SDL ();
|
||||
// static void SDR ();
|
||||
static void CACHE ();
|
||||
// static void LL ();
|
||||
// static void LWC1 ();
|
||||
// static void LDC1 ();
|
||||
// static void LD ();
|
||||
// static void SC ();
|
||||
// static void SWC1 ();
|
||||
// static void SDC1 ();
|
||||
// static void SD ();
|
||||
|
||||
/********************** R4300i OpCodes: Special **********************/
|
||||
static void SPECIAL_SLL ();
|
||||
static void SPECIAL_SRL ();
|
||||
static void SPECIAL_SRA ();
|
||||
static void SPECIAL_SLLV ();
|
||||
static void SPECIAL_SRLV ();
|
||||
static void SPECIAL_SRAV ();
|
||||
static void SPECIAL_JR ();
|
||||
static void SPECIAL_JALR ();
|
||||
static void SPECIAL_SYSCALL();
|
||||
static void SPECIAL_MFLO ();
|
||||
static void SPECIAL_MTLO ();
|
||||
static void SPECIAL_MFHI ();
|
||||
static void SPECIAL_MTHI ();
|
||||
static void SPECIAL_DSLLV ();
|
||||
static void SPECIAL_DSRLV ();
|
||||
static void SPECIAL_DSRAV ();
|
||||
static void SPECIAL_MULT ();
|
||||
static void SPECIAL_MULTU ();
|
||||
static void SPECIAL_DIV ();
|
||||
static void SPECIAL_DIVU ();
|
||||
static void SPECIAL_DMULT ();
|
||||
static void SPECIAL_DMULTU ();
|
||||
static void SPECIAL_DDIV ();
|
||||
static void SPECIAL_DDIVU ();
|
||||
static void SPECIAL_ADD ();
|
||||
static void SPECIAL_ADDU ();
|
||||
static void SPECIAL_SUB ();
|
||||
static void SPECIAL_SUBU ();
|
||||
static void SPECIAL_AND ();
|
||||
static void SPECIAL_OR ();
|
||||
static void SPECIAL_XOR ();
|
||||
static void SPECIAL_NOR ();
|
||||
static void SPECIAL_SLT ();
|
||||
static void SPECIAL_SLTU ();
|
||||
static void SPECIAL_DADD ();
|
||||
static void SPECIAL_DADDU ();
|
||||
static void SPECIAL_DSUB ();
|
||||
static void SPECIAL_DSUBU ();
|
||||
static void SPECIAL_DSLL ();
|
||||
static void SPECIAL_DSRL ();
|
||||
static void SPECIAL_DSRA ();
|
||||
static void SPECIAL_DSLL32 ();
|
||||
static void SPECIAL_DSRL32 ();
|
||||
static void SPECIAL_DSRA32 ();
|
||||
|
||||
/************************** COP0 functions **************************/
|
||||
static void COP0_MF ();
|
||||
static void COP0_MT ();
|
||||
|
||||
/************************** COP0 CO functions ***********************/
|
||||
static void COP0_CO_TLBR ();
|
||||
static void COP0_CO_TLBWI ();
|
||||
static void COP0_CO_TLBWR ();
|
||||
static void COP0_CO_TLBP ();
|
||||
static void COP0_CO_ERET ();
|
||||
|
||||
/************************** COP1 functions **************************/
|
||||
static void COP1_MF ();
|
||||
static void COP1_DMF ();
|
||||
static void COP1_CF ();
|
||||
static void COP1_MT ();
|
||||
static void COP1_DMT ();
|
||||
static void COP1_CT ();
|
||||
|
||||
/************************** COP1: S functions ************************/
|
||||
static void COP1_S_ADD ();
|
||||
static void COP1_S_SUB ();
|
||||
static void COP1_S_MUL ();
|
||||
static void COP1_S_DIV ();
|
||||
static void COP1_S_ABS ();
|
||||
static void COP1_S_NEG ();
|
||||
static void COP1_S_SQRT ();
|
||||
static void COP1_S_MOV ();
|
||||
static void COP1_S_TRUNC_L ();
|
||||
static void COP1_S_CEIL_L (); //added by Witten
|
||||
static void COP1_S_FLOOR_L (); //added by Witten
|
||||
static void COP1_S_ROUND_W ();
|
||||
static void COP1_S_TRUNC_W ();
|
||||
static void COP1_S_CEIL_W (); //added by Witten
|
||||
static void COP1_S_FLOOR_W ();
|
||||
static void COP1_S_CVT_D ();
|
||||
static void COP1_S_CVT_W ();
|
||||
static void COP1_S_CVT_L ();
|
||||
static void COP1_S_CMP ();
|
||||
|
||||
/************************** COP1: D functions ************************/
|
||||
static void COP1_D_ADD ();
|
||||
static void COP1_D_SUB ();
|
||||
static void COP1_D_MUL ();
|
||||
static void COP1_D_DIV ();
|
||||
static void COP1_D_ABS ();
|
||||
static void COP1_D_NEG ();
|
||||
static void COP1_D_SQRT ();
|
||||
static void COP1_D_MOV ();
|
||||
static void COP1_D_TRUNC_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_ROUND_W ();
|
||||
static void COP1_D_TRUNC_W ();
|
||||
static void COP1_D_CEIL_W (); //added by Witten
|
||||
static void COP1_D_FLOOR_W (); //added by Witten
|
||||
static void COP1_D_CVT_S ();
|
||||
static void COP1_D_CVT_W ();
|
||||
static void COP1_D_CVT_L ();
|
||||
static void COP1_D_CMP ();
|
||||
|
||||
/************************** COP1: W functions ************************/
|
||||
static void COP1_W_CVT_S ();
|
||||
static void COP1_W_CVT_D ();
|
||||
|
||||
/************************** COP1: L functions ************************/
|
||||
static void COP1_L_CVT_S ();
|
||||
static void COP1_L_CVT_D ();
|
||||
|
||||
/************************** Other functions **************************/
|
||||
static void UnknownOpcode ();
|
||||
|
||||
static void BeforeCallDirect(CRegInfo & RegSet);
|
||||
static void AfterCallDirect(CRegInfo & RegSet);
|
||||
static void EnterCodeBlock();
|
||||
static void ExitCodeBlock();
|
||||
static void CompileReadTLBMiss(uint32_t VirtualAddress, x86Reg LookUpReg);
|
||||
static void CompileReadTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||
static void CompileWriteTLBMiss(x86Reg AddressReg, x86Reg LookUpReg);
|
||||
static void UpdateSyncCPU(CRegInfo & RegSet, uint32_t Cycles);
|
||||
static void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false);
|
||||
static void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet);
|
||||
static void ChangeDefaultRoundingModel();
|
||||
static void OverflowDelaySlot(bool TestTimer);
|
||||
|
||||
static STEP_TYPE m_NextInstruction;
|
||||
static uint32_t m_CompilePC;
|
||||
static OPCODE m_Opcode;
|
||||
static CRegInfo m_RegWorkingSet;
|
||||
static uint32_t m_BranchCompare;
|
||||
static CCodeSection * m_Section;
|
||||
|
||||
/********* Helper Functions *********/
|
||||
typedef CRegInfo::REG_STATE REG_STATE;
|
||||
|
||||
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 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 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 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 GetMipsRegMapHi ( int32_t Reg ) { return m_RegWorkingSet.GetMipsRegMapHi(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 IsMapped ( int32_t Reg ) { return m_RegWorkingSet.IsMapped(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 IsUnsigned ( int32_t Reg ) { return m_RegWorkingSet.IsUnsigned(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 Is32BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is32BitMapped(Reg); }
|
||||
static bool Is64BitMapped ( int32_t Reg ) { return m_RegWorkingSet.Is64BitMapped(Reg); }
|
||||
|
||||
static void FixRoundModel ( CRegInfo::FPU_ROUND RoundMethod )
|
||||
{
|
||||
m_RegWorkingSet.FixRoundModel(RoundMethod);
|
||||
}
|
||||
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);
|
||||
}
|
||||
static void Load_FPR_ToTop ( int32_t Reg, int32_t RegToLoad, CRegInfo::FPU_STATE Format)
|
||||
{
|
||||
m_RegWorkingSet.Load_FPR_ToTop(Reg,RegToLoad,Format);
|
||||
}
|
||||
static bool RegInStack ( int32_t Reg, CRegInfo::FPU_STATE Format )
|
||||
{
|
||||
return m_RegWorkingSet.RegInStack(Reg,Format);
|
||||
}
|
||||
static x86FpuValues StackPosition ( int32_t Reg )
|
||||
{
|
||||
return m_RegWorkingSet.StackPosition(Reg);
|
||||
}
|
||||
static void UnMap_AllFPRs()
|
||||
{
|
||||
m_RegWorkingSet.UnMap_AllFPRs();
|
||||
}
|
||||
static void UnMap_FPR ( uint32_t Reg, bool WriteBackValue )
|
||||
{
|
||||
m_RegWorkingSet.UnMap_FPR(Reg,WriteBackValue);
|
||||
}
|
||||
|
||||
static x86Reg FreeX86Reg()
|
||||
{
|
||||
return m_RegWorkingSet.FreeX86Reg();
|
||||
}
|
||||
static x86Reg Free8BitX86Reg()
|
||||
{
|
||||
return m_RegWorkingSet.Free8BitX86Reg();
|
||||
}
|
||||
static void Map_GPR_32bit ( int32_t Reg, bool SignValue, int32_t MipsRegToLoad )
|
||||
{
|
||||
m_RegWorkingSet.Map_GPR_32bit(Reg,SignValue,MipsRegToLoad);
|
||||
}
|
||||
static void Map_GPR_64bit ( int32_t Reg, int32_t MipsRegToLoad )
|
||||
{
|
||||
m_RegWorkingSet.Map_GPR_64bit(Reg,MipsRegToLoad);
|
||||
}
|
||||
static x86Reg Get_MemoryStack()
|
||||
{
|
||||
return m_RegWorkingSet.Get_MemoryStack();
|
||||
}
|
||||
static x86Reg Map_MemoryStack ( x86Reg Reg, bool bMapRegister, bool LoadValue = true )
|
||||
{
|
||||
return m_RegWorkingSet.Map_MemoryStack(Reg,bMapRegister,LoadValue);
|
||||
}
|
||||
static x86Reg Map_TempReg ( x86Reg Reg, int32_t MipsReg, bool LoadHiWord )
|
||||
{
|
||||
return m_RegWorkingSet.Map_TempReg(Reg,MipsReg,LoadHiWord);
|
||||
}
|
||||
static void ProtectGPR ( uint32_t Reg )
|
||||
{
|
||||
m_RegWorkingSet.ProtectGPR(Reg);
|
||||
}
|
||||
static void UnProtectGPR ( uint32_t Reg )
|
||||
{
|
||||
m_RegWorkingSet.UnProtectGPR(Reg);
|
||||
}
|
||||
static void ResetX86Protection()
|
||||
{
|
||||
m_RegWorkingSet.ResetX86Protection();
|
||||
}
|
||||
static x86Reg UnMap_TempReg()
|
||||
{
|
||||
return m_RegWorkingSet.UnMap_TempReg();
|
||||
}
|
||||
static void UnMap_GPR ( uint32_t Reg, bool WriteBackValue )
|
||||
{
|
||||
m_RegWorkingSet.UnMap_GPR(Reg,WriteBackValue);
|
||||
}
|
||||
static bool UnMap_X86reg ( x86Reg Reg )
|
||||
{
|
||||
return m_RegWorkingSet.UnMap_X86reg(Reg);
|
||||
}
|
||||
|
||||
public:
|
||||
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. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
|
||||
class CRegInfo :
|
||||
private CDebugSettings,
|
||||
private CX86Ops,
|
||||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
//enums
|
||||
enum REG_STATE
|
||||
{
|
||||
STATE_UNKNOWN = 0x00,
|
||||
STATE_KNOWN_VALUE = 0x01,
|
||||
STATE_X86_MAPPED = 0x02,
|
||||
STATE_SIGN = 0x04,
|
||||
STATE_32BIT = 0x08,
|
||||
STATE_MODIFIED = 0x10,
|
||||
|
||||
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_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_SIGN = (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN), // = 13
|
||||
STATE_CONST_64 = (STATE_KNOWN_VALUE), // = 1
|
||||
};
|
||||
|
||||
enum REG_MAPPED
|
||||
{
|
||||
NotMapped = 0,
|
||||
GPR_Mapped = 1,
|
||||
Temp_Mapped = 2,
|
||||
Stack_Mapped = 3,
|
||||
};
|
||||
|
||||
enum FPU_STATE
|
||||
{
|
||||
FPU_Any = -1,
|
||||
FPU_Unknown = 0,
|
||||
FPU_Dword = 1,
|
||||
FPU_Qword = 2,
|
||||
FPU_Float = 3,
|
||||
FPU_Double = 4,
|
||||
};
|
||||
|
||||
enum FPU_ROUND
|
||||
{
|
||||
RoundUnknown = -1,
|
||||
RoundDefault = 0,
|
||||
RoundTruncate = 1,
|
||||
RoundNearest = 2,
|
||||
RoundDown = 3,
|
||||
RoundUp = 4,
|
||||
};
|
||||
|
||||
public:
|
||||
CRegInfo();
|
||||
CRegInfo(const CRegInfo&);
|
||||
~CRegInfo();
|
||||
|
||||
CRegInfo& operator=(const CRegInfo&);
|
||||
|
||||
bool operator==(const CRegInfo& right) const;
|
||||
bool operator!=(const CRegInfo& right) const;
|
||||
|
||||
static REG_STATE ConstantsType(int64_t Value);
|
||||
|
||||
void FixRoundModel(FPU_ROUND RoundMethod);
|
||||
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);
|
||||
bool RegInStack(int32_t Reg, FPU_STATE Format);
|
||||
void UnMap_AllFPRs();
|
||||
void UnMap_FPR(int32_t Reg, bool WriteBackValue);
|
||||
x86FpuValues StackPosition(int32_t Reg);
|
||||
|
||||
x86Reg FreeX86Reg();
|
||||
x86Reg Free8BitX86Reg();
|
||||
void Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsRegToLoad);
|
||||
void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad);
|
||||
x86Reg Get_MemoryStack() const;
|
||||
x86Reg Map_MemoryStack(x86Reg Reg, bool bMapRegister, bool LoadValue = true);
|
||||
x86Reg Map_TempReg(x86Reg Reg, int32_t MipsReg, bool LoadHiWord);
|
||||
void ProtectGPR(uint32_t Reg);
|
||||
void UnProtectGPR(uint32_t Reg);
|
||||
void ResetX86Protection();
|
||||
x86Reg UnMap_TempReg();
|
||||
void UnMap_GPR(uint32_t Reg, bool WriteBackValue);
|
||||
bool UnMap_X86reg(x86Reg Reg);
|
||||
void WriteBackRegisters();
|
||||
|
||||
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 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 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 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 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 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]; }
|
||||
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; }
|
||||
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]; }
|
||||
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]; }
|
||||
CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) const { return m_RegMapLo[Reg]; }
|
||||
CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; }
|
||||
|
||||
uint32_t GetX86MapOrder(x86Reg Reg) const { return m_x86reg_MapOrder[Reg]; }
|
||||
bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[Reg]; }
|
||||
REG_MAPPED GetX86Mapped(x86Reg Reg) const { return m_x86reg_MappedTo[Reg]; }
|
||||
|
||||
uint32_t GetBlockCycleCount() const { return m_CycleCount; }
|
||||
|
||||
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 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 SetMipsRegMapLo(int32_t GetMipsReg, x86Reg Reg) { m_RegMapLo[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 SetX86MapOrder(x86Reg Reg, uint32_t Order) { m_x86reg_MapOrder[Reg] = Order; }
|
||||
void SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; }
|
||||
void SetX86Mapped(x86Reg Reg, REG_MAPPED Mapping) { m_x86reg_MappedTo[Reg] = Mapping; }
|
||||
|
||||
void SetBlockCycleCount(uint32_t CyleCount) { m_CycleCount = CyleCount; }
|
||||
|
||||
int32_t & StackTopPos() { return m_Stack_TopPos; }
|
||||
int32_t & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; }
|
||||
FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; }
|
||||
FPU_ROUND & FpuRoundingModel(int32_t Reg) { return m_x86fpu_RoundingModel[Reg]; }
|
||||
bool & FpuBeenUsed() { return m_Fpu_Used; }
|
||||
|
||||
FPU_ROUND GetRoundingModel() const { return m_RoundingModel; }
|
||||
void SetRoundingModel(FPU_ROUND RoundingModel) { m_RoundingModel = RoundingModel; }
|
||||
|
||||
private:
|
||||
const char * RoundingModelName(FPU_ROUND RoundType);
|
||||
x86Reg UnMap_8BitTempReg();
|
||||
|
||||
//r4k
|
||||
REG_STATE m_MIPS_RegState[32];
|
||||
MIPS_DWORD m_MIPS_RegVal[32];
|
||||
x86Reg m_RegMapHi[32];
|
||||
x86Reg m_RegMapLo[32];
|
||||
|
||||
REG_MAPPED m_x86reg_MappedTo[10];
|
||||
uint32_t m_x86reg_MapOrder[10];
|
||||
bool m_x86reg_Protected[10];
|
||||
|
||||
uint32_t m_CycleCount;
|
||||
|
||||
//FPU
|
||||
int32_t m_Stack_TopPos;
|
||||
int32_t m_x86fpu_MappedTo[8];
|
||||
FPU_STATE m_x86fpu_State[8];
|
||||
bool m_x86fpu_StateChanged[8];
|
||||
FPU_ROUND m_x86fpu_RoundingModel[8];
|
||||
|
||||
bool m_Fpu_Used;
|
||||
FPU_ROUND m_RoundingModel;
|
||||
|
||||
static uint32_t m_fpuControl;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
|
||||
class CRegInfo :
|
||||
private CDebugSettings,
|
||||
private CX86Ops,
|
||||
private CSystemRegisters
|
||||
{
|
||||
public:
|
||||
//enums
|
||||
enum REG_STATE
|
||||
{
|
||||
STATE_UNKNOWN = 0x00,
|
||||
STATE_KNOWN_VALUE = 0x01,
|
||||
STATE_X86_MAPPED = 0x02,
|
||||
STATE_SIGN = 0x04,
|
||||
STATE_32BIT = 0x08,
|
||||
STATE_MODIFIED = 0x10,
|
||||
|
||||
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_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_SIGN = (STATE_KNOWN_VALUE | STATE_32BIT | STATE_SIGN), // = 13
|
||||
STATE_CONST_64 = (STATE_KNOWN_VALUE), // = 1
|
||||
};
|
||||
|
||||
enum REG_MAPPED
|
||||
{
|
||||
NotMapped = 0,
|
||||
GPR_Mapped = 1,
|
||||
Temp_Mapped = 2,
|
||||
Stack_Mapped = 3,
|
||||
};
|
||||
|
||||
enum FPU_STATE
|
||||
{
|
||||
FPU_Any = -1,
|
||||
FPU_Unknown = 0,
|
||||
FPU_Dword = 1,
|
||||
FPU_Qword = 2,
|
||||
FPU_Float = 3,
|
||||
FPU_Double = 4,
|
||||
};
|
||||
|
||||
enum FPU_ROUND
|
||||
{
|
||||
RoundUnknown = -1,
|
||||
RoundDefault = 0,
|
||||
RoundTruncate = 1,
|
||||
RoundNearest = 2,
|
||||
RoundDown = 3,
|
||||
RoundUp = 4,
|
||||
};
|
||||
|
||||
public:
|
||||
CRegInfo();
|
||||
CRegInfo(const CRegInfo&);
|
||||
~CRegInfo();
|
||||
|
||||
CRegInfo& operator=(const CRegInfo&);
|
||||
|
||||
bool operator==(const CRegInfo& right) const;
|
||||
bool operator!=(const CRegInfo& right) const;
|
||||
|
||||
static REG_STATE ConstantsType(int64_t Value);
|
||||
|
||||
void FixRoundModel(FPU_ROUND RoundMethod);
|
||||
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);
|
||||
bool RegInStack(int32_t Reg, FPU_STATE Format);
|
||||
void UnMap_AllFPRs();
|
||||
void UnMap_FPR(int32_t Reg, bool WriteBackValue);
|
||||
x86FpuValues StackPosition(int32_t Reg);
|
||||
|
||||
x86Reg FreeX86Reg();
|
||||
x86Reg Free8BitX86Reg();
|
||||
void Map_GPR_32bit(int32_t MipsReg, bool SignValue, int32_t MipsRegToLoad);
|
||||
void Map_GPR_64bit(int32_t MipsReg, int32_t MipsRegToLoad);
|
||||
x86Reg Get_MemoryStack() const;
|
||||
x86Reg Map_MemoryStack(x86Reg Reg, bool bMapRegister, bool LoadValue = true);
|
||||
x86Reg Map_TempReg(x86Reg Reg, int32_t MipsReg, bool LoadHiWord);
|
||||
void ProtectGPR(uint32_t Reg);
|
||||
void UnProtectGPR(uint32_t Reg);
|
||||
void ResetX86Protection();
|
||||
x86Reg UnMap_TempReg();
|
||||
void UnMap_GPR(uint32_t Reg, bool WriteBackValue);
|
||||
bool UnMap_X86reg(x86Reg Reg);
|
||||
void WriteBackRegisters();
|
||||
|
||||
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 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 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 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 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 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]; }
|
||||
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; }
|
||||
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]; }
|
||||
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]; }
|
||||
CX86Ops::x86Reg GetMipsRegMapLo(int32_t Reg) const { return m_RegMapLo[Reg]; }
|
||||
CX86Ops::x86Reg GetMipsRegMapHi(int32_t Reg) const { return m_RegMapHi[Reg]; }
|
||||
|
||||
uint32_t GetX86MapOrder(x86Reg Reg) const { return m_x86reg_MapOrder[Reg]; }
|
||||
bool GetX86Protected(x86Reg Reg) const { return m_x86reg_Protected[Reg]; }
|
||||
REG_MAPPED GetX86Mapped(x86Reg Reg) const { return m_x86reg_MappedTo[Reg]; }
|
||||
|
||||
uint32_t GetBlockCycleCount() const { return m_CycleCount; }
|
||||
|
||||
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 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 SetMipsRegMapLo(int32_t GetMipsReg, x86Reg Reg) { m_RegMapLo[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 SetX86MapOrder(x86Reg Reg, uint32_t Order) { m_x86reg_MapOrder[Reg] = Order; }
|
||||
void SetX86Protected(x86Reg Reg, bool Protected) { m_x86reg_Protected[Reg] = Protected; }
|
||||
void SetX86Mapped(x86Reg Reg, REG_MAPPED Mapping) { m_x86reg_MappedTo[Reg] = Mapping; }
|
||||
|
||||
void SetBlockCycleCount(uint32_t CyleCount) { m_CycleCount = CyleCount; }
|
||||
|
||||
int32_t & StackTopPos() { return m_Stack_TopPos; }
|
||||
int32_t & FpuMappedTo(int32_t Reg) { return m_x86fpu_MappedTo[Reg]; }
|
||||
FPU_STATE & FpuState(int32_t Reg) { return m_x86fpu_State[Reg]; }
|
||||
FPU_ROUND & FpuRoundingModel(int32_t Reg) { return m_x86fpu_RoundingModel[Reg]; }
|
||||
bool & FpuBeenUsed() { return m_Fpu_Used; }
|
||||
|
||||
FPU_ROUND GetRoundingModel() const { return m_RoundingModel; }
|
||||
void SetRoundingModel(FPU_ROUND RoundingModel) { m_RoundingModel = RoundingModel; }
|
||||
|
||||
private:
|
||||
const char * RoundingModelName(FPU_ROUND RoundType);
|
||||
x86Reg UnMap_8BitTempReg();
|
||||
|
||||
//r4k
|
||||
REG_STATE m_MIPS_RegState[32];
|
||||
MIPS_DWORD m_MIPS_RegVal[32];
|
||||
x86Reg m_RegMapHi[32];
|
||||
x86Reg m_RegMapLo[32];
|
||||
|
||||
REG_MAPPED m_x86reg_MappedTo[10];
|
||||
uint32_t m_x86reg_MapOrder[10];
|
||||
bool m_x86reg_Protected[10];
|
||||
|
||||
uint32_t m_CycleCount;
|
||||
|
||||
//FPU
|
||||
int32_t m_Stack_TopPos;
|
||||
int32_t m_x86fpu_MappedTo[8];
|
||||
FPU_STATE m_x86fpu_State[8];
|
||||
bool m_x86fpu_StateChanged[8];
|
||||
FPU_ROUND m_x86fpu_RoundingModel[8];
|
||||
|
||||
bool m_Fpu_Used;
|
||||
FPU_ROUND m_RoundingModel;
|
||||
|
||||
static uint32_t m_fpuControl;
|
||||
};
|
||||
|
|
|
@ -1,173 +1,173 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SectionInfo.h"
|
||||
#include "JumpInfo.h"
|
||||
|
||||
CJumpInfo::CJumpInfo()
|
||||
{
|
||||
TargetPC = (uint32_t)-1;
|
||||
JumpPC = (uint32_t)-1;
|
||||
BranchLabel = "";
|
||||
LinkLocation = NULL;
|
||||
LinkLocation2 = NULL;
|
||||
FallThrough = false;
|
||||
PermLoop = false;
|
||||
DoneDelaySlot = false;
|
||||
ExitReason = CExitInfo::Normal;
|
||||
}
|
||||
|
||||
#ifdef legacycode
|
||||
|
||||
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
||||
{
|
||||
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
|
||||
if (!InLoop) { return false; }
|
||||
if (!Parent->InLoop) { return false; }
|
||||
if (Parent->ParentSection.empty()) { return false; }
|
||||
if (this == Parent) { return true; }
|
||||
if (Parent->Test == Test) { return true; }
|
||||
Parent->Test = Test;
|
||||
|
||||
for (SECTION_LIST::iterator iter = Parent->ParentSection.begin(); iter != Parent->ParentSection.end(); iter++)
|
||||
{
|
||||
CCodeSection * ParentSection = *iter;
|
||||
if (!IsAllParentLoops(ParentSection,IgnoreIfCompiled,Test)) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection )
|
||||
{
|
||||
if (this == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SECTION_LIST::iterator iter = ParentSection.begin();
|
||||
while ( iter != ParentSection.end())
|
||||
{
|
||||
CCodeSection * ParentIter = *iter;
|
||||
if (ParentIter == Parent && (Parent->ContinueSection != this || Parent->JumpSection != this))
|
||||
{
|
||||
ParentSection.erase(iter);
|
||||
iter = ParentSection.begin();
|
||||
} else {
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||
// {
|
||||
// if (!ContinueSection && Parent->ContinueSection == this)
|
||||
// {
|
||||
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
// }
|
||||
// }
|
||||
if (ContinueSection && Parent->ContinueSection == this)
|
||||
{
|
||||
Parent->ContinueSection = NULL;
|
||||
}
|
||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||
// {
|
||||
// if (ContinueSection && Parent->JumpSection == this)
|
||||
// {
|
||||
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
// }
|
||||
// }
|
||||
if (!ContinueSection && Parent->JumpSection == this)
|
||||
{
|
||||
Parent->JumpSection = NULL;
|
||||
}
|
||||
if (AllowDelete)
|
||||
{
|
||||
bool KillMe = true;
|
||||
for (SECTION_LIST::iterator iter = ParentSection.begin(); iter != ParentSection.end(); iter++)
|
||||
{
|
||||
if (!IsAllParentLoops(*iter,false,GetNewTestValue()))
|
||||
{
|
||||
KillMe = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (KillMe)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCodeSection::~CCodeSection()
|
||||
{
|
||||
while (ParentSection.size() > 0)
|
||||
{
|
||||
CCodeSection * Parent = *ParentSection.begin();
|
||||
if (Parent->ContinueSection == this) { UnlinkParent(Parent, false, true); }
|
||||
if (Parent->JumpSection == this) { UnlinkParent(Parent, false, false); }
|
||||
}
|
||||
|
||||
if (ContinueSection)
|
||||
{
|
||||
ContinueSection->UnlinkParent(this, true, true);
|
||||
if (ContinueSection)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
ContinueSection = NULL;
|
||||
}
|
||||
if (JumpSection)
|
||||
{
|
||||
JumpSection->UnlinkParent(this, true, false);
|
||||
if (JumpSection)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
JumpSection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t CCodeSection::GetNewTestValue()
|
||||
{
|
||||
static uint32_t LastTest = 0;
|
||||
if (LastTest == 0xFFFFFFFF) { LastTest = 0; }
|
||||
LastTest += 1;
|
||||
return LastTest;
|
||||
}
|
||||
|
||||
void CRegInfo::Initialize()
|
||||
{
|
||||
int count;
|
||||
|
||||
MIPS_RegState[0] = STATE_CONST_32_SIGN;
|
||||
MIPS_RegVal[0].DW = 0;
|
||||
for (count = 1; count < 32; count ++ ) {
|
||||
MIPS_RegState[count] = STATE_UNKNOWN;
|
||||
MIPS_RegVal[count].DW = 0;
|
||||
}
|
||||
for (count = 0; count < 10; count ++ ) {
|
||||
x86reg_MappedTo[count] = NotMapped;
|
||||
x86reg_Protected[count] = false;
|
||||
x86reg_MapOrder[count] = 0;
|
||||
}
|
||||
CycleCount = 0;
|
||||
RandomModifier = 0;
|
||||
|
||||
Stack_TopPos = 0;
|
||||
for (count = 0; count < 8; count ++ ) {
|
||||
x86fpu_MappedTo[count] = -1;
|
||||
x86fpu_State[count] = FPU_Unkown;
|
||||
x86fpu_RoundingModel[count] = RoundDefault;
|
||||
}
|
||||
Fpu_Used = false;
|
||||
RoundingModel = RoundUnknown;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SectionInfo.h"
|
||||
#include "JumpInfo.h"
|
||||
|
||||
CJumpInfo::CJumpInfo()
|
||||
{
|
||||
TargetPC = (uint32_t)-1;
|
||||
JumpPC = (uint32_t)-1;
|
||||
BranchLabel = "";
|
||||
LinkLocation = NULL;
|
||||
LinkLocation2 = NULL;
|
||||
FallThrough = false;
|
||||
PermLoop = false;
|
||||
DoneDelaySlot = false;
|
||||
ExitReason = CExitInfo::Normal;
|
||||
}
|
||||
|
||||
#ifdef legacycode
|
||||
|
||||
bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled, uint32_t Test)
|
||||
{
|
||||
if (IgnoreIfCompiled && Parent->CompiledLocation != NULL) { return true; }
|
||||
if (!InLoop) { return false; }
|
||||
if (!Parent->InLoop) { return false; }
|
||||
if (Parent->ParentSection.empty()) { return false; }
|
||||
if (this == Parent) { return true; }
|
||||
if (Parent->Test == Test) { return true; }
|
||||
Parent->Test = Test;
|
||||
|
||||
for (SECTION_LIST::iterator iter = Parent->ParentSection.begin(); iter != Parent->ParentSection.end(); iter++)
|
||||
{
|
||||
CCodeSection * ParentSection = *iter;
|
||||
if (!IsAllParentLoops(ParentSection,IgnoreIfCompiled,Test)) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCodeSection::UnlinkParent( CCodeSection * Parent, bool AllowDelete, bool ContinueSection )
|
||||
{
|
||||
if (this == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SECTION_LIST::iterator iter = ParentSection.begin();
|
||||
while ( iter != ParentSection.end())
|
||||
{
|
||||
CCodeSection * ParentIter = *iter;
|
||||
if (ParentIter == Parent && (Parent->ContinueSection != this || Parent->JumpSection != this))
|
||||
{
|
||||
ParentSection.erase(iter);
|
||||
iter = ParentSection.begin();
|
||||
} else {
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||
// {
|
||||
// if (!ContinueSection && Parent->ContinueSection == this)
|
||||
// {
|
||||
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
// }
|
||||
// }
|
||||
if (ContinueSection && Parent->ContinueSection == this)
|
||||
{
|
||||
Parent->ContinueSection = NULL;
|
||||
}
|
||||
// if (Parent->ContinueSection != Parent->JumpSection)
|
||||
// {
|
||||
// if (ContinueSection && Parent->JumpSection == this)
|
||||
// {
|
||||
// g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
// }
|
||||
// }
|
||||
if (!ContinueSection && Parent->JumpSection == this)
|
||||
{
|
||||
Parent->JumpSection = NULL;
|
||||
}
|
||||
if (AllowDelete)
|
||||
{
|
||||
bool KillMe = true;
|
||||
for (SECTION_LIST::iterator iter = ParentSection.begin(); iter != ParentSection.end(); iter++)
|
||||
{
|
||||
if (!IsAllParentLoops(*iter,false,GetNewTestValue()))
|
||||
{
|
||||
KillMe = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (KillMe)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CCodeSection::~CCodeSection()
|
||||
{
|
||||
while (ParentSection.size() > 0)
|
||||
{
|
||||
CCodeSection * Parent = *ParentSection.begin();
|
||||
if (Parent->ContinueSection == this) { UnlinkParent(Parent, false, true); }
|
||||
if (Parent->JumpSection == this) { UnlinkParent(Parent, false, false); }
|
||||
}
|
||||
|
||||
if (ContinueSection)
|
||||
{
|
||||
ContinueSection->UnlinkParent(this, true, true);
|
||||
if (ContinueSection)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
ContinueSection = NULL;
|
||||
}
|
||||
if (JumpSection)
|
||||
{
|
||||
JumpSection->UnlinkParent(this, true, false);
|
||||
if (JumpSection)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
JumpSection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t CCodeSection::GetNewTestValue()
|
||||
{
|
||||
static uint32_t LastTest = 0;
|
||||
if (LastTest == 0xFFFFFFFF) { LastTest = 0; }
|
||||
LastTest += 1;
|
||||
return LastTest;
|
||||
}
|
||||
|
||||
void CRegInfo::Initialize()
|
||||
{
|
||||
int count;
|
||||
|
||||
MIPS_RegState[0] = STATE_CONST_32_SIGN;
|
||||
MIPS_RegVal[0].DW = 0;
|
||||
for (count = 1; count < 32; count ++ ) {
|
||||
MIPS_RegState[count] = STATE_UNKNOWN;
|
||||
MIPS_RegVal[count].DW = 0;
|
||||
}
|
||||
for (count = 0; count < 10; count ++ ) {
|
||||
x86reg_MappedTo[count] = NotMapped;
|
||||
x86reg_Protected[count] = false;
|
||||
x86reg_MapOrder[count] = 0;
|
||||
}
|
||||
CycleCount = 0;
|
||||
RandomModifier = 0;
|
||||
|
||||
Stack_TopPos = 0;
|
||||
for (count = 0; count < 8; count ++ ) {
|
||||
x86fpu_MappedTo[count] = -1;
|
||||
x86fpu_State[count] = FPU_Unkown;
|
||||
x86fpu_RoundingModel[count] = RoundDefault;
|
||||
}
|
||||
Fpu_Used = false;
|
||||
RoundingModel = RoundUnknown;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,23 +1,23 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CCodeSection;
|
||||
class CCodeBlock;
|
||||
struct CJumpInfo;
|
||||
|
||||
struct BLOCK_PARENT
|
||||
{
|
||||
CCodeSection * Parent;
|
||||
CJumpInfo * JumpInfo;
|
||||
};
|
||||
|
||||
typedef std::vector<BLOCK_PARENT> BLOCK_PARENT_LIST;
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CCodeSection;
|
||||
class CCodeBlock;
|
||||
struct CJumpInfo;
|
||||
|
||||
struct BLOCK_PARENT
|
||||
{
|
||||
CCodeSection * Parent;
|
||||
CJumpInfo * JumpInfo;
|
||||
};
|
||||
|
||||
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. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CX86Ops
|
||||
{
|
||||
public:
|
||||
enum x86Reg
|
||||
{
|
||||
x86_EAX = 0,
|
||||
x86_EBX = 3,
|
||||
x86_ECX = 1,
|
||||
x86_EDX = 2,
|
||||
x86_ESI = 6,
|
||||
x86_EDI = 7,
|
||||
x86_EBP = 5,
|
||||
x86_ESP = 4,
|
||||
x86_Any8Bit = -3,
|
||||
x86_Any = -2,
|
||||
x86_Unknown = -1,
|
||||
|
||||
x86_AL = 0, x86_BL = 3, x86_CL = 1, x86_DL = 2,
|
||||
x86_AH = 4, x86_BH = 7, x86_CH = 5, x86_DH = 6
|
||||
};
|
||||
|
||||
enum x86FpuValues
|
||||
{
|
||||
x86_ST_Unknown = -1,
|
||||
x86_ST0 = 0,
|
||||
x86_ST1 = 1,
|
||||
x86_ST2 = 2,
|
||||
x86_ST3 = 3,
|
||||
x86_ST4 = 4,
|
||||
x86_ST5 = 5,
|
||||
x86_ST6 = 6,
|
||||
x86_ST7 = 7
|
||||
};
|
||||
|
||||
enum Multipler
|
||||
{
|
||||
Multip_x1 = 1,
|
||||
Multip_x2 = 2,
|
||||
Multip_x4 = 4,
|
||||
Multip_x8 = 8
|
||||
};
|
||||
|
||||
static x86Reg x86_Registers[8];
|
||||
static const char * x86_Name(x86Reg Reg);
|
||||
static const char * x86_ByteName(x86Reg Reg);
|
||||
static const char * x86_HalfName(x86Reg Reg);
|
||||
static const char * fpu_Name(x86FpuValues Reg);
|
||||
|
||||
protected:
|
||||
//Logging Functions
|
||||
static void WriteX86Comment(const char * Comment);
|
||||
static void WriteX86Label(const char * Label);
|
||||
|
||||
static void AdcX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AdcConstToVariable(void *Variable, const char * VariableName, uint8_t Constant);
|
||||
static void AdcConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void AddConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
static void AddConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AddVariableToX86reg(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 AndConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
static void AndConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
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 AndX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void X86HardBreakPoint();
|
||||
static void X86BreakPoint(const char * FileName, int32_t LineNumber);
|
||||
static void Call_Direct(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 CompConstToX86reg(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 CompVariableToX86reg(x86Reg Reg, void * Variable, const char * VariableName);
|
||||
static void CompX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void DecX86reg(x86Reg Reg);
|
||||
static void DivX86reg(x86Reg reg);
|
||||
static void idivX86reg(x86Reg reg);
|
||||
static void imulX86reg(x86Reg reg);
|
||||
static void IncX86reg(x86Reg Reg);
|
||||
static void JaeLabel8(const char * Label, uint8_t Value);
|
||||
static void JaeLabel32(const char * Label, uint32_t Value);
|
||||
static void JaLabel8(const char * Label, uint8_t Value);
|
||||
static void JaLabel32(const char * Label, uint32_t Value);
|
||||
static void JbLabel8(const char * Label, uint8_t Value);
|
||||
static void JbLabel32(const char * Label, uint32_t Value);
|
||||
static void JecxzLabel8(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 JgeLabel32(const char * Label, uint32_t Value);
|
||||
static void JgLabel8(const char * Label, uint8_t Value);
|
||||
static void JgLabel32(const char * Label, uint32_t Value);
|
||||
static void JleLabel8(const char * Label, uint8_t Value);
|
||||
static void JleLabel32(const char * Label, uint32_t Value);
|
||||
static void JlLabel8(const char * Label, uint8_t Value);
|
||||
static void JlLabel32(const char * Label, uint32_t Value);
|
||||
static void JmpDirectReg(x86Reg reg);
|
||||
static void JmpIndirectLabel32(const char * Label, uint32_t location);
|
||||
static void JmpIndirectReg(x86Reg reg);
|
||||
static void JmpLabel8(const char * Label, uint8_t Value);
|
||||
static void JmpLabel32(const char * Label, uint32_t Value);
|
||||
static void JneLabel8(const char * Label, uint8_t Value);
|
||||
static void JneLabel32(const char * Label, uint32_t Value);
|
||||
static void JnsLabel8(const char * Label, uint8_t Value);
|
||||
static void JnsLabel32(const char * Label, uint32_t Value);
|
||||
static void JnzLabel8(const char * Label, uint8_t Value);
|
||||
static void JnzLabel32(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 JzLabel32(const char * Label, uint32_t Value);
|
||||
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 LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int32_t offset);
|
||||
static void MoveConstByteToN64Mem(uint8_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 MoveConstByteToX86regPointer(uint8_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstHalfToX86regPointer(uint16_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveConstToMemoryDisp(uint32_t Const, x86Reg AddrReg, uint32_t Disp);
|
||||
static void MoveConstToN64Mem(uint32_t Const, x86Reg AddrReg);
|
||||
static void MoveConstToN64MemDisp(uint32_t Const, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstToX86Pointer(uint32_t Const, x86Reg X86Pointer);
|
||||
static void MoveConstToX86reg(uint32_t Const, x86Reg reg);
|
||||
static void MoveConstToX86regPointer(uint32_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveSxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxVariableToX86regByte(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 MoveVariableToX86reg(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 MoveX86PointerToX86reg(x86Reg reg, x86Reg X86Pointer);
|
||||
static void MoveX86PointerToX86regDisp(x86Reg reg, x86Reg X86Pointer, uint8_t Disp);
|
||||
static void MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86regByteToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86regHalfToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg, uint8_t offset);
|
||||
static void MoveX86regToMemory(x86Reg reg, x86Reg AddrReg, uint32_t Disp);
|
||||
static void MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
static void MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer);
|
||||
static void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MulX86reg(x86Reg reg);
|
||||
static void NotX86Reg(x86Reg Reg);
|
||||
static void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void OrConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
static void OrVariableToX86Reg(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 Push(x86Reg reg);
|
||||
static void Pushad();
|
||||
static void PushImm32(uint32_t Value);
|
||||
static void PushImm32(const char * String, uint32_t Value);
|
||||
static void Pop(x86Reg reg);
|
||||
static void Popad();
|
||||
static void Ret();
|
||||
static void Seta(x86Reg reg);
|
||||
static void Setae(x86Reg reg);
|
||||
static void SetaVariable(void * Variable, const char * VariableName);
|
||||
static void Setb(x86Reg reg);
|
||||
static void SetbVariable(void * Variable, const char * VariableName);
|
||||
static void Setg(x86Reg reg);
|
||||
static void SetgVariable(void * Variable, const char * VariableName);
|
||||
static void Setl(x86Reg reg);
|
||||
static void SetlVariable(void * Variable, const char * VariableName);
|
||||
static void Setz(x86Reg reg);
|
||||
static void Setnz(x86Reg reg);
|
||||
static void ShiftLeftDouble(x86Reg Destination, x86Reg Source);
|
||||
static void ShiftLeftDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
static void ShiftLeftSign(x86Reg reg);
|
||||
static void ShiftLeftSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void ShiftRightDouble(x86Reg Destination, x86Reg Source);
|
||||
static void ShiftRightDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
static void ShiftRightSign(x86Reg reg);
|
||||
static void ShiftRightSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void ShiftRightUnsign(x86Reg reg);
|
||||
static void ShiftRightUnsignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void SbbConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void SbbVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void SbbX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void SubConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void SubVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void SubX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void TestConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
static void TestVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void TestX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void XorConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void XorX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
static void XorVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||
|
||||
static void fpuAbs();
|
||||
static void fpuAddDword(void * Variable, const char * VariableName);
|
||||
static void fpuAddDwordRegPointer(x86Reg x86Pointer);
|
||||
static void fpuAddQword(void * Variable, const char * VariableName);
|
||||
static void fpuAddQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuAddReg(x86FpuValues reg);
|
||||
static void fpuAddRegPop(int32_t * StackPos, x86FpuValues reg);
|
||||
static void fpuComDword(void * Variable, const char * VariableName, bool Pop);
|
||||
static void fpuComDwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
static void fpuComQword(void * Variable, const char * VariableName, bool Pop);
|
||||
static void fpuComQwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
static void fpuComReg(x86FpuValues reg, bool Pop);
|
||||
static void fpuDivDword(void * Variable, const char * VariableName);
|
||||
static void fpuDivDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuDivQword(void * Variable, const char * VariableName);
|
||||
static void fpuDivQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuDivReg(x86FpuValues Reg);
|
||||
static void fpuDivRegPop(x86FpuValues reg);
|
||||
static void fpuExchange(x86FpuValues Reg);
|
||||
static void fpuFree(x86FpuValues Reg);
|
||||
static void fpuDecStack(int32_t * StackPos);
|
||||
static void fpuIncStack(int32_t * StackPos);
|
||||
static void fpuLoadControl(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 fpuLoadDwordFromN64Mem(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 fpuLoadIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadQwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
static void fpuLoadReg(int32_t * StackPos, x86FpuValues Reg);
|
||||
static void fpuMulDword(void * Variable, const char * VariableName);
|
||||
static void fpuMulDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuMulQword(void * Variable, const char * VariableName);
|
||||
static void fpuMulQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuMulReg(x86FpuValues reg);
|
||||
static void fpuMulRegPop(x86FpuValues reg);
|
||||
static void fpuNeg();
|
||||
static void fpuRound();
|
||||
static void fpuSqrt();
|
||||
static void fpuStoreControl(void * Variable, const char * VariableName);
|
||||
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 fpuStoreDwordToN64Mem(int32_t * StackPos, x86Reg reg, 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 fpuStoreIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
static void fpuStoreIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreStatus();
|
||||
static void fpuSubDword(void * Variable, const char * VariableName);
|
||||
static void fpuSubDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuSubDwordReverse(void * Variable, const char * VariableName);
|
||||
static void fpuSubQword(void * Variable, const char * VariableName);
|
||||
static void fpuSubQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuSubQwordReverse(void * Variable, const char * VariableName);
|
||||
static void fpuSubReg(x86FpuValues reg);
|
||||
static void fpuSubRegPop(x86FpuValues reg);
|
||||
|
||||
static bool Is8BitReg(x86Reg Reg);
|
||||
static uint8_t CalcMultiplyCode(Multipler Multiply);
|
||||
static uint8_t * m_RecompPos;
|
||||
|
||||
static void * GetAddressOf(int32_t value, ...);
|
||||
static void SetJump32(uint32_t * Loc, uint32_t * JumpLoc);
|
||||
static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
|
||||
|
||||
private:
|
||||
static void BreakPointNotification(const char * FileName, int32_t LineNumber);
|
||||
static char m_fpupop[2][2];
|
||||
};
|
||||
|
||||
#define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr))
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CX86Ops
|
||||
{
|
||||
public:
|
||||
enum x86Reg
|
||||
{
|
||||
x86_EAX = 0,
|
||||
x86_EBX = 3,
|
||||
x86_ECX = 1,
|
||||
x86_EDX = 2,
|
||||
x86_ESI = 6,
|
||||
x86_EDI = 7,
|
||||
x86_EBP = 5,
|
||||
x86_ESP = 4,
|
||||
x86_Any8Bit = -3,
|
||||
x86_Any = -2,
|
||||
x86_Unknown = -1,
|
||||
|
||||
x86_AL = 0, x86_BL = 3, x86_CL = 1, x86_DL = 2,
|
||||
x86_AH = 4, x86_BH = 7, x86_CH = 5, x86_DH = 6
|
||||
};
|
||||
|
||||
enum x86FpuValues
|
||||
{
|
||||
x86_ST_Unknown = -1,
|
||||
x86_ST0 = 0,
|
||||
x86_ST1 = 1,
|
||||
x86_ST2 = 2,
|
||||
x86_ST3 = 3,
|
||||
x86_ST4 = 4,
|
||||
x86_ST5 = 5,
|
||||
x86_ST6 = 6,
|
||||
x86_ST7 = 7
|
||||
};
|
||||
|
||||
enum Multipler
|
||||
{
|
||||
Multip_x1 = 1,
|
||||
Multip_x2 = 2,
|
||||
Multip_x4 = 4,
|
||||
Multip_x8 = 8
|
||||
};
|
||||
|
||||
static x86Reg x86_Registers[8];
|
||||
static const char * x86_Name(x86Reg Reg);
|
||||
static const char * x86_ByteName(x86Reg Reg);
|
||||
static const char * x86_HalfName(x86Reg Reg);
|
||||
static const char * fpu_Name(x86FpuValues Reg);
|
||||
|
||||
protected:
|
||||
//Logging Functions
|
||||
static void WriteX86Comment(const char * Comment);
|
||||
static void WriteX86Label(const char * Label);
|
||||
|
||||
static void AdcX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AdcConstToVariable(void *Variable, const char * VariableName, uint8_t Constant);
|
||||
static void AdcConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AdcVariableToX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void AdcX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void AddConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
static void AddConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void AddVariableToX86reg(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 AndConstToVariable(uint32_t Const, void *Variable, const char * VariableName);
|
||||
static void AndConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
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 AndX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void X86HardBreakPoint();
|
||||
static void X86BreakPoint(const char * FileName, int32_t LineNumber);
|
||||
static void Call_Direct(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 CompConstToX86reg(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 CompVariableToX86reg(x86Reg Reg, void * Variable, const char * VariableName);
|
||||
static void CompX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void DecX86reg(x86Reg Reg);
|
||||
static void DivX86reg(x86Reg reg);
|
||||
static void idivX86reg(x86Reg reg);
|
||||
static void imulX86reg(x86Reg reg);
|
||||
static void IncX86reg(x86Reg Reg);
|
||||
static void JaeLabel8(const char * Label, uint8_t Value);
|
||||
static void JaeLabel32(const char * Label, uint32_t Value);
|
||||
static void JaLabel8(const char * Label, uint8_t Value);
|
||||
static void JaLabel32(const char * Label, uint32_t Value);
|
||||
static void JbLabel8(const char * Label, uint8_t Value);
|
||||
static void JbLabel32(const char * Label, uint32_t Value);
|
||||
static void JecxzLabel8(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 JgeLabel32(const char * Label, uint32_t Value);
|
||||
static void JgLabel8(const char * Label, uint8_t Value);
|
||||
static void JgLabel32(const char * Label, uint32_t Value);
|
||||
static void JleLabel8(const char * Label, uint8_t Value);
|
||||
static void JleLabel32(const char * Label, uint32_t Value);
|
||||
static void JlLabel8(const char * Label, uint8_t Value);
|
||||
static void JlLabel32(const char * Label, uint32_t Value);
|
||||
static void JmpDirectReg(x86Reg reg);
|
||||
static void JmpIndirectLabel32(const char * Label, uint32_t location);
|
||||
static void JmpIndirectReg(x86Reg reg);
|
||||
static void JmpLabel8(const char * Label, uint8_t Value);
|
||||
static void JmpLabel32(const char * Label, uint32_t Value);
|
||||
static void JneLabel8(const char * Label, uint8_t Value);
|
||||
static void JneLabel32(const char * Label, uint32_t Value);
|
||||
static void JnsLabel8(const char * Label, uint8_t Value);
|
||||
static void JnsLabel32(const char * Label, uint32_t Value);
|
||||
static void JnzLabel8(const char * Label, uint8_t Value);
|
||||
static void JnzLabel32(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 JzLabel32(const char * Label, uint32_t Value);
|
||||
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 LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int32_t offset);
|
||||
static void MoveConstByteToN64Mem(uint8_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 MoveConstByteToX86regPointer(uint8_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveConstHalfToVariable(uint16_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstHalfToX86regPointer(uint16_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveConstToMemoryDisp(uint32_t Const, x86Reg AddrReg, uint32_t Disp);
|
||||
static void MoveConstToN64Mem(uint32_t Const, x86Reg AddrReg);
|
||||
static void MoveConstToN64MemDisp(uint32_t Const, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void MoveConstToX86Pointer(uint32_t Const, x86Reg X86Pointer);
|
||||
static void MoveConstToX86reg(uint32_t Const, x86Reg reg);
|
||||
static void MoveConstToX86regPointer(uint32_t Const, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveSxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveSxVariableToX86regByte(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 MoveVariableToX86reg(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 MoveX86PointerToX86reg(x86Reg reg, x86Reg X86Pointer);
|
||||
static void MoveX86PointerToX86regDisp(x86Reg reg, x86Reg X86Pointer, uint8_t Disp);
|
||||
static void MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86regByteToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86regHalfToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveX86regPointerToX86regDisp8(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg, uint8_t offset);
|
||||
static void MoveX86regToMemory(x86Reg reg, x86Reg AddrReg, uint32_t Disp);
|
||||
static void MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, uint8_t Disp);
|
||||
static void MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void MoveX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
static void MoveX86regToX86Pointer(x86Reg reg, x86Reg X86Pointer);
|
||||
static void MoveX86regToX86regPointer(x86Reg reg, x86Reg AddrReg1, x86Reg AddrReg2);
|
||||
static void MoveZxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg);
|
||||
static void MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg);
|
||||
static void MoveZxVariableToX86regByte(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MoveZxVariableToX86regHalf(void * Variable, const char * VariableName, x86Reg reg);
|
||||
static void MulX86reg(x86Reg reg);
|
||||
static void NotX86Reg(x86Reg Reg);
|
||||
static void OrConstToVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void OrConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
static void OrVariableToX86Reg(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 Push(x86Reg reg);
|
||||
static void Pushad();
|
||||
static void PushImm32(uint32_t Value);
|
||||
static void PushImm32(const char * String, uint32_t Value);
|
||||
static void Pop(x86Reg reg);
|
||||
static void Popad();
|
||||
static void Ret();
|
||||
static void Seta(x86Reg reg);
|
||||
static void Setae(x86Reg reg);
|
||||
static void SetaVariable(void * Variable, const char * VariableName);
|
||||
static void Setb(x86Reg reg);
|
||||
static void SetbVariable(void * Variable, const char * VariableName);
|
||||
static void Setg(x86Reg reg);
|
||||
static void SetgVariable(void * Variable, const char * VariableName);
|
||||
static void Setl(x86Reg reg);
|
||||
static void SetlVariable(void * Variable, const char * VariableName);
|
||||
static void Setz(x86Reg reg);
|
||||
static void Setnz(x86Reg reg);
|
||||
static void ShiftLeftDouble(x86Reg Destination, x86Reg Source);
|
||||
static void ShiftLeftDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
static void ShiftLeftSign(x86Reg reg);
|
||||
static void ShiftLeftSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void ShiftRightDouble(x86Reg Destination, x86Reg Source);
|
||||
static void ShiftRightDoubleImmed(x86Reg Destination, x86Reg Source, uint8_t Immediate);
|
||||
static void ShiftRightSign(x86Reg reg);
|
||||
static void ShiftRightSignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void ShiftRightUnsign(x86Reg reg);
|
||||
static void ShiftRightUnsignImmed(x86Reg reg, uint8_t Immediate);
|
||||
static void SbbConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void SbbVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void SbbX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void SubConstFromVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void SubConstFromX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void SubVariableFromX86reg(x86Reg reg, void * Variable, const char * VariableName);
|
||||
static void SubX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void TestConstToX86Reg(uint32_t Const, x86Reg reg);
|
||||
static void TestVariable(uint32_t Const, void * Variable, const char * VariableName);
|
||||
static void TestX86RegToX86Reg(x86Reg Destination, x86Reg Source);
|
||||
static void XorConstToX86Reg(x86Reg Reg, uint32_t Const);
|
||||
static void XorX86RegToX86Reg(x86Reg Source, x86Reg Destination);
|
||||
static void XorVariableToX86reg(void * Variable, const char * VariableName, x86Reg reg);
|
||||
|
||||
static void fpuAbs();
|
||||
static void fpuAddDword(void * Variable, const char * VariableName);
|
||||
static void fpuAddDwordRegPointer(x86Reg x86Pointer);
|
||||
static void fpuAddQword(void * Variable, const char * VariableName);
|
||||
static void fpuAddQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuAddReg(x86FpuValues reg);
|
||||
static void fpuAddRegPop(int32_t * StackPos, x86FpuValues reg);
|
||||
static void fpuComDword(void * Variable, const char * VariableName, bool Pop);
|
||||
static void fpuComDwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
static void fpuComQword(void * Variable, const char * VariableName, bool Pop);
|
||||
static void fpuComQwordRegPointer(x86Reg X86Pointer, bool Pop);
|
||||
static void fpuComReg(x86FpuValues reg, bool Pop);
|
||||
static void fpuDivDword(void * Variable, const char * VariableName);
|
||||
static void fpuDivDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuDivQword(void * Variable, const char * VariableName);
|
||||
static void fpuDivQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuDivReg(x86FpuValues Reg);
|
||||
static void fpuDivRegPop(x86FpuValues reg);
|
||||
static void fpuExchange(x86FpuValues Reg);
|
||||
static void fpuFree(x86FpuValues Reg);
|
||||
static void fpuDecStack(int32_t * StackPos);
|
||||
static void fpuIncStack(int32_t * StackPos);
|
||||
static void fpuLoadControl(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 fpuLoadDwordFromN64Mem(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 fpuLoadIntegerDwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadQword(int32_t * StackPos, void * Variable, const char * VariableName);
|
||||
static void fpuLoadQwordFromX86Reg(int32_t * StackPos, x86Reg Reg);
|
||||
static void fpuLoadQwordFromN64Mem(int32_t * StackPos, x86Reg reg);
|
||||
static void fpuLoadReg(int32_t * StackPos, x86FpuValues Reg);
|
||||
static void fpuMulDword(void * Variable, const char * VariableName);
|
||||
static void fpuMulDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuMulQword(void * Variable, const char * VariableName);
|
||||
static void fpuMulQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuMulReg(x86FpuValues reg);
|
||||
static void fpuMulRegPop(x86FpuValues reg);
|
||||
static void fpuNeg();
|
||||
static void fpuRound();
|
||||
static void fpuSqrt();
|
||||
static void fpuStoreControl(void * Variable, const char * VariableName);
|
||||
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 fpuStoreDwordToN64Mem(int32_t * StackPos, x86Reg reg, 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 fpuStoreIntegerQword(int32_t * StackPos, void * Variable, const char * VariableName, bool pop);
|
||||
static void fpuStoreIntegerQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreQwordFromX86Reg(int32_t * StackPos, x86Reg Reg, bool pop);
|
||||
static void fpuStoreStatus();
|
||||
static void fpuSubDword(void * Variable, const char * VariableName);
|
||||
static void fpuSubDwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuSubDwordReverse(void * Variable, const char * VariableName);
|
||||
static void fpuSubQword(void * Variable, const char * VariableName);
|
||||
static void fpuSubQwordRegPointer(x86Reg X86Pointer);
|
||||
static void fpuSubQwordReverse(void * Variable, const char * VariableName);
|
||||
static void fpuSubReg(x86FpuValues reg);
|
||||
static void fpuSubRegPop(x86FpuValues reg);
|
||||
|
||||
static bool Is8BitReg(x86Reg Reg);
|
||||
static uint8_t CalcMultiplyCode(Multipler Multiply);
|
||||
static uint8_t * m_RecompPos;
|
||||
|
||||
static void * GetAddressOf(int32_t value, ...);
|
||||
static void SetJump32(uint32_t * Loc, uint32_t * JumpLoc);
|
||||
static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
|
||||
|
||||
private:
|
||||
static void BreakPointNotification(const char * FileName, int32_t LineNumber);
|
||||
static char m_fpupop[2][2];
|
||||
};
|
||||
|
||||
#define AddressOf(Addr) CX86Ops::GetAddressOf(5,(Addr))
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "x86CodeLog.h"
|
||||
#include <Common/path.h>
|
||||
#include <Windows.h>
|
||||
|
||||
static HANDLE hCPULogFile = NULL;
|
||||
bool bX86Logging = false;
|
||||
|
||||
void x86_Log_Message (const char * Message, ...)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
|
||||
va_list ap;
|
||||
va_start( ap, Message );
|
||||
vsprintf( Msg, Message, ap );
|
||||
va_end( ap );
|
||||
|
||||
strcat(Msg,"\r\n");
|
||||
|
||||
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
||||
}
|
||||
|
||||
void Start_x86_Log (void)
|
||||
{
|
||||
CPath LogFileName(CPath::MODULE_DIRECTORY);
|
||||
LogFileName.AppendDirectory("Logs");
|
||||
LogFileName.SetNameExtension("CPUoutput.log");
|
||||
|
||||
if (hCPULogFile) { Stop_x86_Log(); }
|
||||
hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
|
||||
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
if (hCPULogFile)
|
||||
{
|
||||
bX86Logging = true;
|
||||
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
|
||||
}
|
||||
}
|
||||
|
||||
void Stop_x86_Log (void)
|
||||
{
|
||||
if (hCPULogFile)
|
||||
{
|
||||
CloseHandle(hCPULogFile);
|
||||
hCPULogFile = NULL;
|
||||
bX86Logging = false;
|
||||
}
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "x86CodeLog.h"
|
||||
#include <Common/path.h>
|
||||
#include <Windows.h>
|
||||
|
||||
static HANDLE hCPULogFile = NULL;
|
||||
bool bX86Logging = false;
|
||||
|
||||
void x86_Log_Message (const char * Message, ...)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
|
||||
va_list ap;
|
||||
va_start( ap, Message );
|
||||
vsprintf( Msg, Message, ap );
|
||||
va_end( ap );
|
||||
|
||||
strcat(Msg,"\r\n");
|
||||
|
||||
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
||||
}
|
||||
|
||||
void Start_x86_Log (void)
|
||||
{
|
||||
CPath LogFileName(CPath::MODULE_DIRECTORY);
|
||||
LogFileName.AppendDirectory("Logs");
|
||||
LogFileName.SetNameExtension("CPUoutput.log");
|
||||
|
||||
if (hCPULogFile) { Stop_x86_Log(); }
|
||||
hCPULogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
|
||||
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
if (hCPULogFile)
|
||||
{
|
||||
bX86Logging = true;
|
||||
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
|
||||
}
|
||||
}
|
||||
|
||||
void Stop_x86_Log (void)
|
||||
{
|
||||
if (hCPULogFile)
|
||||
{
|
||||
CloseHandle(hCPULogFile);
|
||||
hCPULogFile = NULL;
|
||||
bX86Logging = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,135 +1,135 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SpeedLimiterClass.h"
|
||||
#include <Common/Util.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#include <Mmsystem.h>
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#endif
|
||||
|
||||
CSpeedLimiter::CSpeedLimiter()
|
||||
{
|
||||
m_Frames = 0;
|
||||
m_LastTime = 0;
|
||||
m_Speed = 60;
|
||||
m_BaseSpeed = 60;
|
||||
m_Ratio = 1000.0F / (float)m_Speed;
|
||||
|
||||
#ifdef _WIN32
|
||||
TIMECAPS Caps;
|
||||
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||
if (timeBeginPeriod(Caps.wPeriodMin) == TIMERR_NOCANDO)
|
||||
{
|
||||
g_Notify->DisplayError("Error during timer begin");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CSpeedLimiter::~CSpeedLimiter()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
TIMECAPS Caps;
|
||||
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||
timeEndPeriod(Caps.wPeriodMin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSpeedLimiter::SetHertz(uint32_t Hertz)
|
||||
{
|
||||
m_Speed = Hertz;
|
||||
m_BaseSpeed = Hertz;
|
||||
FixSpeedRatio();
|
||||
}
|
||||
|
||||
void CSpeedLimiter::FixSpeedRatio()
|
||||
{
|
||||
m_Ratio = 1000.0f / static_cast<double>(m_Speed);
|
||||
m_Frames = 0;
|
||||
#ifdef _WIN32
|
||||
m_LastTime = timeGetTime();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CSpeedLimiter::Timer_Process(uint32_t * FrameRate)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_Frames += 1;
|
||||
uint32_t CurrentTime = timeGetTime();
|
||||
|
||||
/* Calculate time that should of elapsed for this frame */
|
||||
double CalculatedTime = (double)m_LastTime + (m_Ratio * (double)m_Frames);
|
||||
if ((double)CurrentTime < CalculatedTime)
|
||||
{
|
||||
int32_t time = (int)(CalculatedTime - (double)CurrentTime);
|
||||
if (time > 0)
|
||||
{
|
||||
pjutil::Sleep(time);
|
||||
}
|
||||
|
||||
/* Refresh current time */
|
||||
CurrentTime = timeGetTime();
|
||||
}
|
||||
|
||||
if (CurrentTime - m_LastTime >= 1000)
|
||||
{
|
||||
/* Output FPS */
|
||||
if (FrameRate != NULL) { *FrameRate = m_Frames; }
|
||||
m_Frames = 0;
|
||||
m_LastTime = CurrentTime;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSpeedLimiter::IncreaseSpeed()
|
||||
{
|
||||
if (m_Speed >= 60)
|
||||
{
|
||||
m_Speed += 10;
|
||||
}
|
||||
else if (m_Speed >= 15)
|
||||
{
|
||||
m_Speed += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Speed += 1;
|
||||
}
|
||||
SpeedChanged(m_Speed);
|
||||
FixSpeedRatio();
|
||||
}
|
||||
|
||||
void CSpeedLimiter::DecreaseSpeed()
|
||||
{
|
||||
if (m_Speed > 60)
|
||||
{
|
||||
m_Speed -= 10;
|
||||
}
|
||||
else if (m_Speed > 15)
|
||||
{
|
||||
m_Speed -= 5;
|
||||
}
|
||||
else if (m_Speed > 1)
|
||||
{
|
||||
m_Speed -= 1;
|
||||
}
|
||||
SpeedChanged(m_Speed);
|
||||
FixSpeedRatio();
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SpeedLimiterClass.h"
|
||||
#include <Common/Util.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#include <Mmsystem.h>
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#endif
|
||||
|
||||
CSpeedLimiter::CSpeedLimiter()
|
||||
{
|
||||
m_Frames = 0;
|
||||
m_LastTime = 0;
|
||||
m_Speed = 60;
|
||||
m_BaseSpeed = 60;
|
||||
m_Ratio = 1000.0F / (float)m_Speed;
|
||||
|
||||
#ifdef _WIN32
|
||||
TIMECAPS Caps;
|
||||
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||
if (timeBeginPeriod(Caps.wPeriodMin) == TIMERR_NOCANDO)
|
||||
{
|
||||
g_Notify->DisplayError("Error during timer begin");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CSpeedLimiter::~CSpeedLimiter()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
TIMECAPS Caps;
|
||||
timeGetDevCaps(&Caps, sizeof(Caps));
|
||||
timeEndPeriod(Caps.wPeriodMin);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSpeedLimiter::SetHertz(uint32_t Hertz)
|
||||
{
|
||||
m_Speed = Hertz;
|
||||
m_BaseSpeed = Hertz;
|
||||
FixSpeedRatio();
|
||||
}
|
||||
|
||||
void CSpeedLimiter::FixSpeedRatio()
|
||||
{
|
||||
m_Ratio = 1000.0f / static_cast<double>(m_Speed);
|
||||
m_Frames = 0;
|
||||
#ifdef _WIN32
|
||||
m_LastTime = timeGetTime();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CSpeedLimiter::Timer_Process(uint32_t * FrameRate)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
m_Frames += 1;
|
||||
uint32_t CurrentTime = timeGetTime();
|
||||
|
||||
/* Calculate time that should of elapsed for this frame */
|
||||
double CalculatedTime = (double)m_LastTime + (m_Ratio * (double)m_Frames);
|
||||
if ((double)CurrentTime < CalculatedTime)
|
||||
{
|
||||
int32_t time = (int)(CalculatedTime - (double)CurrentTime);
|
||||
if (time > 0)
|
||||
{
|
||||
pjutil::Sleep(time);
|
||||
}
|
||||
|
||||
/* Refresh current time */
|
||||
CurrentTime = timeGetTime();
|
||||
}
|
||||
|
||||
if (CurrentTime - m_LastTime >= 1000)
|
||||
{
|
||||
/* Output FPS */
|
||||
if (FrameRate != NULL) { *FrameRate = m_Frames; }
|
||||
m_Frames = 0;
|
||||
m_LastTime = CurrentTime;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSpeedLimiter::IncreaseSpeed()
|
||||
{
|
||||
if (m_Speed >= 60)
|
||||
{
|
||||
m_Speed += 10;
|
||||
}
|
||||
else if (m_Speed >= 15)
|
||||
{
|
||||
m_Speed += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Speed += 1;
|
||||
}
|
||||
SpeedChanged(m_Speed);
|
||||
FixSpeedRatio();
|
||||
}
|
||||
|
||||
void CSpeedLimiter::DecreaseSpeed()
|
||||
{
|
||||
if (m_Speed > 60)
|
||||
{
|
||||
m_Speed -= 10;
|
||||
}
|
||||
else if (m_Speed > 15)
|
||||
{
|
||||
m_Speed -= 5;
|
||||
}
|
||||
else if (m_Speed > 1)
|
||||
{
|
||||
m_Speed -= 1;
|
||||
}
|
||||
SpeedChanged(m_Speed);
|
||||
FixSpeedRatio();
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/GameSettings.h>
|
||||
|
||||
class CSpeedLimiter :
|
||||
private CGameSettings
|
||||
{
|
||||
public:
|
||||
CSpeedLimiter();
|
||||
~CSpeedLimiter();
|
||||
|
||||
void SetHertz(const uint32_t Hertz);
|
||||
bool Timer_Process(uint32_t* const FrameRate);
|
||||
void IncreaseSpeed();
|
||||
void DecreaseSpeed();
|
||||
|
||||
private:
|
||||
CSpeedLimiter(const CSpeedLimiter&); // Disable copy constructor
|
||||
CSpeedLimiter& operator=(const CSpeedLimiter&); // Disable assignment
|
||||
|
||||
void FixSpeedRatio();
|
||||
|
||||
uint32_t m_Speed, m_BaseSpeed, m_Frames, m_LastTime;
|
||||
double m_Ratio;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/GameSettings.h>
|
||||
|
||||
class CSpeedLimiter :
|
||||
private CGameSettings
|
||||
{
|
||||
public:
|
||||
CSpeedLimiter();
|
||||
~CSpeedLimiter();
|
||||
|
||||
void SetHertz(const uint32_t Hertz);
|
||||
bool Timer_Process(uint32_t* const FrameRate);
|
||||
void IncreaseSpeed();
|
||||
void DecreaseSpeed();
|
||||
|
||||
private:
|
||||
CSpeedLimiter(const CSpeedLimiter&); // Disable copy constructor
|
||||
CSpeedLimiter& operator=(const CSpeedLimiter&); // Disable assignment
|
||||
|
||||
void FixSpeedRatio();
|
||||
|
||||
uint32_t m_Speed, m_BaseSpeed, m_Frames, m_LastTime;
|
||||
double m_Ratio;
|
||||
};
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SystemGlobals.h"
|
||||
|
||||
CN64System * g_System = NULL;
|
||||
CN64System * g_BaseSystem = NULL;
|
||||
CN64System * g_SyncSystem = NULL;
|
||||
CRecompiler * g_Recompiler = NULL;
|
||||
CMipsMemoryVM * g_MMU = NULL; //Memory of the n64
|
||||
CTLB * g_TLB = NULL; //TLB Unit
|
||||
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
|
||||
CNotification * g_Notify = 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_DDRom = NULL; //64DD IPL ROM
|
||||
CN64Disk * g_Disk = NULL; //64DD DISK
|
||||
CAudio * g_Audio = NULL;
|
||||
CSystemTimer * g_SystemTimer = NULL;
|
||||
CTransVaddr * g_TransVaddr = NULL;
|
||||
CSystemEvents * g_SystemEvents = NULL;
|
||||
uint32_t * g_TLBLoadAddress = NULL;
|
||||
uint32_t * g_TLBStoreAddress = NULL;
|
||||
CDebugger * g_Debugger = NULL;
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SystemGlobals.h"
|
||||
|
||||
CN64System * g_System = NULL;
|
||||
CN64System * g_BaseSystem = NULL;
|
||||
CN64System * g_SyncSystem = NULL;
|
||||
CRecompiler * g_Recompiler = NULL;
|
||||
CMipsMemoryVM * g_MMU = NULL; //Memory of the n64
|
||||
CTLB * g_TLB = NULL; //TLB Unit
|
||||
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
|
||||
CNotification * g_Notify = 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_DDRom = NULL; //64DD IPL ROM
|
||||
CN64Disk * g_Disk = NULL; //64DD DISK
|
||||
CAudio * g_Audio = NULL;
|
||||
CSystemTimer * g_SystemTimer = NULL;
|
||||
CTransVaddr * g_TransVaddr = NULL;
|
||||
CSystemEvents * g_SystemEvents = NULL;
|
||||
uint32_t * g_TLBLoadAddress = NULL;
|
||||
uint32_t * g_TLBStoreAddress = NULL;
|
||||
CDebugger * g_Debugger = NULL;
|
||||
|
||||
int * g_NextTimer;
|
|
@ -1,60 +1,60 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettings;
|
||||
extern CSettings * g_Settings;
|
||||
|
||||
class CN64System;
|
||||
extern CN64System * g_System;
|
||||
extern CN64System * g_BaseSystem;
|
||||
extern CN64System * g_SyncSystem;
|
||||
|
||||
class CRecompiler;
|
||||
extern CRecompiler * g_Recompiler;
|
||||
|
||||
class CMipsMemoryVM;
|
||||
extern CMipsMemoryVM * g_MMU; //Memory of the n64
|
||||
|
||||
class CTLB;
|
||||
extern CTLB * g_TLB; //TLB Unit
|
||||
|
||||
class CRegisters;
|
||||
extern CRegisters * g_Reg; //Current Register Set attached to the g_MMU
|
||||
|
||||
class CPlugins;
|
||||
extern CPlugins * g_Plugins;
|
||||
|
||||
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_DDRom; //64DD IPL ROM
|
||||
|
||||
class CN64Disk;
|
||||
extern CN64Disk * g_Disk; //64DD DISK
|
||||
|
||||
class CAudio;
|
||||
extern CAudio * g_Audio;
|
||||
|
||||
class CSystemTimer;
|
||||
extern CSystemTimer * g_SystemTimer;
|
||||
|
||||
__interface CTransVaddr;
|
||||
extern CTransVaddr * g_TransVaddr;
|
||||
|
||||
class CSystemEvents;
|
||||
extern CSystemEvents * g_SystemEvents;
|
||||
|
||||
extern int32_t * g_NextTimer;
|
||||
extern uint32_t * g_TLBLoadAddress;
|
||||
extern uint32_t * g_TLBStoreAddress;
|
||||
|
||||
__interface CDebugger;
|
||||
extern CDebugger * g_Debugger;
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettings;
|
||||
extern CSettings * g_Settings;
|
||||
|
||||
class CN64System;
|
||||
extern CN64System * g_System;
|
||||
extern CN64System * g_BaseSystem;
|
||||
extern CN64System * g_SyncSystem;
|
||||
|
||||
class CRecompiler;
|
||||
extern CRecompiler * g_Recompiler;
|
||||
|
||||
class CMipsMemoryVM;
|
||||
extern CMipsMemoryVM * g_MMU; //Memory of the n64
|
||||
|
||||
class CTLB;
|
||||
extern CTLB * g_TLB; //TLB Unit
|
||||
|
||||
class CRegisters;
|
||||
extern CRegisters * g_Reg; //Current Register Set attached to the g_MMU
|
||||
|
||||
class CPlugins;
|
||||
extern CPlugins * g_Plugins;
|
||||
|
||||
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_DDRom; //64DD IPL ROM
|
||||
|
||||
class CN64Disk;
|
||||
extern CN64Disk * g_Disk; //64DD DISK
|
||||
|
||||
class CAudio;
|
||||
extern CAudio * g_Audio;
|
||||
|
||||
class CSystemTimer;
|
||||
extern CSystemTimer * g_SystemTimer;
|
||||
|
||||
__interface CTransVaddr;
|
||||
extern CTransVaddr * g_TransVaddr;
|
||||
|
||||
class CSystemEvents;
|
||||
extern CSystemEvents * g_SystemEvents;
|
||||
|
||||
extern int32_t * g_NextTimer;
|
||||
extern uint32_t * g_TLBLoadAddress;
|
||||
extern uint32_t * g_TLBStoreAddress;
|
||||
|
||||
__interface CDebugger;
|
||||
extern CDebugger * g_Debugger;
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
//Plugin controller
|
||||
#include "Plugins/PluginClass.h"
|
||||
|
||||
//Base Plugin class, all plugin derive from this, handles core functions
|
||||
#include "Plugins/PluginBase.h"
|
||||
|
||||
#include "Plugins/GFXPlugin.h"
|
||||
#include "Plugins/AudioPlugin.h"
|
||||
#include "Plugins/ControllerPlugin.h"
|
||||
#include "Plugins/RSPPlugin.h"
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
//Plugin controller
|
||||
#include "Plugins/PluginClass.h"
|
||||
|
||||
//Base Plugin class, all plugin derive from this, handles core functions
|
||||
#include "Plugins/PluginBase.h"
|
||||
|
||||
#include "Plugins/GFXPlugin.h"
|
||||
#include "Plugins/AudioPlugin.h"
|
||||
#include "Plugins/ControllerPlugin.h"
|
||||
#include "Plugins/RSPPlugin.h"
|
||||
|
|
|
@ -1,208 +1,208 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
CAudioPlugin::CAudioPlugin() :
|
||||
AiLenChanged(NULL),
|
||||
AiReadLength(NULL),
|
||||
ProcessAList(NULL),
|
||||
m_hAudioThread(NULL),
|
||||
AiUpdate(NULL),
|
||||
AiDacrateChanged(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CAudioPlugin::~CAudioPlugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CAudioPlugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
void(CALL *InitiateAudio)(void);
|
||||
LoadFunction(InitiateAudio);
|
||||
LoadFunction(AiDacrateChanged);
|
||||
LoadFunction(AiLenChanged);
|
||||
LoadFunction(AiReadLength);
|
||||
LoadFunction(AiUpdate);
|
||||
LoadFunction(ProcessAList);
|
||||
|
||||
// Make sure dll has all needed functions
|
||||
if (AiDacrateChanged == NULL) { UnloadPlugin(); return false; }
|
||||
if (AiLenChanged == NULL) { UnloadPlugin(); return false; }
|
||||
if (AiReadLength == NULL) { UnloadPlugin(); return false; }
|
||||
if (InitiateAudio == NULL) { UnloadPlugin(); return false; }
|
||||
if (ProcessAList == NULL) { UnloadPlugin(); return false; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
struct AUDIO_INFO
|
||||
{
|
||||
void * hwnd;
|
||||
void * hinst;
|
||||
|
||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
||||
|
||||
// bswap on a dword (32 bits) boundry
|
||||
// eg. the first 8 bytes are stored like this:
|
||||
// 4 3 2 1 8 7 6 5
|
||||
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.
|
||||
uint8_t * RDRAM;
|
||||
uint8_t * DMEM;
|
||||
uint8_t * IMEM;
|
||||
|
||||
uint32_t * MI__INTR_REG;
|
||||
|
||||
uint32_t * AI__DRAM_ADDR_REG;
|
||||
uint32_t * AI__LEN_REG;
|
||||
uint32_t * AI__CONTROL_REG;
|
||||
uint32_t * AI__STATUS_REG;
|
||||
uint32_t * AI__DACRATE_REG;
|
||||
uint32_t * AI__BITRATE_REG;
|
||||
|
||||
void(CALL *CheckInterrupts)(void);
|
||||
};
|
||||
|
||||
//Get Function from DLL
|
||||
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
|
||||
LoadFunction(InitiateAudio);
|
||||
if (InitiateAudio == NULL) { return false; }
|
||||
|
||||
AUDIO_INFO Info = { 0 };
|
||||
|
||||
Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
|
||||
Info.hinst = Window ? Window->GetModuleInstance() : NULL;;
|
||||
Info.MemoryBswaped = true;
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
||||
// 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.
|
||||
if (System == NULL)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
uint32_t Value = 0;
|
||||
|
||||
Info.HEADER = Buffer;
|
||||
Info.RDRAM = Buffer;
|
||||
Info.DMEM = Buffer;
|
||||
Info.IMEM = Buffer;
|
||||
Info.MI__INTR_REG = &Value;
|
||||
Info.AI__DRAM_ADDR_REG = &Value;
|
||||
Info.AI__LEN_REG = &Value;
|
||||
Info.AI__CONTROL_REG = &Value;
|
||||
Info.AI__STATUS_REG = &Value;
|
||||
Info.AI__DACRATE_REG = &Value;
|
||||
Info.AI__BITRATE_REG = &Value;
|
||||
}
|
||||
// Send initialization information to the DLL
|
||||
else
|
||||
{
|
||||
Info.HEADER = g_Rom->GetRomAddress();
|
||||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
|
||||
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
|
||||
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
|
||||
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
|
||||
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
|
||||
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
|
||||
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
|
||||
}
|
||||
|
||||
m_Initialized = InitiateAudio(Info) != 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
|
||||
if (System != NULL)
|
||||
{
|
||||
if (AiUpdate)
|
||||
{
|
||||
if (m_hAudioThread)
|
||||
{
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||
TerminateThread(m_hAudioThread, 0);
|
||||
}
|
||||
DWORD ThreadID;
|
||||
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
||||
}
|
||||
|
||||
if (g_Reg->AI_DACRATE_REG != 0)
|
||||
{
|
||||
DacrateChanged(System->SystemType());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CAudioPlugin::UnloadPluginDetails(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_hAudioThread)
|
||||
{
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||
TerminateThread(m_hAudioThread, 0);
|
||||
m_hAudioThread = NULL;
|
||||
}
|
||||
#endif
|
||||
AiDacrateChanged = NULL;
|
||||
AiLenChanged = NULL;
|
||||
AiReadLength = NULL;
|
||||
AiUpdate = NULL;
|
||||
ProcessAList = NULL;
|
||||
}
|
||||
|
||||
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
||||
{
|
||||
if (!Initialized()) { return; }
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
||||
|
||||
//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;
|
||||
AiDacrateChanged(Type);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void CAudioPlugin::AudioThread(CAudioPlugin * _this)
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
_this->AiUpdate(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
CAudioPlugin::CAudioPlugin() :
|
||||
AiLenChanged(NULL),
|
||||
AiReadLength(NULL),
|
||||
ProcessAList(NULL),
|
||||
m_hAudioThread(NULL),
|
||||
AiUpdate(NULL),
|
||||
AiDacrateChanged(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
CAudioPlugin::~CAudioPlugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CAudioPlugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
void(CALL *InitiateAudio)(void);
|
||||
LoadFunction(InitiateAudio);
|
||||
LoadFunction(AiDacrateChanged);
|
||||
LoadFunction(AiLenChanged);
|
||||
LoadFunction(AiReadLength);
|
||||
LoadFunction(AiUpdate);
|
||||
LoadFunction(ProcessAList);
|
||||
|
||||
// Make sure dll has all needed functions
|
||||
if (AiDacrateChanged == NULL) { UnloadPlugin(); return false; }
|
||||
if (AiLenChanged == NULL) { UnloadPlugin(); return false; }
|
||||
if (AiReadLength == NULL) { UnloadPlugin(); return false; }
|
||||
if (InitiateAudio == NULL) { UnloadPlugin(); return false; }
|
||||
if (ProcessAList == NULL) { UnloadPlugin(); return false; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
struct AUDIO_INFO
|
||||
{
|
||||
void * hwnd;
|
||||
void * hinst;
|
||||
|
||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre
|
||||
|
||||
// bswap on a dword (32 bits) boundry
|
||||
// eg. the first 8 bytes are stored like this:
|
||||
// 4 3 2 1 8 7 6 5
|
||||
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.
|
||||
uint8_t * RDRAM;
|
||||
uint8_t * DMEM;
|
||||
uint8_t * IMEM;
|
||||
|
||||
uint32_t * MI__INTR_REG;
|
||||
|
||||
uint32_t * AI__DRAM_ADDR_REG;
|
||||
uint32_t * AI__LEN_REG;
|
||||
uint32_t * AI__CONTROL_REG;
|
||||
uint32_t * AI__STATUS_REG;
|
||||
uint32_t * AI__DACRATE_REG;
|
||||
uint32_t * AI__BITRATE_REG;
|
||||
|
||||
void(CALL *CheckInterrupts)(void);
|
||||
};
|
||||
|
||||
//Get Function from DLL
|
||||
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
|
||||
LoadFunction(InitiateAudio);
|
||||
if (InitiateAudio == NULL) { return false; }
|
||||
|
||||
AUDIO_INFO Info = { 0 };
|
||||
|
||||
Info.hwnd = Window ? Window->GetWindowHandle() : NULL;
|
||||
Info.hinst = Window ? Window->GetModuleInstance() : NULL;;
|
||||
Info.MemoryBswaped = true;
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
||||
// 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.
|
||||
if (System == NULL)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
uint32_t Value = 0;
|
||||
|
||||
Info.HEADER = Buffer;
|
||||
Info.RDRAM = Buffer;
|
||||
Info.DMEM = Buffer;
|
||||
Info.IMEM = Buffer;
|
||||
Info.MI__INTR_REG = &Value;
|
||||
Info.AI__DRAM_ADDR_REG = &Value;
|
||||
Info.AI__LEN_REG = &Value;
|
||||
Info.AI__CONTROL_REG = &Value;
|
||||
Info.AI__STATUS_REG = &Value;
|
||||
Info.AI__DACRATE_REG = &Value;
|
||||
Info.AI__BITRATE_REG = &Value;
|
||||
}
|
||||
// Send initialization information to the DLL
|
||||
else
|
||||
{
|
||||
Info.HEADER = g_Rom->GetRomAddress();
|
||||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
|
||||
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
|
||||
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
|
||||
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
|
||||
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
|
||||
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
|
||||
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
|
||||
}
|
||||
|
||||
m_Initialized = InitiateAudio(Info) != 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
|
||||
if (System != NULL)
|
||||
{
|
||||
if (AiUpdate)
|
||||
{
|
||||
if (m_hAudioThread)
|
||||
{
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||
TerminateThread(m_hAudioThread, 0);
|
||||
}
|
||||
DWORD ThreadID;
|
||||
m_hAudioThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this, 0, &ThreadID);
|
||||
}
|
||||
|
||||
if (g_Reg->AI_DACRATE_REG != 0)
|
||||
{
|
||||
DacrateChanged(System->SystemType());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CAudioPlugin::UnloadPluginDetails(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_hAudioThread)
|
||||
{
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Terminate Audio Thread");
|
||||
TerminateThread(m_hAudioThread, 0);
|
||||
m_hAudioThread = NULL;
|
||||
}
|
||||
#endif
|
||||
AiDacrateChanged = NULL;
|
||||
AiLenChanged = NULL;
|
||||
AiReadLength = NULL;
|
||||
AiUpdate = NULL;
|
||||
ProcessAList = NULL;
|
||||
}
|
||||
|
||||
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
||||
{
|
||||
if (!Initialized()) { return; }
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
||||
|
||||
//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;
|
||||
AiDacrateChanged(Type);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void CAudioPlugin::AudioThread(CAudioPlugin * _this)
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
|
||||
if (g_Settings->LoadBool(Setting_CN64TimeCritical))
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
_this->AiUpdate(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
class CAudioPlugin : public CPlugin
|
||||
{
|
||||
public:
|
||||
CAudioPlugin(void);
|
||||
~CAudioPlugin();
|
||||
|
||||
void DacrateChanged(SYSTEM_TYPE Type);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
|
||||
void(CALL *AiLenChanged)(void);
|
||||
uint32_t(CALL *AiReadLength)(void);
|
||||
void(CALL *ProcessAList)(void);
|
||||
|
||||
private:
|
||||
CAudioPlugin(const CAudioPlugin&); // Disable copy constructor
|
||||
CAudioPlugin& operator=(const CAudioPlugin&); // Disable assignment
|
||||
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstAudioDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstAudioSettings; }
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_AUDIO; }
|
||||
|
||||
void * m_hAudioThread;
|
||||
|
||||
bool LoadFunctions(void);
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
void(CALL *AiUpdate) (int32_t Wait);
|
||||
void(CALL *AiDacrateChanged)(SYSTEM_TYPE Type);
|
||||
|
||||
// Function used in a thread for using audio
|
||||
static void AudioThread(CAudioPlugin * _this);
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
class CAudioPlugin : public CPlugin
|
||||
{
|
||||
public:
|
||||
CAudioPlugin(void);
|
||||
~CAudioPlugin();
|
||||
|
||||
void DacrateChanged(SYSTEM_TYPE Type);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
|
||||
void(CALL *AiLenChanged)(void);
|
||||
uint32_t(CALL *AiReadLength)(void);
|
||||
void(CALL *ProcessAList)(void);
|
||||
|
||||
private:
|
||||
CAudioPlugin(const CAudioPlugin&); // Disable copy constructor
|
||||
CAudioPlugin& operator=(const CAudioPlugin&); // Disable assignment
|
||||
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstAudioDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstAudioSettings; }
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_AUDIO; }
|
||||
|
||||
void * m_hAudioThread;
|
||||
|
||||
bool LoadFunctions(void);
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
void(CALL *AiUpdate) (int32_t Wait);
|
||||
void(CALL *AiDacrateChanged)(SYSTEM_TYPE Type);
|
||||
|
||||
// Function used in a thread for using audio
|
||||
static void AudioThread(CAudioPlugin * _this);
|
||||
};
|
||||
|
|
|
@ -1,183 +1,183 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include "ControllerPlugin.h"
|
||||
|
||||
CControl_Plugin::CControl_Plugin(void) :
|
||||
WM_KeyDown(NULL),
|
||||
WM_KeyUp(NULL),
|
||||
RumbleCommand(NULL),
|
||||
GetKeys(NULL),
|
||||
ReadController(NULL),
|
||||
ControllerCommand(NULL),
|
||||
m_AllocatedControllers(false)
|
||||
{
|
||||
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
|
||||
memset(&m_Controllers, 0, sizeof(m_Controllers));
|
||||
}
|
||||
|
||||
CControl_Plugin::~CControl_Plugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CControl_Plugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
void(CALL *InitiateControllers)(void);
|
||||
LoadFunction(InitiateControllers);
|
||||
LoadFunction(ControllerCommand);
|
||||
LoadFunction(GetKeys);
|
||||
LoadFunction(ReadController);
|
||||
LoadFunction(WM_KeyDown);
|
||||
LoadFunction(WM_KeyUp);
|
||||
LoadFunction(RumbleCommand);
|
||||
|
||||
//Make sure dll had all needed functions
|
||||
if (InitiateControllers == NULL) { UnloadPlugin(); return false; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
// Allocate our own controller
|
||||
m_AllocatedControllers = true;
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
|
||||
for (int32_t i = 0; i < 4; i++)
|
||||
{
|
||||
m_PluginControllers[i].Present = false;
|
||||
m_PluginControllers[i].RawData = false;
|
||||
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
||||
}
|
||||
|
||||
// Test Plugin version
|
||||
if (m_PluginInfo.Version == 0x0100)
|
||||
{
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
||||
_LoadFunction("InitiateControllers",InitiateControllers_1_0);
|
||||
if (InitiateControllers_1_0 == NULL) { return false; }
|
||||
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
||||
m_Initialized = true;
|
||||
}
|
||||
else if (m_PluginInfo.Version >= 0x0101)
|
||||
{
|
||||
CONTROL_INFO ControlInfo;
|
||||
ControlInfo.Controls = m_PluginControllers;
|
||||
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
|
||||
ControlInfo.hinst = Window ? Window->GetModuleInstance() : NULL;
|
||||
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : NULL;
|
||||
ControlInfo.MemoryBswaped = true;
|
||||
|
||||
if (m_PluginInfo.Version == 0x0101)
|
||||
{
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
||||
_LoadFunction("InitiateControllers",InitiateControllers_1_1);
|
||||
if (InitiateControllers_1_1 == NULL) { return false; }
|
||||
|
||||
InitiateControllers_1_1(ControlInfo);
|
||||
m_Initialized = true;
|
||||
}
|
||||
else if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
||||
_LoadFunction("InitiateControllers",InitiateControllers_1_2);
|
||||
if (InitiateControllers_1_2 == NULL) { return false; }
|
||||
|
||||
InitiateControllers_1_2(&ControlInfo);
|
||||
m_Initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
#endif
|
||||
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CControl_Plugin::UnloadPluginDetails(void)
|
||||
{
|
||||
if (m_AllocatedControllers)
|
||||
{
|
||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||
{
|
||||
delete m_Controllers[count];
|
||||
m_Controllers[count] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_AllocatedControllers = false;
|
||||
ControllerCommand = NULL;
|
||||
GetKeys = NULL;
|
||||
ReadController = NULL;
|
||||
WM_KeyDown = NULL;
|
||||
WM_KeyUp = NULL;
|
||||
}
|
||||
|
||||
void CControl_Plugin::UpdateKeys(void)
|
||||
{
|
||||
if (!m_AllocatedControllers) { return; }
|
||||
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_RawData)
|
||||
{
|
||||
GetKeys(cont, &m_Controllers[cont]->m_Buttons);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
if (ReadController) { ReadController(-1, NULL); }
|
||||
}
|
||||
|
||||
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
||||
{
|
||||
if (m_AllocatedControllers)
|
||||
{
|
||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||
{
|
||||
delete m_Controllers[count];
|
||||
m_Controllers[count] = NULL;
|
||||
}
|
||||
}
|
||||
m_AllocatedControllers = false;
|
||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||
{
|
||||
m_Controllers[count] = Plugin->m_Controllers[count];
|
||||
}
|
||||
}
|
||||
|
||||
CCONTROL::CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType) :
|
||||
m_Present(Present), m_RawData(RawData), m_PlugType(PlugType)
|
||||
{
|
||||
m_Buttons.Value = 0;
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include "ControllerPlugin.h"
|
||||
|
||||
CControl_Plugin::CControl_Plugin(void) :
|
||||
WM_KeyDown(NULL),
|
||||
WM_KeyUp(NULL),
|
||||
RumbleCommand(NULL),
|
||||
GetKeys(NULL),
|
||||
ReadController(NULL),
|
||||
ControllerCommand(NULL),
|
||||
m_AllocatedControllers(false)
|
||||
{
|
||||
memset(&m_PluginControllers, 0, sizeof(m_PluginControllers));
|
||||
memset(&m_Controllers, 0, sizeof(m_Controllers));
|
||||
}
|
||||
|
||||
CControl_Plugin::~CControl_Plugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CControl_Plugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
void(CALL *InitiateControllers)(void);
|
||||
LoadFunction(InitiateControllers);
|
||||
LoadFunction(ControllerCommand);
|
||||
LoadFunction(GetKeys);
|
||||
LoadFunction(ReadController);
|
||||
LoadFunction(WM_KeyDown);
|
||||
LoadFunction(WM_KeyUp);
|
||||
LoadFunction(RumbleCommand);
|
||||
|
||||
//Make sure dll had all needed functions
|
||||
if (InitiateControllers == NULL) { UnloadPlugin(); return false; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
// Allocate our own controller
|
||||
m_AllocatedControllers = true;
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
|
||||
for (int32_t i = 0; i < 4; i++)
|
||||
{
|
||||
m_PluginControllers[i].Present = false;
|
||||
m_PluginControllers[i].RawData = false;
|
||||
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
||||
}
|
||||
|
||||
// Test Plugin version
|
||||
if (m_PluginInfo.Version == 0x0100)
|
||||
{
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
||||
_LoadFunction("InitiateControllers",InitiateControllers_1_0);
|
||||
if (InitiateControllers_1_0 == NULL) { return false; }
|
||||
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
||||
m_Initialized = true;
|
||||
}
|
||||
else if (m_PluginInfo.Version >= 0x0101)
|
||||
{
|
||||
CONTROL_INFO ControlInfo;
|
||||
ControlInfo.Controls = m_PluginControllers;
|
||||
ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress());
|
||||
ControlInfo.hinst = Window ? Window->GetModuleInstance() : NULL;
|
||||
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : NULL;
|
||||
ControlInfo.MemoryBswaped = true;
|
||||
|
||||
if (m_PluginInfo.Version == 0x0101)
|
||||
{
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
||||
_LoadFunction("InitiateControllers",InitiateControllers_1_1);
|
||||
if (InitiateControllers_1_1 == NULL) { return false; }
|
||||
|
||||
InitiateControllers_1_1(ControlInfo);
|
||||
m_Initialized = true;
|
||||
}
|
||||
else if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
||||
_LoadFunction("InitiateControllers",InitiateControllers_1_2);
|
||||
if (InitiateControllers_1_2 == NULL) { return false; }
|
||||
|
||||
InitiateControllers_1_2(&ControlInfo);
|
||||
m_Initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
#endif
|
||||
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CControl_Plugin::UnloadPluginDetails(void)
|
||||
{
|
||||
if (m_AllocatedControllers)
|
||||
{
|
||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||
{
|
||||
delete m_Controllers[count];
|
||||
m_Controllers[count] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_AllocatedControllers = false;
|
||||
ControllerCommand = NULL;
|
||||
GetKeys = NULL;
|
||||
ReadController = NULL;
|
||||
WM_KeyDown = NULL;
|
||||
WM_KeyUp = NULL;
|
||||
}
|
||||
|
||||
void CControl_Plugin::UpdateKeys(void)
|
||||
{
|
||||
if (!m_AllocatedControllers) { return; }
|
||||
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_RawData)
|
||||
{
|
||||
GetKeys(cont, &m_Controllers[cont]->m_Buttons);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
if (ReadController) { ReadController(-1, NULL); }
|
||||
}
|
||||
|
||||
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
||||
{
|
||||
if (m_AllocatedControllers)
|
||||
{
|
||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||
{
|
||||
delete m_Controllers[count];
|
||||
m_Controllers[count] = NULL;
|
||||
}
|
||||
}
|
||||
m_AllocatedControllers = false;
|
||||
for (int32_t count = 0; count < sizeof(m_Controllers) / sizeof(m_Controllers[0]); count++)
|
||||
{
|
||||
m_Controllers[count] = Plugin->m_Controllers[count];
|
||||
}
|
||||
}
|
||||
|
||||
CCONTROL::CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType) :
|
||||
m_Present(Present), m_RawData(RawData), m_PlugType(PlugType)
|
||||
{
|
||||
m_Buttons.Value = 0;
|
||||
}
|
||||
|
|
|
@ -1,130 +1,130 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t Value;
|
||||
struct
|
||||
{
|
||||
unsigned R_DPAD : 1;
|
||||
unsigned L_DPAD : 1;
|
||||
unsigned D_DPAD : 1;
|
||||
unsigned U_DPAD : 1;
|
||||
unsigned START_BUTTON : 1;
|
||||
unsigned Z_TRIG : 1;
|
||||
unsigned B_BUTTON : 1;
|
||||
unsigned A_BUTTON : 1;
|
||||
|
||||
unsigned R_CBUTTON : 1;
|
||||
unsigned L_CBUTTON : 1;
|
||||
unsigned D_CBUTTON : 1;
|
||||
unsigned U_CBUTTON : 1;
|
||||
unsigned R_TRIG : 1;
|
||||
unsigned L_TRIG : 1;
|
||||
unsigned Reserved1 : 1;
|
||||
unsigned Reserved2 : 1;
|
||||
|
||||
signed Y_AXIS : 8;
|
||||
|
||||
signed X_AXIS : 8;
|
||||
};
|
||||
} BUTTONS;
|
||||
#pragma warning(pop)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t Present;
|
||||
int32_t RawData;
|
||||
int32_t Plugin;
|
||||
} CONTROL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * hMainWindow;
|
||||
void * hinst;
|
||||
|
||||
int32_t MemoryBswaped; // memory in client- or server-native endian
|
||||
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_INFO;
|
||||
|
||||
enum PluginType
|
||||
{
|
||||
PLUGIN_NONE = 1,
|
||||
PLUGIN_MEMPAK = 2,
|
||||
PLUGIN_RUMBLE_PAK = 3,
|
||||
PLUGIN_TANSFER_PAK = 4, // not implemeted for non raw data
|
||||
PLUGIN_RAW = 5, // the controller plugin is passed in raw data
|
||||
};
|
||||
|
||||
class CControl_Plugin;
|
||||
|
||||
class CCONTROL
|
||||
{
|
||||
public:
|
||||
CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType);
|
||||
inline bool Present(void) const { return m_Present != 0; }
|
||||
inline uint32_t Buttons(void) const { return m_Buttons.Value; }
|
||||
inline PluginType Plugin(void) const { return static_cast<PluginType>(m_PlugType); }
|
||||
private:
|
||||
friend CControl_Plugin; //controller plugin class has full access
|
||||
|
||||
int32_t & m_Present;
|
||||
int32_t & m_RawData;
|
||||
int32_t & m_PlugType;
|
||||
BUTTONS m_Buttons;
|
||||
|
||||
CCONTROL(void); // Disable default constructor
|
||||
CCONTROL(const CCONTROL&); // Disable copy constructor
|
||||
CCONTROL& operator=(const CCONTROL&); // Disable assignment
|
||||
};
|
||||
|
||||
class CControl_Plugin : public CPlugin
|
||||
{
|
||||
public:
|
||||
CControl_Plugin(void);
|
||||
~CControl_Plugin();
|
||||
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
void SetControl(CControl_Plugin const * const Plugin);
|
||||
void UpdateKeys(void);
|
||||
|
||||
void(CALL *WM_KeyDown) (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 *GetKeys) (int32_t Control, BUTTONS * Keys);
|
||||
void(CALL *ReadController) (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 CONTROL * PluginControllers(void) { return m_PluginControllers; }
|
||||
|
||||
private:
|
||||
CControl_Plugin(const CControl_Plugin&); // Disable copy constructor
|
||||
CControl_Plugin& operator=(const CControl_Plugin&); // Disable assignment
|
||||
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstCtrlDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstCtrlSettings; }
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_CONTROLLER; }
|
||||
bool LoadFunctions(void);
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
bool m_AllocatedControllers;
|
||||
|
||||
// What the different controls are set up as
|
||||
CONTROL m_PluginControllers[4];
|
||||
CCONTROL * m_Controllers[4];
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t Value;
|
||||
struct
|
||||
{
|
||||
unsigned R_DPAD : 1;
|
||||
unsigned L_DPAD : 1;
|
||||
unsigned D_DPAD : 1;
|
||||
unsigned U_DPAD : 1;
|
||||
unsigned START_BUTTON : 1;
|
||||
unsigned Z_TRIG : 1;
|
||||
unsigned B_BUTTON : 1;
|
||||
unsigned A_BUTTON : 1;
|
||||
|
||||
unsigned R_CBUTTON : 1;
|
||||
unsigned L_CBUTTON : 1;
|
||||
unsigned D_CBUTTON : 1;
|
||||
unsigned U_CBUTTON : 1;
|
||||
unsigned R_TRIG : 1;
|
||||
unsigned L_TRIG : 1;
|
||||
unsigned Reserved1 : 1;
|
||||
unsigned Reserved2 : 1;
|
||||
|
||||
signed Y_AXIS : 8;
|
||||
|
||||
signed X_AXIS : 8;
|
||||
};
|
||||
} BUTTONS;
|
||||
#pragma warning(pop)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int32_t Present;
|
||||
int32_t RawData;
|
||||
int32_t Plugin;
|
||||
} CONTROL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * hMainWindow;
|
||||
void * hinst;
|
||||
|
||||
int32_t MemoryBswaped; // memory in client- or server-native endian
|
||||
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_INFO;
|
||||
|
||||
enum PluginType
|
||||
{
|
||||
PLUGIN_NONE = 1,
|
||||
PLUGIN_MEMPAK = 2,
|
||||
PLUGIN_RUMBLE_PAK = 3,
|
||||
PLUGIN_TANSFER_PAK = 4, // not implemeted for non raw data
|
||||
PLUGIN_RAW = 5, // the controller plugin is passed in raw data
|
||||
};
|
||||
|
||||
class CControl_Plugin;
|
||||
|
||||
class CCONTROL
|
||||
{
|
||||
public:
|
||||
CCONTROL(int32_t &Present, int32_t &RawData, int32_t &PlugType);
|
||||
inline bool Present(void) const { return m_Present != 0; }
|
||||
inline uint32_t Buttons(void) const { return m_Buttons.Value; }
|
||||
inline PluginType Plugin(void) const { return static_cast<PluginType>(m_PlugType); }
|
||||
private:
|
||||
friend CControl_Plugin; //controller plugin class has full access
|
||||
|
||||
int32_t & m_Present;
|
||||
int32_t & m_RawData;
|
||||
int32_t & m_PlugType;
|
||||
BUTTONS m_Buttons;
|
||||
|
||||
CCONTROL(void); // Disable default constructor
|
||||
CCONTROL(const CCONTROL&); // Disable copy constructor
|
||||
CCONTROL& operator=(const CCONTROL&); // Disable assignment
|
||||
};
|
||||
|
||||
class CControl_Plugin : public CPlugin
|
||||
{
|
||||
public:
|
||||
CControl_Plugin(void);
|
||||
~CControl_Plugin();
|
||||
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
void SetControl(CControl_Plugin const * const Plugin);
|
||||
void UpdateKeys(void);
|
||||
|
||||
void(CALL *WM_KeyDown) (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 *GetKeys) (int32_t Control, BUTTONS * Keys);
|
||||
void(CALL *ReadController) (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 CONTROL * PluginControllers(void) { return m_PluginControllers; }
|
||||
|
||||
private:
|
||||
CControl_Plugin(const CControl_Plugin&); // Disable copy constructor
|
||||
CControl_Plugin& operator=(const CControl_Plugin&); // Disable assignment
|
||||
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstCtrlDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstCtrlSettings; }
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_CONTROLLER; }
|
||||
bool LoadFunctions(void);
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
bool m_AllocatedControllers;
|
||||
|
||||
// What the different controls are set up as
|
||||
CONTROL m_PluginControllers[4];
|
||||
CCONTROL * m_Controllers[4];
|
||||
};
|
||||
|
|
|
@ -1,269 +1,269 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include "GFXPlugin.h"
|
||||
|
||||
CGfxPlugin::CGfxPlugin() :
|
||||
CaptureScreen(NULL),
|
||||
ChangeWindow(NULL),
|
||||
DrawScreen(NULL),
|
||||
DrawStatus(NULL),
|
||||
MoveScreen(NULL),
|
||||
ProcessDList(NULL),
|
||||
ProcessRDPList(NULL),
|
||||
ShowCFB(NULL),
|
||||
UpdateScreen(NULL),
|
||||
ViStatusChanged(NULL),
|
||||
ViWidthChanged(NULL),
|
||||
SoftReset(NULL),
|
||||
GetRomBrowserMenu(NULL),
|
||||
OnRomBrowserMenuItem(NULL),
|
||||
GetDebugInfo(NULL),
|
||||
InitiateDebugger(NULL)
|
||||
{
|
||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||
}
|
||||
|
||||
CGfxPlugin::~CGfxPlugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CGfxPlugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
int32_t(CALL *InitiateGFX) (void * Gfx_Info);
|
||||
LoadFunction(InitiateGFX);
|
||||
LoadFunction(ChangeWindow);
|
||||
LoadFunction(DrawScreen);
|
||||
LoadFunction(MoveScreen);
|
||||
LoadFunction(ProcessDList);
|
||||
LoadFunction(UpdateScreen);
|
||||
LoadFunction(ViStatusChanged);
|
||||
LoadFunction(ViWidthChanged);
|
||||
LoadFunction(SoftReset);
|
||||
|
||||
// version 0x104 functions
|
||||
_LoadFunction("DrawFullScreenStatus", DrawStatus);
|
||||
|
||||
// Rom Browser
|
||||
LoadFunction(GetRomBrowserMenu);
|
||||
LoadFunction(OnRomBrowserMenuItem);
|
||||
|
||||
//Make sure dll had all needed functions
|
||||
if (ChangeWindow == NULL) { UnloadPlugin(); return false; }
|
||||
if (DrawScreen == NULL) { DrawScreen = DummyDrawScreen; }
|
||||
if (InitiateGFX == NULL) { UnloadPlugin(); return false; }
|
||||
if (MoveScreen == NULL) { MoveScreen = DummyMoveScreen; }
|
||||
if (ProcessDList == NULL) { UnloadPlugin(); return false; }
|
||||
if (UpdateScreen == NULL) { UnloadPlugin(); return false; }
|
||||
if (ViStatusChanged == NULL) { ViStatusChanged = DummyViStatusChanged; }
|
||||
if (ViWidthChanged == NULL) { ViWidthChanged = DummyViWidthChanged; }
|
||||
if (SoftReset == NULL) { SoftReset = DummySoftReset; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0103)
|
||||
{
|
||||
LoadFunction(ProcessRDPList);
|
||||
LoadFunction(CaptureScreen);
|
||||
LoadFunction(ShowCFB);
|
||||
LoadFunction(GetDebugInfo);
|
||||
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
||||
|
||||
if (ProcessRDPList == NULL) { UnloadPlugin(); return false; }
|
||||
if (CaptureScreen == NULL) { UnloadPlugin(); return false; }
|
||||
if (ShowCFB == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0104)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
if (GetDebugInfo != NULL)
|
||||
{
|
||||
GetDebugInfo(&m_GFXDebug);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
if (m_Initialized)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * hWnd; /* Render window */
|
||||
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
|
||||
// bswap on a dword (32 bits) boundry
|
||||
// eg. the first 8 bytes are stored like this:
|
||||
// 4 3 2 1 8 7 6 5
|
||||
|
||||
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.
|
||||
uint8_t * RDRAM;
|
||||
uint8_t * DMEM;
|
||||
uint8_t * IMEM;
|
||||
|
||||
uint32_t * MI__INTR_REG;
|
||||
|
||||
uint32_t * DPC__START_REG;
|
||||
uint32_t * DPC__END_REG;
|
||||
uint32_t * DPC__CURRENT_REG;
|
||||
uint32_t * DPC__STATUS_REG;
|
||||
uint32_t * DPC__CLOCK_REG;
|
||||
uint32_t * DPC__BUFBUSY_REG;
|
||||
uint32_t * DPC__PIPEBUSY_REG;
|
||||
uint32_t * DPC__TMEM_REG;
|
||||
|
||||
uint32_t * VI__STATUS_REG;
|
||||
uint32_t * VI__ORIGIN_REG;
|
||||
uint32_t * VI__WIDTH_REG;
|
||||
uint32_t * VI__INTR_REG;
|
||||
uint32_t * VI__V_CURRENT_LINE_REG;
|
||||
uint32_t * VI__TIMING_REG;
|
||||
uint32_t * VI__V_SYNC_REG;
|
||||
uint32_t * VI__H_SYNC_REG;
|
||||
uint32_t * VI__LEAP_REG;
|
||||
uint32_t * VI__H_START_REG;
|
||||
uint32_t * VI__V_START_REG;
|
||||
uint32_t * VI__V_BURST_REG;
|
||||
uint32_t * VI__X_SCALE_REG;
|
||||
uint32_t * VI__Y_SCALE_REG;
|
||||
|
||||
void(CALL *CheckInterrupts)(void);
|
||||
} GFX_INFO;
|
||||
|
||||
//Get Function from DLL
|
||||
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
|
||||
_LoadFunction("InitiateGFX",InitiateGFX);
|
||||
if (InitiateGFX == NULL) { return false; }
|
||||
|
||||
GFX_INFO Info = { 0 };
|
||||
|
||||
Info.MemoryBswaped = true;
|
||||
Info.hWnd = Window->GetWindowHandle();
|
||||
Info.hStatusBar = Window->GetStatusBar();
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
||||
// 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.
|
||||
if (System == NULL)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
uint32_t Value = 0;
|
||||
|
||||
Info.HEADER = Buffer;
|
||||
Info.RDRAM = Buffer;
|
||||
Info.DMEM = Buffer;
|
||||
Info.IMEM = Buffer;
|
||||
Info.MI__INTR_REG = &Value;
|
||||
Info.VI__STATUS_REG = &Value;
|
||||
Info.VI__ORIGIN_REG = &Value;
|
||||
Info.VI__WIDTH_REG = &Value;
|
||||
Info.VI__INTR_REG = &Value;
|
||||
Info.VI__V_CURRENT_LINE_REG = &Value;
|
||||
Info.VI__TIMING_REG = &Value;
|
||||
Info.VI__V_SYNC_REG = &Value;
|
||||
Info.VI__H_SYNC_REG = &Value;
|
||||
Info.VI__LEAP_REG = &Value;
|
||||
Info.VI__H_START_REG = &Value;
|
||||
Info.VI__V_START_REG = &Value;
|
||||
Info.VI__V_BURST_REG = &Value;
|
||||
Info.VI__X_SCALE_REG = &Value;
|
||||
Info.VI__Y_SCALE_REG = &Value;
|
||||
}
|
||||
// Send initialization information to the DLL
|
||||
else
|
||||
{
|
||||
Info.HEADER = g_Rom->GetRomAddress();
|
||||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
|
||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
|
||||
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
|
||||
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
|
||||
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
|
||||
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
|
||||
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_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__LEAP_REG = &g_Reg->VI_LEAP_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_BURST_REG = &g_Reg->VI_V_BURST_REG;
|
||||
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
|
||||
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
|
||||
}
|
||||
|
||||
m_Initialized = InitiateGFX(Info) != 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
#endif
|
||||
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CGfxPlugin::UnloadPluginDetails(void)
|
||||
{
|
||||
if (m_LibHandle != NULL)
|
||||
{
|
||||
pjutil::DynLibClose(m_LibHandle);
|
||||
m_LibHandle = NULL;
|
||||
}
|
||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||
|
||||
// CaptureScreen = NULL;
|
||||
ChangeWindow = NULL;
|
||||
GetDebugInfo = NULL;
|
||||
DrawScreen = NULL;
|
||||
DrawStatus = NULL;
|
||||
// FrameBufferRead = NULL;
|
||||
// FrameBufferWrite = NULL;
|
||||
InitiateDebugger = NULL;
|
||||
MoveScreen = NULL;
|
||||
ProcessDList = NULL;
|
||||
ProcessRDPList = NULL;
|
||||
ShowCFB = NULL;
|
||||
UpdateScreen = NULL;
|
||||
ViStatusChanged = NULL;
|
||||
ViWidthChanged = NULL;
|
||||
GetRomBrowserMenu = NULL;
|
||||
OnRomBrowserMenuItem = NULL;
|
||||
}
|
||||
|
||||
void CGfxPlugin::ProcessMenuItem(int32_t id)
|
||||
{
|
||||
if (m_GFXDebug.ProcessMenuItem)
|
||||
{
|
||||
m_GFXDebug.ProcessMenuItem(id);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include "GFXPlugin.h"
|
||||
|
||||
CGfxPlugin::CGfxPlugin() :
|
||||
CaptureScreen(NULL),
|
||||
ChangeWindow(NULL),
|
||||
DrawScreen(NULL),
|
||||
DrawStatus(NULL),
|
||||
MoveScreen(NULL),
|
||||
ProcessDList(NULL),
|
||||
ProcessRDPList(NULL),
|
||||
ShowCFB(NULL),
|
||||
UpdateScreen(NULL),
|
||||
ViStatusChanged(NULL),
|
||||
ViWidthChanged(NULL),
|
||||
SoftReset(NULL),
|
||||
GetRomBrowserMenu(NULL),
|
||||
OnRomBrowserMenuItem(NULL),
|
||||
GetDebugInfo(NULL),
|
||||
InitiateDebugger(NULL)
|
||||
{
|
||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||
}
|
||||
|
||||
CGfxPlugin::~CGfxPlugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CGfxPlugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
int32_t(CALL *InitiateGFX) (void * Gfx_Info);
|
||||
LoadFunction(InitiateGFX);
|
||||
LoadFunction(ChangeWindow);
|
||||
LoadFunction(DrawScreen);
|
||||
LoadFunction(MoveScreen);
|
||||
LoadFunction(ProcessDList);
|
||||
LoadFunction(UpdateScreen);
|
||||
LoadFunction(ViStatusChanged);
|
||||
LoadFunction(ViWidthChanged);
|
||||
LoadFunction(SoftReset);
|
||||
|
||||
// version 0x104 functions
|
||||
_LoadFunction("DrawFullScreenStatus", DrawStatus);
|
||||
|
||||
// Rom Browser
|
||||
LoadFunction(GetRomBrowserMenu);
|
||||
LoadFunction(OnRomBrowserMenuItem);
|
||||
|
||||
//Make sure dll had all needed functions
|
||||
if (ChangeWindow == NULL) { UnloadPlugin(); return false; }
|
||||
if (DrawScreen == NULL) { DrawScreen = DummyDrawScreen; }
|
||||
if (InitiateGFX == NULL) { UnloadPlugin(); return false; }
|
||||
if (MoveScreen == NULL) { MoveScreen = DummyMoveScreen; }
|
||||
if (ProcessDList == NULL) { UnloadPlugin(); return false; }
|
||||
if (UpdateScreen == NULL) { UnloadPlugin(); return false; }
|
||||
if (ViStatusChanged == NULL) { ViStatusChanged = DummyViStatusChanged; }
|
||||
if (ViWidthChanged == NULL) { ViWidthChanged = DummyViWidthChanged; }
|
||||
if (SoftReset == NULL) { SoftReset = DummySoftReset; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0103)
|
||||
{
|
||||
LoadFunction(ProcessRDPList);
|
||||
LoadFunction(CaptureScreen);
|
||||
LoadFunction(ShowCFB);
|
||||
LoadFunction(GetDebugInfo);
|
||||
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
||||
|
||||
if (ProcessRDPList == NULL) { UnloadPlugin(); return false; }
|
||||
if (CaptureScreen == NULL) { UnloadPlugin(); return false; }
|
||||
if (ShowCFB == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0104)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
if (GetDebugInfo != NULL)
|
||||
{
|
||||
GetDebugInfo(&m_GFXDebug);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
if (m_Initialized)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * hWnd; /* Render window */
|
||||
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
|
||||
// bswap on a dword (32 bits) boundry
|
||||
// eg. the first 8 bytes are stored like this:
|
||||
// 4 3 2 1 8 7 6 5
|
||||
|
||||
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.
|
||||
uint8_t * RDRAM;
|
||||
uint8_t * DMEM;
|
||||
uint8_t * IMEM;
|
||||
|
||||
uint32_t * MI__INTR_REG;
|
||||
|
||||
uint32_t * DPC__START_REG;
|
||||
uint32_t * DPC__END_REG;
|
||||
uint32_t * DPC__CURRENT_REG;
|
||||
uint32_t * DPC__STATUS_REG;
|
||||
uint32_t * DPC__CLOCK_REG;
|
||||
uint32_t * DPC__BUFBUSY_REG;
|
||||
uint32_t * DPC__PIPEBUSY_REG;
|
||||
uint32_t * DPC__TMEM_REG;
|
||||
|
||||
uint32_t * VI__STATUS_REG;
|
||||
uint32_t * VI__ORIGIN_REG;
|
||||
uint32_t * VI__WIDTH_REG;
|
||||
uint32_t * VI__INTR_REG;
|
||||
uint32_t * VI__V_CURRENT_LINE_REG;
|
||||
uint32_t * VI__TIMING_REG;
|
||||
uint32_t * VI__V_SYNC_REG;
|
||||
uint32_t * VI__H_SYNC_REG;
|
||||
uint32_t * VI__LEAP_REG;
|
||||
uint32_t * VI__H_START_REG;
|
||||
uint32_t * VI__V_START_REG;
|
||||
uint32_t * VI__V_BURST_REG;
|
||||
uint32_t * VI__X_SCALE_REG;
|
||||
uint32_t * VI__Y_SCALE_REG;
|
||||
|
||||
void(CALL *CheckInterrupts)(void);
|
||||
} GFX_INFO;
|
||||
|
||||
//Get Function from DLL
|
||||
int32_t(CALL *InitiateGFX)(GFX_INFO Gfx_Info);
|
||||
_LoadFunction("InitiateGFX",InitiateGFX);
|
||||
if (InitiateGFX == NULL) { return false; }
|
||||
|
||||
GFX_INFO Info = { 0 };
|
||||
|
||||
Info.MemoryBswaped = true;
|
||||
Info.hWnd = Window->GetWindowHandle();
|
||||
Info.hStatusBar = Window->GetStatusBar();
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
||||
// 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.
|
||||
if (System == NULL)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
uint32_t Value = 0;
|
||||
|
||||
Info.HEADER = Buffer;
|
||||
Info.RDRAM = Buffer;
|
||||
Info.DMEM = Buffer;
|
||||
Info.IMEM = Buffer;
|
||||
Info.MI__INTR_REG = &Value;
|
||||
Info.VI__STATUS_REG = &Value;
|
||||
Info.VI__ORIGIN_REG = &Value;
|
||||
Info.VI__WIDTH_REG = &Value;
|
||||
Info.VI__INTR_REG = &Value;
|
||||
Info.VI__V_CURRENT_LINE_REG = &Value;
|
||||
Info.VI__TIMING_REG = &Value;
|
||||
Info.VI__V_SYNC_REG = &Value;
|
||||
Info.VI__H_SYNC_REG = &Value;
|
||||
Info.VI__LEAP_REG = &Value;
|
||||
Info.VI__H_START_REG = &Value;
|
||||
Info.VI__V_START_REG = &Value;
|
||||
Info.VI__V_BURST_REG = &Value;
|
||||
Info.VI__X_SCALE_REG = &Value;
|
||||
Info.VI__Y_SCALE_REG = &Value;
|
||||
}
|
||||
// Send initialization information to the DLL
|
||||
else
|
||||
{
|
||||
Info.HEADER = g_Rom->GetRomAddress();
|
||||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
|
||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
|
||||
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
|
||||
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
|
||||
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
|
||||
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
|
||||
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_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__LEAP_REG = &g_Reg->VI_LEAP_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_BURST_REG = &g_Reg->VI_V_BURST_REG;
|
||||
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
|
||||
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
|
||||
}
|
||||
|
||||
m_Initialized = InitiateGFX(Info) != 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
#endif
|
||||
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CGfxPlugin::UnloadPluginDetails(void)
|
||||
{
|
||||
if (m_LibHandle != NULL)
|
||||
{
|
||||
pjutil::DynLibClose(m_LibHandle);
|
||||
m_LibHandle = NULL;
|
||||
}
|
||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||
|
||||
// CaptureScreen = NULL;
|
||||
ChangeWindow = NULL;
|
||||
GetDebugInfo = NULL;
|
||||
DrawScreen = NULL;
|
||||
DrawStatus = NULL;
|
||||
// FrameBufferRead = NULL;
|
||||
// FrameBufferWrite = NULL;
|
||||
InitiateDebugger = NULL;
|
||||
MoveScreen = NULL;
|
||||
ProcessDList = NULL;
|
||||
ProcessRDPList = NULL;
|
||||
ShowCFB = NULL;
|
||||
UpdateScreen = NULL;
|
||||
ViStatusChanged = NULL;
|
||||
ViWidthChanged = NULL;
|
||||
GetRomBrowserMenu = NULL;
|
||||
OnRomBrowserMenuItem = NULL;
|
||||
}
|
||||
|
||||
void CGfxPlugin::ProcessMenuItem(int32_t id)
|
||||
{
|
||||
if (m_GFXDebug.ProcessMenuItem)
|
||||
{
|
||||
m_GFXDebug.ProcessMenuItem(id);
|
||||
}
|
||||
}
|
|
@ -1,98 +1,98 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
class CGfxPlugin : public CPlugin
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
/* Menu */
|
||||
/* Items should have an ID between 5101 and 5200 */
|
||||
void * hGFXMenu;
|
||||
void(CALL *ProcessMenuItem)(int32_t ID);
|
||||
|
||||
/* Break Points */
|
||||
int32_t UseBPoints;
|
||||
char BPPanelName[20];
|
||||
void(CALL *Add_BPoint) (void);
|
||||
void(CALL *CreateBPPanel) (void * hDlg, void * rcBox);
|
||||
void(CALL *HideBPPanel) (void);
|
||||
void(CALL *PaintBPPanel) (void * ps);
|
||||
void(CALL *ShowBPPanel) (void);
|
||||
void(CALL *RefreshBpoints) (void * hList);
|
||||
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
||||
void(CALL *RemoveAllBpoint) (void);
|
||||
|
||||
/* GFX command Window */
|
||||
void(CALL *Enter_GFX_Commands_Window)(void);
|
||||
} GFXDEBUG_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void(CALL *UpdateBreakPoints)(void);
|
||||
void(CALL *UpdateMemory)(void);
|
||||
void(CALL *UpdateR4300iRegisters)(void);
|
||||
void(CALL *Enter_BPoint_Window)(void);
|
||||
void(CALL *Enter_R4300i_Commands_Window)(void);
|
||||
void(CALL *Enter_R4300i_Register_Window)(void);
|
||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||
void(CALL *Enter_Memory_Window)(void);
|
||||
} DEBUG_INFO;
|
||||
|
||||
public:
|
||||
CGfxPlugin(void);
|
||||
~CGfxPlugin();
|
||||
|
||||
bool LoadFunctions(void);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
|
||||
void(CALL *CaptureScreen) (const char *);
|
||||
void(CALL *ChangeWindow) (void);
|
||||
void(CALL *DrawScreen) (void);
|
||||
void(CALL *DrawStatus) (const char * lpString, int32_t RightAlign);
|
||||
void(CALL *MoveScreen) (int32_t xpos, int32_t ypos);
|
||||
void(CALL *ProcessDList) (void);
|
||||
void(CALL *ProcessRDPList) (void);
|
||||
void(CALL *ShowCFB) (void);
|
||||
void(CALL *UpdateScreen) (void);
|
||||
void(CALL *ViStatusChanged) (void);
|
||||
void(CALL *ViWidthChanged) (void);
|
||||
void(CALL *SoftReset) (void);
|
||||
|
||||
//Rom Browser
|
||||
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 * GetDebugMenu(void) { return m_GFXDebug.hGFXMenu; }
|
||||
void ProcessMenuItem(int32_t id);
|
||||
|
||||
private:
|
||||
CGfxPlugin(const CGfxPlugin&); // Disable copy constructor
|
||||
CGfxPlugin& operator=(const CGfxPlugin&); // Disable assignment
|
||||
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; }
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_GFX; }
|
||||
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
GFXDEBUG_INFO m_GFXDebug;
|
||||
|
||||
void(CALL *GetDebugInfo) (GFXDEBUG_INFO * GFXDebugInfo);
|
||||
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
||||
|
||||
static void CALL DummyDrawScreen(void) {}
|
||||
static void CALL DummyMoveScreen(int32_t /*xpos*/, int32_t /*ypos*/) {}
|
||||
static void CALL DummyViStatusChanged(void) {}
|
||||
static void CALL DummyViWidthChanged(void) {}
|
||||
static void CALL DummySoftReset(void) {}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
class CGfxPlugin : public CPlugin
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
/* Menu */
|
||||
/* Items should have an ID between 5101 and 5200 */
|
||||
void * hGFXMenu;
|
||||
void(CALL *ProcessMenuItem)(int32_t ID);
|
||||
|
||||
/* Break Points */
|
||||
int32_t UseBPoints;
|
||||
char BPPanelName[20];
|
||||
void(CALL *Add_BPoint) (void);
|
||||
void(CALL *CreateBPPanel) (void * hDlg, void * rcBox);
|
||||
void(CALL *HideBPPanel) (void);
|
||||
void(CALL *PaintBPPanel) (void * ps);
|
||||
void(CALL *ShowBPPanel) (void);
|
||||
void(CALL *RefreshBpoints) (void * hList);
|
||||
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
||||
void(CALL *RemoveAllBpoint) (void);
|
||||
|
||||
/* GFX command Window */
|
||||
void(CALL *Enter_GFX_Commands_Window)(void);
|
||||
} GFXDEBUG_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void(CALL *UpdateBreakPoints)(void);
|
||||
void(CALL *UpdateMemory)(void);
|
||||
void(CALL *UpdateR4300iRegisters)(void);
|
||||
void(CALL *Enter_BPoint_Window)(void);
|
||||
void(CALL *Enter_R4300i_Commands_Window)(void);
|
||||
void(CALL *Enter_R4300i_Register_Window)(void);
|
||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||
void(CALL *Enter_Memory_Window)(void);
|
||||
} DEBUG_INFO;
|
||||
|
||||
public:
|
||||
CGfxPlugin(void);
|
||||
~CGfxPlugin();
|
||||
|
||||
bool LoadFunctions(void);
|
||||
bool Initiate(CN64System * System, RenderWindow * Window);
|
||||
|
||||
void(CALL *CaptureScreen) (const char *);
|
||||
void(CALL *ChangeWindow) (void);
|
||||
void(CALL *DrawScreen) (void);
|
||||
void(CALL *DrawStatus) (const char * lpString, int32_t RightAlign);
|
||||
void(CALL *MoveScreen) (int32_t xpos, int32_t ypos);
|
||||
void(CALL *ProcessDList) (void);
|
||||
void(CALL *ProcessRDPList) (void);
|
||||
void(CALL *ShowCFB) (void);
|
||||
void(CALL *UpdateScreen) (void);
|
||||
void(CALL *ViStatusChanged) (void);
|
||||
void(CALL *ViWidthChanged) (void);
|
||||
void(CALL *SoftReset) (void);
|
||||
|
||||
//Rom Browser
|
||||
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 * GetDebugMenu(void) { return m_GFXDebug.hGFXMenu; }
|
||||
void ProcessMenuItem(int32_t id);
|
||||
|
||||
private:
|
||||
CGfxPlugin(const CGfxPlugin&); // Disable copy constructor
|
||||
CGfxPlugin& operator=(const CGfxPlugin&); // Disable assignment
|
||||
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; }
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_GFX; }
|
||||
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
GFXDEBUG_INFO m_GFXDebug;
|
||||
|
||||
void(CALL *GetDebugInfo) (GFXDEBUG_INFO * GFXDebugInfo);
|
||||
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
||||
|
||||
static void CALL DummyDrawScreen(void) {}
|
||||
static void CALL DummyMoveScreen(int32_t /*xpos*/, int32_t /*ypos*/) {}
|
||||
static void CALL DummyViStatusChanged(void) {}
|
||||
static void CALL DummyViWidthChanged(void) {}
|
||||
static void CALL DummySoftReset(void) {}
|
||||
};
|
|
@ -1,426 +1,426 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/Plugins/PluginClass.h>
|
||||
#include <Common/path.h>
|
||||
|
||||
CPlugins::CPlugins(const stdstr & PluginDir) :
|
||||
m_MainWindow(NULL),
|
||||
m_SyncWindow(NULL),
|
||||
m_PluginDir(PluginDir),
|
||||
m_Gfx(NULL),
|
||||
m_Audio(NULL),
|
||||
m_RSP(NULL),
|
||||
m_Control(NULL)
|
||||
{
|
||||
CreatePlugins();
|
||||
g_Settings->RegisterChangeCB(Plugin_RSP_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_CONT_Current, 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(Game_EditPlugin_Gfx, 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_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||
}
|
||||
|
||||
CPlugins::~CPlugins(void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Plugin_RSP_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_CONT_Current, 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(Game_EditPlugin_Gfx, 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_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||
|
||||
DestroyGfxPlugin();
|
||||
DestroyAudioPlugin();
|
||||
DestroyRspPlugin();
|
||||
DestroyControlPlugin();
|
||||
}
|
||||
|
||||
void CPlugins::PluginChanged(CPlugins * _this)
|
||||
{
|
||||
if (g_Settings->LoadBool(Game_TempLoaded) == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
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 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;
|
||||
|
||||
if (bGfxChange || bAudioChange || bRspChange || bContChange)
|
||||
{
|
||||
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
||||
{
|
||||
//Ensure that base system actually exists before we go triggering the event
|
||||
if (g_BaseSystem)
|
||||
{
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ChangePlugins);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_this->Reset(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename plugin_type>
|
||||
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type)
|
||||
{
|
||||
if (plugin != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FileName = g_Settings->LoadStringVal(PluginSettingID);
|
||||
CPath PluginFileName(PluginDir, FileName.c_str());
|
||||
plugin = new plugin_type();
|
||||
if (plugin)
|
||||
{
|
||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading (%s): Starting", type, (const char *)PluginFileName);
|
||||
if (plugin->Load(PluginFileName))
|
||||
{
|
||||
WriteTrace(TraceLevel, TraceDebug, "%s Current Ver: %s", type, plugin->PluginName());
|
||||
g_Settings->SaveString(PluginVerSettingID, plugin->PluginName());
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceError, TraceDebug, "Failed to load %s", (const char *)PluginFileName);
|
||||
delete plugin;
|
||||
plugin = NULL;
|
||||
}
|
||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceError, TraceDebug, "Failed to allocate %s plugin", type);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugins::CreatePlugins(void)
|
||||
{
|
||||
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_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");
|
||||
|
||||
//Enable debugger
|
||||
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
||||
{
|
||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
|
||||
m_RSP->EnableDebugging(bHaveDebugger());
|
||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging done");
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugins::GameReset(void)
|
||||
{
|
||||
if (m_Gfx)
|
||||
{
|
||||
m_Gfx->GameReset();
|
||||
}
|
||||
if (m_Audio)
|
||||
{
|
||||
m_Audio->GameReset();
|
||||
}
|
||||
if (m_RSP)
|
||||
{
|
||||
m_RSP->GameReset();
|
||||
}
|
||||
if (m_Control)
|
||||
{
|
||||
m_Control->GameReset();
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugins::DestroyGfxPlugin(void)
|
||||
{
|
||||
if (m_Gfx == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "before delete m_Gfx");
|
||||
delete m_Gfx;
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "after delete m_Gfx");
|
||||
m_Gfx = NULL;
|
||||
// g_Settings->UnknownSetting_GFX = NULL;
|
||||
DestroyRspPlugin();
|
||||
}
|
||||
|
||||
void CPlugins::DestroyAudioPlugin(void)
|
||||
{
|
||||
if (m_Audio == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before close");
|
||||
m_Audio->Close();
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
|
||||
delete m_Audio;
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
|
||||
m_Audio = NULL;
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
|
||||
// g_Settings->UnknownSetting_AUDIO = NULL;
|
||||
DestroyRspPlugin();
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
|
||||
}
|
||||
|
||||
void CPlugins::DestroyRspPlugin(void)
|
||||
{
|
||||
if (m_RSP == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before close");
|
||||
m_RSP->Close();
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
|
||||
delete m_RSP;
|
||||
m_RSP = NULL;
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
|
||||
// g_Settings->UnknownSetting_RSP = NULL;
|
||||
}
|
||||
|
||||
void CPlugins::DestroyControlPlugin(void)
|
||||
{
|
||||
if (m_Control == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before close");
|
||||
m_Control->Close();
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
|
||||
delete m_Control;
|
||||
m_Control = NULL;
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
|
||||
// g_Settings->UnknownSetting_CTRL = NULL;
|
||||
}
|
||||
|
||||
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
||||
{
|
||||
m_MainWindow = MainWindow;
|
||||
m_SyncWindow = SyncWindow;
|
||||
}
|
||||
|
||||
void CPlugins::RomOpened(void)
|
||||
{
|
||||
m_Gfx->RomOpened();
|
||||
m_RSP->RomOpened();
|
||||
m_Audio->RomOpened();
|
||||
m_Control->RomOpened();
|
||||
}
|
||||
|
||||
void CPlugins::RomClosed(void)
|
||||
{
|
||||
m_Gfx->RomClose();
|
||||
m_RSP->RomClose();
|
||||
m_Audio->RomClose();
|
||||
m_Control->RomClose();
|
||||
}
|
||||
|
||||
bool CPlugins::Initiate(CN64System * System)
|
||||
{
|
||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||
//Check to make sure we have the plugin available to be used
|
||||
if (m_Gfx == NULL) { return false; }
|
||||
if (m_Audio == NULL) { return false; }
|
||||
if (m_RSP == NULL) { return false; }
|
||||
if (m_Control == NULL) { return false; }
|
||||
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPlugins::ResetInUiThread(CN64System * System)
|
||||
{
|
||||
return m_MainWindow->ResetPluginsInUiThread(this, System);
|
||||
}
|
||||
|
||||
bool CPlugins::Reset(CN64System * System)
|
||||
{
|
||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||
|
||||
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 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;
|
||||
|
||||
//if GFX and Audio has changed we also need to force reset of RSP
|
||||
if (bGfxChange || bAudioChange)
|
||||
bRspChange = true;
|
||||
|
||||
if (bGfxChange) { DestroyGfxPlugin(); }
|
||||
if (bAudioChange) { DestroyAudioPlugin(); }
|
||||
if (bRspChange) { DestroyRspPlugin(); }
|
||||
if (bContChange) { DestroyControlPlugin(); }
|
||||
|
||||
CreatePlugins();
|
||||
|
||||
if (m_Gfx && bGfxChange)
|
||||
{
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
||||
}
|
||||
if (m_Audio && bAudioChange)
|
||||
{
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
||||
}
|
||||
if (m_Control && bContChange)
|
||||
{
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
||||
}
|
||||
if (m_RSP && bRspChange)
|
||||
{
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||
}
|
||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case PLUGIN_TYPE_RSP:
|
||||
if (m_RSP == NULL || m_RSP->DllConfig == NULL) { break; }
|
||||
if (!m_RSP->Initialized())
|
||||
{
|
||||
if (!m_RSP->Initiate(this, NULL))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_RSP->DllConfig(hParent);
|
||||
break;
|
||||
case PLUGIN_TYPE_GFX:
|
||||
if (m_Gfx == NULL || m_Gfx->DllConfig == NULL) { break; }
|
||||
if (!m_Gfx->Initialized())
|
||||
{
|
||||
if (!m_Gfx->Initiate(NULL, m_MainWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Gfx->DllConfig(hParent);
|
||||
break;
|
||||
case PLUGIN_TYPE_AUDIO:
|
||||
if (m_Audio == NULL || m_Audio->DllConfig == NULL) { break; }
|
||||
if (!m_Audio->Initialized())
|
||||
{
|
||||
if (!m_Audio->Initiate(NULL, m_MainWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Audio->DllConfig(hParent);
|
||||
break;
|
||||
case PLUGIN_TYPE_CONTROLLER:
|
||||
if (m_Control == NULL || m_Control->DllConfig == NULL) { break; }
|
||||
if (!m_Control->Initialized())
|
||||
{
|
||||
if (!m_Control->Initiate(NULL, m_MainWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Control->DllConfig(hParent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DummyCheckInterrupts(void)
|
||||
{
|
||||
}
|
||||
|
||||
void DummyFunction(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||
{
|
||||
//Copy GFX Plugin
|
||||
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());
|
||||
|
||||
if (!dstGfxPlugin.DirectoryExists())
|
||||
{
|
||||
dstGfxPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcGfxPlugin.CopyTo(dstGfxPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy m_Audio Plugin
|
||||
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());
|
||||
if (!dstAudioPlugin.DirectoryExists())
|
||||
{
|
||||
dstAudioPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcAudioPlugin.CopyTo(dstAudioPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy RSP Plugin
|
||||
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());
|
||||
if (!dstRSPPlugin.DirectoryExists())
|
||||
{
|
||||
dstRSPPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcRSPPlugin.CopyTo(dstRSPPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy Controller Plugin
|
||||
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());
|
||||
if (!dstContPlugin.DirectoryExists())
|
||||
{
|
||||
dstContPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcContPlugin.CopyTo(dstContPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/Plugins/PluginClass.h>
|
||||
#include <Common/path.h>
|
||||
|
||||
CPlugins::CPlugins(const stdstr & PluginDir) :
|
||||
m_MainWindow(NULL),
|
||||
m_SyncWindow(NULL),
|
||||
m_PluginDir(PluginDir),
|
||||
m_Gfx(NULL),
|
||||
m_Audio(NULL),
|
||||
m_RSP(NULL),
|
||||
m_Control(NULL)
|
||||
{
|
||||
CreatePlugins();
|
||||
g_Settings->RegisterChangeCB(Plugin_RSP_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_CONT_Current, 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(Game_EditPlugin_Gfx, 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_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||
}
|
||||
|
||||
CPlugins::~CPlugins(void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Plugin_RSP_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_CONT_Current, 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(Game_EditPlugin_Gfx, 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_RSP, this, (CSettings::SettingChangedFunc)PluginChanged);
|
||||
|
||||
DestroyGfxPlugin();
|
||||
DestroyAudioPlugin();
|
||||
DestroyRspPlugin();
|
||||
DestroyControlPlugin();
|
||||
}
|
||||
|
||||
void CPlugins::PluginChanged(CPlugins * _this)
|
||||
{
|
||||
if (g_Settings->LoadBool(Game_TempLoaded) == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
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 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;
|
||||
|
||||
if (bGfxChange || bAudioChange || bRspChange || bContChange)
|
||||
{
|
||||
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
||||
{
|
||||
//Ensure that base system actually exists before we go triggering the event
|
||||
if (g_BaseSystem)
|
||||
{
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ChangePlugins);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_this->Reset(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename plugin_type>
|
||||
static void LoadPlugin(SettingID PluginSettingID, SettingID PluginVerSettingID, plugin_type * & plugin, const char * PluginDir, stdstr & FileName, TraceModuleProject64 TraceLevel, const char * type)
|
||||
{
|
||||
if (plugin != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FileName = g_Settings->LoadStringVal(PluginSettingID);
|
||||
CPath PluginFileName(PluginDir, FileName.c_str());
|
||||
plugin = new plugin_type();
|
||||
if (plugin)
|
||||
{
|
||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading (%s): Starting", type, (const char *)PluginFileName);
|
||||
if (plugin->Load(PluginFileName))
|
||||
{
|
||||
WriteTrace(TraceLevel, TraceDebug, "%s Current Ver: %s", type, plugin->PluginName());
|
||||
g_Settings->SaveString(PluginVerSettingID, plugin->PluginName());
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceError, TraceDebug, "Failed to load %s", (const char *)PluginFileName);
|
||||
delete plugin;
|
||||
plugin = NULL;
|
||||
}
|
||||
WriteTrace(TraceLevel, TraceDebug, "%s Loading Done", type);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceError, TraceDebug, "Failed to allocate %s plugin", type);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugins::CreatePlugins(void)
|
||||
{
|
||||
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_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");
|
||||
|
||||
//Enable debugger
|
||||
if (m_RSP != NULL && m_RSP->EnableDebugging)
|
||||
{
|
||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging starting");
|
||||
m_RSP->EnableDebugging(bHaveDebugger());
|
||||
WriteTrace(TraceRSPPlugin, TraceInfo, "EnableDebugging done");
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugins::GameReset(void)
|
||||
{
|
||||
if (m_Gfx)
|
||||
{
|
||||
m_Gfx->GameReset();
|
||||
}
|
||||
if (m_Audio)
|
||||
{
|
||||
m_Audio->GameReset();
|
||||
}
|
||||
if (m_RSP)
|
||||
{
|
||||
m_RSP->GameReset();
|
||||
}
|
||||
if (m_Control)
|
||||
{
|
||||
m_Control->GameReset();
|
||||
}
|
||||
}
|
||||
|
||||
void CPlugins::DestroyGfxPlugin(void)
|
||||
{
|
||||
if (m_Gfx == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "before delete m_Gfx");
|
||||
delete m_Gfx;
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "after delete m_Gfx");
|
||||
m_Gfx = NULL;
|
||||
// g_Settings->UnknownSetting_GFX = NULL;
|
||||
DestroyRspPlugin();
|
||||
}
|
||||
|
||||
void CPlugins::DestroyAudioPlugin(void)
|
||||
{
|
||||
if (m_Audio == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before close");
|
||||
m_Audio->Close();
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before delete");
|
||||
delete m_Audio;
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after delete");
|
||||
m_Audio = NULL;
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "before DestroyRspPlugin");
|
||||
// g_Settings->UnknownSetting_AUDIO = NULL;
|
||||
DestroyRspPlugin();
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "after DestroyRspPlugin");
|
||||
}
|
||||
|
||||
void CPlugins::DestroyRspPlugin(void)
|
||||
{
|
||||
if (m_RSP == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before close");
|
||||
m_RSP->Close();
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "before delete");
|
||||
delete m_RSP;
|
||||
m_RSP = NULL;
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "after delete");
|
||||
// g_Settings->UnknownSetting_RSP = NULL;
|
||||
}
|
||||
|
||||
void CPlugins::DestroyControlPlugin(void)
|
||||
{
|
||||
if (m_Control == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before close");
|
||||
m_Control->Close();
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "before delete");
|
||||
delete m_Control;
|
||||
m_Control = NULL;
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "after delete");
|
||||
// g_Settings->UnknownSetting_CTRL = NULL;
|
||||
}
|
||||
|
||||
void CPlugins::SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow)
|
||||
{
|
||||
m_MainWindow = MainWindow;
|
||||
m_SyncWindow = SyncWindow;
|
||||
}
|
||||
|
||||
void CPlugins::RomOpened(void)
|
||||
{
|
||||
m_Gfx->RomOpened();
|
||||
m_RSP->RomOpened();
|
||||
m_Audio->RomOpened();
|
||||
m_Control->RomOpened();
|
||||
}
|
||||
|
||||
void CPlugins::RomClosed(void)
|
||||
{
|
||||
m_Gfx->RomClose();
|
||||
m_RSP->RomClose();
|
||||
m_Audio->RomClose();
|
||||
m_Control->RomClose();
|
||||
}
|
||||
|
||||
bool CPlugins::Initiate(CN64System * System)
|
||||
{
|
||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||
//Check to make sure we have the plugin available to be used
|
||||
if (m_Gfx == NULL) { return false; }
|
||||
if (m_Audio == NULL) { return false; }
|
||||
if (m_RSP == NULL) { return false; }
|
||||
if (m_Control == NULL) { return false; }
|
||||
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPlugins::ResetInUiThread(CN64System * System)
|
||||
{
|
||||
return m_MainWindow->ResetPluginsInUiThread(this, System);
|
||||
}
|
||||
|
||||
bool CPlugins::Reset(CN64System * System)
|
||||
{
|
||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||
|
||||
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 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;
|
||||
|
||||
//if GFX and Audio has changed we also need to force reset of RSP
|
||||
if (bGfxChange || bAudioChange)
|
||||
bRspChange = true;
|
||||
|
||||
if (bGfxChange) { DestroyGfxPlugin(); }
|
||||
if (bAudioChange) { DestroyAudioPlugin(); }
|
||||
if (bRspChange) { DestroyRspPlugin(); }
|
||||
if (bContChange) { DestroyControlPlugin(); }
|
||||
|
||||
CreatePlugins();
|
||||
|
||||
if (m_Gfx && bGfxChange)
|
||||
{
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Starting");
|
||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Gfx Initiate Done");
|
||||
}
|
||||
if (m_Audio && bAudioChange)
|
||||
{
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Starting");
|
||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio Initiate Done");
|
||||
}
|
||||
if (m_Control && bContChange)
|
||||
{
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Starting");
|
||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control Initiate Done");
|
||||
}
|
||||
if (m_RSP && bRspChange)
|
||||
{
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Starting");
|
||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP Initiate Done");
|
||||
}
|
||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case PLUGIN_TYPE_RSP:
|
||||
if (m_RSP == NULL || m_RSP->DllConfig == NULL) { break; }
|
||||
if (!m_RSP->Initialized())
|
||||
{
|
||||
if (!m_RSP->Initiate(this, NULL))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_RSP->DllConfig(hParent);
|
||||
break;
|
||||
case PLUGIN_TYPE_GFX:
|
||||
if (m_Gfx == NULL || m_Gfx->DllConfig == NULL) { break; }
|
||||
if (!m_Gfx->Initialized())
|
||||
{
|
||||
if (!m_Gfx->Initiate(NULL, m_MainWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Gfx->DllConfig(hParent);
|
||||
break;
|
||||
case PLUGIN_TYPE_AUDIO:
|
||||
if (m_Audio == NULL || m_Audio->DllConfig == NULL) { break; }
|
||||
if (!m_Audio->Initialized())
|
||||
{
|
||||
if (!m_Audio->Initiate(NULL, m_MainWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Audio->DllConfig(hParent);
|
||||
break;
|
||||
case PLUGIN_TYPE_CONTROLLER:
|
||||
if (m_Control == NULL || m_Control->DllConfig == NULL) { break; }
|
||||
if (!m_Control->Initialized())
|
||||
{
|
||||
if (!m_Control->Initiate(NULL, m_MainWindow))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Control->DllConfig(hParent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DummyCheckInterrupts(void)
|
||||
{
|
||||
}
|
||||
|
||||
void DummyFunction(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||
{
|
||||
//Copy GFX Plugin
|
||||
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());
|
||||
|
||||
if (!dstGfxPlugin.DirectoryExists())
|
||||
{
|
||||
dstGfxPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcGfxPlugin.CopyTo(dstGfxPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy m_Audio Plugin
|
||||
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());
|
||||
if (!dstAudioPlugin.DirectoryExists())
|
||||
{
|
||||
dstAudioPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcAudioPlugin.CopyTo(dstAudioPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy RSP Plugin
|
||||
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());
|
||||
if (!dstRSPPlugin.DirectoryExists())
|
||||
{
|
||||
dstRSPPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcRSPPlugin.CopyTo(dstRSPPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy Controller Plugin
|
||||
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());
|
||||
if (!dstContPlugin.DirectoryExists())
|
||||
{
|
||||
dstContPlugin.DirectoryCreate();
|
||||
}
|
||||
if (!srcContPlugin.CopyTo(dstContPlugin))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -1,154 +1,154 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <list>
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
|
||||
#ifndef PLUGIN_INFO_STRUCT
|
||||
#define PLUGIN_INFO_STRUCT
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t Version; /* Should be set to 1 */
|
||||
uint16_t Type; /* Set to PLUGIN_TYPE_GFX */
|
||||
char Name[100]; /* Name of the DLL */
|
||||
|
||||
/* If DLL supports memory these memory options then set them to TRUE or FALSE
|
||||
if it does not support it */
|
||||
int32_t NormalMemory; /* a normal BYTE array */
|
||||
int32_t MemoryBswaped; /* a normal BYTE array where the memory has been pre
|
||||
bswap on a dword (32 bits) boundry */
|
||||
} PLUGIN_INFO;
|
||||
|
||||
#endif
|
||||
|
||||
// enum's
|
||||
enum SETTING_DATA_TYPE
|
||||
{
|
||||
Data_DWORD_General = 0, // A uint32_t 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_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_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_String_RDB_Setting = 7, // A string read from the rom database, with config file
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dwSize;
|
||||
int32_t DefaultStartRange;
|
||||
int32_t SettingStartRange;
|
||||
int32_t MaximumSettings;
|
||||
int32_t NoDefault;
|
||||
int32_t DefaultLocation;
|
||||
void * handle;
|
||||
uint32_t(*GetSetting) (void * handle, int32_t ID);
|
||||
const char * (*GetSettingSz) (void * handle, int32_t ID, char * Buffer, int32_t BufferLen);
|
||||
void(*SetSetting) (void * handle, int32_t ID, uint32_t Value);
|
||||
void(*SetSettingSz) (void * handle, int32_t ID, const char * Value);
|
||||
void(*RegisterSetting) (void * handle, int32_t ID, int32_t DefaultID, SettingDataType Type,
|
||||
SettingType Location, const char * Category, const char * DefaultStr, uint32_t Value);
|
||||
void(*UseUnregisteredSetting) (int32_t ID);
|
||||
} PLUGIN_SETTINGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t(*FindSystemSettingId) (void * handle, const char * Name);
|
||||
} PLUGIN_SETTINGS2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void(*FlushSettings) (void * handle);
|
||||
} PLUGIN_SETTINGS3;
|
||||
|
||||
enum PLUGIN_TYPE
|
||||
{
|
||||
PLUGIN_TYPE_NONE = 0,
|
||||
PLUGIN_TYPE_RSP = 1,
|
||||
PLUGIN_TYPE_GFX = 2,
|
||||
PLUGIN_TYPE_AUDIO = 3,
|
||||
PLUGIN_TYPE_CONTROLLER = 4,
|
||||
};
|
||||
|
||||
class CSettings;
|
||||
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
||||
class CN64System;
|
||||
class CPlugins;
|
||||
|
||||
__interface RenderWindow
|
||||
{
|
||||
virtual bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) = 0;
|
||||
virtual void * GetWindowHandle(void) const = 0;
|
||||
virtual void * GetStatusBar(void) const = 0;
|
||||
virtual void * GetModuleInstance(void) const = 0;
|
||||
};
|
||||
|
||||
class CPlugins :
|
||||
private CDebugSettings
|
||||
{
|
||||
public:
|
||||
//Functions
|
||||
CPlugins(const stdstr & PluginDir);
|
||||
~CPlugins();
|
||||
|
||||
bool Initiate(CN64System * System);
|
||||
void RomOpened(void);
|
||||
void RomClosed(void);
|
||||
void SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow);
|
||||
void ConfigPlugin(void * hParent, PLUGIN_TYPE Type);
|
||||
bool CopyPlugins(const stdstr & DstDir) const;
|
||||
void CreatePlugins(void);
|
||||
bool Reset(CN64System * System);
|
||||
bool ResetInUiThread(CN64System * System);
|
||||
void GameReset(void);
|
||||
|
||||
inline CGfxPlugin * Gfx(void) const { return m_Gfx; }
|
||||
inline CAudioPlugin * Audio(void) const { return m_Audio; }
|
||||
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
||||
inline CControl_Plugin * Control(void) const { return m_Control; }
|
||||
|
||||
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
||||
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
||||
|
||||
private:
|
||||
CPlugins(void); // Disable default constructor
|
||||
CPlugins(const CPlugins&); // Disable copy constructor
|
||||
CPlugins& operator=(const CPlugins&); // Disable assignment
|
||||
|
||||
void DestroyGfxPlugin(void);
|
||||
void DestroyAudioPlugin(void);
|
||||
void DestroyRspPlugin(void);
|
||||
void DestroyControlPlugin(void);
|
||||
|
||||
static void PluginChanged(CPlugins * _this);
|
||||
|
||||
RenderWindow * m_MainWindow;
|
||||
RenderWindow * m_SyncWindow;
|
||||
|
||||
stdstr const m_PluginDir;
|
||||
|
||||
//Plugins
|
||||
CGfxPlugin * m_Gfx;
|
||||
CAudioPlugin * m_Audio;
|
||||
CRSP_Plugin * m_RSP;
|
||||
CControl_Plugin * m_Control;
|
||||
|
||||
stdstr m_GfxFile;
|
||||
stdstr m_AudioFile;
|
||||
stdstr m_RSPFile;
|
||||
stdstr m_ControlFile;
|
||||
};
|
||||
|
||||
//Dummy Functions
|
||||
void DummyCheckInterrupts(void);
|
||||
void DummyFunction(void);
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <list>
|
||||
#include <Project64-core/Settings/DebugSettings.h>
|
||||
|
||||
#ifndef PLUGIN_INFO_STRUCT
|
||||
#define PLUGIN_INFO_STRUCT
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t Version; /* Should be set to 1 */
|
||||
uint16_t Type; /* Set to PLUGIN_TYPE_GFX */
|
||||
char Name[100]; /* Name of the DLL */
|
||||
|
||||
/* If DLL supports memory these memory options then set them to TRUE or FALSE
|
||||
if it does not support it */
|
||||
int32_t NormalMemory; /* a normal BYTE array */
|
||||
int32_t MemoryBswaped; /* a normal BYTE array where the memory has been pre
|
||||
bswap on a dword (32 bits) boundry */
|
||||
} PLUGIN_INFO;
|
||||
|
||||
#endif
|
||||
|
||||
// enum's
|
||||
enum SETTING_DATA_TYPE
|
||||
{
|
||||
Data_DWORD_General = 0, // A uint32_t 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_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_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_String_RDB_Setting = 7, // A string read from the rom database, with config file
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dwSize;
|
||||
int32_t DefaultStartRange;
|
||||
int32_t SettingStartRange;
|
||||
int32_t MaximumSettings;
|
||||
int32_t NoDefault;
|
||||
int32_t DefaultLocation;
|
||||
void * handle;
|
||||
uint32_t(*GetSetting) (void * handle, int32_t ID);
|
||||
const char * (*GetSettingSz) (void * handle, int32_t ID, char * Buffer, int32_t BufferLen);
|
||||
void(*SetSetting) (void * handle, int32_t ID, uint32_t Value);
|
||||
void(*SetSettingSz) (void * handle, int32_t ID, const char * Value);
|
||||
void(*RegisterSetting) (void * handle, int32_t ID, int32_t DefaultID, SettingDataType Type,
|
||||
SettingType Location, const char * Category, const char * DefaultStr, uint32_t Value);
|
||||
void(*UseUnregisteredSetting) (int32_t ID);
|
||||
} PLUGIN_SETTINGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t(*FindSystemSettingId) (void * handle, const char * Name);
|
||||
} PLUGIN_SETTINGS2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void(*FlushSettings) (void * handle);
|
||||
} PLUGIN_SETTINGS3;
|
||||
|
||||
enum PLUGIN_TYPE
|
||||
{
|
||||
PLUGIN_TYPE_NONE = 0,
|
||||
PLUGIN_TYPE_RSP = 1,
|
||||
PLUGIN_TYPE_GFX = 2,
|
||||
PLUGIN_TYPE_AUDIO = 3,
|
||||
PLUGIN_TYPE_CONTROLLER = 4,
|
||||
};
|
||||
|
||||
class CSettings;
|
||||
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
||||
class CN64System;
|
||||
class CPlugins;
|
||||
|
||||
__interface RenderWindow
|
||||
{
|
||||
virtual bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System) = 0;
|
||||
virtual void * GetWindowHandle(void) const = 0;
|
||||
virtual void * GetStatusBar(void) const = 0;
|
||||
virtual void * GetModuleInstance(void) const = 0;
|
||||
};
|
||||
|
||||
class CPlugins :
|
||||
private CDebugSettings
|
||||
{
|
||||
public:
|
||||
//Functions
|
||||
CPlugins(const stdstr & PluginDir);
|
||||
~CPlugins();
|
||||
|
||||
bool Initiate(CN64System * System);
|
||||
void RomOpened(void);
|
||||
void RomClosed(void);
|
||||
void SetRenderWindows(RenderWindow * MainWindow, RenderWindow * SyncWindow);
|
||||
void ConfigPlugin(void * hParent, PLUGIN_TYPE Type);
|
||||
bool CopyPlugins(const stdstr & DstDir) const;
|
||||
void CreatePlugins(void);
|
||||
bool Reset(CN64System * System);
|
||||
bool ResetInUiThread(CN64System * System);
|
||||
void GameReset(void);
|
||||
|
||||
inline CGfxPlugin * Gfx(void) const { return m_Gfx; }
|
||||
inline CAudioPlugin * Audio(void) const { return m_Audio; }
|
||||
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
||||
inline CControl_Plugin * Control(void) const { return m_Control; }
|
||||
|
||||
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
||||
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
||||
|
||||
private:
|
||||
CPlugins(void); // Disable default constructor
|
||||
CPlugins(const CPlugins&); // Disable copy constructor
|
||||
CPlugins& operator=(const CPlugins&); // Disable assignment
|
||||
|
||||
void DestroyGfxPlugin(void);
|
||||
void DestroyAudioPlugin(void);
|
||||
void DestroyRspPlugin(void);
|
||||
void DestroyControlPlugin(void);
|
||||
|
||||
static void PluginChanged(CPlugins * _this);
|
||||
|
||||
RenderWindow * m_MainWindow;
|
||||
RenderWindow * m_SyncWindow;
|
||||
|
||||
stdstr const m_PluginDir;
|
||||
|
||||
//Plugins
|
||||
CGfxPlugin * m_Gfx;
|
||||
CAudioPlugin * m_Audio;
|
||||
CRSP_Plugin * m_RSP;
|
||||
CControl_Plugin * m_Control;
|
||||
|
||||
stdstr m_GfxFile;
|
||||
stdstr m_AudioFile;
|
||||
stdstr m_RSPFile;
|
||||
stdstr m_ControlFile;
|
||||
};
|
||||
|
||||
//Dummy Functions
|
||||
void DummyCheckInterrupts(void);
|
||||
void DummyFunction(void);
|
||||
|
|
|
@ -1,218 +1,218 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include "RSPPlugin.h"
|
||||
#include "GFXPlugin.h"
|
||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||
|
||||
void DummyFunc1(int a) { a += 1; }
|
||||
|
||||
CRSP_Plugin::CRSP_Plugin(void) :
|
||||
DoRspCycles(NULL),
|
||||
EnableDebugging(NULL),
|
||||
m_CycleCount(0),
|
||||
GetDebugInfo(NULL),
|
||||
InitiateDebugger(NULL)
|
||||
{
|
||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||
}
|
||||
|
||||
CRSP_Plugin::~CRSP_Plugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CRSP_Plugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
void(CALL *InitiateRSP)(void);
|
||||
LoadFunction(InitiateRSP);
|
||||
LoadFunction(DoRspCycles);
|
||||
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
|
||||
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
|
||||
LoadFunction(EnableDebugging);
|
||||
if (EnableDebugging == NULL) { EnableDebugging = DummyFunc1; }
|
||||
|
||||
//Make sure dll had all needed functions
|
||||
if (DoRspCycles == NULL) { UnloadPlugin(); return false; }
|
||||
if (InitiateRSP == NULL) { UnloadPlugin(); return false; }
|
||||
if (RomClosed == NULL) { UnloadPlugin(); return false; }
|
||||
if (CloseDLL == NULL) { UnloadPlugin(); return false; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
// Get debug info if able
|
||||
if (GetDebugInfo != NULL)
|
||||
{
|
||||
GetDebugInfo(&m_RSPDebug);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||
{
|
||||
if (m_PluginInfo.Version == 1 || m_PluginInfo.Version == 0x100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * hInst;
|
||||
int MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
|
||||
bswap on a dword (32 bits) boundry */
|
||||
uint8_t * RDRAM;
|
||||
uint8_t * DMEM;
|
||||
uint8_t * IMEM;
|
||||
|
||||
uint32_t * MI__INTR_REG;
|
||||
|
||||
uint32_t * SP__MEM_ADDR_REG;
|
||||
uint32_t * SP__DRAM_ADDR_REG;
|
||||
uint32_t * SP__RD_LEN_REG;
|
||||
uint32_t * SP__WR_LEN_REG;
|
||||
uint32_t * SP__STATUS_REG;
|
||||
uint32_t * SP__DMA_FULL_REG;
|
||||
uint32_t * SP__DMA_BUSY_REG;
|
||||
uint32_t * SP__PC_REG;
|
||||
uint32_t * SP__SEMAPHORE_REG;
|
||||
|
||||
uint32_t * DPC__START_REG;
|
||||
uint32_t * DPC__END_REG;
|
||||
uint32_t * DPC__CURRENT_REG;
|
||||
uint32_t * DPC__STATUS_REG;
|
||||
uint32_t * DPC__CLOCK_REG;
|
||||
uint32_t * DPC__BUFBUSY_REG;
|
||||
uint32_t * DPC__PIPEBUSY_REG;
|
||||
uint32_t * DPC__TMEM_REG;
|
||||
|
||||
void(CALL *CheckInterrupts)(void);
|
||||
void(CALL *ProcessDlist)(void);
|
||||
void(CALL *ProcessAlist)(void);
|
||||
void(CALL *ProcessRdpList)(void);
|
||||
void(CALL *ShowCFB)(void);
|
||||
} RSP_INFO_1_1;
|
||||
|
||||
RSP_INFO_1_1 Info = { 0 };
|
||||
|
||||
Info.hInst = Plugins->MainWindow()->GetModuleInstance();
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
|
||||
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateRSP) (RSP_INFO_1_1 Audio_Info, uint32_t * Cycles);
|
||||
LoadFunction(InitiateRSP);
|
||||
if (InitiateRSP == NULL) { return false; }
|
||||
|
||||
// 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.
|
||||
if (System == NULL)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
uint32_t Value = 0;
|
||||
|
||||
Info.ProcessDlist = DummyCheckInterrupts;
|
||||
Info.ProcessRdpList = DummyCheckInterrupts;
|
||||
Info.ShowCFB = DummyCheckInterrupts;
|
||||
Info.ProcessAlist = DummyCheckInterrupts;
|
||||
|
||||
Info.RDRAM = Buffer;
|
||||
Info.DMEM = Buffer;
|
||||
Info.IMEM = Buffer;
|
||||
|
||||
Info.MI__INTR_REG = &Value;
|
||||
|
||||
Info.SP__MEM_ADDR_REG = &Value;
|
||||
Info.SP__DRAM_ADDR_REG = &Value;
|
||||
Info.SP__RD_LEN_REG = &Value;
|
||||
Info.SP__WR_LEN_REG = &Value;
|
||||
Info.SP__STATUS_REG = &Value;
|
||||
Info.SP__DMA_FULL_REG = &Value;
|
||||
Info.SP__DMA_BUSY_REG = &Value;
|
||||
Info.SP__PC_REG = &Value;
|
||||
Info.SP__SEMAPHORE_REG = &Value;
|
||||
|
||||
Info.DPC__START_REG = &Value;
|
||||
Info.DPC__END_REG = &Value;
|
||||
Info.DPC__CURRENT_REG = &Value;
|
||||
Info.DPC__STATUS_REG = &Value;
|
||||
Info.DPC__CLOCK_REG = &Value;
|
||||
Info.DPC__BUFBUSY_REG = &Value;
|
||||
Info.DPC__PIPEBUSY_REG = &Value;
|
||||
Info.DPC__TMEM_REG = &Value;
|
||||
}
|
||||
// Send initialization information to the DLL
|
||||
else
|
||||
{
|
||||
Info.ProcessDlist = Plugins->Gfx()->ProcessDList;
|
||||
Info.ProcessRdpList = Plugins->Gfx()->ProcessRDPList;
|
||||
Info.ShowCFB = Plugins->Gfx()->ShowCFB;
|
||||
Info.ProcessAlist = Plugins->Audio()->ProcessAList;
|
||||
|
||||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
|
||||
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
|
||||
|
||||
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_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__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
|
||||
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_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__PC_REG = &g_Reg->SP_PC_REG;
|
||||
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
|
||||
|
||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||
}
|
||||
|
||||
InitiateRSP(Info, &m_CycleCount);
|
||||
m_Initialized = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
#endif
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CRSP_Plugin::UnloadPluginDetails(void)
|
||||
{
|
||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||
DoRspCycles = NULL;
|
||||
EnableDebugging = NULL;
|
||||
GetDebugInfo = NULL;
|
||||
InitiateDebugger = NULL;
|
||||
}
|
||||
|
||||
void CRSP_Plugin::ProcessMenuItem(int id)
|
||||
{
|
||||
if (m_RSPDebug.ProcessMenuItem)
|
||||
{
|
||||
m_RSPDebug.ProcessMenuItem(id);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||
#include "RSPPlugin.h"
|
||||
#include "GFXPlugin.h"
|
||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||
|
||||
void DummyFunc1(int a) { a += 1; }
|
||||
|
||||
CRSP_Plugin::CRSP_Plugin(void) :
|
||||
DoRspCycles(NULL),
|
||||
EnableDebugging(NULL),
|
||||
m_CycleCount(0),
|
||||
GetDebugInfo(NULL),
|
||||
InitiateDebugger(NULL)
|
||||
{
|
||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||
}
|
||||
|
||||
CRSP_Plugin::~CRSP_Plugin()
|
||||
{
|
||||
Close();
|
||||
UnloadPlugin();
|
||||
}
|
||||
|
||||
bool CRSP_Plugin::LoadFunctions(void)
|
||||
{
|
||||
// Find entries for functions in DLL
|
||||
void(CALL *InitiateRSP)(void);
|
||||
LoadFunction(InitiateRSP);
|
||||
LoadFunction(DoRspCycles);
|
||||
_LoadFunction("GetRspDebugInfo", GetDebugInfo);
|
||||
_LoadFunction("InitiateRSPDebugger", InitiateDebugger);
|
||||
LoadFunction(EnableDebugging);
|
||||
if (EnableDebugging == NULL) { EnableDebugging = DummyFunc1; }
|
||||
|
||||
//Make sure dll had all needed functions
|
||||
if (DoRspCycles == NULL) { UnloadPlugin(); return false; }
|
||||
if (InitiateRSP == NULL) { UnloadPlugin(); return false; }
|
||||
if (RomClosed == NULL) { UnloadPlugin(); return false; }
|
||||
if (CloseDLL == NULL) { UnloadPlugin(); return false; }
|
||||
|
||||
if (m_PluginInfo.Version >= 0x0102)
|
||||
{
|
||||
if (PluginOpened == NULL) { UnloadPlugin(); return false; }
|
||||
}
|
||||
|
||||
// Get debug info if able
|
||||
if (GetDebugInfo != NULL)
|
||||
{
|
||||
GetDebugInfo(&m_RSPDebug);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRSP_Plugin::Initiate(CPlugins * Plugins, CN64System * System)
|
||||
{
|
||||
if (m_PluginInfo.Version == 1 || m_PluginInfo.Version == 0x100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * hInst;
|
||||
int MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
|
||||
bswap on a dword (32 bits) boundry */
|
||||
uint8_t * RDRAM;
|
||||
uint8_t * DMEM;
|
||||
uint8_t * IMEM;
|
||||
|
||||
uint32_t * MI__INTR_REG;
|
||||
|
||||
uint32_t * SP__MEM_ADDR_REG;
|
||||
uint32_t * SP__DRAM_ADDR_REG;
|
||||
uint32_t * SP__RD_LEN_REG;
|
||||
uint32_t * SP__WR_LEN_REG;
|
||||
uint32_t * SP__STATUS_REG;
|
||||
uint32_t * SP__DMA_FULL_REG;
|
||||
uint32_t * SP__DMA_BUSY_REG;
|
||||
uint32_t * SP__PC_REG;
|
||||
uint32_t * SP__SEMAPHORE_REG;
|
||||
|
||||
uint32_t * DPC__START_REG;
|
||||
uint32_t * DPC__END_REG;
|
||||
uint32_t * DPC__CURRENT_REG;
|
||||
uint32_t * DPC__STATUS_REG;
|
||||
uint32_t * DPC__CLOCK_REG;
|
||||
uint32_t * DPC__BUFBUSY_REG;
|
||||
uint32_t * DPC__PIPEBUSY_REG;
|
||||
uint32_t * DPC__TMEM_REG;
|
||||
|
||||
void(CALL *CheckInterrupts)(void);
|
||||
void(CALL *ProcessDlist)(void);
|
||||
void(CALL *ProcessAlist)(void);
|
||||
void(CALL *ProcessRdpList)(void);
|
||||
void(CALL *ShowCFB)(void);
|
||||
} RSP_INFO_1_1;
|
||||
|
||||
RSP_INFO_1_1 Info = { 0 };
|
||||
|
||||
Info.hInst = Plugins->MainWindow()->GetModuleInstance();
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
Info.MemoryBswaped = (System == NULL); // only true when the system's not yet loaded
|
||||
|
||||
//Get Function from DLL
|
||||
void(CALL *InitiateRSP) (RSP_INFO_1_1 Audio_Info, uint32_t * Cycles);
|
||||
LoadFunction(InitiateRSP);
|
||||
if (InitiateRSP == NULL) { return false; }
|
||||
|
||||
// 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.
|
||||
if (System == NULL)
|
||||
{
|
||||
uint8_t Buffer[100];
|
||||
uint32_t Value = 0;
|
||||
|
||||
Info.ProcessDlist = DummyCheckInterrupts;
|
||||
Info.ProcessRdpList = DummyCheckInterrupts;
|
||||
Info.ShowCFB = DummyCheckInterrupts;
|
||||
Info.ProcessAlist = DummyCheckInterrupts;
|
||||
|
||||
Info.RDRAM = Buffer;
|
||||
Info.DMEM = Buffer;
|
||||
Info.IMEM = Buffer;
|
||||
|
||||
Info.MI__INTR_REG = &Value;
|
||||
|
||||
Info.SP__MEM_ADDR_REG = &Value;
|
||||
Info.SP__DRAM_ADDR_REG = &Value;
|
||||
Info.SP__RD_LEN_REG = &Value;
|
||||
Info.SP__WR_LEN_REG = &Value;
|
||||
Info.SP__STATUS_REG = &Value;
|
||||
Info.SP__DMA_FULL_REG = &Value;
|
||||
Info.SP__DMA_BUSY_REG = &Value;
|
||||
Info.SP__PC_REG = &Value;
|
||||
Info.SP__SEMAPHORE_REG = &Value;
|
||||
|
||||
Info.DPC__START_REG = &Value;
|
||||
Info.DPC__END_REG = &Value;
|
||||
Info.DPC__CURRENT_REG = &Value;
|
||||
Info.DPC__STATUS_REG = &Value;
|
||||
Info.DPC__CLOCK_REG = &Value;
|
||||
Info.DPC__BUFBUSY_REG = &Value;
|
||||
Info.DPC__PIPEBUSY_REG = &Value;
|
||||
Info.DPC__TMEM_REG = &Value;
|
||||
}
|
||||
// Send initialization information to the DLL
|
||||
else
|
||||
{
|
||||
Info.ProcessDlist = Plugins->Gfx()->ProcessDList;
|
||||
Info.ProcessRdpList = Plugins->Gfx()->ProcessRDPList;
|
||||
Info.ShowCFB = Plugins->Gfx()->ShowCFB;
|
||||
Info.ProcessAlist = Plugins->Audio()->ProcessAList;
|
||||
|
||||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
|
||||
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
|
||||
|
||||
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_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__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
|
||||
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_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__PC_REG = &g_Reg->SP_PC_REG;
|
||||
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
|
||||
|
||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||
}
|
||||
|
||||
InitiateRSP(Info, &m_CycleCount);
|
||||
m_Initialized = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
pjutil::DynLibCallDllMain();
|
||||
#endif
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
void CRSP_Plugin::UnloadPluginDetails(void)
|
||||
{
|
||||
memset(&m_RSPDebug, 0, sizeof(m_RSPDebug));
|
||||
DoRspCycles = NULL;
|
||||
EnableDebugging = NULL;
|
||||
GetDebugInfo = NULL;
|
||||
InitiateDebugger = NULL;
|
||||
}
|
||||
|
||||
void CRSP_Plugin::ProcessMenuItem(int id)
|
||||
{
|
||||
if (m_RSPDebug.ProcessMenuItem)
|
||||
{
|
||||
m_RSPDebug.ProcessMenuItem(id);
|
||||
}
|
||||
}
|
|
@ -1,77 +1,77 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
class CRSP_Plugin : public CPlugin
|
||||
{
|
||||
typedef struct {
|
||||
/* Menu */
|
||||
/* Items should have an ID between 5001 and 5100 */
|
||||
void * hRSPMenu;
|
||||
void(CALL *ProcessMenuItem) (int32_t ID);
|
||||
|
||||
/* Break Points */
|
||||
int32_t UseBPoints;
|
||||
char BPPanelName[20];
|
||||
void(CALL *Add_BPoint) (void);
|
||||
void(CALL *CreateBPPanel) (void);
|
||||
void(CALL *HideBPPanel) (void);
|
||||
void(CALL *PaintBPPanel) (void);
|
||||
void(CALL *ShowBPPanel) (void);
|
||||
void(CALL *RefreshBpoints) (void * hList);
|
||||
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
||||
void(CALL *RemoveAllBpoint) (void);
|
||||
|
||||
/* RSP command Window */
|
||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||
} RSPDEBUG_INFO;
|
||||
|
||||
typedef struct {
|
||||
void(CALL *UpdateBreakPoints)(void);
|
||||
void(CALL *UpdateMemory)(void);
|
||||
void(CALL *UpdateR4300iRegisters)(void);
|
||||
void(CALL *Enter_BPoint_Window)(void);
|
||||
void(CALL *Enter_R4300i_Commands_Window)(void);
|
||||
void(CALL *Enter_R4300i_Register_Window)(void);
|
||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||
void(CALL *Enter_Memory_Window)(void);
|
||||
} DEBUG_INFO;
|
||||
|
||||
public:
|
||||
CRSP_Plugin(void);
|
||||
~CRSP_Plugin();
|
||||
|
||||
bool Initiate(CPlugins * Plugins, CN64System * System);
|
||||
|
||||
uint32_t(CALL *DoRspCycles)(uint32_t);
|
||||
void(CALL *EnableDebugging)(int32_t Enable);
|
||||
|
||||
void * GetDebugMenu(void) { return m_RSPDebug.hRSPMenu; }
|
||||
void ProcessMenuItem(int32_t id);
|
||||
|
||||
private:
|
||||
CRSP_Plugin(const CRSP_Plugin&); // Disable copy constructor
|
||||
CRSP_Plugin& operator=(const CRSP_Plugin&); // Disable assignment
|
||||
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_RSP; }
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstRSPDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstRSPSettings; }
|
||||
|
||||
bool LoadFunctions(void);
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
RSPDEBUG_INFO m_RSPDebug;
|
||||
uint32_t m_CycleCount;
|
||||
|
||||
void(CALL *GetDebugInfo) (RSPDEBUG_INFO * GFXDebugInfo);
|
||||
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
class CRSP_Plugin : public CPlugin
|
||||
{
|
||||
typedef struct {
|
||||
/* Menu */
|
||||
/* Items should have an ID between 5001 and 5100 */
|
||||
void * hRSPMenu;
|
||||
void(CALL *ProcessMenuItem) (int32_t ID);
|
||||
|
||||
/* Break Points */
|
||||
int32_t UseBPoints;
|
||||
char BPPanelName[20];
|
||||
void(CALL *Add_BPoint) (void);
|
||||
void(CALL *CreateBPPanel) (void);
|
||||
void(CALL *HideBPPanel) (void);
|
||||
void(CALL *PaintBPPanel) (void);
|
||||
void(CALL *ShowBPPanel) (void);
|
||||
void(CALL *RefreshBpoints) (void * hList);
|
||||
void(CALL *RemoveBpoint) (void * hList, int32_t index);
|
||||
void(CALL *RemoveAllBpoint) (void);
|
||||
|
||||
/* RSP command Window */
|
||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||
} RSPDEBUG_INFO;
|
||||
|
||||
typedef struct {
|
||||
void(CALL *UpdateBreakPoints)(void);
|
||||
void(CALL *UpdateMemory)(void);
|
||||
void(CALL *UpdateR4300iRegisters)(void);
|
||||
void(CALL *Enter_BPoint_Window)(void);
|
||||
void(CALL *Enter_R4300i_Commands_Window)(void);
|
||||
void(CALL *Enter_R4300i_Register_Window)(void);
|
||||
void(CALL *Enter_RSP_Commands_Window)(void);
|
||||
void(CALL *Enter_Memory_Window)(void);
|
||||
} DEBUG_INFO;
|
||||
|
||||
public:
|
||||
CRSP_Plugin(void);
|
||||
~CRSP_Plugin();
|
||||
|
||||
bool Initiate(CPlugins * Plugins, CN64System * System);
|
||||
|
||||
uint32_t(CALL *DoRspCycles)(uint32_t);
|
||||
void(CALL *EnableDebugging)(int32_t Enable);
|
||||
|
||||
void * GetDebugMenu(void) { return m_RSPDebug.hRSPMenu; }
|
||||
void ProcessMenuItem(int32_t id);
|
||||
|
||||
private:
|
||||
CRSP_Plugin(const CRSP_Plugin&); // Disable copy constructor
|
||||
CRSP_Plugin& operator=(const CRSP_Plugin&); // Disable assignment
|
||||
|
||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_RSP; }
|
||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstRSPDefaultSet; }
|
||||
virtual int32_t GetSettingStartRange() const { return FirstRSPSettings; }
|
||||
|
||||
bool LoadFunctions(void);
|
||||
void UnloadPluginDetails(void);
|
||||
|
||||
RSPDEBUG_INFO m_RSPDebug;
|
||||
uint32_t m_CycleCount;
|
||||
|
||||
void(CALL *GetDebugInfo) (RSPDEBUG_INFO * GFXDebugInfo);
|
||||
void(CALL *InitiateDebugger)(DEBUG_INFO DebugInfo);
|
||||
};
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "DebugSettings.h"
|
||||
|
||||
int CDebugSettings::m_RefCount = 0;
|
||||
|
||||
bool CDebugSettings::m_bHaveDebugger = false;
|
||||
bool CDebugSettings::m_bLogX86Code = false;
|
||||
bool CDebugSettings::m_bShowTLBMisses = false;
|
||||
bool CDebugSettings::m_bShowDivByZero = false;
|
||||
bool CDebugSettings::m_Registered = false;
|
||||
|
||||
CDebugSettings::CDebugSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (!m_Registered && g_Settings)
|
||||
{
|
||||
m_Registered = true;
|
||||
g_Settings->RegisterChangeCB(Debugger_Enabled, 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_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
|
||||
RefreshSettings();
|
||||
}
|
||||
}
|
||||
|
||||
CDebugSettings::~CDebugSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0 && g_Settings)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Debugger_Enabled, 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_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugSettings::RefreshSettings()
|
||||
{
|
||||
m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
|
||||
m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles);
|
||||
m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses);
|
||||
m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "DebugSettings.h"
|
||||
|
||||
int CDebugSettings::m_RefCount = 0;
|
||||
|
||||
bool CDebugSettings::m_bHaveDebugger = false;
|
||||
bool CDebugSettings::m_bLogX86Code = false;
|
||||
bool CDebugSettings::m_bShowTLBMisses = false;
|
||||
bool CDebugSettings::m_bShowDivByZero = false;
|
||||
bool CDebugSettings::m_Registered = false;
|
||||
|
||||
CDebugSettings::CDebugSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (!m_Registered && g_Settings)
|
||||
{
|
||||
m_Registered = true;
|
||||
g_Settings->RegisterChangeCB(Debugger_Enabled, 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_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
|
||||
RefreshSettings();
|
||||
}
|
||||
}
|
||||
|
||||
CDebugSettings::~CDebugSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0 && g_Settings)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Debugger_Enabled, 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_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugSettings::RefreshSettings()
|
||||
{
|
||||
m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled);
|
||||
m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles);
|
||||
m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses);
|
||||
m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero);
|
||||
}
|
|
@ -1,42 +1,42 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
class CDebugSettings
|
||||
{
|
||||
public:
|
||||
CDebugSettings();
|
||||
virtual ~CDebugSettings();
|
||||
|
||||
static inline bool bHaveDebugger(void) { return m_bHaveDebugger; }
|
||||
static inline bool bLogX86Code(void) { return m_bLogX86Code; }
|
||||
static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; }
|
||||
static inline bool bShowDivByZero(void) { return m_bShowDivByZero; }
|
||||
|
||||
private:
|
||||
static void StaticRefreshSettings(CDebugSettings * _this)
|
||||
{
|
||||
_this->RefreshSettings();
|
||||
}
|
||||
|
||||
void RefreshSettings(void);
|
||||
|
||||
//Settings that can be changed on the fly
|
||||
static bool m_bHaveDebugger;
|
||||
static bool m_bLogX86Code;
|
||||
static bool m_bShowTLBMisses;
|
||||
static bool m_bShowDivByZero;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
static bool m_Registered;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
class CDebugSettings
|
||||
{
|
||||
public:
|
||||
CDebugSettings();
|
||||
virtual ~CDebugSettings();
|
||||
|
||||
static inline bool bHaveDebugger(void) { return m_bHaveDebugger; }
|
||||
static inline bool bLogX86Code(void) { return m_bLogX86Code; }
|
||||
static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; }
|
||||
static inline bool bShowDivByZero(void) { return m_bShowDivByZero; }
|
||||
|
||||
private:
|
||||
static void StaticRefreshSettings(CDebugSettings * _this)
|
||||
{
|
||||
_this->RefreshSettings();
|
||||
}
|
||||
|
||||
void RefreshSettings(void);
|
||||
|
||||
//Settings that can be changed on the fly
|
||||
static bool m_bHaveDebugger;
|
||||
static bool m_bLogX86Code;
|
||||
static bool m_bShowTLBMisses;
|
||||
static bool m_bShowDivByZero;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
static bool m_Registered;
|
||||
};
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/Settings/GameSettings.h>
|
||||
|
||||
bool CGameSettings::m_bSMM_StoreInstruc;
|
||||
bool CGameSettings::m_bSMM_Protect;
|
||||
bool CGameSettings::m_bSMM_ValidFunc;
|
||||
bool CGameSettings::m_bSMM_PIDMA;
|
||||
bool CGameSettings::m_bSMM_TLB;
|
||||
bool CGameSettings::m_bUseTlb;
|
||||
uint32_t CGameSettings::m_CountPerOp = 2;
|
||||
uint32_t CGameSettings::m_ViRefreshRate = 1500;
|
||||
uint32_t CGameSettings::m_AiCountPerBytes = 500;
|
||||
bool CGameSettings::m_DelayDP = false;
|
||||
bool CGameSettings::m_DelaySI = false;
|
||||
uint32_t CGameSettings::m_RdramSize = 0;
|
||||
bool CGameSettings::m_bFixedAudio = true;
|
||||
bool CGameSettings::m_bSyncingToAudio = true;
|
||||
bool CGameSettings::m_bSyncToAudio = true;
|
||||
bool CGameSettings::m_bFastSP = true;
|
||||
bool CGameSettings::m_b32Bit = true;
|
||||
bool CGameSettings::m_RspAudioSignal;
|
||||
bool CGameSettings::m_bRomInMemory;
|
||||
bool CGameSettings::m_RegCaching;
|
||||
bool CGameSettings::m_bLinkBlocks;
|
||||
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
|
||||
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
|
||||
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;
|
||||
|
||||
void CGameSettings::RefreshGameSettings()
|
||||
{
|
||||
m_bSMM_StoreInstruc = false /*g_Settings->LoadBool(Game_SMM_StoreInstruc)*/;
|
||||
m_bSMM_Protect = g_Settings->LoadBool(Game_SMM_Protect);
|
||||
m_bSMM_ValidFunc = g_Settings->LoadBool(Game_SMM_ValidFunc);
|
||||
m_bSMM_PIDMA = g_Settings->LoadBool(Game_SMM_PIDMA);
|
||||
m_bSMM_TLB = g_Settings->LoadBool(Game_SMM_TLB);
|
||||
m_bUseTlb = g_Settings->LoadBool(Game_UseTlb);
|
||||
m_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
|
||||
m_AiCountPerBytes = g_Settings->LoadDword(Game_AiCountPerBytes);
|
||||
m_CountPerOp = g_Settings->LoadDword(Game_CounterFactor);
|
||||
m_RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
||||
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
||||
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
||||
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
||||
m_bSyncToAudio = m_bFixedAudio ? g_Settings->LoadBool(Game_SyncViaAudio) : false;
|
||||
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
||||
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
|
||||
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
|
||||
m_bRomInMemory = g_Settings->LoadBool(Game_LoadRomToMemory);
|
||||
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
|
||||
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
|
||||
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
|
||||
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
|
||||
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
|
||||
|
||||
m_bSyncingToAudio = m_bSyncToAudio;
|
||||
if (m_CountPerOp == 0)
|
||||
{
|
||||
m_CountPerOp = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameSettings::SpeedChanged(int SpeedLimit)
|
||||
{
|
||||
int FullSpeed = g_System->m_SystemType == SYSTEM_PAL ? 50 : 60;
|
||||
m_bSyncingToAudio = SpeedLimit == FullSpeed ? m_bSyncToAudio : false;
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/Settings/GameSettings.h>
|
||||
|
||||
bool CGameSettings::m_bSMM_StoreInstruc;
|
||||
bool CGameSettings::m_bSMM_Protect;
|
||||
bool CGameSettings::m_bSMM_ValidFunc;
|
||||
bool CGameSettings::m_bSMM_PIDMA;
|
||||
bool CGameSettings::m_bSMM_TLB;
|
||||
bool CGameSettings::m_bUseTlb;
|
||||
uint32_t CGameSettings::m_CountPerOp = 2;
|
||||
uint32_t CGameSettings::m_ViRefreshRate = 1500;
|
||||
uint32_t CGameSettings::m_AiCountPerBytes = 500;
|
||||
bool CGameSettings::m_DelayDP = false;
|
||||
bool CGameSettings::m_DelaySI = false;
|
||||
uint32_t CGameSettings::m_RdramSize = 0;
|
||||
bool CGameSettings::m_bFixedAudio = true;
|
||||
bool CGameSettings::m_bSyncingToAudio = true;
|
||||
bool CGameSettings::m_bSyncToAudio = true;
|
||||
bool CGameSettings::m_bFastSP = true;
|
||||
bool CGameSettings::m_b32Bit = true;
|
||||
bool CGameSettings::m_RspAudioSignal;
|
||||
bool CGameSettings::m_bRomInMemory;
|
||||
bool CGameSettings::m_RegCaching;
|
||||
bool CGameSettings::m_bLinkBlocks;
|
||||
uint32_t CGameSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
|
||||
SYSTEM_TYPE CGameSettings::m_SystemType = SYSTEM_NTSC;
|
||||
CPU_TYPE CGameSettings::m_CpuType = CPU_Recompiler;
|
||||
|
||||
void CGameSettings::RefreshGameSettings()
|
||||
{
|
||||
m_bSMM_StoreInstruc = false /*g_Settings->LoadBool(Game_SMM_StoreInstruc)*/;
|
||||
m_bSMM_Protect = g_Settings->LoadBool(Game_SMM_Protect);
|
||||
m_bSMM_ValidFunc = g_Settings->LoadBool(Game_SMM_ValidFunc);
|
||||
m_bSMM_PIDMA = g_Settings->LoadBool(Game_SMM_PIDMA);
|
||||
m_bSMM_TLB = g_Settings->LoadBool(Game_SMM_TLB);
|
||||
m_bUseTlb = g_Settings->LoadBool(Game_UseTlb);
|
||||
m_ViRefreshRate = g_Settings->LoadDword(Game_ViRefreshRate);
|
||||
m_AiCountPerBytes = g_Settings->LoadDword(Game_AiCountPerBytes);
|
||||
m_CountPerOp = g_Settings->LoadDword(Game_CounterFactor);
|
||||
m_RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
||||
m_DelaySI = g_Settings->LoadBool(Game_DelaySI);
|
||||
m_DelayDP = g_Settings->LoadBool(Game_DelayDP);
|
||||
m_bFixedAudio = g_Settings->LoadBool(Game_FixedAudio);
|
||||
m_bSyncToAudio = m_bFixedAudio ? g_Settings->LoadBool(Game_SyncViaAudio) : false;
|
||||
m_b32Bit = g_Settings->LoadBool(Game_32Bit);
|
||||
m_bFastSP = g_Settings->LoadBool(Game_FastSP);
|
||||
m_RspAudioSignal = g_Settings->LoadBool(Game_RspAudioSignal);
|
||||
m_bRomInMemory = g_Settings->LoadBool(Game_LoadRomToMemory);
|
||||
m_RegCaching = g_Settings->LoadBool(Game_RegCache);
|
||||
m_bLinkBlocks = g_Settings->LoadBool(Game_BlockLinking);
|
||||
m_LookUpMode = g_Settings->LoadDword(Game_FuncLookupMode);
|
||||
m_SystemType = (SYSTEM_TYPE)g_Settings->LoadDword(Game_SystemType);
|
||||
m_CpuType = (CPU_TYPE)g_Settings->LoadDword(Game_CpuType);
|
||||
|
||||
m_bSyncingToAudio = m_bSyncToAudio;
|
||||
if (m_CountPerOp == 0)
|
||||
{
|
||||
m_CountPerOp = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameSettings::SpeedChanged(int SpeedLimit)
|
||||
{
|
||||
int FullSpeed = g_System->m_SystemType == SYSTEM_PAL ? 50 : 60;
|
||||
m_bSyncingToAudio = SpeedLimit == FullSpeed ? m_bSyncToAudio : false;
|
||||
}
|
|
@ -1,73 +1,73 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
class CGameSettings
|
||||
{
|
||||
public:
|
||||
void RefreshGameSettings(void);
|
||||
|
||||
inline static bool bRomInMemory(void) { return m_bRomInMemory; }
|
||||
inline static bool bRegCaching(void) { return m_RegCaching; }
|
||||
inline static bool bLinkBlocks(void) { return m_bLinkBlocks; }
|
||||
inline static FUNC_LOOKUP_METHOD LookUpMode(void) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
|
||||
inline static bool bUseTlb(void) { return m_bUseTlb; }
|
||||
inline static uint32_t CountPerOp(void) { return m_CountPerOp; }
|
||||
inline static uint32_t ViRefreshRate(void) { return m_ViRefreshRate; }
|
||||
inline static uint32_t AiCountPerBytes(void) { return m_AiCountPerBytes; }
|
||||
inline static bool bDelayDP(void) { return m_DelayDP; }
|
||||
inline static bool bDelaySI(void) { return m_DelaySI; }
|
||||
inline static uint32_t RdramSize(void) { return m_RdramSize; }
|
||||
inline static bool bFixedAudio(void) { return m_bFixedAudio; }
|
||||
inline static bool bSyncToAudio(void) { return m_bSyncingToAudio; }
|
||||
inline static bool bFastSP(void) { return m_bFastSP; }
|
||||
inline static bool b32BitCore(void) { return m_b32Bit; }
|
||||
inline static bool RspAudioSignal(void) { return m_RspAudioSignal; }
|
||||
inline static bool bSMM_StoreInstruc(void) { return m_bSMM_StoreInstruc; }
|
||||
inline static bool bSMM_Protect(void) { return m_bSMM_Protect; }
|
||||
inline static bool bSMM_ValidFunc(void) { return m_bSMM_ValidFunc; }
|
||||
inline static bool bSMM_PIDMA(void) { return m_bSMM_PIDMA; }
|
||||
inline static bool bSMM_TLB(void) { return m_bSMM_TLB; }
|
||||
inline static SYSTEM_TYPE SystemType(void) { return m_SystemType; }
|
||||
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
||||
|
||||
protected:
|
||||
static void SpeedChanged(int32_t SpeedLimit);
|
||||
|
||||
private:
|
||||
//Settings that can be changed on the fly
|
||||
static bool m_bRomInMemory;
|
||||
static bool m_RegCaching;
|
||||
static bool m_bLinkBlocks;
|
||||
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
|
||||
static bool m_bUseTlb;
|
||||
static uint32_t m_CountPerOp;
|
||||
static uint32_t m_ViRefreshRate;
|
||||
static uint32_t m_AiCountPerBytes;
|
||||
static bool m_DelayDP;
|
||||
static bool m_DelaySI;
|
||||
static uint32_t m_RdramSize;
|
||||
static bool m_bFixedAudio;
|
||||
static bool m_bSyncingToAudio;
|
||||
static bool m_bSyncToAudio;
|
||||
static bool m_bFastSP;
|
||||
static bool m_b32Bit;
|
||||
static bool m_RspAudioSignal;
|
||||
static bool m_bSMM_StoreInstruc;
|
||||
static bool m_bSMM_Protect;
|
||||
static bool m_bSMM_ValidFunc;
|
||||
static bool m_bSMM_PIDMA;
|
||||
static bool m_bSMM_TLB;
|
||||
static SYSTEM_TYPE m_SystemType;
|
||||
static CPU_TYPE m_CpuType;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
class CGameSettings
|
||||
{
|
||||
public:
|
||||
void RefreshGameSettings(void);
|
||||
|
||||
inline static bool bRomInMemory(void) { return m_bRomInMemory; }
|
||||
inline static bool bRegCaching(void) { return m_RegCaching; }
|
||||
inline static bool bLinkBlocks(void) { return m_bLinkBlocks; }
|
||||
inline static FUNC_LOOKUP_METHOD LookUpMode(void) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; }
|
||||
inline static bool bUseTlb(void) { return m_bUseTlb; }
|
||||
inline static uint32_t CountPerOp(void) { return m_CountPerOp; }
|
||||
inline static uint32_t ViRefreshRate(void) { return m_ViRefreshRate; }
|
||||
inline static uint32_t AiCountPerBytes(void) { return m_AiCountPerBytes; }
|
||||
inline static bool bDelayDP(void) { return m_DelayDP; }
|
||||
inline static bool bDelaySI(void) { return m_DelaySI; }
|
||||
inline static uint32_t RdramSize(void) { return m_RdramSize; }
|
||||
inline static bool bFixedAudio(void) { return m_bFixedAudio; }
|
||||
inline static bool bSyncToAudio(void) { return m_bSyncingToAudio; }
|
||||
inline static bool bFastSP(void) { return m_bFastSP; }
|
||||
inline static bool b32BitCore(void) { return m_b32Bit; }
|
||||
inline static bool RspAudioSignal(void) { return m_RspAudioSignal; }
|
||||
inline static bool bSMM_StoreInstruc(void) { return m_bSMM_StoreInstruc; }
|
||||
inline static bool bSMM_Protect(void) { return m_bSMM_Protect; }
|
||||
inline static bool bSMM_ValidFunc(void) { return m_bSMM_ValidFunc; }
|
||||
inline static bool bSMM_PIDMA(void) { return m_bSMM_PIDMA; }
|
||||
inline static bool bSMM_TLB(void) { return m_bSMM_TLB; }
|
||||
inline static SYSTEM_TYPE SystemType(void) { return m_SystemType; }
|
||||
inline static CPU_TYPE CpuType(void) { return m_CpuType; }
|
||||
|
||||
protected:
|
||||
static void SpeedChanged(int32_t SpeedLimit);
|
||||
|
||||
private:
|
||||
//Settings that can be changed on the fly
|
||||
static bool m_bRomInMemory;
|
||||
static bool m_RegCaching;
|
||||
static bool m_bLinkBlocks;
|
||||
static uint32_t m_LookUpMode; //FUNC_LOOKUP_METHOD
|
||||
static bool m_bUseTlb;
|
||||
static uint32_t m_CountPerOp;
|
||||
static uint32_t m_ViRefreshRate;
|
||||
static uint32_t m_AiCountPerBytes;
|
||||
static bool m_DelayDP;
|
||||
static bool m_DelaySI;
|
||||
static uint32_t m_RdramSize;
|
||||
static bool m_bFixedAudio;
|
||||
static bool m_bSyncingToAudio;
|
||||
static bool m_bSyncToAudio;
|
||||
static bool m_bFastSP;
|
||||
static bool m_b32Bit;
|
||||
static bool m_RspAudioSignal;
|
||||
static bool m_bSMM_StoreInstruc;
|
||||
static bool m_bSMM_Protect;
|
||||
static bool m_bSMM_ValidFunc;
|
||||
static bool m_bSMM_PIDMA;
|
||||
static bool m_bSMM_TLB;
|
||||
static SYSTEM_TYPE m_SystemType;
|
||||
static CPU_TYPE m_CpuType;
|
||||
};
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "N64SystemSettings.h"
|
||||
|
||||
int32_t CN64SystemSettings::m_RefCount = 0;
|
||||
|
||||
bool CN64SystemSettings::m_bShowCPUPer;
|
||||
bool CN64SystemSettings::m_bProfiling;
|
||||
bool CN64SystemSettings::m_bBasicMode;
|
||||
bool CN64SystemSettings::m_bLimitFPS;
|
||||
bool CN64SystemSettings::m_bShowDListAListCount;
|
||||
bool CN64SystemSettings::m_bDisplayFrameRate;
|
||||
|
||||
CN64SystemSettings::CN64SystemSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->RegisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
||||
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CN64SystemSettings::~CN64SystemSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->UnregisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CN64SystemSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
|
||||
m_bDisplayFrameRate = g_Settings->LoadBool(UserInterface_DisplayFrameRate);
|
||||
|
||||
m_bShowCPUPer = g_Settings->LoadBool(UserInterface_ShowCPUPer);
|
||||
m_bProfiling = g_Settings->LoadBool(Debugger_ProfileCode);
|
||||
m_bShowDListAListCount = g_Settings->LoadBool(Debugger_ShowDListAListCount);
|
||||
m_bLimitFPS = g_Settings->LoadBool(GameRunning_LimitFPS);
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "N64SystemSettings.h"
|
||||
|
||||
int32_t CN64SystemSettings::m_RefCount = 0;
|
||||
|
||||
bool CN64SystemSettings::m_bShowCPUPer;
|
||||
bool CN64SystemSettings::m_bProfiling;
|
||||
bool CN64SystemSettings::m_bBasicMode;
|
||||
bool CN64SystemSettings::m_bLimitFPS;
|
||||
bool CN64SystemSettings::m_bShowDListAListCount;
|
||||
bool CN64SystemSettings::m_bDisplayFrameRate;
|
||||
|
||||
CN64SystemSettings::CN64SystemSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->RegisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->RegisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
||||
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CN64SystemSettings::~CN64SystemSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(UserInterface_BasicMode, NULL, RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(UserInterface_DisplayFrameRate, NULL, RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(UserInterface_ShowCPUPer, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->UnregisterChangeCB(Debugger_ProfileCode, NULL, RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Debugger_ShowDListAListCount, NULL, RefreshSettings);
|
||||
|
||||
g_Settings->UnregisterChangeCB(GameRunning_LimitFPS, NULL, RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CN64SystemSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bBasicMode = g_Settings->LoadBool(UserInterface_BasicMode);
|
||||
m_bDisplayFrameRate = g_Settings->LoadBool(UserInterface_DisplayFrameRate);
|
||||
|
||||
m_bShowCPUPer = g_Settings->LoadBool(UserInterface_ShowCPUPer);
|
||||
m_bProfiling = g_Settings->LoadBool(Debugger_ProfileCode);
|
||||
m_bShowDListAListCount = g_Settings->LoadBool(Debugger_ShowDListAListCount);
|
||||
m_bLimitFPS = g_Settings->LoadBool(GameRunning_LimitFPS);
|
||||
}
|
|
@ -1,37 +1,37 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CN64SystemSettings
|
||||
{
|
||||
protected:
|
||||
CN64SystemSettings();
|
||||
virtual ~CN64SystemSettings();
|
||||
|
||||
inline static bool bBasicMode(void) { return m_bBasicMode; }
|
||||
inline static bool bDisplayFrameRate(void) { return m_bDisplayFrameRate; }
|
||||
inline static bool bShowCPUPer(void) { return m_bShowCPUPer; }
|
||||
inline static bool bProfiling(void) { return m_bProfiling; }
|
||||
inline static bool bShowDListAListCount(void) { return m_bShowDListAListCount; }
|
||||
inline static bool bLimitFPS(void) { return m_bLimitFPS; }
|
||||
|
||||
private:
|
||||
static void RefreshSettings(void *);
|
||||
|
||||
static bool m_bShowCPUPer;
|
||||
static bool m_bProfiling;
|
||||
static bool m_bBasicMode;
|
||||
static bool m_bLimitFPS;
|
||||
static bool m_bShowDListAListCount;
|
||||
static bool m_bDisplayFrameRate;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CN64SystemSettings
|
||||
{
|
||||
protected:
|
||||
CN64SystemSettings();
|
||||
virtual ~CN64SystemSettings();
|
||||
|
||||
inline static bool bBasicMode(void) { return m_bBasicMode; }
|
||||
inline static bool bDisplayFrameRate(void) { return m_bDisplayFrameRate; }
|
||||
inline static bool bShowCPUPer(void) { return m_bShowCPUPer; }
|
||||
inline static bool bProfiling(void) { return m_bProfiling; }
|
||||
inline static bool bShowDListAListCount(void) { return m_bShowDListAListCount; }
|
||||
inline static bool bLimitFPS(void) { return m_bLimitFPS; }
|
||||
|
||||
private:
|
||||
static void RefreshSettings(void *);
|
||||
|
||||
static bool m_bShowCPUPer;
|
||||
static bool m_bProfiling;
|
||||
static bool m_bBasicMode;
|
||||
static bool m_bLimitFPS;
|
||||
static bool m_bShowDListAListCount;
|
||||
static bool m_bDisplayFrameRate;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
};
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
class CRecompilerSettings
|
||||
{
|
||||
public:
|
||||
CRecompilerSettings();
|
||||
virtual ~CRecompilerSettings();
|
||||
|
||||
static bool bShowRecompMemSize(void) { return m_bShowRecompMemSize; }
|
||||
|
||||
static bool bProfiling(void) { return m_bProfiling; }
|
||||
|
||||
private:
|
||||
static void StaticRefreshSettings(CRecompilerSettings * _this)
|
||||
{
|
||||
_this->RefreshSettings();
|
||||
}
|
||||
|
||||
void RefreshSettings(void);
|
||||
|
||||
//Settings that can be changed on the fly
|
||||
static bool m_bShowRecompMemSize;
|
||||
static bool m_bProfiling;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
class CRecompilerSettings
|
||||
{
|
||||
public:
|
||||
CRecompilerSettings();
|
||||
virtual ~CRecompilerSettings();
|
||||
|
||||
static bool bShowRecompMemSize(void) { return m_bShowRecompMemSize; }
|
||||
|
||||
static bool bProfiling(void) { return m_bProfiling; }
|
||||
|
||||
private:
|
||||
static void StaticRefreshSettings(CRecompilerSettings * _this)
|
||||
{
|
||||
_this->RefreshSettings();
|
||||
}
|
||||
|
||||
void RefreshSettings(void);
|
||||
|
||||
//Settings that can be changed on the fly
|
||||
static bool m_bShowRecompMemSize;
|
||||
static bool m_bProfiling;
|
||||
|
||||
static int32_t m_RefCount;
|
||||
};
|
||||
|
|
|
@ -1,260 +1,260 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include <Common/path.h>
|
||||
|
||||
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue ) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue ) :
|
||||
m_DefaultStr(DefaultValue),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(DefaultSetting),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::~CSettingTypeApplication()
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
|
||||
{
|
||||
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
||||
if (!BaseDir.DirectoryExists())
|
||||
{
|
||||
printf("BaseDir does not exists, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
stdstr SettingsFile, OrigSettingsFile;
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
OrigSettingsFile = SettingsFile;
|
||||
if (!g_Settings->LoadStringVal(SupportFile_Settings,SettingsFile) && i > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (SettingsFile == OrigSettingsFile)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
delete m_SettingsIniFile;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
|
||||
#else
|
||||
CPath SettingsDir(CPath(SettingsFile).GetDirectory(), "");
|
||||
#endif
|
||||
if (!SettingsDir.DirectoryExists())
|
||||
{
|
||||
SettingsDir.DirectoryCreate();
|
||||
}
|
||||
|
||||
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
|
||||
}
|
||||
|
||||
m_SettingsIniFile->SetAutoFlush(false);
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Flush()
|
||||
{
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
m_SettingsIniFile->FlushChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::CleanUp()
|
||||
{
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
m_SettingsIniFile->SetAutoFlush(true);
|
||||
delete m_SettingsIniFile;
|
||||
m_SettingsIniFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeApplication::Load ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
bool bRes = false;
|
||||
|
||||
uint32_t dwValue;
|
||||
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
|
||||
if (bRes)
|
||||
{
|
||||
Value = dwValue != 0;
|
||||
}
|
||||
|
||||
if (!bRes && m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeApplication::Load ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
bool bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value);
|
||||
if (!bRes && m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
const char * CSettingTypeApplication::SectionName ( void ) const
|
||||
{
|
||||
return m_Section.c_str();
|
||||
}
|
||||
|
||||
bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
bool bRes = m_SettingsIniFile ? m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value) : false;
|
||||
if (!bRes)
|
||||
{
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeApplication::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::LoadDefault(int /*Index*/, uint32_t & Value) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, const stdstr & Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||
}
|
||||
|
||||
stdstr CSettingTypeApplication::FixSectionName(const char * Section)
|
||||
{
|
||||
stdstr SectionName(Section);
|
||||
|
||||
if (SectionName.empty())
|
||||
{
|
||||
SectionName = "default";
|
||||
}
|
||||
SectionName.Replace("\\","-");
|
||||
return SectionName;
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include <Common/path.h>
|
||||
|
||||
CIniFile * CSettingTypeApplication::m_SettingsIniFile = NULL;
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, bool DefaultValue ) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, const char * DefaultValue ) :
|
||||
m_DefaultStr(DefaultValue),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(DefaultSetting),
|
||||
m_Section(FixSectionName(Section)),
|
||||
m_KeyName(Name),
|
||||
m_KeyNameIdex(m_KeyName)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplication::~CSettingTypeApplication()
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Initialize( const char * /*AppName*/ )
|
||||
{
|
||||
CPath BaseDir(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
||||
if (!BaseDir.DirectoryExists())
|
||||
{
|
||||
printf("BaseDir does not exists, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
stdstr SettingsFile, OrigSettingsFile;
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
OrigSettingsFile = SettingsFile;
|
||||
if (!g_Settings->LoadStringVal(SupportFile_Settings,SettingsFile) && i > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (SettingsFile == OrigSettingsFile)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
delete m_SettingsIniFile;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
CPath SettingsDir(CPath(SettingsFile).GetDriveDirectory(),"");
|
||||
#else
|
||||
CPath SettingsDir(CPath(SettingsFile).GetDirectory(), "");
|
||||
#endif
|
||||
if (!SettingsDir.DirectoryExists())
|
||||
{
|
||||
SettingsDir.DirectoryCreate();
|
||||
}
|
||||
|
||||
m_SettingsIniFile = new CIniFile(SettingsFile.c_str());
|
||||
}
|
||||
|
||||
m_SettingsIniFile->SetAutoFlush(false);
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Flush()
|
||||
{
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
m_SettingsIniFile->FlushChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::CleanUp()
|
||||
{
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
m_SettingsIniFile->SetAutoFlush(true);
|
||||
delete m_SettingsIniFile;
|
||||
m_SettingsIniFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeApplication::Load ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
bool bRes = false;
|
||||
|
||||
uint32_t dwValue;
|
||||
bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,dwValue);
|
||||
if (bRes)
|
||||
{
|
||||
Value = dwValue != 0;
|
||||
}
|
||||
|
||||
if (!bRes && m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeApplication::Load ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
bool bRes = m_SettingsIniFile->GetNumber(SectionName(),m_KeyNameIdex.c_str(),Value,Value);
|
||||
if (!bRes && m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
const char * CSettingTypeApplication::SectionName ( void ) const
|
||||
{
|
||||
return m_Section.c_str();
|
||||
}
|
||||
|
||||
bool CSettingTypeApplication::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
bool bRes = m_SettingsIniFile ? m_SettingsIniFile->GetString(SectionName(),m_KeyNameIdex.c_str(),m_DefaultStr,Value) : false;
|
||||
if (!bRes)
|
||||
{
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeApplication::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::LoadDefault(int /*Index*/, uint32_t & Value) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, const stdstr & Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),Value);
|
||||
}
|
||||
|
||||
stdstr CSettingTypeApplication::FixSectionName(const char * Section)
|
||||
{
|
||||
stdstr SectionName(Section);
|
||||
|
||||
if (SectionName.empty())
|
||||
{
|
||||
SectionName = "default";
|
||||
}
|
||||
SectionName.Replace("\\","-");
|
||||
return SectionName;
|
||||
}
|
||||
|
||||
void CSettingTypeApplication::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(SectionName(),m_KeyNameIdex.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Common/IniFileClass.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeApplication :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
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, uint32_t DefaultValue);
|
||||
CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting);
|
||||
virtual ~CSettingTypeApplication();
|
||||
|
||||
virtual bool IndexBasedSetting(void) const { return false; }
|
||||
virtual SettingType GetSettingType(void) const { return SettingType_CfgFile; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save(int32_t Index, bool 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 char * Value);
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete(int32_t Index);
|
||||
|
||||
// Initialize this class to use ini or registry
|
||||
static void Initialize(const char * AppName);
|
||||
static void CleanUp(void);
|
||||
static void Flush(void);
|
||||
|
||||
const char * GetKeyName(void) const { return m_KeyName.c_str(); }
|
||||
|
||||
protected:
|
||||
const char * m_DefaultStr;
|
||||
const uint32_t m_DefaultValue;
|
||||
const SettingID m_DefaultSetting;
|
||||
|
||||
stdstr FixSectionName(const char * Section);
|
||||
|
||||
static CIniFile * m_SettingsIniFile;
|
||||
const stdstr m_Section;
|
||||
const stdstr m_KeyName;
|
||||
mutable stdstr m_KeyNameIdex;
|
||||
|
||||
virtual const char * SectionName(void) const;
|
||||
|
||||
private:
|
||||
CSettingTypeApplication(const CSettingTypeApplication&); // Disable copy constructor
|
||||
CSettingTypeApplication& operator=(const CSettingTypeApplication&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Common/IniFileClass.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeApplication :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
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, uint32_t DefaultValue);
|
||||
CSettingTypeApplication(const char * Section, const char * Name, SettingID DefaultSetting);
|
||||
virtual ~CSettingTypeApplication();
|
||||
|
||||
virtual bool IndexBasedSetting(void) const { return false; }
|
||||
virtual SettingType GetSettingType(void) const { return SettingType_CfgFile; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save(int32_t Index, bool 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 char * Value);
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete(int32_t Index);
|
||||
|
||||
// Initialize this class to use ini or registry
|
||||
static void Initialize(const char * AppName);
|
||||
static void CleanUp(void);
|
||||
static void Flush(void);
|
||||
|
||||
const char * GetKeyName(void) const { return m_KeyName.c_str(); }
|
||||
|
||||
protected:
|
||||
const char * m_DefaultStr;
|
||||
const uint32_t m_DefaultValue;
|
||||
const SettingID m_DefaultSetting;
|
||||
|
||||
stdstr FixSectionName(const char * Section);
|
||||
|
||||
static CIniFile * m_SettingsIniFile;
|
||||
const stdstr m_Section;
|
||||
const stdstr m_KeyName;
|
||||
mutable stdstr m_KeyNameIdex;
|
||||
|
||||
virtual const char * SectionName(void) const;
|
||||
|
||||
private:
|
||||
CSettingTypeApplication(const CSettingTypeApplication&); // Disable copy constructor
|
||||
CSettingTypeApplication& operator=(const CSettingTypeApplication&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,105 +1,105 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-ApplicationIndex.h"
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::~CSettingTypeApplicationIndex ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
return CSettingTypeApplication::Load(0,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationIndex::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
return CSettingTypeApplication::Load(0,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationIndex::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
return CSettingTypeApplication::Load(0,Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, bool Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, uint32_t Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, const stdstr & Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, const char * Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Delete ( int Index )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,(const char *)NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-ApplicationIndex.h"
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, uint32_t DefaultValue ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, bool DefaultValue ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, const char * DefaultValue ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeApplicationIndex::~CSettingTypeApplicationIndex ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationIndex::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
return CSettingTypeApplication::Load(0,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationIndex::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
return CSettingTypeApplication::Load(0,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationIndex::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
return CSettingTypeApplication::Load(0,Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::LoadDefault ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, bool Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, uint32_t Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, const stdstr & Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Save ( int Index, const char * Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeApplicationIndex::Delete ( int Index )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s %d",m_KeyName.c_str(),Index);
|
||||
CSettingTypeApplication::Save(0,(const char *)NULL);
|
||||
}
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeApplicationIndex :
|
||||
public CSettingTypeApplication
|
||||
{
|
||||
public:
|
||||
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, uint32_t DefaultValue );
|
||||
CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||
~CSettingTypeApplicationIndex();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeApplicationIndex(void); // Disable default constructor
|
||||
CSettingTypeApplicationIndex(const CSettingTypeApplicationIndex&); // Disable copy constructor
|
||||
CSettingTypeApplicationIndex& operator=(const CSettingTypeApplicationIndex&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeApplicationIndex :
|
||||
public CSettingTypeApplication
|
||||
{
|
||||
public:
|
||||
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, uint32_t DefaultValue );
|
||||
CSettingTypeApplicationIndex(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||
~CSettingTypeApplicationIndex();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeApplicationIndex(void); // Disable default constructor
|
||||
CSettingTypeApplicationIndex(const CSettingTypeApplicationIndex&); // Disable copy constructor
|
||||
CSettingTypeApplicationIndex& operator=(const CSettingTypeApplicationIndex&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-ApplicationPath.h"
|
||||
#include <Common/path.h>
|
||||
|
||||
CSettingTypeApplicationPath::CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultSetting)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CSettingTypeApplicationPath::~CSettingTypeApplicationPath()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationPath::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
bool bRes = CSettingTypeApplication::Load(Index,Value);
|
||||
#ifdef WIN32
|
||||
if (bRes)
|
||||
{
|
||||
if (Value.substr(0,2) == ".\\" || Value.substr(0,2) == "./" ||
|
||||
Value.substr(0,3) == "..\\" || Value.substr(0,3) == "../")
|
||||
{
|
||||
CPath FullFilePath(CPath::MODULE_DIRECTORY), RelativePath(Value);
|
||||
FullFilePath.SetNameExtension(RelativePath.GetNameExtension().c_str());
|
||||
FullFilePath.AppendDirectory(RelativePath.GetDirectory().c_str());
|
||||
|
||||
Value = (const std::string &)FullFilePath;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return bRes;
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-ApplicationPath.h"
|
||||
#include <Common/path.h>
|
||||
|
||||
CSettingTypeApplicationPath::CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeApplication(Section,Name,DefaultSetting)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CSettingTypeApplicationPath::~CSettingTypeApplicationPath()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeApplicationPath::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
bool bRes = CSettingTypeApplication::Load(Index,Value);
|
||||
#ifdef WIN32
|
||||
if (bRes)
|
||||
{
|
||||
if (Value.substr(0,2) == ".\\" || Value.substr(0,2) == "./" ||
|
||||
Value.substr(0,3) == "..\\" || Value.substr(0,3) == "../")
|
||||
{
|
||||
CPath FullFilePath(CPath::MODULE_DIRECTORY), RelativePath(Value);
|
||||
FullFilePath.SetNameExtension(RelativePath.GetNameExtension().c_str());
|
||||
FullFilePath.AppendDirectory(RelativePath.GetDirectory().c_str());
|
||||
|
||||
Value = (const std::string &)FullFilePath;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return bRes;
|
||||
}
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeApplicationPath :
|
||||
public CSettingTypeApplication
|
||||
{
|
||||
public:
|
||||
virtual ~CSettingTypeApplicationPath();
|
||||
|
||||
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||
|
||||
//return the values
|
||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
private:
|
||||
CSettingTypeApplicationPath(void); // Disable default constructor
|
||||
CSettingTypeApplicationPath(const CSettingTypeApplicationPath&); // Disable copy constructor
|
||||
CSettingTypeApplicationPath& operator=(const CSettingTypeApplicationPath&); // Disable assignment
|
||||
|
||||
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, uint32_t DefaultValue );
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeApplicationPath :
|
||||
public CSettingTypeApplication
|
||||
{
|
||||
public:
|
||||
virtual ~CSettingTypeApplicationPath();
|
||||
|
||||
CSettingTypeApplicationPath(const char * Section, const char * Name, SettingID DefaultSetting );
|
||||
|
||||
//return the values
|
||||
virtual bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
private:
|
||||
CSettingTypeApplicationPath(void); // Disable default constructor
|
||||
CSettingTypeApplicationPath(const CSettingTypeApplicationPath&); // Disable copy constructor
|
||||
CSettingTypeApplicationPath& operator=(const CSettingTypeApplicationPath&); // Disable assignment
|
||||
|
||||
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, uint32_t DefaultValue );
|
||||
};
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/Settings.h>
|
||||
#include <Common/StdString.h>
|
||||
|
||||
enum SettingType
|
||||
{
|
||||
SettingType_Unknown = -1,
|
||||
SettingType_ConstString = 0,
|
||||
SettingType_ConstValue = 1,
|
||||
SettingType_CfgFile = 2,
|
||||
SettingType_Registry = 3,
|
||||
SettingType_RelativePath = 4,
|
||||
TemporarySetting = 5,
|
||||
SettingType_RomDatabase = 6,
|
||||
SettingType_CheatSetting = 7,
|
||||
SettingType_GameSetting = 8,
|
||||
SettingType_BoolVariable = 9,
|
||||
SettingType_NumberVariable = 10,
|
||||
SettingType_StringVariable = 11,
|
||||
SettingType_SelectedDirectory = 12,
|
||||
SettingType_RdbSetting = 13,
|
||||
};
|
||||
|
||||
class CSettingType
|
||||
{
|
||||
public:
|
||||
virtual ~CSettingType() {};
|
||||
|
||||
virtual SettingType GetSettingType ( void ) const = 0;
|
||||
virtual bool IndexBasedSetting ( void ) const = 0;
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const = 0;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const = 0;
|
||||
|
||||
//Update the settings
|
||||
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, const stdstr & Value ) = 0;
|
||||
virtual void Save ( int32_t Index, const char * Value ) = 0;
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index ) = 0;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/Settings.h>
|
||||
#include <Common/StdString.h>
|
||||
|
||||
enum SettingType
|
||||
{
|
||||
SettingType_Unknown = -1,
|
||||
SettingType_ConstString = 0,
|
||||
SettingType_ConstValue = 1,
|
||||
SettingType_CfgFile = 2,
|
||||
SettingType_Registry = 3,
|
||||
SettingType_RelativePath = 4,
|
||||
TemporarySetting = 5,
|
||||
SettingType_RomDatabase = 6,
|
||||
SettingType_CheatSetting = 7,
|
||||
SettingType_GameSetting = 8,
|
||||
SettingType_BoolVariable = 9,
|
||||
SettingType_NumberVariable = 10,
|
||||
SettingType_StringVariable = 11,
|
||||
SettingType_SelectedDirectory = 12,
|
||||
SettingType_RdbSetting = 13,
|
||||
};
|
||||
|
||||
class CSettingType
|
||||
{
|
||||
public:
|
||||
virtual ~CSettingType() {};
|
||||
|
||||
virtual SettingType GetSettingType ( void ) const = 0;
|
||||
virtual bool IndexBasedSetting ( void ) const = 0;
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const = 0;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const = 0;
|
||||
|
||||
//Update the settings
|
||||
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, const stdstr & Value ) = 0;
|
||||
virtual void Save ( int32_t Index, const char * Value ) = 0;
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index ) = 0;
|
||||
};
|
||||
|
|
|
@ -1,148 +1,148 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Cheats.h"
|
||||
|
||||
|
||||
|
||||
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;
|
||||
stdstr * CSettingTypeCheats::m_SectionIdent = NULL;
|
||||
|
||||
CSettingTypeCheats::CSettingTypeCheats(const char * PostFix ) :
|
||||
m_PostFix(PostFix)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeCheats::~CSettingTypeCheats ( void )
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Initialize ( void )
|
||||
{
|
||||
m_CheatIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
|
||||
m_CheatIniFile->SetAutoFlush(false);
|
||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||
GameChanged(NULL);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::CleanUp ( void )
|
||||
{
|
||||
if (m_CheatIniFile)
|
||||
{
|
||||
m_CheatIniFile->SetAutoFlush(true);
|
||||
delete m_CheatIniFile;
|
||||
m_CheatIniFile = NULL;
|
||||
}
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
delete m_SectionIdent;
|
||||
m_SectionIdent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::FlushChanges( void )
|
||||
{
|
||||
if (m_CheatIniFile)
|
||||
{
|
||||
m_CheatIniFile->FlushChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::GameChanged ( void * /*Data */ )
|
||||
{
|
||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||
}
|
||||
|
||||
/*stdstr CSettingTypeCheats::FixName ( const char * Section, const char * Name )
|
||||
{
|
||||
}
|
||||
|
||||
const char * CSettingTypeCheats::SectionName ( void ) const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::UpdateSettings ( void * )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}*/
|
||||
|
||||
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeCheats::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
if (m_CheatIniFile == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeCheats::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Save ( int Index, const stdstr & Value )
|
||||
{
|
||||
if (m_CheatIniFile == NULL) { return; }
|
||||
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Save ( int Index, const char * Value )
|
||||
{
|
||||
if (m_CheatIniFile == NULL) { return; }
|
||||
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Delete ( int Index )
|
||||
{
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Cheats.h"
|
||||
|
||||
|
||||
|
||||
CIniFile * CSettingTypeCheats::m_CheatIniFile = NULL;
|
||||
stdstr * CSettingTypeCheats::m_SectionIdent = NULL;
|
||||
|
||||
CSettingTypeCheats::CSettingTypeCheats(const char * PostFix ) :
|
||||
m_PostFix(PostFix)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeCheats::~CSettingTypeCheats ( void )
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Initialize ( void )
|
||||
{
|
||||
m_CheatIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Cheats).c_str());
|
||||
m_CheatIniFile->SetAutoFlush(false);
|
||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||
GameChanged(NULL);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::CleanUp ( void )
|
||||
{
|
||||
if (m_CheatIniFile)
|
||||
{
|
||||
m_CheatIniFile->SetAutoFlush(true);
|
||||
delete m_CheatIniFile;
|
||||
m_CheatIniFile = NULL;
|
||||
}
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
delete m_SectionIdent;
|
||||
m_SectionIdent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::FlushChanges( void )
|
||||
{
|
||||
if (m_CheatIniFile)
|
||||
{
|
||||
m_CheatIniFile->FlushChanges();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::GameChanged ( void * /*Data */ )
|
||||
{
|
||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||
}
|
||||
|
||||
/*stdstr CSettingTypeCheats::FixName ( const char * Section, const char * Name )
|
||||
{
|
||||
}
|
||||
|
||||
const char * CSettingTypeCheats::SectionName ( void ) const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::UpdateSettings ( void * )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}*/
|
||||
|
||||
bool CSettingTypeCheats::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeCheats::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeCheats::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
if (m_CheatIniFile == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
return m_CheatIniFile->GetString(m_SectionIdent->c_str(),Key.c_str(),"",Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeCheats::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Save ( int Index, const stdstr & Value )
|
||||
{
|
||||
if (m_CheatIniFile == NULL) { return; }
|
||||
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Save ( int Index, const char * Value )
|
||||
{
|
||||
if (m_CheatIniFile == NULL) { return; }
|
||||
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),Value);
|
||||
}
|
||||
|
||||
void CSettingTypeCheats::Delete ( int Index )
|
||||
{
|
||||
stdstr_f Key("Cheat%d%s",Index,m_PostFix);
|
||||
m_CheatIniFile->SaveString(m_SectionIdent->c_str(),Key.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
#include <Common/IniFileClass.h>
|
||||
|
||||
class CSettingTypeCheats :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeCheats(const char * PostFix );
|
||||
~CSettingTypeCheats();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
// Initialize this class to use ini or registry
|
||||
static void Initialize ( void );
|
||||
static void CleanUp ( void );
|
||||
static void FlushChanges ( void );
|
||||
|
||||
protected:
|
||||
static CIniFile * m_CheatIniFile;
|
||||
static stdstr * m_SectionIdent;
|
||||
const char * const m_PostFix;
|
||||
static void GameChanged ( void * /*Data */ );
|
||||
|
||||
private:
|
||||
CSettingTypeCheats(void); // Disable default constructor
|
||||
CSettingTypeCheats(const CSettingTypeCheats&); // Disable copy constructor
|
||||
CSettingTypeCheats& operator=(const CSettingTypeCheats&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
#include <Common/IniFileClass.h>
|
||||
|
||||
class CSettingTypeCheats :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeCheats(const char * PostFix );
|
||||
~CSettingTypeCheats();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_CheatSetting; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
// Initialize this class to use ini or registry
|
||||
static void Initialize ( void );
|
||||
static void CleanUp ( void );
|
||||
static void FlushChanges ( void );
|
||||
|
||||
protected:
|
||||
static CIniFile * m_CheatIniFile;
|
||||
static stdstr * m_SectionIdent;
|
||||
const char * const m_PostFix;
|
||||
static void GameChanged ( void * /*Data */ );
|
||||
|
||||
private:
|
||||
CSettingTypeCheats(void); // Disable default constructor
|
||||
CSettingTypeCheats(const CSettingTypeCheats&); // Disable copy constructor
|
||||
CSettingTypeCheats& operator=(const CSettingTypeCheats&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,259 +1,259 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-GameSetting.h"
|
||||
|
||||
bool CSettingTypeGame::m_RdbEditor = false;
|
||||
bool CSettingTypeGame::m_EraseDefaults = true;
|
||||
stdstr * CSettingTypeGame::m_SectionIdent = NULL;
|
||||
|
||||
CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue ) :
|
||||
CSettingTypeApplication("",Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGame::CSettingTypeGame(const char * Name, uint32_t DefaultValue ) :
|
||||
CSettingTypeApplication("",Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGame::CSettingTypeGame(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeApplication("",Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGame::~CSettingTypeGame()
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Initialize ( void )
|
||||
{
|
||||
UpdateSettings(NULL);
|
||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
||||
}
|
||||
|
||||
void CSettingTypeGame::CleanUp ( void )
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
delete m_SectionIdent;
|
||||
m_SectionIdent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char * CSettingTypeGame::SectionName ( void ) const
|
||||
{
|
||||
return m_SectionIdent ? m_SectionIdent->c_str() : "";
|
||||
}
|
||||
|
||||
void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
|
||||
{
|
||||
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
|
||||
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
|
||||
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||
|
||||
if (m_SectionIdent == NULL)
|
||||
{
|
||||
m_SectionIdent = new stdstr;
|
||||
}
|
||||
if (SectionIdent != *m_SectionIdent)
|
||||
{
|
||||
*m_SectionIdent = SectionIdent;
|
||||
g_Settings->SettingTypeChanged(SettingType_GameSetting);
|
||||
g_Settings->SettingTypeChanged(SettingType_RomDatabase);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeGame::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
return g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return CSettingTypeApplication::Load(Index,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeGame::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
return g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return CSettingTypeApplication::Load(Index,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
return g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return CSettingTypeApplication::Load(Index,Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::LoadDefault ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->LoadDefaultString(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeGame::Save ( int Index, bool Value )
|
||||
{
|
||||
if (m_EraseDefaults)
|
||||
{
|
||||
bool bDefault;
|
||||
LoadDefault(Index,bDefault);
|
||||
if (bDefault == Value)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->SaveBool(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Save(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Save ( int Index, uint32_t Value )
|
||||
{
|
||||
if (m_EraseDefaults)
|
||||
{
|
||||
uint32_t ulDefault;
|
||||
CSettingTypeGame::LoadDefault(Index,ulDefault);
|
||||
if (ulDefault == Value)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->SaveDword(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Save(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Save ( int Index, const stdstr & Value )
|
||||
{
|
||||
Save(Index,Value.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Save ( int Index, const char * Value )
|
||||
{
|
||||
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
|
||||
{
|
||||
stdstr szDefault;
|
||||
CSettingTypeGame::LoadDefault(Index,szDefault);
|
||||
if (_stricmp(szDefault.c_str(),Value) == 0)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->SaveString(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Save(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Delete ( int Index )
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
|
||||
} else {
|
||||
g_Settings->DeleteSetting(m_DefaultSetting);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Delete(Index);
|
||||
}
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-GameSetting.h"
|
||||
|
||||
bool CSettingTypeGame::m_RdbEditor = false;
|
||||
bool CSettingTypeGame::m_EraseDefaults = true;
|
||||
stdstr * CSettingTypeGame::m_SectionIdent = NULL;
|
||||
|
||||
CSettingTypeGame::CSettingTypeGame(const char * Name, const char * DefaultValue ) :
|
||||
CSettingTypeApplication("",Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGame::CSettingTypeGame(const char * Name, uint32_t DefaultValue ) :
|
||||
CSettingTypeApplication("",Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGame::CSettingTypeGame(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeApplication("",Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGame::~CSettingTypeGame()
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Initialize ( void )
|
||||
{
|
||||
UpdateSettings(NULL);
|
||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
||||
}
|
||||
|
||||
void CSettingTypeGame::CleanUp ( void )
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,UpdateSettings);
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
delete m_SectionIdent;
|
||||
m_SectionIdent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const char * CSettingTypeGame::SectionName ( void ) const
|
||||
{
|
||||
return m_SectionIdent ? m_SectionIdent->c_str() : "";
|
||||
}
|
||||
|
||||
void CSettingTypeGame::UpdateSettings ( void * /*Data */ )
|
||||
{
|
||||
m_RdbEditor = g_Settings->LoadBool(Setting_RdbEditor);
|
||||
m_EraseDefaults = g_Settings->LoadBool(Setting_EraseGameDefaults);
|
||||
stdstr SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||
|
||||
if (m_SectionIdent == NULL)
|
||||
{
|
||||
m_SectionIdent = new stdstr;
|
||||
}
|
||||
if (SectionIdent != *m_SectionIdent)
|
||||
{
|
||||
*m_SectionIdent = SectionIdent;
|
||||
g_Settings->SettingTypeChanged(SettingType_GameSetting);
|
||||
g_Settings->SettingTypeChanged(SettingType_RomDatabase);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeGame::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
return g_Settings->LoadBoolIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
return g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return CSettingTypeApplication::Load(Index,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeGame::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
return g_Settings->LoadDwordIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
return g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return CSettingTypeApplication::Load(Index,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeGame::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
return g_Settings->LoadStringIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
return g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
return CSettingTypeApplication::Load(Index,Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeGame::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->LoadDefaultBoolIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->LoadDefaultBool(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::LoadDefault ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->LoadDefaultDwordIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->LoadDefaultDword(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::LoadDefault ( int Index, stdstr & Value ) const
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->LoadDefaultStringIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->LoadDefaultString(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::LoadDefault(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeGame::Save ( int Index, bool Value )
|
||||
{
|
||||
if (m_EraseDefaults)
|
||||
{
|
||||
bool bDefault;
|
||||
LoadDefault(Index,bDefault);
|
||||
if (bDefault == Value)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->SaveBoolIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->SaveBool(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Save(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Save ( int Index, uint32_t Value )
|
||||
{
|
||||
if (m_EraseDefaults)
|
||||
{
|
||||
uint32_t ulDefault;
|
||||
CSettingTypeGame::LoadDefault(Index,ulDefault);
|
||||
if (ulDefault == Value)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->SaveDwordIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->SaveDword(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Save(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Save ( int Index, const stdstr & Value )
|
||||
{
|
||||
Save(Index,Value.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Save ( int Index, const char * Value )
|
||||
{
|
||||
if (m_EraseDefaults && m_DefaultSetting != Rdb_GoodName)
|
||||
{
|
||||
stdstr szDefault;
|
||||
CSettingTypeGame::LoadDefault(Index,szDefault);
|
||||
if (_stricmp(szDefault.c_str(),Value) == 0)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->SaveStringIndex(m_DefaultSetting,Index,Value);
|
||||
} else {
|
||||
g_Settings->SaveString(m_DefaultSetting,Value);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Save(Index,Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeGame::Delete ( int Index )
|
||||
{
|
||||
if (m_RdbEditor && g_Settings->GetSettingType(m_DefaultSetting) == SettingType_RomDatabase)
|
||||
{
|
||||
if (g_Settings->IndexBasedSetting(m_DefaultSetting))
|
||||
{
|
||||
g_Settings->DeleteSettingIndex(m_DefaultSetting,Index);
|
||||
} else {
|
||||
g_Settings->DeleteSetting(m_DefaultSetting);
|
||||
}
|
||||
} else {
|
||||
CSettingTypeApplication::Delete(Index);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeGame :
|
||||
public CSettingTypeApplication
|
||||
{
|
||||
protected:
|
||||
static bool m_RdbEditor;
|
||||
static bool m_EraseDefaults;
|
||||
static stdstr * m_SectionIdent;
|
||||
|
||||
static void UpdateSettings ( void * /*Data */ );
|
||||
|
||||
virtual const char * SectionName ( void ) const;
|
||||
|
||||
public:
|
||||
CSettingTypeGame(const char * Name, const char * DefaultValue );
|
||||
CSettingTypeGame(const char * Name, uint32_t DefaultValue );
|
||||
CSettingTypeGame(const char * Name, SettingID DefaultSetting );
|
||||
virtual ~CSettingTypeGame();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
||||
|
||||
static void Initialize( void );
|
||||
static void CleanUp ( void );
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeGame(void); // Disable default constructor
|
||||
CSettingTypeGame(const CSettingTypeGame&); // Disable copy constructor
|
||||
CSettingTypeGame& operator=(const CSettingTypeGame&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeGame :
|
||||
public CSettingTypeApplication
|
||||
{
|
||||
protected:
|
||||
static bool m_RdbEditor;
|
||||
static bool m_EraseDefaults;
|
||||
static stdstr * m_SectionIdent;
|
||||
|
||||
static void UpdateSettings ( void * /*Data */ );
|
||||
|
||||
virtual const char * SectionName ( void ) const;
|
||||
|
||||
public:
|
||||
CSettingTypeGame(const char * Name, const char * DefaultValue );
|
||||
CSettingTypeGame(const char * Name, uint32_t DefaultValue );
|
||||
CSettingTypeGame(const char * Name, SettingID DefaultSetting );
|
||||
virtual ~CSettingTypeGame();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
||||
|
||||
static void Initialize( void );
|
||||
static void CleanUp ( void );
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeGame(void); // Disable default constructor
|
||||
CSettingTypeGame(const CSettingTypeGame&); // Disable copy constructor
|
||||
CSettingTypeGame& operator=(const CSettingTypeGame&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,104 +1,104 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-GameSetting.h"
|
||||
#include "SettingsType-GameSettingIndex.h"
|
||||
|
||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
||||
CSettingTypeGame("", DefaultSetting),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue ) :
|
||||
CSettingTypeGame("", DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
||||
CSettingTypeGame("", DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGameIndex::~CSettingTypeGameIndex()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
return CSettingTypeGame::Load(Index,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeGameIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
return CSettingTypeGame::Load(0,Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeGameIndex::Save ( int Index, bool Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(Index,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save(int Index, uint32_t Value)
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save ( int Index, const char * Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Delete ( int Index )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Delete(0);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-Application.h"
|
||||
#include "SettingsType-GameSetting.h"
|
||||
#include "SettingsType-GameSettingIndex.h"
|
||||
|
||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
||||
CSettingTypeGame("", DefaultSetting),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, uint32_t DefaultValue ) :
|
||||
CSettingTypeGame("", DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGameIndex::CSettingTypeGameIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
||||
CSettingTypeGame("", DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeGameIndex::~CSettingTypeGameIndex()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeGameIndex::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
return CSettingTypeGame::Load(Index,Value);
|
||||
}
|
||||
|
||||
bool CSettingTypeGameIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeGameIndex::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
return CSettingTypeGame::Load(0,Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeGameIndex::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeGameIndex::Save ( int Index, bool Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(Index,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save(int Index, uint32_t Value)
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Save ( int Index, const char * Value )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Save(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeGameIndex::Delete ( int Index )
|
||||
{
|
||||
m_KeyNameIdex.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeGame::Delete(0);
|
||||
}
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeGameIndex :
|
||||
public CSettingTypeGame
|
||||
{
|
||||
stdstr m_PreIndex, m_PostIndex;
|
||||
|
||||
public:
|
||||
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, SettingID DefaultSetting );
|
||||
~CSettingTypeGameIndex();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeGameIndex(void); // Disable default constructor
|
||||
CSettingTypeGameIndex(const CSettingTypeGameIndex&); // Disable copy constructor
|
||||
CSettingTypeGameIndex& operator=(const CSettingTypeGameIndex&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeGameIndex :
|
||||
public CSettingTypeGame
|
||||
{
|
||||
stdstr m_PreIndex, m_PostIndex;
|
||||
|
||||
public:
|
||||
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, SettingID DefaultSetting );
|
||||
~CSettingTypeGameIndex();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_GameSetting; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeGameIndex(void); // Disable default constructor
|
||||
CSettingTypeGameIndex(const CSettingTypeGameIndex&); // Disable copy constructor
|
||||
CSettingTypeGameIndex& operator=(const CSettingTypeGameIndex&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,123 +1,123 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBCpuType.h"
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBCpuType::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
|
||||
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
|
||||
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
|
||||
else if (_stricmp(String,"default") == 0)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
} else {
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
stdstr strValue;
|
||||
switch (Value)
|
||||
{
|
||||
case CPU_Interpreter: strValue = "Interpreter"; break;
|
||||
case CPU_Recompiler: strValue = "Recompiler"; break;
|
||||
case CPU_SyncCores: strValue = "SyncCores"; break;
|
||||
default:
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBCpuType.h"
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBCpuType::CSettingTypeRDBCpuType(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBCpuType::~CSettingTypeRDBCpuType()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBCpuType::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
if (_stricmp(String,"Interpreter") == 0) { Value = CPU_Interpreter; }
|
||||
else if (_stricmp(String,"Recompiler") == 0) { Value = CPU_Recompiler; }
|
||||
else if (_stricmp(String,"SyncCores") == 0) { Value = CPU_SyncCores; }
|
||||
else if (_stricmp(String,"default") == 0)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBCpuType::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
} else {
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
stdstr strValue;
|
||||
switch (Value)
|
||||
{
|
||||
case CPU_Interpreter: strValue = "Interpreter"; break;
|
||||
case CPU_Recompiler: strValue = "Recompiler"; break;
|
||||
case CPU_SyncCores: strValue = "SyncCores"; break;
|
||||
default:
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),strValue.c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBCpuType::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBCpuType :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBCpuType(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBCpuType();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBCpuType(void); // Disable default constructor
|
||||
CSettingTypeRDBCpuType(const CSettingTypeRDBCpuType&); // Disable copy constructor
|
||||
CSettingTypeRDBCpuType& operator=(const CSettingTypeRDBCpuType&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBCpuType :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBCpuType(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBCpuType(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBCpuType();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBCpuType(void); // Disable default constructor
|
||||
CSettingTypeRDBCpuType(const CSettingTypeRDBCpuType&); // Disable copy constructor
|
||||
CSettingTypeRDBCpuType& operator=(const CSettingTypeRDBCpuType&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,112 +1,112 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBOnOff.h"
|
||||
|
||||
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBOnOff::~CSettingTypeRDBOnOff()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
if (_stricmp(String,"On") == 0) { Value = true; }
|
||||
else if (_stricmp(String,"Off") == 0) { Value = false; }
|
||||
else if (_stricmp(String,"Global") == 0 || _stricmp(String,"default"))
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
} else {
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "On" : "Off");
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBOnOff.h"
|
||||
|
||||
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBOnOff::CSettingTypeRDBOnOff(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBOnOff::~CSettingTypeRDBOnOff()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBOnOff::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
if (_stricmp(String,"On") == 0) { Value = true; }
|
||||
else if (_stricmp(String,"Off") == 0) { Value = false; }
|
||||
else if (_stricmp(String,"Global") == 0 || _stricmp(String,"default"))
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
else { g_Notify->BreakPoint(__FILE__, __LINE__); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBOnOff::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
} else {
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),Value? "On" : "Off");
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBOnOff::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBOnOff :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBOnOff(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBOnOff();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBOnOff(void); // Disable default constructor
|
||||
CSettingTypeRDBOnOff(const CSettingTypeRDBOnOff&); // Disable copy constructor
|
||||
CSettingTypeRDBOnOff& operator=(const CSettingTypeRDBOnOff&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBOnOff :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBOnOff(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBOnOff(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBOnOff();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBOnOff(void); // Disable default constructor
|
||||
CSettingTypeRDBOnOff(const CSettingTypeRDBOnOff&); // Disable copy constructor
|
||||
CSettingTypeRDBOnOff& operator=(const CSettingTypeRDBOnOff&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBRamSize.h"
|
||||
|
||||
// == 8 ? 0x800000 : 0x400000
|
||||
|
||||
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBRDRamSize::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
uint32_t ulValue;
|
||||
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,ulValue);
|
||||
}
|
||||
Value = 0x400000;
|
||||
if (ulValue == 8)
|
||||
{
|
||||
Value = 0x800000;
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBRamSize.h"
|
||||
|
||||
// == 8 ? 0x800000 : 0x400000
|
||||
|
||||
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBRDRamSize::CSettingTypeRDBRDRamSize(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBRDRamSize::~CSettingTypeRDBRDRamSize()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBRDRamSize::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
uint32_t ulValue;
|
||||
bool bRes = m_SettingsIniFile->GetNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultValue,ulValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,ulValue);
|
||||
}
|
||||
Value = 0x400000;
|
||||
if (ulValue == 8)
|
||||
{
|
||||
Value = 0x800000;
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBRDRamSize::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(m_SectionIdent->c_str(),m_KeyName.c_str(),Value == 0x800000 ? 8 : 4);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBRDRamSize::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBRDRamSize :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBRDRamSize(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBRDRamSize();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBRDRamSize(void); // Disable default constructor
|
||||
CSettingTypeRDBRDRamSize(const CSettingTypeRDBRDRamSize&); // Disable copy constructor
|
||||
CSettingTypeRDBRDRamSize& operator=(const CSettingTypeRDBRDRamSize&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBRDRamSize :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBRDRamSize(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBRDRamSize(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBRDRamSize();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBRDRamSize(void); // Disable default constructor
|
||||
CSettingTypeRDBRDRamSize(const CSettingTypeRDBRDRamSize&); // Disable copy constructor
|
||||
CSettingTypeRDBRDRamSize& operator=(const CSettingTypeRDBRDRamSize&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,126 +1,126 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBSaveChip.h"
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBSaveChip::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
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,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
|
||||
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
|
||||
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
|
||||
else if (_stricmp(String,"default") == 0)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
} else {
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
} else {
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
switch (Value)
|
||||
{
|
||||
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_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_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
|
||||
default:
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBSaveChip.h"
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBSaveChip::CSettingTypeRDBSaveChip(const char * Name, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase(Name,DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBSaveChip::~CSettingTypeRDBSaveChip()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBSaveChip::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(),m_KeyName.c_str(),m_DefaultStr,strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
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,"16kbit Eeprom") == 0) { Value = SaveChip_Eeprom_16K; }
|
||||
else if (_stricmp(String,"Sram") == 0) { Value = SaveChip_Sram; }
|
||||
else if (_stricmp(String,"FlashRam") == 0) { Value = SaveChip_FlashRam; }
|
||||
else if (_stricmp(String,"default") == 0)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
return false;
|
||||
} else {
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBSaveChip::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
} else {
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
switch (Value)
|
||||
{
|
||||
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_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_FlashRam: m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),"FlashRam"); break;
|
||||
default:
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBSaveChip::Delete( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBSaveChip :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBSaveChip(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBSaveChip();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBSaveChip(void); // Disable default constructor
|
||||
CSettingTypeRDBSaveChip(const CSettingTypeRDBSaveChip&); // Disable copy constructor
|
||||
CSettingTypeRDBSaveChip& operator=(const CSettingTypeRDBSaveChip&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBSaveChip :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBSaveChip(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBSaveChip(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBSaveChip();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBSaveChip(void); // Disable default constructor
|
||||
CSettingTypeRDBSaveChip(const CSettingTypeRDBSaveChip&); // Disable copy constructor
|
||||
CSettingTypeRDBSaveChip& operator=(const CSettingTypeRDBSaveChip&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,124 +1,124 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBYesNo.h"
|
||||
|
||||
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting) :
|
||||
CSettingTypeRomDatabase(Name, DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, int DefaultValue) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBYesNo::Load(int Index, bool & Value) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(), m_KeyName.c_str(), m_DefaultStr, strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
if (_stricmp(String, "Yes") == 0)
|
||||
{
|
||||
Value = true;
|
||||
}
|
||||
else if (_stricmp(String, "No") == 0)
|
||||
{
|
||||
Value = false;
|
||||
}
|
||||
else if (_stricmp(String, "default") == 0)
|
||||
{
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBYesNo::Load(int /*Index*/, uint32_t & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBYesNo::Load(int /*Index*/, stdstr & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, bool & Value) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
}
|
||||
else {
|
||||
g_Settings->LoadBool(m_DefaultSetting, Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, bool Value)
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, uint32_t Value)
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, const stdstr & /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, const char * /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Delete(int /*Index*/)
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RDBYesNo.h"
|
||||
|
||||
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting) :
|
||||
CSettingTypeRomDatabase(Name, DefaultSetting)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBYesNo::CSettingTypeRDBYesNo(const char * Name, int DefaultValue) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRDBYesNo::~CSettingTypeRDBYesNo()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBYesNo::Load(int Index, bool & Value) const
|
||||
{
|
||||
stdstr strValue;
|
||||
bool bRes = m_SettingsIniFile->GetString(m_SectionIdent->c_str(), m_KeyName.c_str(), m_DefaultStr, strValue);
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
const char * String = strValue.c_str();
|
||||
|
||||
if (_stricmp(String, "Yes") == 0)
|
||||
{
|
||||
Value = true;
|
||||
}
|
||||
else if (_stricmp(String, "No") == 0)
|
||||
{
|
||||
Value = false;
|
||||
}
|
||||
else if (_stricmp(String, "default") == 0)
|
||||
{
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
LoadDefault(Index, Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBYesNo::Load(int /*Index*/, uint32_t & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRDBYesNo::Load(int /*Index*/, stdstr & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, bool & Value) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
}
|
||||
else {
|
||||
g_Settings->LoadBool(m_DefaultSetting, Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, bool Value)
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, uint32_t Value)
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), Value ? "Yes" : "No");
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, const stdstr & /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Save(int /*Index*/, const char * /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRDBYesNo::Delete(int /*Index*/)
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(), m_KeyName.c_str(), NULL);
|
||||
}
|
|
@ -1,44 +1,44 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBYesNo :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBYesNo(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBYesNo();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBYesNo(void); // Disable default constructor
|
||||
CSettingTypeRDBYesNo(const CSettingTypeRDBYesNo&); // Disable copy constructor
|
||||
CSettingTypeRDBYesNo& operator=(const CSettingTypeRDBYesNo&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRDBYesNo :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
CSettingTypeRDBYesNo(const char * Name, SettingID DefaultSetting );
|
||||
CSettingTypeRDBYesNo(const char * Name, int32_t DefaultValue );
|
||||
~CSettingTypeRDBYesNo();
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRDBYesNo(void); // Disable default constructor
|
||||
CSettingTypeRDBYesNo(const CSettingTypeRDBYesNo&); // Disable copy constructor
|
||||
CSettingTypeRDBYesNo& operator=(const CSettingTypeRDBYesNo&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,89 +1,89 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RelativePath.h"
|
||||
|
||||
CSettingTypeRelativePath::CSettingTypeRelativePath(const char * Directory, const char * FileName) :
|
||||
m_Directory(Directory),
|
||||
m_FileName(FileName)
|
||||
{
|
||||
BuildPath();
|
||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
||||
}
|
||||
|
||||
CSettingTypeRelativePath::~CSettingTypeRelativePath(void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
||||
}
|
||||
|
||||
bool CSettingTypeRelativePath::Load(int /*Index*/, stdstr & value) const
|
||||
{
|
||||
value = m_FullPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, bool & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, bool /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, uint32_t /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, const stdstr & Value)
|
||||
{
|
||||
m_Directory = "";
|
||||
m_FileName = Value;
|
||||
BuildPath();
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, const char * Value)
|
||||
{
|
||||
m_Directory = "";
|
||||
m_FileName = Value;
|
||||
BuildPath();
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Delete(int /*Index*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::BuildPath(void)
|
||||
{
|
||||
CPath FullPath(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
||||
FullPath.AppendDirectory(m_Directory.c_str());
|
||||
FullPath.SetNameExtension(m_FileName.c_str());
|
||||
m_FullPath = (const char *)FullPath;
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::RefreshSettings(void * _this)
|
||||
{
|
||||
((CSettingTypeRelativePath *)_this)->BuildPath();
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RelativePath.h"
|
||||
|
||||
CSettingTypeRelativePath::CSettingTypeRelativePath(const char * Directory, const char * FileName) :
|
||||
m_Directory(Directory),
|
||||
m_FileName(FileName)
|
||||
{
|
||||
BuildPath();
|
||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
||||
}
|
||||
|
||||
CSettingTypeRelativePath::~CSettingTypeRelativePath(void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory, this, RefreshSettings);
|
||||
}
|
||||
|
||||
bool CSettingTypeRelativePath::Load(int /*Index*/, stdstr & value) const
|
||||
{
|
||||
value = m_FullPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, bool & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, uint32_t & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::LoadDefault(int /*Index*/, stdstr & /*Value*/) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, bool /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, uint32_t /*Value*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, const stdstr & Value)
|
||||
{
|
||||
m_Directory = "";
|
||||
m_FileName = Value;
|
||||
BuildPath();
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Save(int /*Index*/, const char * Value)
|
||||
{
|
||||
m_Directory = "";
|
||||
m_FileName = Value;
|
||||
BuildPath();
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::Delete(int /*Index*/)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::BuildPath(void)
|
||||
{
|
||||
CPath FullPath(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(),"");
|
||||
FullPath.AppendDirectory(m_Directory.c_str());
|
||||
FullPath.SetNameExtension(m_FileName.c_str());
|
||||
m_FullPath = (const char *)FullPath;
|
||||
}
|
||||
|
||||
void CSettingTypeRelativePath::RefreshSettings(void * _this)
|
||||
{
|
||||
((CSettingTypeRelativePath *)_this)->BuildPath();
|
||||
}
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Common/path.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeRelativePath :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeRelativePath(const char * Directory, const char * FileName);
|
||||
~CSettingTypeRelativePath();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRelativePath(void); // Disable default constructor
|
||||
CSettingTypeRelativePath(const CSettingTypeRelativePath&); // Disable copy constructor
|
||||
CSettingTypeRelativePath& operator=(const CSettingTypeRelativePath&); // Disable assignment
|
||||
|
||||
static void RefreshSettings(void * _this);
|
||||
void BuildPath ( void );
|
||||
|
||||
std::string m_FullPath;
|
||||
std::string m_Directory;
|
||||
std::string m_FileName;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Common/path.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeRelativePath :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeRelativePath(const char * Directory, const char * FileName);
|
||||
~CSettingTypeRelativePath();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_RelativePath; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRelativePath(void); // Disable default constructor
|
||||
CSettingTypeRelativePath(const CSettingTypeRelativePath&); // Disable copy constructor
|
||||
CSettingTypeRelativePath& operator=(const CSettingTypeRelativePath&); // Disable assignment
|
||||
|
||||
static void RefreshSettings(void * _this);
|
||||
void BuildPath ( void );
|
||||
|
||||
std::string m_FullPath;
|
||||
std::string m_Directory;
|
||||
std::string m_FileName;
|
||||
};
|
||||
|
|
|
@ -1,318 +1,318 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
|
||||
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
|
||||
CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
|
||||
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
||||
m_KeyName(StripNameSection(Name)),
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
||||
m_KeyName(StripNameSection(Name)),
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
||||
m_KeyName(StripNameSection(Name)),
|
||||
m_DefaultStr(DefaultValue),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
||||
m_KeyName(Name),
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(DefaultSetting),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Initialize( void )
|
||||
{
|
||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
||||
|
||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
||||
|
||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::CleanUp( void )
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
||||
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
delete m_SettingsIniFile;
|
||||
m_SettingsIniFile = NULL;
|
||||
}
|
||||
if (m_GlideIniFile)
|
||||
{
|
||||
delete m_GlideIniFile;
|
||||
m_GlideIniFile = NULL;
|
||||
}
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
delete m_SectionIdent;
|
||||
m_SectionIdent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::BaseDirChanged ( void * /*Data */ )
|
||||
{
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
delete m_SettingsIniFile;
|
||||
m_SettingsIniFile = NULL;
|
||||
}
|
||||
if (m_GlideIniFile)
|
||||
{
|
||||
delete m_GlideIniFile;
|
||||
m_GlideIniFile = NULL;
|
||||
}
|
||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ )
|
||||
{
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
uint32_t temp_value = Value;
|
||||
bool bRes = Load(Index,temp_value);
|
||||
Value = temp_value != 0;
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
bool bRes = false;
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
||||
}
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
stdstr temp_value;
|
||||
bool bRes = false;
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
||||
}
|
||||
if (bRes)
|
||||
{
|
||||
Value = temp_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
} else {
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
} else {
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultStr;
|
||||
} else {
|
||||
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DeleteOnDefault)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Save ( int Index, uint32_t Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DeleteOnDefault)
|
||||
{
|
||||
uint32_t defaultValue = 0;
|
||||
LoadDefault(Index,defaultValue);
|
||||
if (defaultValue == Value)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::IsGlideSetting (const char * Name)
|
||||
{
|
||||
if (_strnicmp(Name,"Glide64-",8) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const char * CSettingTypeRomDatabase::StripNameSection (const char * Name)
|
||||
{
|
||||
if (_strnicmp(Name,"Glide64-",8) == 0)
|
||||
{
|
||||
return &Name[8];
|
||||
}
|
||||
return Name;
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
|
||||
CIniFile * CSettingTypeRomDatabase::m_SettingsIniFile = NULL;
|
||||
CIniFile * CSettingTypeRomDatabase::m_GlideIniFile = NULL;
|
||||
stdstr * CSettingTypeRomDatabase::m_SectionIdent = NULL;
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
||||
m_KeyName(StripNameSection(Name)),
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
||||
m_KeyName(StripNameSection(Name)),
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(DefaultValue),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
||||
m_KeyName(StripNameSection(Name)),
|
||||
m_DefaultStr(DefaultValue),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(Default_Constant),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
||||
m_KeyName(Name),
|
||||
m_DefaultStr(""),
|
||||
m_DefaultValue(0),
|
||||
m_DefaultSetting(DefaultSetting),
|
||||
m_DeleteOnDefault(DeleteOnDefault),
|
||||
m_GlideSetting(IsGlideSetting(Name))
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabase::~CSettingTypeRomDatabase()
|
||||
{
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Initialize( void )
|
||||
{
|
||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
||||
|
||||
g_Settings->RegisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||
g_Settings->RegisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
||||
|
||||
m_SectionIdent = new stdstr(g_Settings->LoadStringVal(Game_IniKey));
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::CleanUp( void )
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(Cmd_BaseDirectory,NULL,BaseDirChanged);
|
||||
g_Settings->UnregisterChangeCB(Game_IniKey,NULL,GameChanged);
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
delete m_SettingsIniFile;
|
||||
m_SettingsIniFile = NULL;
|
||||
}
|
||||
if (m_GlideIniFile)
|
||||
{
|
||||
delete m_GlideIniFile;
|
||||
m_GlideIniFile = NULL;
|
||||
}
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
delete m_SectionIdent;
|
||||
m_SectionIdent = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::BaseDirChanged ( void * /*Data */ )
|
||||
{
|
||||
if (m_SettingsIniFile)
|
||||
{
|
||||
delete m_SettingsIniFile;
|
||||
m_SettingsIniFile = NULL;
|
||||
}
|
||||
if (m_GlideIniFile)
|
||||
{
|
||||
delete m_GlideIniFile;
|
||||
m_GlideIniFile = NULL;
|
||||
}
|
||||
m_SettingsIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_RomDatabase).c_str());
|
||||
m_GlideIniFile = new CIniFile(g_Settings->LoadStringVal(SupportFile_Glide64RDB).c_str());
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::GameChanged ( void * /*Data */ )
|
||||
{
|
||||
if (m_SectionIdent)
|
||||
{
|
||||
*m_SectionIdent = g_Settings->LoadStringVal(Game_IniKey);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load ( int Index, bool & Value ) const
|
||||
{
|
||||
uint32_t temp_value = Value;
|
||||
bool bRes = Load(Index,temp_value);
|
||||
Value = temp_value != 0;
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
bool bRes = false;
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
bRes = m_GlideIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = m_SettingsIniFile->GetNumber(Section(),m_KeyName.c_str(),Value,Value);
|
||||
}
|
||||
if (!bRes)
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
stdstr temp_value;
|
||||
bool bRes = false;
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
bRes = m_GlideIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = m_SettingsIniFile->GetString(Section(),m_KeyName.c_str(),m_DefaultStr,temp_value);
|
||||
}
|
||||
if (bRes)
|
||||
{
|
||||
Value = temp_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadDefault(Index,Value);
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue != 0;
|
||||
} else {
|
||||
g_Settings->LoadBool(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultValue;
|
||||
} else {
|
||||
g_Settings->LoadDword(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::LoadDefault ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
if (m_DefaultSetting != Default_None)
|
||||
{
|
||||
if (m_DefaultSetting == Default_Constant)
|
||||
{
|
||||
Value = m_DefaultStr;
|
||||
} else {
|
||||
g_Settings->LoadStringVal(m_DefaultSetting,Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DeleteOnDefault)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Save ( int Index, uint32_t Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DeleteOnDefault)
|
||||
{
|
||||
uint32_t defaultValue = 0;
|
||||
LoadDefault(Index,defaultValue);
|
||||
if (defaultValue == Value)
|
||||
{
|
||||
Delete(Index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveNumber(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, const stdstr & Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),Value);
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabase::Delete ( int /*Index*/ )
|
||||
{
|
||||
if (!g_Settings->LoadBool(Setting_RdbEditor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_GlideSetting)
|
||||
{
|
||||
m_GlideIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SettingsIniFile->SaveString(Section(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabase::IsGlideSetting (const char * Name)
|
||||
{
|
||||
if (_strnicmp(Name,"Glide64-",8) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const char * CSettingTypeRomDatabase::StripNameSection (const char * Name)
|
||||
{
|
||||
if (_strnicmp(Name,"Glide64-",8) == 0)
|
||||
{
|
||||
return &Name[8];
|
||||
}
|
||||
return Name;
|
||||
}
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Common/IniFileClass.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeRomDatabase :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeRomDatabase(const char * Name, const char * 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, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
||||
|
||||
virtual ~CSettingTypeRomDatabase();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
static void Initialize( void );
|
||||
static void CleanUp ( void );
|
||||
|
||||
protected:
|
||||
static void GameChanged ( void * /*Data */ );
|
||||
static void BaseDirChanged ( void * /*Data */ );
|
||||
|
||||
static bool IsGlideSetting (const char * Name);
|
||||
static const char * StripNameSection (const char * Name);
|
||||
virtual const char * Section ( void ) const { return m_SectionIdent->c_str(); }
|
||||
|
||||
mutable stdstr m_KeyName;
|
||||
const char *const m_DefaultStr;
|
||||
const int32_t m_DefaultValue;
|
||||
const SettingID m_DefaultSetting;
|
||||
const bool m_DeleteOnDefault;
|
||||
bool m_GlideSetting;
|
||||
|
||||
static stdstr * m_SectionIdent;
|
||||
static CIniFile * m_SettingsIniFile;
|
||||
static CIniFile * m_GlideIniFile;
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabase(); // Disable default constructor
|
||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Common/IniFileClass.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeRomDatabase :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeRomDatabase(const char * Name, const char * 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, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
||||
|
||||
virtual ~CSettingTypeRomDatabase();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RomDatabase; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
static void Initialize( void );
|
||||
static void CleanUp ( void );
|
||||
|
||||
protected:
|
||||
static void GameChanged ( void * /*Data */ );
|
||||
static void BaseDirChanged ( void * /*Data */ );
|
||||
|
||||
static bool IsGlideSetting (const char * Name);
|
||||
static const char * StripNameSection (const char * Name);
|
||||
virtual const char * Section ( void ) const { return m_SectionIdent->c_str(); }
|
||||
|
||||
mutable stdstr m_KeyName;
|
||||
const char *const m_DefaultStr;
|
||||
const int32_t m_DefaultValue;
|
||||
const SettingID m_DefaultSetting;
|
||||
const bool m_DeleteOnDefault;
|
||||
bool m_GlideSetting;
|
||||
|
||||
static stdstr * m_SectionIdent;
|
||||
static CIniFile * m_SettingsIniFile;
|
||||
static CIniFile * m_GlideIniFile;
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabase(); // Disable default constructor
|
||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,106 +1,106 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RomDatabaseIndex.h"
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
||||
CSettingTypeRomDatabase("",DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue ) :
|
||||
CSettingTypeRomDatabase("",DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase("",DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase("",DefaultSetting),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
return CSettingTypeRomDatabase::Load(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Delete ( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
#include "SettingsType-RomDatabaseIndex.h"
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, const char * DefaultValue ) :
|
||||
CSettingTypeRomDatabase("",DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, bool DefaultValue ) :
|
||||
CSettingTypeRomDatabase("",DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, int DefaultValue ) :
|
||||
CSettingTypeRomDatabase("",DefaultValue),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting ) :
|
||||
CSettingTypeRomDatabase("",DefaultSetting),
|
||||
m_PreIndex(PreIndex),
|
||||
m_PostIndex(PostIndex)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseIndex::~CSettingTypeRomDatabaseIndex()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabaseIndex::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeRomDatabaseIndex::Load ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
return CSettingTypeRomDatabase::Load(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, bool & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, uint32_t & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::LoadDefault ( int Index, stdstr & Value ) const
|
||||
{
|
||||
m_KeyName.Format("%s%d%s",m_PreIndex.c_str(),Index,m_PostIndex.c_str());
|
||||
CSettingTypeRomDatabase::LoadDefault(0,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeRomDatabaseIndex::Delete ( int /*Index*/ )
|
||||
{
|
||||
m_SettingsIniFile->SaveString(m_SectionIdent->c_str(),m_KeyName.c_str(),NULL);
|
||||
}
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRomDatabaseIndex :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
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, int32_t DefaultValue );
|
||||
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
|
||||
|
||||
virtual ~CSettingTypeRomDatabaseIndex();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabaseIndex(void); // Disable default constructor
|
||||
CSettingTypeRomDatabaseIndex(const CSettingTypeRomDatabaseIndex&); // Disable copy constructor
|
||||
CSettingTypeRomDatabaseIndex& operator=(const CSettingTypeRomDatabaseIndex&); // Disable assignment
|
||||
|
||||
stdstr m_PreIndex, m_PostIndex;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRomDatabaseIndex :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
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, int32_t DefaultValue );
|
||||
CSettingTypeRomDatabaseIndex(const char * PreIndex, const char * PostIndex, SettingID DefaultSetting );
|
||||
|
||||
virtual ~CSettingTypeRomDatabaseIndex();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return true; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabaseIndex(void); // Disable default constructor
|
||||
CSettingTypeRomDatabaseIndex(const CSettingTypeRomDatabaseIndex&); // Disable copy constructor
|
||||
CSettingTypeRomDatabaseIndex& operator=(const CSettingTypeRomDatabaseIndex&); // Disable assignment
|
||||
|
||||
stdstr m_PreIndex, m_PostIndex;
|
||||
};
|
||||
|
|
|
@ -1,64 +1,64 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabaseSetting.h"
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultSetting, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
|
||||
{
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-RomDatabaseSetting.h"
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, int DefaultValue, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, bool DefaultValue, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, const char * DefaultValue, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultValue, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault ) :
|
||||
CSettingTypeRomDatabase(Name, DefaultSetting, DeleteOnDefault),
|
||||
m_SectionIdent(SectionIdent)
|
||||
{
|
||||
m_SectionIdent.Replace("\\","-");
|
||||
if (!m_GlideSetting)
|
||||
{
|
||||
m_GlideSetting = IsGlideSetting(m_SectionIdent.c_str());
|
||||
m_SectionIdent = StripNameSection(m_SectionIdent.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
CSettingTypeRomDatabaseSetting::~CSettingTypeRomDatabaseSetting()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
|
||||
class CSettingTypeRomDatabaseSetting :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
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, int DefaultValue, bool DeleteOnDefault = false );
|
||||
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
||||
|
||||
virtual ~CSettingTypeRomDatabaseSetting();
|
||||
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RdbSetting; }
|
||||
|
||||
private:
|
||||
virtual const char * Section ( void ) const { return m_SectionIdent.c_str(); }
|
||||
|
||||
stdstr m_SectionIdent;
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabaseSetting(void); // Disable default constructor
|
||||
CSettingTypeRomDatabaseSetting(const CSettingTypeRomDatabaseSetting&); // Disable copy constructor
|
||||
CSettingTypeRomDatabaseSetting& operator=(const CSettingTypeRomDatabaseSetting&); // Disable assignment
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "SettingsType-RomDatabase.h"
|
||||
|
||||
class CSettingTypeRomDatabaseSetting :
|
||||
public CSettingTypeRomDatabase
|
||||
{
|
||||
public:
|
||||
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, int DefaultValue, bool DeleteOnDefault = false );
|
||||
CSettingTypeRomDatabaseSetting(const char * SectionIdent, const char * Name, SettingID DefaultSetting, bool DeleteOnDefault = false );
|
||||
|
||||
virtual ~CSettingTypeRomDatabaseSetting();
|
||||
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_RdbSetting; }
|
||||
|
||||
private:
|
||||
virtual const char * Section ( void ) const { return m_SectionIdent.c_str(); }
|
||||
|
||||
stdstr m_SectionIdent;
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabaseSetting(void); // Disable default constructor
|
||||
CSettingTypeRomDatabaseSetting(const CSettingTypeRomDatabaseSetting&); // Disable copy constructor
|
||||
CSettingTypeRomDatabaseSetting& operator=(const CSettingTypeRomDatabaseSetting&); // Disable assignment
|
||||
};
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
class CSettingTypeRomDatabase :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue );
|
||||
CSettingTypeRomDatabase(const char * Name, bool DefaultValue );
|
||||
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue );
|
||||
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting );
|
||||
~CSettingTypeRomDatabase();
|
||||
|
||||
virtual SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RomDatabase; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
static void Initilize ( void );
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabase(void); // Disable default constructor
|
||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||
|
||||
const const char * m_KeyName;
|
||||
const const char * m_DefaultStr;
|
||||
const int32_t m_DefaultValue;
|
||||
const SettingID m_DefaultSetting;
|
||||
|
||||
static CIniFile * m_SettingsIniFile;
|
||||
stdstr m_SectionIdent;
|
||||
};
|
||||
#pragma once
|
||||
|
||||
class CSettingTypeRomDatabase :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeRomDatabase(const char * Name, const char * DefaultValue );
|
||||
CSettingTypeRomDatabase(const char * Name, bool DefaultValue );
|
||||
CSettingTypeRomDatabase(const char * Name, int32_t DefaultValue );
|
||||
CSettingTypeRomDatabase(const char * Name, SettingID DefaultSetting );
|
||||
~CSettingTypeRomDatabase();
|
||||
|
||||
virtual SettingLocation GetSettingsLocation ( void ) const { return SettingLocation_RomDatabase; }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
static void Initilize ( void );
|
||||
|
||||
private:
|
||||
CSettingTypeRomDatabase(void); // Disable default constructor
|
||||
CSettingTypeRomDatabase(const CSettingTypeRomDatabase&); // Disable copy constructor
|
||||
CSettingTypeRomDatabase& operator=(const CSettingTypeRomDatabase&); // Disable assignment
|
||||
|
||||
const const char * m_KeyName;
|
||||
const const char * m_DefaultStr;
|
||||
const int32_t m_DefaultValue;
|
||||
const SettingID m_DefaultSetting;
|
||||
|
||||
static CIniFile * m_SettingsIniFile;
|
||||
stdstr m_SectionIdent;
|
||||
};
|
||||
|
|
|
@ -1,85 +1,85 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-SelectedDirectory.h"
|
||||
|
||||
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
|
||||
m_Name(Name),
|
||||
m_InitialDir(InitialDir),
|
||||
m_SelectedDir(SelectedDir),
|
||||
m_UseSelected(UseSelected)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
|
||||
return g_Settings->LoadStringVal(DirSettingId, Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
g_Settings->SaveBool(m_UseSelected,true);
|
||||
g_Settings->SaveString(m_SelectedDir,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-SelectedDirectory.h"
|
||||
|
||||
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected ) :
|
||||
m_Name(Name),
|
||||
m_InitialDir(InitialDir),
|
||||
m_SelectedDir(SelectedDir),
|
||||
m_UseSelected(UseSelected)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeSelectedDirectory::~CSettingTypeSelectedDirectory()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeSelectedDirectory::Load ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
|
||||
return g_Settings->LoadStringVal(DirSettingId, Value);
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
//Update the settings
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
g_Settings->SaveBool(m_UseSelected,true);
|
||||
g_Settings->SaveString(m_SelectedDir,Value);
|
||||
}
|
||||
|
||||
void CSettingTypeSelectedDirectory::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeSelectedDirectory :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
|
||||
~CSettingTypeSelectedDirectory();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
|
||||
|
||||
const char * GetName ( void ) const { return m_Name.c_str(); }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeSelectedDirectory(void); // Disable default constructor
|
||||
CSettingTypeSelectedDirectory(const CSettingTypeSelectedDirectory&); // Disable copy constructor
|
||||
CSettingTypeSelectedDirectory& operator=(const CSettingTypeSelectedDirectory&); // Disable assignment
|
||||
|
||||
std::string m_Name;
|
||||
SettingID m_InitialDir;
|
||||
SettingID m_SelectedDir;
|
||||
SettingID m_UseSelected;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeSelectedDirectory :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected );
|
||||
~CSettingTypeSelectedDirectory();
|
||||
|
||||
virtual bool IndexBasedSetting ( void ) const { return false; }
|
||||
virtual SettingType GetSettingType ( void ) const { return SettingType_SelectedDirectory; }
|
||||
|
||||
const char * GetName ( void ) const { return m_Name.c_str(); }
|
||||
|
||||
//return the values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
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, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
virtual void Save ( int32_t Index, bool 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 char * Value );
|
||||
|
||||
// Delete the setting
|
||||
virtual void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeSelectedDirectory(void); // Disable default constructor
|
||||
CSettingTypeSelectedDirectory(const CSettingTypeSelectedDirectory&); // Disable copy constructor
|
||||
CSettingTypeSelectedDirectory& operator=(const CSettingTypeSelectedDirectory&); // Disable assignment
|
||||
|
||||
std::string m_Name;
|
||||
SettingID m_InitialDir;
|
||||
SettingID m_SelectedDir;
|
||||
SettingID m_UseSelected;
|
||||
};
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-TempBool.h"
|
||||
|
||||
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) :
|
||||
m_value(initialValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeTempBool::~CSettingTypeTempBool ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeTempBool::Load ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
Value = m_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempBool::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-TempBool.h"
|
||||
|
||||
CSettingTypeTempBool::CSettingTypeTempBool(bool initialValue) :
|
||||
m_value(initialValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeTempBool::~CSettingTypeTempBool ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeTempBool::Load ( int /*Index*/, bool & Value ) const
|
||||
{
|
||||
Value = m_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempBool::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempBool::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, bool Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempBool::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeTempBool :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeTempBool(bool initialValue );
|
||||
~CSettingTypeTempBool();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
|
||||
|
||||
//return the values
|
||||
bool Load ( int32_t Index, bool & Value ) const;
|
||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeTempBool(void); // Disable default constructor
|
||||
CSettingTypeTempBool(const CSettingTypeTempBool&); // Disable copy constructor
|
||||
CSettingTypeTempBool& operator=(const CSettingTypeTempBool&); // Disable assignment
|
||||
|
||||
bool m_value;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeTempBool :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeTempBool(bool initialValue );
|
||||
~CSettingTypeTempBool();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_BoolVariable; }
|
||||
|
||||
//return the values
|
||||
bool Load ( int32_t Index, bool & Value ) const;
|
||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeTempBool(void); // Disable default constructor
|
||||
CSettingTypeTempBool(const CSettingTypeTempBool&); // Disable copy constructor
|
||||
CSettingTypeTempBool& operator=(const CSettingTypeTempBool&); // Disable assignment
|
||||
|
||||
bool m_value;
|
||||
};
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-TempNumber.h"
|
||||
|
||||
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
|
||||
m_value(initialValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeTempNumber::~CSettingTypeTempNumber ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
Value = m_value;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-TempNumber.h"
|
||||
|
||||
CSettingTypeTempNumber::CSettingTypeTempNumber(uint32_t initialValue) :
|
||||
m_value(initialValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeTempNumber::~CSettingTypeTempNumber ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, uint32_t & Value ) const
|
||||
{
|
||||
Value = m_value;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempNumber::Load ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, uint32_t Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, const stdstr & /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Save ( int /*Index*/, const char * /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempNumber::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeTempNumber :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeTempNumber(uint32_t initialValue);
|
||||
~CSettingTypeTempNumber();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
|
||||
|
||||
//return the values
|
||||
bool Load ( int32_t Index, bool & Value ) const;
|
||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeTempNumber(void); // Disable default constructor
|
||||
CSettingTypeTempNumber(const CSettingTypeTempNumber&); // Disable copy constructor
|
||||
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
|
||||
|
||||
uint32_t m_value;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeTempNumber :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeTempNumber(uint32_t initialValue);
|
||||
~CSettingTypeTempNumber();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_NumberVariable; }
|
||||
|
||||
//return the values
|
||||
bool Load ( int32_t Index, bool & Value ) const;
|
||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeTempNumber(void); // Disable default constructor
|
||||
CSettingTypeTempNumber(const CSettingTypeTempNumber&); // Disable copy constructor
|
||||
CSettingTypeTempNumber& operator=(const CSettingTypeTempNumber&); // Disable assignment
|
||||
|
||||
uint32_t m_value;
|
||||
};
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-TempString.h"
|
||||
|
||||
CSettingTypeTempString::CSettingTypeTempString(const char * initialValue) :
|
||||
m_value(initialValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeTempString::~CSettingTypeTempString ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempString::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
Value = m_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, const stdstr & Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "SettingsType-TempString.h"
|
||||
|
||||
CSettingTypeTempString::CSettingTypeTempString(const char * initialValue) :
|
||||
m_value(initialValue)
|
||||
{
|
||||
}
|
||||
|
||||
CSettingTypeTempString::~CSettingTypeTempString ( void )
|
||||
{
|
||||
}
|
||||
|
||||
bool CSettingTypeTempString::Load ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempString::Load ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSettingTypeTempString::Load ( int /*Index*/, stdstr & Value ) const
|
||||
{
|
||||
Value = m_value;
|
||||
return true;
|
||||
}
|
||||
|
||||
//return the default values
|
||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, bool & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, uint32_t & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::LoadDefault ( int /*Index*/, stdstr & /*Value*/ ) const
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, bool /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, uint32_t /*Value*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, const stdstr & Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Save ( int /*Index*/, const char * Value )
|
||||
{
|
||||
m_value = Value;
|
||||
}
|
||||
|
||||
void CSettingTypeTempString::Delete( int /*Index*/ )
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
}
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeTempString :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeTempString(const char * initialValue);
|
||||
~CSettingTypeTempString();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
|
||||
|
||||
//return the values
|
||||
bool Load ( int32_t Index, bool & Value ) const;
|
||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeTempString(void); // Disable default constructor
|
||||
CSettingTypeTempString(const CSettingTypeTempString&); // Disable copy constructor
|
||||
CSettingTypeTempString& operator=(const CSettingTypeTempString&); // Disable assignment
|
||||
|
||||
stdstr m_value;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Base.h>
|
||||
|
||||
class CSettingTypeTempString :
|
||||
public CSettingType
|
||||
{
|
||||
public:
|
||||
CSettingTypeTempString(const char * initialValue);
|
||||
~CSettingTypeTempString();
|
||||
|
||||
bool IndexBasedSetting ( void ) const { return false; }
|
||||
SettingType GetSettingType ( void ) const { return SettingType_StringVariable; }
|
||||
|
||||
//return the values
|
||||
bool Load ( int32_t Index, bool & Value ) const;
|
||||
bool Load ( int32_t Index, uint32_t & Value ) const;
|
||||
bool Load ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//return the default values
|
||||
void LoadDefault ( int32_t Index, bool & Value ) const;
|
||||
void LoadDefault ( int32_t Index, uint32_t & Value ) const;
|
||||
void LoadDefault ( int32_t Index, stdstr & Value ) const;
|
||||
|
||||
//Update the settings
|
||||
void Save ( int32_t Index, bool Value );
|
||||
void Save ( int32_t Index, uint32_t Value );
|
||||
void Save ( int32_t Index, const stdstr & Value );
|
||||
void Save ( int32_t Index, const char * Value );
|
||||
|
||||
// Delete the setting
|
||||
void Delete ( int32_t Index );
|
||||
|
||||
private:
|
||||
CSettingTypeTempString(void); // Disable default constructor
|
||||
CSettingTypeTempString(const CSettingTypeTempString&); // Disable copy constructor
|
||||
CSettingTypeTempString& operator=(const CSettingTypeTempString&); // Disable assignment
|
||||
|
||||
stdstr m_value;
|
||||
};
|
||||
|
|
|
@ -1,318 +1,318 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
MaxPluginSetting = 65535
|
||||
};
|
||||
|
||||
enum SettingID
|
||||
{
|
||||
//Default values
|
||||
Default_None,
|
||||
Default_Constant,
|
||||
|
||||
//information - temp keys
|
||||
Info_ShortCutsChanged,
|
||||
|
||||
//Command Settings
|
||||
Cmd_BaseDirectory,
|
||||
Cmd_RomFile,
|
||||
Cmd_ShowHelp,
|
||||
|
||||
//Support Files
|
||||
SupportFile_Settings,
|
||||
SupportFile_SettingsDefault,
|
||||
SupportFile_RomDatabase,
|
||||
SupportFile_RomDatabaseDefault,
|
||||
SupportFile_Glide64RDB,
|
||||
SupportFile_Glide64RDBDefault,
|
||||
SupportFile_Cheats,
|
||||
SupportFile_CheatsDefault,
|
||||
SupportFile_Notes,
|
||||
SupportFile_NotesDefault,
|
||||
SupportFile_ExtInfo,
|
||||
SupportFile_ExtInfoDefault,
|
||||
SupportFile_ShortCuts,
|
||||
SupportFile_ShortCutsDefault,
|
||||
SupportFile_RomListCache,
|
||||
SupportFile_RomListCacheDefault,
|
||||
SupportFile_7zipCache,
|
||||
SupportFile_7zipCacheDefault,
|
||||
|
||||
//Settings
|
||||
Setting_ApplicationName,
|
||||
Setting_UseFromRegistry,
|
||||
Setting_RdbEditor,
|
||||
Setting_CN64TimeCritical,
|
||||
Setting_PluginPageFirst,
|
||||
Setting_DisableScrSaver,
|
||||
Setting_AutoSleep,
|
||||
Setting_AutoStart,
|
||||
Setting_AutoFullscreen,
|
||||
Setting_CheckEmuRunning,
|
||||
Setting_EraseGameDefaults,
|
||||
|
||||
Setting_AutoZipInstantSave,
|
||||
Setting_RememberCheats,
|
||||
Setting_LanguageDir,
|
||||
Setting_LanguageDirDefault,
|
||||
Setting_CurrentLanguage,
|
||||
Setting_EnableDisk,
|
||||
|
||||
//RDB TLB Settings
|
||||
Rdb_GoodName,
|
||||
Rdb_SaveChip,
|
||||
Rdb_CpuType,
|
||||
Rdb_RDRamSize,
|
||||
Rdb_CounterFactor,
|
||||
Rdb_UseTlb,
|
||||
Rdb_DelayDP,
|
||||
Rdb_DelaySi,
|
||||
Rdb_32Bit,
|
||||
Rdb_FastSP,
|
||||
Rdb_Status,
|
||||
Rdb_NotesCore,
|
||||
Rdb_NotesPlugin,
|
||||
Rdb_FixedAudio,
|
||||
Rdb_SyncViaAudio,
|
||||
Rdb_RspAudioSignal,
|
||||
Rdb_TLB_VAddrStart,
|
||||
Rdb_TLB_VAddrLen,
|
||||
Rdb_TLB_PAddrStart,
|
||||
Rdb_UseHleGfx,
|
||||
Rdb_UseHleAudio,
|
||||
Rdb_LoadRomToMemory,
|
||||
Rdb_ScreenHertz,
|
||||
Rdb_FuncLookupMode,
|
||||
Rdb_RegCache,
|
||||
Rdb_BlockLinking,
|
||||
Rdb_SMM_StoreInstruc,
|
||||
Rdb_SMM_Cache,
|
||||
Rdb_SMM_PIDMA,
|
||||
Rdb_SMM_TLB,
|
||||
Rdb_SMM_Protect,
|
||||
Rdb_SMM_ValidFunc,
|
||||
Rdb_GameCheatFix,
|
||||
Rdb_GameCheatFixPlugin,
|
||||
Rdb_ViRefreshRate,
|
||||
Rdb_AiCountPerBytes,
|
||||
Rdb_AudioResetOnLoad,
|
||||
Rdb_AllowROMWrites,
|
||||
Rdb_CRC_Recalc,
|
||||
|
||||
//Individual Game Settings
|
||||
Game_IniKey,
|
||||
Game_File,
|
||||
Game_GameName,
|
||||
Game_GoodName,
|
||||
Game_TempLoaded,
|
||||
Game_SystemType,
|
||||
Game_EditPlugin_Gfx,
|
||||
Game_EditPlugin_Audio,
|
||||
Game_EditPlugin_Contr,
|
||||
Game_EditPlugin_RSP,
|
||||
Game_Plugin_Gfx,
|
||||
Game_Plugin_Audio,
|
||||
Game_Plugin_Controller,
|
||||
Game_Plugin_RSP,
|
||||
Game_SaveChip,
|
||||
Game_CpuType,
|
||||
Game_LastSaveSlot,
|
||||
Game_FixedAudio,
|
||||
Game_SyncViaAudio,
|
||||
Game_32Bit,
|
||||
Game_SMM_Cache,
|
||||
Game_SMM_Protect,
|
||||
Game_SMM_ValidFunc,
|
||||
Game_SMM_PIDMA,
|
||||
Game_SMM_TLB,
|
||||
Game_SMM_StoreInstruc,
|
||||
Game_CurrentSaveState,
|
||||
Game_RDRamSize,
|
||||
Game_CounterFactor,
|
||||
Game_UseTlb,
|
||||
Game_DelayDP,
|
||||
Game_DelaySI,
|
||||
Game_FastSP,
|
||||
Game_FuncLookupMode,
|
||||
Game_RegCache,
|
||||
Game_BlockLinking,
|
||||
Game_ScreenHertz,
|
||||
Game_RspAudioSignal,
|
||||
Game_UseHleGfx,
|
||||
Game_UseHleAudio,
|
||||
Game_LoadRomToMemory,
|
||||
Game_ViRefreshRate,
|
||||
Game_AiCountPerBytes,
|
||||
Game_AudioResetOnLoad,
|
||||
Game_AllowROMWrites,
|
||||
Game_CRC_Recalc,
|
||||
|
||||
// General Game running info
|
||||
GameRunning_LoadingInProgress,
|
||||
GameRunning_CPU_Running,
|
||||
GameRunning_CPU_Paused,
|
||||
GameRunning_CPU_PausedType,
|
||||
GameRunning_InstantSaveFile,
|
||||
GameRunning_LimitFPS,
|
||||
GameRunning_ScreenHertz,
|
||||
GameRunning_InReset,
|
||||
|
||||
//User Interface
|
||||
UserInterface_BasicMode,
|
||||
UserInterface_ShowCPUPer,
|
||||
UserInterface_DisplayFrameRate,
|
||||
UserInterface_InFullScreen,
|
||||
UserInterface_FrameDisplayType,
|
||||
UserInterface_MainWindowTop,
|
||||
UserInterface_MainWindowLeft,
|
||||
UserInterface_AlwaysOnTop,
|
||||
|
||||
RomBrowser_Enabled,
|
||||
RomBrowser_ColoumnsChanged,
|
||||
RomBrowser_Top,
|
||||
RomBrowser_Left,
|
||||
RomBrowser_Width,
|
||||
RomBrowser_Height,
|
||||
RomBrowser_PosIndex,
|
||||
RomBrowser_WidthIndex,
|
||||
RomBrowser_SortFieldIndex,
|
||||
RomBrowser_SortAscendingIndex,
|
||||
RomBrowser_Recursive,
|
||||
RomBrowser_Maximized,
|
||||
|
||||
//Directory Info
|
||||
Directory_LastSave,
|
||||
Directory_RecentGameDirCount,
|
||||
Directory_RecentGameDirIndex,
|
||||
Directory_Game,
|
||||
Directory_GameInitial,
|
||||
Directory_GameSelected,
|
||||
Directory_GameUseSelected,
|
||||
Directory_Plugin,
|
||||
Directory_PluginInitial,
|
||||
Directory_PluginSelected,
|
||||
Directory_PluginUseSelected,
|
||||
Directory_PluginSync,
|
||||
Directory_SnapShot,
|
||||
Directory_SnapShotInitial,
|
||||
Directory_SnapShotSelected,
|
||||
Directory_SnapShotUseSelected,
|
||||
Directory_NativeSave,
|
||||
Directory_NativeSaveInitial,
|
||||
Directory_NativeSaveSelected,
|
||||
Directory_NativeSaveUseSelected,
|
||||
Directory_InstantSave,
|
||||
Directory_InstantSaveInitial,
|
||||
Directory_InstantSaveSelected,
|
||||
Directory_InstantSaveUseSelected,
|
||||
Directory_Texture,
|
||||
Directory_TextureInitial,
|
||||
Directory_TextureSelected,
|
||||
Directory_TextureUseSelected,
|
||||
|
||||
//File Info
|
||||
File_RecentGameFileCount,
|
||||
File_RecentGameFileIndex,
|
||||
File_DiskIPLPath,
|
||||
|
||||
//Debugger
|
||||
Debugger_Enabled,
|
||||
Debugger_ShowTLBMisses,
|
||||
Debugger_ShowUnhandledMemory,
|
||||
Debugger_ShowPifErrors,
|
||||
Debugger_ShowDivByZero,
|
||||
Debugger_GenerateLogFiles,
|
||||
Debugger_ProfileCode,
|
||||
Debugger_DisableGameFixes,
|
||||
Debugger_AppLogLevel,
|
||||
Debugger_AppLogFlush,
|
||||
Debugger_ShowDListAListCount,
|
||||
Debugger_ShowRecompMemSize,
|
||||
|
||||
//Trace
|
||||
Debugger_TraceMD5,
|
||||
Debugger_TraceSettings,
|
||||
Debugger_TraceUnknown,
|
||||
Debugger_TraceAppInit,
|
||||
Debugger_TraceAppCleanup,
|
||||
Debugger_TraceN64System,
|
||||
Debugger_TracePlugins,
|
||||
Debugger_TraceGFXPlugin,
|
||||
Debugger_TraceAudioPlugin,
|
||||
Debugger_TraceControllerPlugin,
|
||||
Debugger_TraceRSPPlugin,
|
||||
Debugger_TraceRSP,
|
||||
Debugger_TraceAudio,
|
||||
Debugger_TraceRegisterCache,
|
||||
Debugger_TraceRecompiler,
|
||||
Debugger_TraceTLB,
|
||||
Debugger_TraceProtectedMEM,
|
||||
Debugger_TraceUserInterface,
|
||||
|
||||
//Plugins
|
||||
Plugin_RSP_Current,
|
||||
Plugin_RSP_CurVer,
|
||||
Plugin_GFX_Current,
|
||||
Plugin_GFX_CurVer,
|
||||
Plugin_AUDIO_Current,
|
||||
Plugin_AUDIO_CurVer,
|
||||
Plugin_CONT_Current,
|
||||
Plugin_CONT_CurVer,
|
||||
Plugin_UseHleGfx,
|
||||
Plugin_UseHleAudio,
|
||||
|
||||
Logging_GenerateLog,
|
||||
Logging_LogRDRamRegisters,
|
||||
Logging_LogSPRegisters,
|
||||
Logging_LogDPCRegisters,
|
||||
Logging_LogDPSRegisters,
|
||||
Logging_LogMIPSInterface,
|
||||
Logging_LogVideoInterface,
|
||||
Logging_LogAudioInterface,
|
||||
Logging_LogPerInterface,
|
||||
Logging_LogRDRAMInterface,
|
||||
Logging_LogSerialInterface,
|
||||
Logging_LogPRDMAOperations,
|
||||
Logging_LogPRDirectMemLoads,
|
||||
Logging_LogPRDMAMemLoads,
|
||||
Logging_LogPRDirectMemStores,
|
||||
Logging_LogPRDMAMemStores,
|
||||
Logging_LogControllerPak,
|
||||
Logging_LogCP0changes,
|
||||
Logging_LogCP0reads,
|
||||
Logging_LogTLB,
|
||||
Logging_LogExceptions,
|
||||
Logging_NoInterrupts,
|
||||
Logging_LogCache,
|
||||
Logging_LogRomHeader,
|
||||
Logging_LogUnknown,
|
||||
|
||||
//Cheats
|
||||
Cheat_Entry,
|
||||
Cheat_Active,
|
||||
Cheat_Extension,
|
||||
Cheat_Notes,
|
||||
Cheat_Options,
|
||||
Cheat_Range,
|
||||
Cheat_RangeNotes,
|
||||
|
||||
FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting,
|
||||
FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting,
|
||||
FirstGfxDefaultSet, LastGfxDefaultSet = FirstGfxDefaultSet + MaxPluginSetting,
|
||||
FirstGfxSettings, LastGfxSettings = FirstGfxSettings + MaxPluginSetting,
|
||||
FirstAudioDefaultSet, LastAudioDefaultSet = FirstAudioDefaultSet + MaxPluginSetting,
|
||||
FirstAudioSettings, LastAudioSettings = FirstAudioSettings + MaxPluginSetting,
|
||||
FirstCtrlDefaultSet, LastCtrlDefaultSet = FirstCtrlDefaultSet + MaxPluginSetting,
|
||||
FirstCtrlSettings, LastCtrlSettings = FirstCtrlSettings + MaxPluginSetting,
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
MaxPluginSetting = 65535
|
||||
};
|
||||
|
||||
enum SettingID
|
||||
{
|
||||
//Default values
|
||||
Default_None,
|
||||
Default_Constant,
|
||||
|
||||
//information - temp keys
|
||||
Info_ShortCutsChanged,
|
||||
|
||||
//Command Settings
|
||||
Cmd_BaseDirectory,
|
||||
Cmd_RomFile,
|
||||
Cmd_ShowHelp,
|
||||
|
||||
//Support Files
|
||||
SupportFile_Settings,
|
||||
SupportFile_SettingsDefault,
|
||||
SupportFile_RomDatabase,
|
||||
SupportFile_RomDatabaseDefault,
|
||||
SupportFile_Glide64RDB,
|
||||
SupportFile_Glide64RDBDefault,
|
||||
SupportFile_Cheats,
|
||||
SupportFile_CheatsDefault,
|
||||
SupportFile_Notes,
|
||||
SupportFile_NotesDefault,
|
||||
SupportFile_ExtInfo,
|
||||
SupportFile_ExtInfoDefault,
|
||||
SupportFile_ShortCuts,
|
||||
SupportFile_ShortCutsDefault,
|
||||
SupportFile_RomListCache,
|
||||
SupportFile_RomListCacheDefault,
|
||||
SupportFile_7zipCache,
|
||||
SupportFile_7zipCacheDefault,
|
||||
|
||||
//Settings
|
||||
Setting_ApplicationName,
|
||||
Setting_UseFromRegistry,
|
||||
Setting_RdbEditor,
|
||||
Setting_CN64TimeCritical,
|
||||
Setting_PluginPageFirst,
|
||||
Setting_DisableScrSaver,
|
||||
Setting_AutoSleep,
|
||||
Setting_AutoStart,
|
||||
Setting_AutoFullscreen,
|
||||
Setting_CheckEmuRunning,
|
||||
Setting_EraseGameDefaults,
|
||||
|
||||
Setting_AutoZipInstantSave,
|
||||
Setting_RememberCheats,
|
||||
Setting_LanguageDir,
|
||||
Setting_LanguageDirDefault,
|
||||
Setting_CurrentLanguage,
|
||||
Setting_EnableDisk,
|
||||
|
||||
//RDB TLB Settings
|
||||
Rdb_GoodName,
|
||||
Rdb_SaveChip,
|
||||
Rdb_CpuType,
|
||||
Rdb_RDRamSize,
|
||||
Rdb_CounterFactor,
|
||||
Rdb_UseTlb,
|
||||
Rdb_DelayDP,
|
||||
Rdb_DelaySi,
|
||||
Rdb_32Bit,
|
||||
Rdb_FastSP,
|
||||
Rdb_Status,
|
||||
Rdb_NotesCore,
|
||||
Rdb_NotesPlugin,
|
||||
Rdb_FixedAudio,
|
||||
Rdb_SyncViaAudio,
|
||||
Rdb_RspAudioSignal,
|
||||
Rdb_TLB_VAddrStart,
|
||||
Rdb_TLB_VAddrLen,
|
||||
Rdb_TLB_PAddrStart,
|
||||
Rdb_UseHleGfx,
|
||||
Rdb_UseHleAudio,
|
||||
Rdb_LoadRomToMemory,
|
||||
Rdb_ScreenHertz,
|
||||
Rdb_FuncLookupMode,
|
||||
Rdb_RegCache,
|
||||
Rdb_BlockLinking,
|
||||
Rdb_SMM_StoreInstruc,
|
||||
Rdb_SMM_Cache,
|
||||
Rdb_SMM_PIDMA,
|
||||
Rdb_SMM_TLB,
|
||||
Rdb_SMM_Protect,
|
||||
Rdb_SMM_ValidFunc,
|
||||
Rdb_GameCheatFix,
|
||||
Rdb_GameCheatFixPlugin,
|
||||
Rdb_ViRefreshRate,
|
||||
Rdb_AiCountPerBytes,
|
||||
Rdb_AudioResetOnLoad,
|
||||
Rdb_AllowROMWrites,
|
||||
Rdb_CRC_Recalc,
|
||||
|
||||
//Individual Game Settings
|
||||
Game_IniKey,
|
||||
Game_File,
|
||||
Game_GameName,
|
||||
Game_GoodName,
|
||||
Game_TempLoaded,
|
||||
Game_SystemType,
|
||||
Game_EditPlugin_Gfx,
|
||||
Game_EditPlugin_Audio,
|
||||
Game_EditPlugin_Contr,
|
||||
Game_EditPlugin_RSP,
|
||||
Game_Plugin_Gfx,
|
||||
Game_Plugin_Audio,
|
||||
Game_Plugin_Controller,
|
||||
Game_Plugin_RSP,
|
||||
Game_SaveChip,
|
||||
Game_CpuType,
|
||||
Game_LastSaveSlot,
|
||||
Game_FixedAudio,
|
||||
Game_SyncViaAudio,
|
||||
Game_32Bit,
|
||||
Game_SMM_Cache,
|
||||
Game_SMM_Protect,
|
||||
Game_SMM_ValidFunc,
|
||||
Game_SMM_PIDMA,
|
||||
Game_SMM_TLB,
|
||||
Game_SMM_StoreInstruc,
|
||||
Game_CurrentSaveState,
|
||||
Game_RDRamSize,
|
||||
Game_CounterFactor,
|
||||
Game_UseTlb,
|
||||
Game_DelayDP,
|
||||
Game_DelaySI,
|
||||
Game_FastSP,
|
||||
Game_FuncLookupMode,
|
||||
Game_RegCache,
|
||||
Game_BlockLinking,
|
||||
Game_ScreenHertz,
|
||||
Game_RspAudioSignal,
|
||||
Game_UseHleGfx,
|
||||
Game_UseHleAudio,
|
||||
Game_LoadRomToMemory,
|
||||
Game_ViRefreshRate,
|
||||
Game_AiCountPerBytes,
|
||||
Game_AudioResetOnLoad,
|
||||
Game_AllowROMWrites,
|
||||
Game_CRC_Recalc,
|
||||
|
||||
// General Game running info
|
||||
GameRunning_LoadingInProgress,
|
||||
GameRunning_CPU_Running,
|
||||
GameRunning_CPU_Paused,
|
||||
GameRunning_CPU_PausedType,
|
||||
GameRunning_InstantSaveFile,
|
||||
GameRunning_LimitFPS,
|
||||
GameRunning_ScreenHertz,
|
||||
GameRunning_InReset,
|
||||
|
||||
//User Interface
|
||||
UserInterface_BasicMode,
|
||||
UserInterface_ShowCPUPer,
|
||||
UserInterface_DisplayFrameRate,
|
||||
UserInterface_InFullScreen,
|
||||
UserInterface_FrameDisplayType,
|
||||
UserInterface_MainWindowTop,
|
||||
UserInterface_MainWindowLeft,
|
||||
UserInterface_AlwaysOnTop,
|
||||
|
||||
RomBrowser_Enabled,
|
||||
RomBrowser_ColoumnsChanged,
|
||||
RomBrowser_Top,
|
||||
RomBrowser_Left,
|
||||
RomBrowser_Width,
|
||||
RomBrowser_Height,
|
||||
RomBrowser_PosIndex,
|
||||
RomBrowser_WidthIndex,
|
||||
RomBrowser_SortFieldIndex,
|
||||
RomBrowser_SortAscendingIndex,
|
||||
RomBrowser_Recursive,
|
||||
RomBrowser_Maximized,
|
||||
|
||||
//Directory Info
|
||||
Directory_LastSave,
|
||||
Directory_RecentGameDirCount,
|
||||
Directory_RecentGameDirIndex,
|
||||
Directory_Game,
|
||||
Directory_GameInitial,
|
||||
Directory_GameSelected,
|
||||
Directory_GameUseSelected,
|
||||
Directory_Plugin,
|
||||
Directory_PluginInitial,
|
||||
Directory_PluginSelected,
|
||||
Directory_PluginUseSelected,
|
||||
Directory_PluginSync,
|
||||
Directory_SnapShot,
|
||||
Directory_SnapShotInitial,
|
||||
Directory_SnapShotSelected,
|
||||
Directory_SnapShotUseSelected,
|
||||
Directory_NativeSave,
|
||||
Directory_NativeSaveInitial,
|
||||
Directory_NativeSaveSelected,
|
||||
Directory_NativeSaveUseSelected,
|
||||
Directory_InstantSave,
|
||||
Directory_InstantSaveInitial,
|
||||
Directory_InstantSaveSelected,
|
||||
Directory_InstantSaveUseSelected,
|
||||
Directory_Texture,
|
||||
Directory_TextureInitial,
|
||||
Directory_TextureSelected,
|
||||
Directory_TextureUseSelected,
|
||||
|
||||
//File Info
|
||||
File_RecentGameFileCount,
|
||||
File_RecentGameFileIndex,
|
||||
File_DiskIPLPath,
|
||||
|
||||
//Debugger
|
||||
Debugger_Enabled,
|
||||
Debugger_ShowTLBMisses,
|
||||
Debugger_ShowUnhandledMemory,
|
||||
Debugger_ShowPifErrors,
|
||||
Debugger_ShowDivByZero,
|
||||
Debugger_GenerateLogFiles,
|
||||
Debugger_ProfileCode,
|
||||
Debugger_DisableGameFixes,
|
||||
Debugger_AppLogLevel,
|
||||
Debugger_AppLogFlush,
|
||||
Debugger_ShowDListAListCount,
|
||||
Debugger_ShowRecompMemSize,
|
||||
|
||||
//Trace
|
||||
Debugger_TraceMD5,
|
||||
Debugger_TraceSettings,
|
||||
Debugger_TraceUnknown,
|
||||
Debugger_TraceAppInit,
|
||||
Debugger_TraceAppCleanup,
|
||||
Debugger_TraceN64System,
|
||||
Debugger_TracePlugins,
|
||||
Debugger_TraceGFXPlugin,
|
||||
Debugger_TraceAudioPlugin,
|
||||
Debugger_TraceControllerPlugin,
|
||||
Debugger_TraceRSPPlugin,
|
||||
Debugger_TraceRSP,
|
||||
Debugger_TraceAudio,
|
||||
Debugger_TraceRegisterCache,
|
||||
Debugger_TraceRecompiler,
|
||||
Debugger_TraceTLB,
|
||||
Debugger_TraceProtectedMEM,
|
||||
Debugger_TraceUserInterface,
|
||||
|
||||
//Plugins
|
||||
Plugin_RSP_Current,
|
||||
Plugin_RSP_CurVer,
|
||||
Plugin_GFX_Current,
|
||||
Plugin_GFX_CurVer,
|
||||
Plugin_AUDIO_Current,
|
||||
Plugin_AUDIO_CurVer,
|
||||
Plugin_CONT_Current,
|
||||
Plugin_CONT_CurVer,
|
||||
Plugin_UseHleGfx,
|
||||
Plugin_UseHleAudio,
|
||||
|
||||
Logging_GenerateLog,
|
||||
Logging_LogRDRamRegisters,
|
||||
Logging_LogSPRegisters,
|
||||
Logging_LogDPCRegisters,
|
||||
Logging_LogDPSRegisters,
|
||||
Logging_LogMIPSInterface,
|
||||
Logging_LogVideoInterface,
|
||||
Logging_LogAudioInterface,
|
||||
Logging_LogPerInterface,
|
||||
Logging_LogRDRAMInterface,
|
||||
Logging_LogSerialInterface,
|
||||
Logging_LogPRDMAOperations,
|
||||
Logging_LogPRDirectMemLoads,
|
||||
Logging_LogPRDMAMemLoads,
|
||||
Logging_LogPRDirectMemStores,
|
||||
Logging_LogPRDMAMemStores,
|
||||
Logging_LogControllerPak,
|
||||
Logging_LogCP0changes,
|
||||
Logging_LogCP0reads,
|
||||
Logging_LogTLB,
|
||||
Logging_LogExceptions,
|
||||
Logging_NoInterrupts,
|
||||
Logging_LogCache,
|
||||
Logging_LogRomHeader,
|
||||
Logging_LogUnknown,
|
||||
|
||||
//Cheats
|
||||
Cheat_Entry,
|
||||
Cheat_Active,
|
||||
Cheat_Extension,
|
||||
Cheat_Notes,
|
||||
Cheat_Options,
|
||||
Cheat_Range,
|
||||
Cheat_RangeNotes,
|
||||
|
||||
FirstRSPDefaultSet, LastRSPDefaultSet = FirstRSPDefaultSet + MaxPluginSetting,
|
||||
FirstRSPSettings, LastRSPSettings = FirstRSPSettings + MaxPluginSetting,
|
||||
FirstGfxDefaultSet, LastGfxDefaultSet = FirstGfxDefaultSet + MaxPluginSetting,
|
||||
FirstGfxSettings, LastGfxSettings = FirstGfxSettings + MaxPluginSetting,
|
||||
FirstAudioDefaultSet, LastAudioDefaultSet = FirstAudioDefaultSet + MaxPluginSetting,
|
||||
FirstAudioSettings, LastAudioSettings = FirstAudioSettings + MaxPluginSetting,
|
||||
FirstCtrlDefaultSet, LastCtrlDefaultSet = FirstCtrlDefaultSet + MaxPluginSetting,
|
||||
FirstCtrlSettings, LastCtrlSettings = FirstCtrlSettings + MaxPluginSetting,
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +1,29 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "Support.h"
|
||||
#include <string> //needed for stl string (std::string)
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "UserInterface.h"
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
#include <Project64-core/N64System/ProfilingClass.h>
|
||||
|
||||
//General Mips Information
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/SpeedLimiterClass.h>
|
||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "Support.h"
|
||||
#include <string> //needed for stl string (std::string)
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "UserInterface.h"
|
||||
#include <Project64-core/N64System/N64Types.h>
|
||||
|
||||
#include <Project64-core/N64System/ProfilingClass.h>
|
||||
|
||||
//General Mips Information
|
||||
#include <Project64-core/N64System/N64RomClass.h>
|
||||
#include <Project64-core/N64System/SpeedLimiterClass.h>
|
||||
#include <Project64-core/N64System/Mips/OpCode.h>
|
||||
#include <Project64-core/N64System/Recompiler/X86ops.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
|
|
|
@ -1,76 +1,76 @@
|
|||
template <class T>
|
||||
class CDebugDialog :
|
||||
public CDialogImpl < T >
|
||||
{
|
||||
protected:
|
||||
CDebuggerUI * m_Debugger;
|
||||
HANDLE m_CreatedEvent;
|
||||
HANDLE m_DialogThread;
|
||||
|
||||
static DWORD CreateDebuggerWindow(CDebugDialog<T> * pThis)
|
||||
{
|
||||
pThis->DoModal(NULL);
|
||||
pThis->WindowCreated();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WindowCreated(void)
|
||||
{
|
||||
SetEvent(m_CreatedEvent);
|
||||
}
|
||||
|
||||
public:
|
||||
CDebugDialog(CDebuggerUI * debugger) :
|
||||
m_Debugger(debugger),
|
||||
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
|
||||
m_DialogThread(NULL)
|
||||
{
|
||||
}
|
||||
virtual ~CDebugDialog(void)
|
||||
{
|
||||
HideWindow();
|
||||
CloseHandle(m_CreatedEvent);
|
||||
if (m_DialogThread)
|
||||
{
|
||||
CloseHandle(m_DialogThread);
|
||||
m_DialogThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HideWindow(void)
|
||||
{
|
||||
if (m_hWnd && ::IsWindow(m_hWnd))
|
||||
{
|
||||
::EndDialog(m_hWnd, 0);
|
||||
}
|
||||
if (m_DialogThread)
|
||||
{
|
||||
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "CDebugDialog - time out on close");
|
||||
|
||||
TerminateThread(m_DialogThread, 1);
|
||||
}
|
||||
CloseHandle(m_DialogThread);
|
||||
m_DialogThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowWindow(void)
|
||||
{
|
||||
if (m_hWnd)
|
||||
{
|
||||
SetForegroundWindow((HWND)m_hWnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD ThreadID;
|
||||
ResetEvent(m_CreatedEvent);
|
||||
m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID);
|
||||
if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
template <class T>
|
||||
class CDebugDialog :
|
||||
public CDialogImpl < T >
|
||||
{
|
||||
protected:
|
||||
CDebuggerUI * m_Debugger;
|
||||
HANDLE m_CreatedEvent;
|
||||
HANDLE m_DialogThread;
|
||||
|
||||
static DWORD CreateDebuggerWindow(CDebugDialog<T> * pThis)
|
||||
{
|
||||
pThis->DoModal(NULL);
|
||||
pThis->WindowCreated();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WindowCreated(void)
|
||||
{
|
||||
SetEvent(m_CreatedEvent);
|
||||
}
|
||||
|
||||
public:
|
||||
CDebugDialog(CDebuggerUI * debugger) :
|
||||
m_Debugger(debugger),
|
||||
m_CreatedEvent(CreateEvent(NULL, true, false, NULL)),
|
||||
m_DialogThread(NULL)
|
||||
{
|
||||
}
|
||||
virtual ~CDebugDialog(void)
|
||||
{
|
||||
HideWindow();
|
||||
CloseHandle(m_CreatedEvent);
|
||||
if (m_DialogThread)
|
||||
{
|
||||
CloseHandle(m_DialogThread);
|
||||
m_DialogThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HideWindow(void)
|
||||
{
|
||||
if (m_hWnd && ::IsWindow(m_hWnd))
|
||||
{
|
||||
::EndDialog(m_hWnd, 0);
|
||||
}
|
||||
if (m_DialogThread)
|
||||
{
|
||||
if (WaitForSingleObject(m_DialogThread, 5000) == WAIT_TIMEOUT)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "CDebugDialog - time out on close");
|
||||
|
||||
TerminateThread(m_DialogThread, 1);
|
||||
}
|
||||
CloseHandle(m_DialogThread);
|
||||
m_DialogThread = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowWindow(void)
|
||||
{
|
||||
if (m_hWnd)
|
||||
{
|
||||
SetForegroundWindow((HWND)m_hWnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD ThreadID;
|
||||
ResetEvent(m_CreatedEvent);
|
||||
m_DialogThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateDebuggerWindow, (LPVOID)this, 0, &ThreadID);
|
||||
if (WaitForSingleObject(m_CreatedEvent, 20000) == WAIT_TIMEOUT)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "Failed to get window create notification");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,157 +1,157 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CDumpMemory::CDumpMemory(CDebuggerUI * debugger) :
|
||||
CDebugDialog<CDumpMemory>(debugger)
|
||||
{
|
||||
}
|
||||
|
||||
CDumpMemory::~CDumpMemory()
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_StartAddress.Attach(GetDlgItem(IDC_E_START_ADDR));
|
||||
m_EndAddress.Attach(GetDlgItem(IDC_E_END_ADDR));
|
||||
m_PC.Attach(GetDlgItem(IDC_E_ALT_PC));
|
||||
|
||||
m_StartAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||
m_EndAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||
m_PC.SetDisplayType(CEditNumber::DisplayHex);
|
||||
|
||||
m_StartAddress.SetValue(0x80000000, true, true);
|
||||
m_EndAddress.SetValue(0x803FFFF0, true, true);
|
||||
m_PC.SetValue(0x80000000);
|
||||
HWND hFormatList = GetDlgItem(IDC_FORMAT);
|
||||
int pos = ::SendMessage(hFormatList, CB_ADDSTRING, (WPARAM)0, (LPARAM)"TEXT - Disassembly + PC");
|
||||
::SendMessage(hFormatList, CB_SETITEMDATA, (WPARAM)pos, (LPARAM)DisassemblyWithPC);
|
||||
::SendMessage(hFormatList, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||
|
||||
WindowCreated();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
switch (wID)
|
||||
{
|
||||
case IDCANCEL:
|
||||
EndDialog(0);
|
||||
break;
|
||||
case IDC_BTN_CHOOSE_FILE:
|
||||
{
|
||||
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||
OPENFILENAME openfilename;
|
||||
|
||||
memset(&FileName, 0, sizeof(FileName));
|
||||
memset(&openfilename, 0, sizeof(openfilename));
|
||||
strcpy(Directory, CPath(CPath::MODULE_DIRECTORY));
|
||||
openfilename.lStructSize = sizeof(openfilename);
|
||||
openfilename.hwndOwner = m_hWnd;
|
||||
openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
||||
openfilename.lpstrFile = FileName;
|
||||
openfilename.lpstrInitialDir = Directory;
|
||||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (GetOpenFileName(&openfilename))
|
||||
{
|
||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||
_splitpath(FileName, drive, dir, fname, ext);
|
||||
if (strlen(ext) == 0)
|
||||
{
|
||||
strcat(FileName, ".txt");
|
||||
}
|
||||
SetDlgItemText(IDC_FILENAME, FileName);
|
||||
}
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
break;
|
||||
case IDOK:
|
||||
{
|
||||
TCHAR FileName[MAX_PATH];
|
||||
int CurrentFormatSel = SendDlgItemMessage(IDC_FORMAT, CB_GETCURSEL, 0, 0);
|
||||
DumpFormat Format = (DumpFormat)SendDlgItemMessage(IDC_FORMAT, CB_GETITEMDATA, CurrentFormatSel, 0);
|
||||
DWORD StartPC = m_StartAddress.GetValue();
|
||||
DWORD EndPC = m_EndAddress.GetValue();
|
||||
DWORD DumpPC = m_PC.GetValue();
|
||||
GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName));
|
||||
if (strlen(FileName) == 0)
|
||||
{
|
||||
g_Notify->DisplayError("Please Choose target file");
|
||||
::SetFocus(GetDlgItem(IDC_FILENAME));
|
||||
return false;
|
||||
}
|
||||
if (SendDlgItemMessage(IDC_USE_ALT_PC, BM_GETSTATE, 0, 0) != BST_CHECKED)
|
||||
{
|
||||
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
||||
}
|
||||
//disable buttons
|
||||
::EnableWindow(GetDlgItem(IDC_E_START_ADDR), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_E_END_ADDR), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_E_ALT_PC), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_USE_ALT_PC), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_FILENAME), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_BTN_CHOOSE_FILE), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_FORMAT), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDOK), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDCANCEL), FALSE);
|
||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (!DumpMemory(FileName, Format, StartPC, EndPC, DumpPC))
|
||||
{
|
||||
//enable buttons
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
return false;
|
||||
}
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
EndDialog(0);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case DisassemblyWithPC:
|
||||
{
|
||||
CLog LogFile;
|
||||
if (!LogFile.Open(FileName))
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).c_str());
|
||||
return false;
|
||||
}
|
||||
LogFile.SetFlush(false);
|
||||
LogFile.SetTruncateFile(false);
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
#ifdef legacycode
|
||||
char Command[200];
|
||||
for (COpcode OpCode(StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
||||
{
|
||||
const char * szOpName = OpCode.OpcodeName();
|
||||
OpCode.OpcodeParam(Command);
|
||||
LogFile.LogF("%X: %-15s%s\r\n",OpCode.PC(),szOpName,Command);
|
||||
}
|
||||
#endif
|
||||
m_StartAddress.SetValue(StartPC, true, true);
|
||||
m_EndAddress.SetValue(EndPC, true, true);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CDumpMemory::CDumpMemory(CDebuggerUI * debugger) :
|
||||
CDebugDialog<CDumpMemory>(debugger)
|
||||
{
|
||||
}
|
||||
|
||||
CDumpMemory::~CDumpMemory()
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CDumpMemory::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_StartAddress.Attach(GetDlgItem(IDC_E_START_ADDR));
|
||||
m_EndAddress.Attach(GetDlgItem(IDC_E_END_ADDR));
|
||||
m_PC.Attach(GetDlgItem(IDC_E_ALT_PC));
|
||||
|
||||
m_StartAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||
m_EndAddress.SetDisplayType(CEditNumber::DisplayHex);
|
||||
m_PC.SetDisplayType(CEditNumber::DisplayHex);
|
||||
|
||||
m_StartAddress.SetValue(0x80000000, true, true);
|
||||
m_EndAddress.SetValue(0x803FFFF0, true, true);
|
||||
m_PC.SetValue(0x80000000);
|
||||
HWND hFormatList = GetDlgItem(IDC_FORMAT);
|
||||
int pos = ::SendMessage(hFormatList, CB_ADDSTRING, (WPARAM)0, (LPARAM)"TEXT - Disassembly + PC");
|
||||
::SendMessage(hFormatList, CB_SETITEMDATA, (WPARAM)pos, (LPARAM)DisassemblyWithPC);
|
||||
::SendMessage(hFormatList, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||
|
||||
WindowCreated();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
switch (wID)
|
||||
{
|
||||
case IDCANCEL:
|
||||
EndDialog(0);
|
||||
break;
|
||||
case IDC_BTN_CHOOSE_FILE:
|
||||
{
|
||||
char FileName[_MAX_PATH], Directory[_MAX_PATH];
|
||||
OPENFILENAME openfilename;
|
||||
|
||||
memset(&FileName, 0, sizeof(FileName));
|
||||
memset(&openfilename, 0, sizeof(openfilename));
|
||||
strcpy(Directory, CPath(CPath::MODULE_DIRECTORY));
|
||||
openfilename.lStructSize = sizeof(openfilename);
|
||||
openfilename.hwndOwner = m_hWnd;
|
||||
openfilename.lpstrFilter = "Text file (*.txt)\0*.txt;\0All files (*.*)\0*.*\0";
|
||||
openfilename.lpstrFile = FileName;
|
||||
openfilename.lpstrInitialDir = Directory;
|
||||
openfilename.nMaxFile = MAX_PATH;
|
||||
openfilename.Flags = OFN_HIDEREADONLY;
|
||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (GetOpenFileName(&openfilename))
|
||||
{
|
||||
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||
_splitpath(FileName, drive, dir, fname, ext);
|
||||
if (strlen(ext) == 0)
|
||||
{
|
||||
strcat(FileName, ".txt");
|
||||
}
|
||||
SetDlgItemText(IDC_FILENAME, FileName);
|
||||
}
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
break;
|
||||
case IDOK:
|
||||
{
|
||||
TCHAR FileName[MAX_PATH];
|
||||
int CurrentFormatSel = SendDlgItemMessage(IDC_FORMAT, CB_GETCURSEL, 0, 0);
|
||||
DumpFormat Format = (DumpFormat)SendDlgItemMessage(IDC_FORMAT, CB_GETITEMDATA, CurrentFormatSel, 0);
|
||||
DWORD StartPC = m_StartAddress.GetValue();
|
||||
DWORD EndPC = m_EndAddress.GetValue();
|
||||
DWORD DumpPC = m_PC.GetValue();
|
||||
GetDlgItemText(IDC_FILENAME, FileName, sizeof(FileName));
|
||||
if (strlen(FileName) == 0)
|
||||
{
|
||||
g_Notify->DisplayError("Please Choose target file");
|
||||
::SetFocus(GetDlgItem(IDC_FILENAME));
|
||||
return false;
|
||||
}
|
||||
if (SendDlgItemMessage(IDC_USE_ALT_PC, BM_GETSTATE, 0, 0) != BST_CHECKED)
|
||||
{
|
||||
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
||||
}
|
||||
//disable buttons
|
||||
::EnableWindow(GetDlgItem(IDC_E_START_ADDR), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_E_END_ADDR), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_E_ALT_PC), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_USE_ALT_PC), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_FILENAME), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_BTN_CHOOSE_FILE), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDC_FORMAT), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDOK), FALSE);
|
||||
::EnableWindow(GetDlgItem(IDCANCEL), FALSE);
|
||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
|
||||
if (!DumpMemory(FileName, Format, StartPC, EndPC, DumpPC))
|
||||
{
|
||||
//enable buttons
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
return false;
|
||||
}
|
||||
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
|
||||
}
|
||||
EndDialog(0);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CDumpMemory::DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD /*DumpPC*/)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case DisassemblyWithPC:
|
||||
{
|
||||
CLog LogFile;
|
||||
if (!LogFile.Open(FileName))
|
||||
{
|
||||
g_Notify->DisplayError(stdstr_f("Failed to open\n%s", FileName).c_str());
|
||||
return false;
|
||||
}
|
||||
LogFile.SetFlush(false);
|
||||
LogFile.SetTruncateFile(false);
|
||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||
#ifdef legacycode
|
||||
char Command[200];
|
||||
for (COpcode OpCode(StartPC); OpCode.PC() < EndPC; OpCode.Next())
|
||||
{
|
||||
const char * szOpName = OpCode.OpcodeName();
|
||||
OpCode.OpcodeParam(Command);
|
||||
LogFile.LogF("%X: %-15s%s\r\n",OpCode.PC(),szOpName,Command);
|
||||
}
|
||||
#endif
|
||||
m_StartAddress.SetValue(StartPC, true, true);
|
||||
m_EndAddress.SetValue(EndPC, true, true);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -1,43 +1,43 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDumpMemory :
|
||||
public CDebugDialog < CDumpMemory >
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_Cheats_DumpMemory };
|
||||
|
||||
CDumpMemory(CDebuggerUI * debugger);
|
||||
virtual ~CDumpMemory(void);
|
||||
|
||||
private:
|
||||
CDumpMemory(void); // Disable default constructor
|
||||
CDumpMemory(const CDumpMemory&); // Disable copy constructor
|
||||
CDumpMemory& operator=(const CDumpMemory&); // Disable assignment
|
||||
|
||||
enum DumpFormat
|
||||
{
|
||||
DisassemblyWithPC
|
||||
};
|
||||
|
||||
BEGIN_MSG_MAP_EX(CDumpMemory)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
|
||||
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
|
||||
|
||||
CEditNumber m_StartAddress, m_EndAddress, m_PC;
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDumpMemory :
|
||||
public CDebugDialog < CDumpMemory >
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_Cheats_DumpMemory };
|
||||
|
||||
CDumpMemory(CDebuggerUI * debugger);
|
||||
virtual ~CDumpMemory(void);
|
||||
|
||||
private:
|
||||
CDumpMemory(void); // Disable default constructor
|
||||
CDumpMemory(const CDumpMemory&); // Disable copy constructor
|
||||
CDumpMemory& operator=(const CDumpMemory&); // Disable assignment
|
||||
|
||||
enum DumpFormat
|
||||
{
|
||||
DisassemblyWithPC
|
||||
};
|
||||
|
||||
BEGIN_MSG_MAP_EX(CDumpMemory)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
|
||||
bool DumpMemory(LPCSTR FileName, DumpFormat Format, DWORD StartPC, DWORD EndPC, DWORD DumpPC);
|
||||
|
||||
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. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDebugMemorySearch :
|
||||
public CDebugDialog < CDebugMemorySearch >
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_Debugger_Search };
|
||||
|
||||
CDebugMemorySearch(CDebuggerUI * debugger);
|
||||
virtual ~CDebugMemorySearch(void);
|
||||
|
||||
private:
|
||||
CDebugMemorySearch(void); // Disable default constructor
|
||||
CDebugMemorySearch(const CDebugMemorySearch&); // Disable copy constructor
|
||||
CDebugMemorySearch& operator=(const CDebugMemorySearch&); // Disable assignment
|
||||
|
||||
enum MemorySize
|
||||
{
|
||||
_8Bit,
|
||||
_16Bit,
|
||||
_32Bit,
|
||||
};
|
||||
|
||||
//Searching for value
|
||||
enum SearchMemChangeState
|
||||
{
|
||||
SearchChangeState_Reset,
|
||||
SearchChangeState_Changed,
|
||||
SearchChangeState_Unchanged,
|
||||
SearchChangeState_Greater,
|
||||
SearchChangeState_Lessthan,
|
||||
};
|
||||
|
||||
struct SearchResultItem
|
||||
{
|
||||
DWORD PAddr;
|
||||
DWORD Value;
|
||||
};
|
||||
|
||||
typedef std::vector<SearchResultItem> SearchResult;
|
||||
|
||||
BEGIN_MSG_MAP_EX(CDebugMemorySearch)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
LRESULT OnResultRClick(LPNMHDR lpnmh);
|
||||
|
||||
void EnableUnknownOptions(bool Enable);
|
||||
void EnableValueOptions(bool Enable);
|
||||
void EnableTextOptions(bool Enable);
|
||||
void EnableJalOptions(bool Enable);
|
||||
void AddAlignmentOptions(CComboBox & ctrl);
|
||||
|
||||
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
|
||||
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
|
||||
CListViewCtrl m_SearchResults;
|
||||
SearchResult m_SearchResult;
|
||||
bool m_HaveResults;
|
||||
|
||||
//Searching memory
|
||||
BYTE * m_MemoryState;
|
||||
DWORD m_MemoryStateSize;
|
||||
|
||||
void FixUnknownOptions(bool Reset);
|
||||
void SearchForUnknown(void);
|
||||
void SearchForValue(void);
|
||||
void SearchForText(void);
|
||||
void Reset(void);
|
||||
bool SearchSetBaseForChanges(void);
|
||||
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
|
||||
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDebugMemorySearch :
|
||||
public CDebugDialog < CDebugMemorySearch >
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_Debugger_Search };
|
||||
|
||||
CDebugMemorySearch(CDebuggerUI * debugger);
|
||||
virtual ~CDebugMemorySearch(void);
|
||||
|
||||
private:
|
||||
CDebugMemorySearch(void); // Disable default constructor
|
||||
CDebugMemorySearch(const CDebugMemorySearch&); // Disable copy constructor
|
||||
CDebugMemorySearch& operator=(const CDebugMemorySearch&); // Disable assignment
|
||||
|
||||
enum MemorySize
|
||||
{
|
||||
_8Bit,
|
||||
_16Bit,
|
||||
_32Bit,
|
||||
};
|
||||
|
||||
//Searching for value
|
||||
enum SearchMemChangeState
|
||||
{
|
||||
SearchChangeState_Reset,
|
||||
SearchChangeState_Changed,
|
||||
SearchChangeState_Unchanged,
|
||||
SearchChangeState_Greater,
|
||||
SearchChangeState_Lessthan,
|
||||
};
|
||||
|
||||
struct SearchResultItem
|
||||
{
|
||||
DWORD PAddr;
|
||||
DWORD Value;
|
||||
};
|
||||
|
||||
typedef std::vector<SearchResultItem> SearchResult;
|
||||
|
||||
BEGIN_MSG_MAP_EX(CDebugMemorySearch)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
NOTIFY_HANDLER_EX(IDC_LST_RESULTS, NM_RCLICK, OnResultRClick)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
LRESULT OnResultRClick(LPNMHDR lpnmh);
|
||||
|
||||
void EnableUnknownOptions(bool Enable);
|
||||
void EnableValueOptions(bool Enable);
|
||||
void EnableTextOptions(bool Enable);
|
||||
void EnableJalOptions(bool Enable);
|
||||
void AddAlignmentOptions(CComboBox & ctrl);
|
||||
|
||||
CEditNumber m_PAddrStart, m_SearchLen, m_SearchValue, m_MaxSearch;
|
||||
CComboBox m_UnknownOptions, m_ValueSize, m_UnknownSize;
|
||||
CListViewCtrl m_SearchResults;
|
||||
SearchResult m_SearchResult;
|
||||
bool m_HaveResults;
|
||||
|
||||
//Searching memory
|
||||
BYTE * m_MemoryState;
|
||||
DWORD m_MemoryStateSize;
|
||||
|
||||
void FixUnknownOptions(bool Reset);
|
||||
void SearchForUnknown(void);
|
||||
void SearchForValue(void);
|
||||
void SearchForText(void);
|
||||
void Reset(void);
|
||||
bool SearchSetBaseForChanges(void);
|
||||
bool SearchForChanges(SearchMemChangeState SearchType, MemorySize Size, DWORD &StartAddress, DWORD &Len, DWORD &OldValue, DWORD &NewValue);
|
||||
bool SearchForValue(DWORD Value, MemorySize Size, DWORD &StartAddress, DWORD &Len);
|
||||
};
|
||||
|
|
|
@ -1,288 +1,288 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CDebugTlb::CDebugTlb(CDebuggerUI * debugger) :
|
||||
CDebugDialog<CDebugTlb>(debugger)
|
||||
{
|
||||
}
|
||||
|
||||
CDebugTlb::~CDebugTlb()
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
LV_COLUMN col;
|
||||
|
||||
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
||||
col.fmt = LVCFMT_LEFT;
|
||||
|
||||
col.pszText = "Index";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 0;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
|
||||
|
||||
col.pszText = "Page Mask";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 1;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
|
||||
|
||||
col.pszText = "Entry Hi";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 2;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
|
||||
|
||||
col.pszText = "Entry Lo0";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 3;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
|
||||
|
||||
col.pszText = "Entry Lo1";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 4;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
|
||||
|
||||
col.pszText = "Index";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 0;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
|
||||
|
||||
col.pszText = "Valid";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 1;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
|
||||
|
||||
col.pszText = "Dirty";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 2;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
|
||||
|
||||
col.pszText = "Rule";
|
||||
col.cx = 270;
|
||||
col.iSubItem = 3;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);
|
||||
|
||||
RefreshTLBWindow();
|
||||
SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
// if (Settings().Load(TLBWindowLeft) <= 0)
|
||||
// {
|
||||
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
// }
|
||||
WindowCreated();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||
{
|
||||
switch (wID)
|
||||
{
|
||||
case IDCANCEL:
|
||||
EndDialog(0);
|
||||
break;
|
||||
case IDC_TLB_ENTRIES:
|
||||
::ShowWindow(GetDlgItem(IDC_LIST), SW_SHOW);
|
||||
::ShowWindow(GetDlgItem(IDC_LIST2), SW_HIDE);
|
||||
break;
|
||||
case IDC_TLB_RULES:
|
||||
::ShowWindow(GetDlgItem(IDC_LIST), SW_HIDE);
|
||||
::ShowWindow(GetDlgItem(IDC_LIST2), SW_SHOW);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CDebugTlb::RefreshTLBWindow(void)
|
||||
{
|
||||
if (m_hWnd == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HWND hList = GetDlgItem(IDC_LIST);
|
||||
char Output[100], OldText[100];
|
||||
LV_ITEM item, OldItem;
|
||||
int count;
|
||||
|
||||
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
|
||||
for (count = 0; count < 32; count++)
|
||||
{
|
||||
sprintf(Output, "0x%02X", count);
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = count;
|
||||
item.pszText = Output;
|
||||
item.iSubItem = 0;
|
||||
|
||||
OldItem.mask = LVIF_TEXT;
|
||||
OldItem.iItem = count;
|
||||
OldItem.pszText = OldText;
|
||||
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||
OldItem.iSubItem = 0;
|
||||
|
||||
if (ListView_GetItemCount(hList) <= count)
|
||||
{
|
||||
ListView_InsertItem(hList, &item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].PageMask.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 1;
|
||||
OldItem.iSubItem = 1;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].EntryHi.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 2;
|
||||
OldItem.iSubItem = 2;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].EntryLo0.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 3;
|
||||
OldItem.iSubItem = 3;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].EntryLo1.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 4;
|
||||
OldItem.iSubItem = 4;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
|
||||
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
|
||||
hList = GetDlgItem(IDC_LIST2);
|
||||
for (count = 0; count < 64; count++)
|
||||
{
|
||||
sprintf(Output, "0x%02X", count);
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = count;
|
||||
item.pszText = Output;
|
||||
item.iSubItem = 0;
|
||||
|
||||
OldItem.mask = LVIF_TEXT;
|
||||
OldItem.iItem = count;
|
||||
OldItem.pszText = OldText;
|
||||
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||
OldItem.iSubItem = 0;
|
||||
|
||||
if (ListView_GetItemCount(hList) <= count)
|
||||
{
|
||||
item.iItem = ListView_InsertItem(hList, &item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
|
||||
if (FastTlb[count].ValidEntry)
|
||||
{
|
||||
sprintf(Output, "%s", FastTlb[count].VALID ? "Yes" : "No");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 1;
|
||||
OldItem.iSubItem = 1;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||
{
|
||||
sprintf(Output, "%s", FastTlb[count].DIRTY ? "Yes" : "No");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 2;
|
||||
OldItem.iSubItem = 2;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||
{
|
||||
sprintf(Output, "%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND,
|
||||
FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 3;
|
||||
OldItem.iSubItem = 3;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CDebugTlb::CDebugTlb(CDebuggerUI * debugger) :
|
||||
CDebugDialog<CDebugTlb>(debugger)
|
||||
{
|
||||
}
|
||||
|
||||
CDebugTlb::~CDebugTlb()
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CDebugTlb::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
LV_COLUMN col;
|
||||
|
||||
col.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
||||
col.fmt = LVCFMT_LEFT;
|
||||
|
||||
col.pszText = "Index";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 0;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 0, &col);
|
||||
|
||||
col.pszText = "Page Mask";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 1;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 1, &col);
|
||||
|
||||
col.pszText = "Entry Hi";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 2;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 2, &col);
|
||||
|
||||
col.pszText = "Entry Lo0";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 3;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 3, &col);
|
||||
|
||||
col.pszText = "Entry Lo1";
|
||||
col.cx = 90;
|
||||
col.iSubItem = 4;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST), 4, &col);
|
||||
|
||||
col.pszText = "Index";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 0;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 0, &col);
|
||||
|
||||
col.pszText = "Valid";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 1;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 1, &col);
|
||||
|
||||
col.pszText = "Dirty";
|
||||
col.cx = 40;
|
||||
col.iSubItem = 2;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 2, &col);
|
||||
|
||||
col.pszText = "Rule";
|
||||
col.cx = 270;
|
||||
col.iSubItem = 3;
|
||||
ListView_InsertColumn(GetDlgItem(IDC_LIST2), 3, &col);
|
||||
|
||||
RefreshTLBWindow();
|
||||
SendMessage(GetDlgItem(IDC_TLB_ENTRIES), BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
// if (Settings().Load(TLBWindowLeft) <= 0)
|
||||
// {
|
||||
// SetWindowPos(NULL,Settings().Load(TLBWindowLeft),Settings().Load(TLBWindowTop),0,0, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
// }
|
||||
WindowCreated();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CDebugTlb::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||
{
|
||||
switch (wID)
|
||||
{
|
||||
case IDCANCEL:
|
||||
EndDialog(0);
|
||||
break;
|
||||
case IDC_TLB_ENTRIES:
|
||||
::ShowWindow(GetDlgItem(IDC_LIST), SW_SHOW);
|
||||
::ShowWindow(GetDlgItem(IDC_LIST2), SW_HIDE);
|
||||
break;
|
||||
case IDC_TLB_RULES:
|
||||
::ShowWindow(GetDlgItem(IDC_LIST), SW_HIDE);
|
||||
::ShowWindow(GetDlgItem(IDC_LIST2), SW_SHOW);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CDebugTlb::RefreshTLBWindow(void)
|
||||
{
|
||||
if (m_hWnd == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HWND hList = GetDlgItem(IDC_LIST);
|
||||
char Output[100], OldText[100];
|
||||
LV_ITEM item, OldItem;
|
||||
int count;
|
||||
|
||||
CTLB::TLB_ENTRY * tlb = g_TLB->m_tlb;
|
||||
for (count = 0; count < 32; count++)
|
||||
{
|
||||
sprintf(Output, "0x%02X", count);
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = count;
|
||||
item.pszText = Output;
|
||||
item.iSubItem = 0;
|
||||
|
||||
OldItem.mask = LVIF_TEXT;
|
||||
OldItem.iItem = count;
|
||||
OldItem.pszText = OldText;
|
||||
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||
OldItem.iSubItem = 0;
|
||||
|
||||
if (ListView_GetItemCount(hList) <= count)
|
||||
{
|
||||
ListView_InsertItem(hList, &item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].PageMask.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 1;
|
||||
OldItem.iSubItem = 1;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].EntryHi.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 2;
|
||||
OldItem.iSubItem = 2;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].EntryLo0.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 3;
|
||||
OldItem.iSubItem = 3;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (tlb[count].EntryDefined)
|
||||
{
|
||||
sprintf(Output, "0x%08X", tlb[count].EntryLo1.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 4;
|
||||
OldItem.iSubItem = 4;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
|
||||
CTLB::FASTTLB * FastTlb = g_TLB->m_FastTlb;
|
||||
hList = GetDlgItem(IDC_LIST2);
|
||||
for (count = 0; count < 64; count++)
|
||||
{
|
||||
sprintf(Output, "0x%02X", count);
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = count;
|
||||
item.pszText = Output;
|
||||
item.iSubItem = 0;
|
||||
|
||||
OldItem.mask = LVIF_TEXT;
|
||||
OldItem.iItem = count;
|
||||
OldItem.pszText = OldText;
|
||||
OldItem.cchTextMax = sizeof(OldText) - 1;
|
||||
OldItem.iSubItem = 0;
|
||||
|
||||
if (ListView_GetItemCount(hList) <= count)
|
||||
{
|
||||
item.iItem = ListView_InsertItem(hList, &item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
|
||||
if (FastTlb[count].ValidEntry)
|
||||
{
|
||||
sprintf(Output, "%s", FastTlb[count].VALID ? "Yes" : "No");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 1;
|
||||
OldItem.iSubItem = 1;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||
{
|
||||
sprintf(Output, "%s", FastTlb[count].DIRTY ? "Yes" : "No");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 2;
|
||||
OldItem.iSubItem = 2;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
|
||||
if (FastTlb[count].ValidEntry && FastTlb[count].VALID)
|
||||
{
|
||||
sprintf(Output, "%08X:%08X -> %08X:%08X", FastTlb[count].VSTART, FastTlb[count].VEND,
|
||||
FastTlb[count].PHYSSTART, FastTlb[count].PHYSEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(Output, "................");
|
||||
}
|
||||
item.iSubItem = 3;
|
||||
OldItem.iSubItem = 3;
|
||||
ListView_GetItem(hList, &OldItem);
|
||||
if (strcmp(item.pszText, OldItem.pszText) != 0)
|
||||
{
|
||||
ListView_SetItem(hList, &item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDebugTlb :
|
||||
public CDebugDialog < CDebugTlb >
|
||||
{
|
||||
BEGIN_MSG_MAP_EX(CDebugTlb)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
enum { IDD = IDD_Debugger_TLB };
|
||||
|
||||
CDebugTlb(CDebuggerUI * debugger);
|
||||
virtual ~CDebugTlb(void);
|
||||
|
||||
void RefreshTLBWindow(void);
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDebugTlb :
|
||||
public CDebugDialog < CDebugTlb >
|
||||
{
|
||||
BEGIN_MSG_MAP_EX(CDebugTlb)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
|
||||
public:
|
||||
enum { IDD = IDD_Debugger_TLB };
|
||||
|
||||
CDebugTlb(CDebuggerUI * debugger);
|
||||
virtual ~CDebugTlb(void);
|
||||
|
||||
void RefreshTLBWindow(void);
|
||||
};
|
||||
|
|
|
@ -1,472 +1,472 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
|
||||
CDebugDialog<CDebugMemoryView>(debugger),
|
||||
m_MemoryList(NULL)
|
||||
{
|
||||
if (m_MemoryList == NULL)
|
||||
{
|
||||
m_MemoryList = new CListCtrl;
|
||||
m_MemoryList->RegisterClass();
|
||||
}
|
||||
}
|
||||
|
||||
CDebugMemoryView::~CDebugMemoryView()
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_DataStartLoc = (DWORD)-1;
|
||||
m_CompareStartLoc = (DWORD)-1;
|
||||
memset(m_CompareData, 0, sizeof(m_CompareData));
|
||||
memset(m_CompareValid, 0, sizeof(m_CompareValid));
|
||||
|
||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||
if (hScrlBar)
|
||||
{
|
||||
SCROLLINFO si;
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
||||
si.nMin = 0;
|
||||
si.nMax = 0xFFFF;
|
||||
si.nPos = 0x8000;
|
||||
si.nPage = 100;
|
||||
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||
}
|
||||
|
||||
m_MemAddr.Attach(GetDlgItem(IDC_ADDR_EDIT));
|
||||
m_MemAddr.SetDisplayType(CEditNumber::DisplayHex);
|
||||
m_MemAddr.SetValue(0x80000000, true, true);
|
||||
|
||||
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
if (m_MemoryList == NULL)
|
||||
{
|
||||
m_MemoryList = new CListCtrl;
|
||||
m_MemoryList->RegisterClass();
|
||||
}
|
||||
m_MemoryList->SubclassWindow(GetDlgItem(IDC_MEM_DETAILS));
|
||||
m_MemoryList->ShowHeader(false);
|
||||
m_MemoryList->SetSortEnabled(FALSE);
|
||||
m_MemoryList->AddColumn(_T("Address"), 90);
|
||||
m_MemoryList->AddColumn(_T("1"), 20);
|
||||
m_MemoryList->AddColumn(_T("2"), 20);
|
||||
m_MemoryList->AddColumn(_T("3"), 20);
|
||||
m_MemoryList->AddColumn(_T("4"), 20);
|
||||
m_MemoryList->AddColumn(_T("-"), 10);
|
||||
m_MemoryList->AddColumn(_T("5"), 20);
|
||||
m_MemoryList->AddColumn(_T("6"), 20);
|
||||
m_MemoryList->AddColumn(_T("7"), 20);
|
||||
m_MemoryList->AddColumn(_T("8"), 20);
|
||||
m_MemoryList->AddColumn(_T("-"), 10);
|
||||
m_MemoryList->AddColumn(_T("9"), 20);
|
||||
m_MemoryList->AddColumn(_T("10"), 20);
|
||||
m_MemoryList->AddColumn(_T("11"), 20);
|
||||
m_MemoryList->AddColumn(_T("12"), 20);
|
||||
m_MemoryList->AddColumn(_T("-"), 10);
|
||||
m_MemoryList->AddColumn(_T("13"), 20);
|
||||
m_MemoryList->AddColumn(_T("14"), 20);
|
||||
m_MemoryList->AddColumn(_T("15"), 20);
|
||||
m_MemoryList->AddColumn(_T("16"), 35);
|
||||
m_MemoryList->AddColumn(_T("Memory Ascii"), 140);
|
||||
::SetWindowLongPtr(m_MemoryList->m_hWnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
|
||||
RefreshMemory(false);
|
||||
int height = m_MemoryList->GetTotalHeight();
|
||||
|
||||
RECT MemoryListRect = { 0 };
|
||||
::GetClientRect(GetDlgItem(IDC_MEM_DETAILS), &MemoryListRect);
|
||||
|
||||
if (height > MemoryListRect.bottom)
|
||||
{
|
||||
RECT MemoryListWindow = { 0 };
|
||||
GetWindowRect(&MemoryListWindow);
|
||||
SetWindowPos(NULL, 0, 0, MemoryListWindow.right - MemoryListWindow.left, (MemoryListWindow.bottom - MemoryListWindow.top) + (height - MemoryListRect.bottom), SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOZORDER);
|
||||
|
||||
RECT DlgItemRect = { 0 };
|
||||
::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);
|
||||
|
||||
::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);
|
||||
|
||||
::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);
|
||||
}
|
||||
WindowCreated();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnDestroy(void)
|
||||
{
|
||||
if (m_MemoryList)
|
||||
{
|
||||
m_MemoryList->UnsubclassWindow();
|
||||
delete m_MemoryList;
|
||||
m_MemoryList = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||
{
|
||||
switch (wID)
|
||||
{
|
||||
case IDC_REFRSH_MEM:
|
||||
RefreshMemory(true);
|
||||
break;
|
||||
case IDC_CHK_VADDR:
|
||||
RefreshMemory(false);
|
||||
break;
|
||||
case IDC_DUMP_MEM:
|
||||
m_Debugger->Debug_ShowMemoryDump();
|
||||
break;
|
||||
case IDC_SEARCH_MEM:
|
||||
m_Debugger->Debug_ShowMemorySearch();
|
||||
break;
|
||||
case IDCANCEL:
|
||||
EndDialog(0);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
||||
{
|
||||
CListNotify *pListNotify = reinterpret_cast<CListNotify *>(lpNMHDR);
|
||||
int LineNumber = pListNotify->m_nItem;
|
||||
int Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 1));
|
||||
if (pListNotify->m_nSubItem >= 6 && pListNotify->m_nSubItem < 10)
|
||||
{
|
||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 2));
|
||||
}
|
||||
if (pListNotify->m_nSubItem >= 11 && pListNotify->m_nSubItem < 15)
|
||||
{
|
||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 3));
|
||||
}
|
||||
if (pListNotify->m_nSubItem >= 16 && pListNotify->m_nSubItem < 20)
|
||||
{
|
||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 4));
|
||||
}
|
||||
|
||||
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem, pListNotify->m_nSubItem);
|
||||
int Finish = strlen(strValue);
|
||||
if (Finish > 8)
|
||||
{
|
||||
Finish = 8;
|
||||
}
|
||||
DWORD Value = 0;
|
||||
for (int i = 0; i < Finish; i++)
|
||||
{
|
||||
Value = (Value << 4);
|
||||
if (strValue[i] <= '9' && strValue[i] >= '0')
|
||||
{
|
||||
Value |= strValue[i] - '0';
|
||||
}
|
||||
else if (strValue[i] <= 'f' && strValue[i] >= 'a')
|
||||
{
|
||||
Value |= strValue[i] - 'a' + 10;
|
||||
}
|
||||
else if (strValue[i] <= 'F' && strValue[i] >= 'A')
|
||||
{
|
||||
Value |= strValue[i] - 'A' + 10;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_CurrentData[Pos] == Value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_CompareStartLoc != m_DataStartLoc ||
|
||||
m_CompareVAddrr != m_DataVAddrr)
|
||||
{
|
||||
// copy current data for change comparison
|
||||
m_CompareStartLoc = m_DataStartLoc;
|
||||
m_CompareVAddrr = m_DataVAddrr;
|
||||
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||
}
|
||||
|
||||
m_CompareData[Pos] = m_CurrentData[Pos];
|
||||
m_CurrentData[Pos] = (BYTE)Value;
|
||||
|
||||
//sb
|
||||
if (m_DataVAddrr)
|
||||
{
|
||||
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||
}
|
||||
}
|
||||
Insert_MemoryLineDump(LineNumber);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CDebugMemoryView::ShowAddress(DWORD Address, bool VAddr)
|
||||
{
|
||||
if (m_hWnd == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, VAddr ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
m_MemAddr.SetValue(Address, true, true);
|
||||
RefreshMemory(true);
|
||||
}
|
||||
|
||||
void CDebugMemoryView::Insert_MemoryLineDump(int LineNumber)
|
||||
{
|
||||
if (m_MemoryList == NULL || m_MemoryList->GetColumnCount() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
char Output[20], Hex[60], Ascii[20], AsciiAddOn[15];
|
||||
sprintf(Output, "0x%08X", m_DataStartLoc + (LineNumber << 4));
|
||||
if (m_MemoryList->GetItemCount() <= LineNumber)
|
||||
{
|
||||
HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
||||
m_MemoryList->AddItemAt(LineNumber, Output);
|
||||
for (int i = 0; i < m_MemoryList->GetColumnCount(); i++)
|
||||
{
|
||||
m_MemoryList->SetItemFont(LineNumber, i, hFont);
|
||||
if (i == 5 || i == 10 || i == 15)
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, i, "-");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(Output, m_MemoryList->GetItemText(LineNumber, 0)) != 0)
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, 0, Output);
|
||||
}
|
||||
}
|
||||
|
||||
Hex[0] = 0;
|
||||
Ascii[0] = 0;
|
||||
int CompareStartPos = m_DataStartLoc - m_CompareStartLoc;
|
||||
|
||||
for (int i = 0, col = 1; i < 0x10; i++, col++)
|
||||
{
|
||||
int Pos = ((LineNumber << 4) + i);
|
||||
if (m_DataValid[Pos])
|
||||
{
|
||||
int ComparePos = CompareStartPos + Pos;
|
||||
bool Changed = false;
|
||||
|
||||
if (ComparePos >= 0 && ComparePos < MemoryToDisplay &&
|
||||
m_DataVAddrr == m_CompareVAddrr &&
|
||||
m_DataValid[ComparePos] &&
|
||||
m_CurrentData[Pos] != m_CompareData[ComparePos])
|
||||
{
|
||||
Changed = true;
|
||||
}
|
||||
sprintf(Hex, "%02X", m_CurrentData[Pos]);
|
||||
m_MemoryList->SetItemText(LineNumber, col, Hex);
|
||||
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_EDIT, ITEM_FLAGS_EDIT_HEX);
|
||||
m_MemoryList->SetItemMaxEditLen(LineNumber, col, 2);
|
||||
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW),
|
||||
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_WINDOWTEXT));
|
||||
m_MemoryList->SetItemHighlightColours(LineNumber, col,
|
||||
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
if (m_CurrentData[Pos] < 30)
|
||||
{
|
||||
strcat(Ascii, ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(AsciiAddOn, "%c", m_CurrentData[Pos]);
|
||||
strcat(Ascii, AsciiAddOn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, col, "**");
|
||||
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE);
|
||||
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOWTEXT));
|
||||
strcat(Ascii, "*");
|
||||
}
|
||||
if (i != 0xF)
|
||||
{
|
||||
if ((i & 3) == 3)
|
||||
{
|
||||
col += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(Ascii, m_MemoryList->GetItemText(LineNumber, 20)) != 0)
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, 20, Ascii);
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugMemoryView::OnAddrChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||
{
|
||||
RefreshMemory(false);
|
||||
}
|
||||
|
||||
void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl)
|
||||
{
|
||||
if (ctrl != GetDlgItem(IDC_SCRL_BAR))
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD Location = m_MemAddr.GetValue();
|
||||
switch (request)
|
||||
{
|
||||
case SB_LINEDOWN:
|
||||
m_MemAddr.SetValue(Location < 0xFFFFFFEF ? Location + 0x10 : 0xFFFFFFFF, true, true);
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
m_MemAddr.SetValue(Location > 0x10 ? Location - 0x10 : 0, true, true);
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
m_MemAddr.SetValue(Location < 0xFFFFFEFF ? Location + 0x100 : 0xFFFFFFFF, true, true);
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
m_MemAddr.SetValue(Location > 0x100 ? Location - 0x100 : 0, true, true);
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
m_MemAddr.SetValue((DWORD)Pos << 0x10, true, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugMemoryView::RefreshMemory(bool ResetCompare)
|
||||
{
|
||||
if (m_MemoryList && m_MemoryList->GetHasEditItem())
|
||||
{
|
||||
m_MemoryList->SetFocus();
|
||||
}
|
||||
|
||||
DWORD NewAddress = m_MemAddr.GetValue();
|
||||
if (NewAddress != m_DataStartLoc)
|
||||
{
|
||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||
if (hScrlBar)
|
||||
{
|
||||
SCROLLINFO si;
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = NewAddress >> 0x10;
|
||||
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ResetCompare)
|
||||
{
|
||||
// copy current data for change comparison
|
||||
m_CompareStartLoc = m_DataStartLoc;
|
||||
m_CompareVAddrr = m_DataVAddrr;
|
||||
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||
}
|
||||
|
||||
m_DataStartLoc = m_MemAddr.GetValue();
|
||||
if (m_DataStartLoc > 0xFFFFFF00) { m_DataStartLoc = 0xFFFFFF00; }
|
||||
int WritePos = 0;
|
||||
|
||||
m_DataVAddrr = (SendDlgItemMessage(IDC_CHK_VADDR, BM_GETCHECK, 0, 0) & BST_CHECKED) != 0;
|
||||
|
||||
if ((m_DataStartLoc & 3) != 0)
|
||||
{
|
||||
MIPS_WORD word;
|
||||
bool ValidData = true;
|
||||
|
||||
if (m_DataVAddrr)
|
||||
{
|
||||
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
|
||||
int Offset = (m_DataStartLoc & 3);
|
||||
for (int i = 0; i < (4 - Offset); i++)
|
||||
{
|
||||
if (WritePos >= MemoryToDisplay)
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_DataValid[WritePos + i] = ValidData;
|
||||
if (ValidData)
|
||||
{
|
||||
m_CurrentData[WritePos + i] = word.UB[3 - (i + Offset)];
|
||||
}
|
||||
}
|
||||
WritePos = 4 - Offset;
|
||||
}
|
||||
|
||||
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
|
||||
{
|
||||
MIPS_WORD word;
|
||||
bool ValidData = true;
|
||||
|
||||
if (m_DataVAddrr)
|
||||
{
|
||||
if (!g_MMU->LW_VAddr(Pos, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_MMU->LW_PAddr(Pos, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if ((WritePos + i) >= MemoryToDisplay)
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_DataValid[WritePos + i] = ValidData;
|
||||
if (ValidData)
|
||||
{
|
||||
m_CurrentData[WritePos + i] = word.UB[3 - i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int count = 0; count < 16; count++)
|
||||
{
|
||||
Insert_MemoryLineDump(count);
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CDebugMemoryView::CDebugMemoryView(CDebuggerUI * debugger) :
|
||||
CDebugDialog<CDebugMemoryView>(debugger),
|
||||
m_MemoryList(NULL)
|
||||
{
|
||||
if (m_MemoryList == NULL)
|
||||
{
|
||||
m_MemoryList = new CListCtrl;
|
||||
m_MemoryList->RegisterClass();
|
||||
}
|
||||
}
|
||||
|
||||
CDebugMemoryView::~CDebugMemoryView()
|
||||
{
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_DataStartLoc = (DWORD)-1;
|
||||
m_CompareStartLoc = (DWORD)-1;
|
||||
memset(m_CompareData, 0, sizeof(m_CompareData));
|
||||
memset(m_CompareValid, 0, sizeof(m_CompareValid));
|
||||
|
||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||
if (hScrlBar)
|
||||
{
|
||||
SCROLLINFO si;
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
|
||||
si.nMin = 0;
|
||||
si.nMax = 0xFFFF;
|
||||
si.nPos = 0x8000;
|
||||
si.nPage = 100;
|
||||
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||
}
|
||||
|
||||
m_MemAddr.Attach(GetDlgItem(IDC_ADDR_EDIT));
|
||||
m_MemAddr.SetDisplayType(CEditNumber::DisplayHex);
|
||||
m_MemAddr.SetValue(0x80000000, true, true);
|
||||
|
||||
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, BST_CHECKED, 0);
|
||||
|
||||
if (m_MemoryList == NULL)
|
||||
{
|
||||
m_MemoryList = new CListCtrl;
|
||||
m_MemoryList->RegisterClass();
|
||||
}
|
||||
m_MemoryList->SubclassWindow(GetDlgItem(IDC_MEM_DETAILS));
|
||||
m_MemoryList->ShowHeader(false);
|
||||
m_MemoryList->SetSortEnabled(FALSE);
|
||||
m_MemoryList->AddColumn(_T("Address"), 90);
|
||||
m_MemoryList->AddColumn(_T("1"), 20);
|
||||
m_MemoryList->AddColumn(_T("2"), 20);
|
||||
m_MemoryList->AddColumn(_T("3"), 20);
|
||||
m_MemoryList->AddColumn(_T("4"), 20);
|
||||
m_MemoryList->AddColumn(_T("-"), 10);
|
||||
m_MemoryList->AddColumn(_T("5"), 20);
|
||||
m_MemoryList->AddColumn(_T("6"), 20);
|
||||
m_MemoryList->AddColumn(_T("7"), 20);
|
||||
m_MemoryList->AddColumn(_T("8"), 20);
|
||||
m_MemoryList->AddColumn(_T("-"), 10);
|
||||
m_MemoryList->AddColumn(_T("9"), 20);
|
||||
m_MemoryList->AddColumn(_T("10"), 20);
|
||||
m_MemoryList->AddColumn(_T("11"), 20);
|
||||
m_MemoryList->AddColumn(_T("12"), 20);
|
||||
m_MemoryList->AddColumn(_T("-"), 10);
|
||||
m_MemoryList->AddColumn(_T("13"), 20);
|
||||
m_MemoryList->AddColumn(_T("14"), 20);
|
||||
m_MemoryList->AddColumn(_T("15"), 20);
|
||||
m_MemoryList->AddColumn(_T("16"), 35);
|
||||
m_MemoryList->AddColumn(_T("Memory Ascii"), 140);
|
||||
::SetWindowLongPtr(m_MemoryList->m_hWnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
|
||||
RefreshMemory(false);
|
||||
int height = m_MemoryList->GetTotalHeight();
|
||||
|
||||
RECT MemoryListRect = { 0 };
|
||||
::GetClientRect(GetDlgItem(IDC_MEM_DETAILS), &MemoryListRect);
|
||||
|
||||
if (height > MemoryListRect.bottom)
|
||||
{
|
||||
RECT MemoryListWindow = { 0 };
|
||||
GetWindowRect(&MemoryListWindow);
|
||||
SetWindowPos(NULL, 0, 0, MemoryListWindow.right - MemoryListWindow.left, (MemoryListWindow.bottom - MemoryListWindow.top) + (height - MemoryListRect.bottom), SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOZORDER);
|
||||
|
||||
RECT DlgItemRect = { 0 };
|
||||
::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);
|
||||
|
||||
::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);
|
||||
|
||||
::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);
|
||||
}
|
||||
WindowCreated();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnDestroy(void)
|
||||
{
|
||||
if (m_MemoryList)
|
||||
{
|
||||
m_MemoryList->UnsubclassWindow();
|
||||
delete m_MemoryList;
|
||||
m_MemoryList = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL& /*bHandled*/)
|
||||
{
|
||||
switch (wID)
|
||||
{
|
||||
case IDC_REFRSH_MEM:
|
||||
RefreshMemory(true);
|
||||
break;
|
||||
case IDC_CHK_VADDR:
|
||||
RefreshMemory(false);
|
||||
break;
|
||||
case IDC_DUMP_MEM:
|
||||
m_Debugger->Debug_ShowMemoryDump();
|
||||
break;
|
||||
case IDC_SEARCH_MEM:
|
||||
m_Debugger->Debug_ShowMemorySearch();
|
||||
break;
|
||||
case IDCANCEL:
|
||||
EndDialog(0);
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LRESULT CDebugMemoryView::OnMemoryModified(LPNMHDR lpNMHDR)
|
||||
{
|
||||
CListNotify *pListNotify = reinterpret_cast<CListNotify *>(lpNMHDR);
|
||||
int LineNumber = pListNotify->m_nItem;
|
||||
int Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 1));
|
||||
if (pListNotify->m_nSubItem >= 6 && pListNotify->m_nSubItem < 10)
|
||||
{
|
||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 2));
|
||||
}
|
||||
if (pListNotify->m_nSubItem >= 11 && pListNotify->m_nSubItem < 15)
|
||||
{
|
||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 3));
|
||||
}
|
||||
if (pListNotify->m_nSubItem >= 16 && pListNotify->m_nSubItem < 20)
|
||||
{
|
||||
Pos = ((LineNumber << 4) + (pListNotify->m_nSubItem - 4));
|
||||
}
|
||||
|
||||
LPCSTR strValue = m_MemoryList->GetItemText(pListNotify->m_nItem, pListNotify->m_nSubItem);
|
||||
int Finish = strlen(strValue);
|
||||
if (Finish > 8)
|
||||
{
|
||||
Finish = 8;
|
||||
}
|
||||
DWORD Value = 0;
|
||||
for (int i = 0; i < Finish; i++)
|
||||
{
|
||||
Value = (Value << 4);
|
||||
if (strValue[i] <= '9' && strValue[i] >= '0')
|
||||
{
|
||||
Value |= strValue[i] - '0';
|
||||
}
|
||||
else if (strValue[i] <= 'f' && strValue[i] >= 'a')
|
||||
{
|
||||
Value |= strValue[i] - 'a' + 10;
|
||||
}
|
||||
else if (strValue[i] <= 'F' && strValue[i] >= 'A')
|
||||
{
|
||||
Value |= strValue[i] - 'A' + 10;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_CurrentData[Pos] == Value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_CompareStartLoc != m_DataStartLoc ||
|
||||
m_CompareVAddrr != m_DataVAddrr)
|
||||
{
|
||||
// copy current data for change comparison
|
||||
m_CompareStartLoc = m_DataStartLoc;
|
||||
m_CompareVAddrr = m_DataVAddrr;
|
||||
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||
}
|
||||
|
||||
m_CompareData[Pos] = m_CurrentData[Pos];
|
||||
m_CurrentData[Pos] = (BYTE)Value;
|
||||
|
||||
//sb
|
||||
if (m_DataVAddrr)
|
||||
{
|
||||
if (!g_MMU->SB_VAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_MMU->SB_PAddr(m_DataStartLoc + Pos, (BYTE)Value))
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceError, "failed to store at %X", m_DataStartLoc + Pos);
|
||||
}
|
||||
}
|
||||
Insert_MemoryLineDump(LineNumber);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CDebugMemoryView::ShowAddress(DWORD Address, bool VAddr)
|
||||
{
|
||||
if (m_hWnd == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SendDlgItemMessage(IDC_CHK_VADDR, BM_SETCHECK, VAddr ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||
m_MemAddr.SetValue(Address, true, true);
|
||||
RefreshMemory(true);
|
||||
}
|
||||
|
||||
void CDebugMemoryView::Insert_MemoryLineDump(int LineNumber)
|
||||
{
|
||||
if (m_MemoryList == NULL || m_MemoryList->GetColumnCount() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
char Output[20], Hex[60], Ascii[20], AsciiAddOn[15];
|
||||
sprintf(Output, "0x%08X", m_DataStartLoc + (LineNumber << 4));
|
||||
if (m_MemoryList->GetItemCount() <= LineNumber)
|
||||
{
|
||||
HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
|
||||
m_MemoryList->AddItemAt(LineNumber, Output);
|
||||
for (int i = 0; i < m_MemoryList->GetColumnCount(); i++)
|
||||
{
|
||||
m_MemoryList->SetItemFont(LineNumber, i, hFont);
|
||||
if (i == 5 || i == 10 || i == 15)
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, i, "-");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(Output, m_MemoryList->GetItemText(LineNumber, 0)) != 0)
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, 0, Output);
|
||||
}
|
||||
}
|
||||
|
||||
Hex[0] = 0;
|
||||
Ascii[0] = 0;
|
||||
int CompareStartPos = m_DataStartLoc - m_CompareStartLoc;
|
||||
|
||||
for (int i = 0, col = 1; i < 0x10; i++, col++)
|
||||
{
|
||||
int Pos = ((LineNumber << 4) + i);
|
||||
if (m_DataValid[Pos])
|
||||
{
|
||||
int ComparePos = CompareStartPos + Pos;
|
||||
bool Changed = false;
|
||||
|
||||
if (ComparePos >= 0 && ComparePos < MemoryToDisplay &&
|
||||
m_DataVAddrr == m_CompareVAddrr &&
|
||||
m_DataValid[ComparePos] &&
|
||||
m_CurrentData[Pos] != m_CompareData[ComparePos])
|
||||
{
|
||||
Changed = true;
|
||||
}
|
||||
sprintf(Hex, "%02X", m_CurrentData[Pos]);
|
||||
m_MemoryList->SetItemText(LineNumber, col, Hex);
|
||||
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_EDIT, ITEM_FLAGS_EDIT_HEX);
|
||||
m_MemoryList->SetItemMaxEditLen(LineNumber, col, 2);
|
||||
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW),
|
||||
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_WINDOWTEXT));
|
||||
m_MemoryList->SetItemHighlightColours(LineNumber, col,
|
||||
Changed ? RGB(255, 0, 0) : GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
if (m_CurrentData[Pos] < 30)
|
||||
{
|
||||
strcat(Ascii, ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(AsciiAddOn, "%c", m_CurrentData[Pos]);
|
||||
strcat(Ascii, AsciiAddOn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, col, "**");
|
||||
m_MemoryList->SetItemFormat(LineNumber, col, ITEM_FORMAT_NONE, ITEM_FLAGS_NONE);
|
||||
m_MemoryList->SetItemColours(LineNumber, col, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOWTEXT));
|
||||
strcat(Ascii, "*");
|
||||
}
|
||||
if (i != 0xF)
|
||||
{
|
||||
if ((i & 3) == 3)
|
||||
{
|
||||
col += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(Ascii, m_MemoryList->GetItemText(LineNumber, 20)) != 0)
|
||||
{
|
||||
m_MemoryList->SetItemText(LineNumber, 20, Ascii);
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugMemoryView::OnAddrChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||
{
|
||||
RefreshMemory(false);
|
||||
}
|
||||
|
||||
void CDebugMemoryView::OnVScroll(int request, short Pos, HWND ctrl)
|
||||
{
|
||||
if (ctrl != GetDlgItem(IDC_SCRL_BAR))
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD Location = m_MemAddr.GetValue();
|
||||
switch (request)
|
||||
{
|
||||
case SB_LINEDOWN:
|
||||
m_MemAddr.SetValue(Location < 0xFFFFFFEF ? Location + 0x10 : 0xFFFFFFFF, true, true);
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
m_MemAddr.SetValue(Location > 0x10 ? Location - 0x10 : 0, true, true);
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
m_MemAddr.SetValue(Location < 0xFFFFFEFF ? Location + 0x100 : 0xFFFFFFFF, true, true);
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
m_MemAddr.SetValue(Location > 0x100 ? Location - 0x100 : 0, true, true);
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
m_MemAddr.SetValue((DWORD)Pos << 0x10, true, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CDebugMemoryView::RefreshMemory(bool ResetCompare)
|
||||
{
|
||||
if (m_MemoryList && m_MemoryList->GetHasEditItem())
|
||||
{
|
||||
m_MemoryList->SetFocus();
|
||||
}
|
||||
|
||||
DWORD NewAddress = m_MemAddr.GetValue();
|
||||
if (NewAddress != m_DataStartLoc)
|
||||
{
|
||||
HWND hScrlBar = GetDlgItem(IDC_SCRL_BAR);
|
||||
if (hScrlBar)
|
||||
{
|
||||
SCROLLINFO si;
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = NewAddress >> 0x10;
|
||||
::SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ResetCompare)
|
||||
{
|
||||
// copy current data for change comparison
|
||||
m_CompareStartLoc = m_DataStartLoc;
|
||||
m_CompareVAddrr = m_DataVAddrr;
|
||||
memcpy(m_CompareData, m_CurrentData, sizeof(m_CurrentData));
|
||||
memcpy(m_CompareValid, m_DataValid, sizeof(m_CompareValid));
|
||||
}
|
||||
|
||||
m_DataStartLoc = m_MemAddr.GetValue();
|
||||
if (m_DataStartLoc > 0xFFFFFF00) { m_DataStartLoc = 0xFFFFFF00; }
|
||||
int WritePos = 0;
|
||||
|
||||
m_DataVAddrr = (SendDlgItemMessage(IDC_CHK_VADDR, BM_GETCHECK, 0, 0) & BST_CHECKED) != 0;
|
||||
|
||||
if ((m_DataStartLoc & 3) != 0)
|
||||
{
|
||||
MIPS_WORD word;
|
||||
bool ValidData = true;
|
||||
|
||||
if (m_DataVAddrr)
|
||||
{
|
||||
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
|
||||
int Offset = (m_DataStartLoc & 3);
|
||||
for (int i = 0; i < (4 - Offset); i++)
|
||||
{
|
||||
if (WritePos >= MemoryToDisplay)
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_DataValid[WritePos + i] = ValidData;
|
||||
if (ValidData)
|
||||
{
|
||||
m_CurrentData[WritePos + i] = word.UB[3 - (i + Offset)];
|
||||
}
|
||||
}
|
||||
WritePos = 4 - Offset;
|
||||
}
|
||||
|
||||
for (DWORD Pos = ((m_DataStartLoc + 3) & ~3); Pos < (m_DataStartLoc + MemoryToDisplay); WritePos += 4, Pos += 4)
|
||||
{
|
||||
MIPS_WORD word;
|
||||
bool ValidData = true;
|
||||
|
||||
if (m_DataVAddrr)
|
||||
{
|
||||
if (!g_MMU->LW_VAddr(Pos, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_MMU->LW_PAddr(Pos, word.UW))
|
||||
{
|
||||
ValidData = false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if ((WritePos + i) >= MemoryToDisplay)
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_DataValid[WritePos + i] = ValidData;
|
||||
if (ValidData)
|
||||
{
|
||||
m_CurrentData[WritePos + i] = word.UB[3 - i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int count = 0; count < 16; count++)
|
||||
{
|
||||
Insert_MemoryLineDump(count);
|
||||
}
|
||||
}
|
|
@ -1,58 +1,58 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDebugMemoryView :
|
||||
public CDebugDialog < CDebugMemoryView >
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_Debugger_Memory };
|
||||
|
||||
CDebugMemoryView(CDebuggerUI * debugger);
|
||||
virtual ~CDebugMemoryView(void);
|
||||
|
||||
void ShowAddress(DWORD Address, bool VAddr);
|
||||
|
||||
private:
|
||||
BEGIN_MSG_MAP_EX(CDebugMemoryView)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
|
||||
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
|
||||
MSG_WM_DESTROY(OnDestroy)
|
||||
MSG_WM_VSCROLL(OnVScroll)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
||||
void OnVScroll(int request, short Pos, HWND ctrl);
|
||||
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
||||
LRESULT OnDestroy(void);
|
||||
|
||||
void Insert_MemoryLineDump(int LineNumber);
|
||||
void RefreshMemory(bool ResetCompare);
|
||||
|
||||
enum { MemoryToDisplay = 0x100 };
|
||||
|
||||
CEditNumber m_MemAddr;
|
||||
CListCtrl * m_MemoryList;
|
||||
|
||||
DWORD m_DataStartLoc;
|
||||
bool m_DataVAddrr;
|
||||
BYTE m_CurrentData[MemoryToDisplay];
|
||||
bool m_DataValid[MemoryToDisplay];
|
||||
|
||||
DWORD m_CompareStartLoc;
|
||||
bool m_CompareVAddrr;
|
||||
BYTE m_CompareData[MemoryToDisplay];
|
||||
bool m_CompareValid[MemoryToDisplay];
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDebugMemoryView :
|
||||
public CDebugDialog < CDebugMemoryView >
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_Debugger_Memory };
|
||||
|
||||
CDebugMemoryView(CDebuggerUI * debugger);
|
||||
virtual ~CDebugMemoryView(void);
|
||||
|
||||
void ShowAddress(DWORD Address, bool VAddr);
|
||||
|
||||
private:
|
||||
BEGIN_MSG_MAP_EX(CDebugMemoryView)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
|
||||
COMMAND_HANDLER_EX(IDC_ADDR_EDIT, EN_CHANGE, OnAddrChanged)
|
||||
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_MODIFIED, OnMemoryModified)
|
||||
MSG_WM_DESTROY(OnDestroy)
|
||||
MSG_WM_VSCROLL(OnVScroll)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
||||
void OnVScroll(int request, short Pos, HWND ctrl);
|
||||
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
||||
LRESULT OnDestroy(void);
|
||||
|
||||
void Insert_MemoryLineDump(int LineNumber);
|
||||
void RefreshMemory(bool ResetCompare);
|
||||
|
||||
enum { MemoryToDisplay = 0x100 };
|
||||
|
||||
CEditNumber m_MemAddr;
|
||||
CListCtrl * m_MemoryList;
|
||||
|
||||
DWORD m_DataStartLoc;
|
||||
bool m_DataVAddrr;
|
||||
BYTE m_CurrentData[MemoryToDisplay];
|
||||
bool m_DataValid[MemoryToDisplay];
|
||||
|
||||
DWORD m_CompareStartLoc;
|
||||
bool m_CompareVAddrr;
|
||||
BYTE m_CompareData[MemoryToDisplay];
|
||||
bool m_CompareValid[MemoryToDisplay];
|
||||
};
|
||||
|
|
|
@ -1,149 +1,149 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CPj64Module _Module;
|
||||
|
||||
CDebuggerUI::CDebuggerUI () :
|
||||
m_MemoryDump(NULL),
|
||||
m_MemoryView(NULL),
|
||||
m_MemorySearch(NULL),
|
||||
m_DebugTLB(NULL)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||
g_Debugger = this;
|
||||
}
|
||||
|
||||
CDebuggerUI::~CDebuggerUI (void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||
Debug_Reset();
|
||||
}
|
||||
|
||||
void CDebuggerUI::GameReset ( CDebuggerUI * _this )
|
||||
{
|
||||
if (!g_Settings->LoadBool(GameRunning_InReset))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_this->Debug_Reset();
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_Reset ( void )
|
||||
{
|
||||
if (m_MemoryDump)
|
||||
{
|
||||
m_MemoryDump->HideWindow();
|
||||
delete m_MemoryDump;
|
||||
m_MemoryDump = NULL;
|
||||
}
|
||||
if (m_MemoryView)
|
||||
{
|
||||
m_MemoryView->HideWindow();
|
||||
delete m_MemoryView;
|
||||
m_MemoryView = NULL;
|
||||
}
|
||||
if (m_MemorySearch)
|
||||
{
|
||||
m_MemorySearch->HideWindow();
|
||||
delete m_MemorySearch;
|
||||
m_MemorySearch = NULL;
|
||||
}
|
||||
if (m_DebugTLB)
|
||||
{
|
||||
m_DebugTLB->HideWindow();
|
||||
delete m_DebugTLB;
|
||||
m_DebugTLB = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemoryDump()
|
||||
{
|
||||
if (g_MMU == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_MemoryDump == NULL)
|
||||
{
|
||||
m_MemoryDump = new CDumpMemory(this);
|
||||
}
|
||||
if (m_MemoryDump)
|
||||
{
|
||||
m_MemoryDump->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemoryWindow ( void )
|
||||
{
|
||||
if (g_MMU == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_MemoryView == NULL)
|
||||
{
|
||||
m_MemoryView = new CDebugMemoryView(this);
|
||||
}
|
||||
if (m_MemoryView)
|
||||
{
|
||||
m_MemoryView->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
|
||||
{
|
||||
Debug_ShowMemoryWindow();
|
||||
if (m_MemoryView)
|
||||
{
|
||||
m_MemoryView->ShowAddress(Address,VAddr);
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowTLBWindow (void)
|
||||
{
|
||||
if (g_MMU == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DebugTLB == NULL)
|
||||
{
|
||||
m_DebugTLB = new CDebugTlb(this);
|
||||
}
|
||||
if (m_DebugTLB)
|
||||
{
|
||||
m_DebugTLB->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
||||
{
|
||||
if (m_DebugTLB)
|
||||
{
|
||||
m_DebugTLB->RefreshTLBWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemorySearch()
|
||||
{
|
||||
if (m_MemorySearch == NULL)
|
||||
{
|
||||
m_MemorySearch = new CDebugMemorySearch(this);
|
||||
}
|
||||
if (m_MemorySearch)
|
||||
{
|
||||
m_MemorySearch->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::TLBChanged()
|
||||
{
|
||||
Debug_RefreshTLBWindow();
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include "DebuggerUI.h"
|
||||
|
||||
CPj64Module _Module;
|
||||
|
||||
CDebuggerUI::CDebuggerUI () :
|
||||
m_MemoryDump(NULL),
|
||||
m_MemoryView(NULL),
|
||||
m_MemorySearch(NULL),
|
||||
m_DebugTLB(NULL)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||
g_Debugger = this;
|
||||
}
|
||||
|
||||
CDebuggerUI::~CDebuggerUI (void)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(GameRunning_InReset,this,(CSettings::SettingChangedFunc)GameReset);
|
||||
Debug_Reset();
|
||||
}
|
||||
|
||||
void CDebuggerUI::GameReset ( CDebuggerUI * _this )
|
||||
{
|
||||
if (!g_Settings->LoadBool(GameRunning_InReset))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_this->Debug_Reset();
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_Reset ( void )
|
||||
{
|
||||
if (m_MemoryDump)
|
||||
{
|
||||
m_MemoryDump->HideWindow();
|
||||
delete m_MemoryDump;
|
||||
m_MemoryDump = NULL;
|
||||
}
|
||||
if (m_MemoryView)
|
||||
{
|
||||
m_MemoryView->HideWindow();
|
||||
delete m_MemoryView;
|
||||
m_MemoryView = NULL;
|
||||
}
|
||||
if (m_MemorySearch)
|
||||
{
|
||||
m_MemorySearch->HideWindow();
|
||||
delete m_MemorySearch;
|
||||
m_MemorySearch = NULL;
|
||||
}
|
||||
if (m_DebugTLB)
|
||||
{
|
||||
m_DebugTLB->HideWindow();
|
||||
delete m_DebugTLB;
|
||||
m_DebugTLB = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemoryDump()
|
||||
{
|
||||
if (g_MMU == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_MemoryDump == NULL)
|
||||
{
|
||||
m_MemoryDump = new CDumpMemory(this);
|
||||
}
|
||||
if (m_MemoryDump)
|
||||
{
|
||||
m_MemoryDump->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemoryWindow ( void )
|
||||
{
|
||||
if (g_MMU == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_MemoryView == NULL)
|
||||
{
|
||||
m_MemoryView = new CDebugMemoryView(this);
|
||||
}
|
||||
if (m_MemoryView)
|
||||
{
|
||||
m_MemoryView->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr )
|
||||
{
|
||||
Debug_ShowMemoryWindow();
|
||||
if (m_MemoryView)
|
||||
{
|
||||
m_MemoryView->ShowAddress(Address,VAddr);
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowTLBWindow (void)
|
||||
{
|
||||
if (g_MMU == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_DebugTLB == NULL)
|
||||
{
|
||||
m_DebugTLB = new CDebugTlb(this);
|
||||
}
|
||||
if (m_DebugTLB)
|
||||
{
|
||||
m_DebugTLB->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_RefreshTLBWindow(void)
|
||||
{
|
||||
if (m_DebugTLB)
|
||||
{
|
||||
m_DebugTLB->RefreshTLBWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::Debug_ShowMemorySearch()
|
||||
{
|
||||
if (m_MemorySearch == NULL)
|
||||
{
|
||||
m_MemorySearch = new CDebugMemorySearch(this);
|
||||
}
|
||||
if (m_MemorySearch)
|
||||
{
|
||||
m_MemorySearch->ShowWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void CDebuggerUI::TLBChanged()
|
||||
{
|
||||
Debug_RefreshTLBWindow();
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../WTLApp.h"
|
||||
#include "../../N64System.h"
|
||||
#include "DebugDialog.h"
|
||||
#include "Debugger-MemorySearch.h"
|
||||
#include "Debugger-ViewMemory.h"
|
||||
#include "Debugger-MemoryDump.h"
|
||||
#include "Debugger-TLB.h"
|
||||
#pragma once
|
||||
|
||||
#include "../../WTLApp.h"
|
||||
#include "../../N64System.h"
|
||||
#include "DebugDialog.h"
|
||||
#include "Debugger-MemorySearch.h"
|
||||
#include "Debugger-ViewMemory.h"
|
||||
#include "Debugger-MemoryDump.h"
|
||||
#include "Debugger-TLB.h"
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDumpMemory;
|
||||
class CDebugMemoryView;
|
||||
class CDebugMemorySearch;
|
||||
class CDebugTlb;
|
||||
|
||||
__interface CDebugger
|
||||
{
|
||||
virtual void TLBChanged ( void ) = 0;
|
||||
};
|
||||
|
||||
class CDebuggerUI :
|
||||
public CDebugger
|
||||
{
|
||||
CDumpMemory * m_MemoryDump;
|
||||
CDebugMemoryView * m_MemoryView;
|
||||
CDebugMemorySearch * m_MemorySearch;
|
||||
CDebugTlb * m_DebugTLB;
|
||||
|
||||
protected:
|
||||
CDebuggerUI();
|
||||
virtual ~CDebuggerUI();
|
||||
|
||||
void TLBChanged ( void );
|
||||
|
||||
public:
|
||||
void Debug_Reset ( void );
|
||||
void Debug_ShowMemoryDump ( void );
|
||||
void Debug_ShowMemoryWindow ( void );
|
||||
void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
|
||||
void Debug_ShowMemorySearch ( void );
|
||||
void Debug_ShowTLBWindow ( void );
|
||||
void Debug_RefreshTLBWindow ( void );
|
||||
|
||||
static void GameReset ( CDebuggerUI * _this );
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
class CDumpMemory;
|
||||
class CDebugMemoryView;
|
||||
class CDebugMemorySearch;
|
||||
class CDebugTlb;
|
||||
|
||||
__interface CDebugger
|
||||
{
|
||||
virtual void TLBChanged ( void ) = 0;
|
||||
};
|
||||
|
||||
class CDebuggerUI :
|
||||
public CDebugger
|
||||
{
|
||||
CDumpMemory * m_MemoryDump;
|
||||
CDebugMemoryView * m_MemoryView;
|
||||
CDebugMemorySearch * m_MemorySearch;
|
||||
CDebugTlb * m_DebugTLB;
|
||||
|
||||
protected:
|
||||
CDebuggerUI();
|
||||
virtual ~CDebuggerUI();
|
||||
|
||||
void TLBChanged ( void );
|
||||
|
||||
public:
|
||||
void Debug_Reset ( void );
|
||||
void Debug_ShowMemoryDump ( void );
|
||||
void Debug_ShowMemoryWindow ( void );
|
||||
void Debug_ShowMemoryLocation ( uint32_t Address, bool VAddr );
|
||||
void Debug_ShowMemorySearch ( void );
|
||||
void Debug_ShowTLBWindow ( void );
|
||||
void Debug_RefreshTLBWindow ( void );
|
||||
|
||||
static void GameReset ( CDebuggerUI * _this );
|
||||
};
|
||||
|
|
|
@ -1,119 +1,119 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <io.h>
|
||||
#include "PluginList.h"
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
||||
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
|
||||
{
|
||||
if (bAutoFill)
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
}
|
||||
|
||||
CPluginList::~CPluginList()
|
||||
{
|
||||
}
|
||||
|
||||
int CPluginList::GetPluginCount() const
|
||||
{
|
||||
return m_PluginList.size();
|
||||
}
|
||||
|
||||
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
|
||||
{
|
||||
if (indx < 0 || indx >= (int)m_PluginList.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &m_PluginList[indx];
|
||||
}
|
||||
|
||||
bool CPluginList::LoadList()
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
m_PluginList.clear();
|
||||
AddPluginFromDir(m_PluginDir);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPluginList::AddPluginFromDir(CPath Dir)
|
||||
{
|
||||
Dir.SetNameExtension("*.*");
|
||||
if (Dir.FindFirst(_A_SUBDIR))
|
||||
{
|
||||
do
|
||||
{
|
||||
AddPluginFromDir(Dir);
|
||||
} while (Dir.FindNext());
|
||||
Dir.UpDirectory();
|
||||
}
|
||||
|
||||
Dir.SetNameExtension("*.dll");
|
||||
if (Dir.FindFirst())
|
||||
{
|
||||
HMODULE hLib = NULL;
|
||||
do
|
||||
{
|
||||
if (hLib)
|
||||
{
|
||||
FreeLibrary(hLib);
|
||||
hLib = NULL;
|
||||
}
|
||||
|
||||
//UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS );
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir);
|
||||
hLib = LoadLibrary(Dir);
|
||||
//SetErrorMode(LastErrorMode);
|
||||
|
||||
if (hLib == NULL)
|
||||
{
|
||||
DWORD LoadError = GetLastError();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "failed to loadi %s (error: %d)", (LPCSTR)Dir, LoadError);
|
||||
continue;
|
||||
}
|
||||
|
||||
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
|
||||
GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo");
|
||||
if (GetDllInfo == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PLUGIN Plugin = { 0 };
|
||||
Plugin.Info.MemoryBswaped = true;
|
||||
GetDllInfo(&Plugin.Info);
|
||||
if (!CPlugin::ValidPluginVersion(Plugin.Info))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Plugin.FullPath = Dir;
|
||||
Plugin.FileName = stdstr((const char *)Dir).substr(strlen(m_PluginDir));
|
||||
|
||||
if (GetProcAddress(hLib, "DllAbout") != NULL)
|
||||
{
|
||||
Plugin.AboutFunction = true;
|
||||
}
|
||||
m_PluginList.push_back(Plugin);
|
||||
} while (Dir.FindNext());
|
||||
|
||||
if (hLib)
|
||||
{
|
||||
FreeLibrary(hLib);
|
||||
hLib = NULL;
|
||||
}
|
||||
}
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
#include <io.h>
|
||||
#include "PluginList.h"
|
||||
#include <Project64-core/Plugins/PluginBase.h>
|
||||
|
||||
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
||||
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
|
||||
{
|
||||
if (bAutoFill)
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
}
|
||||
|
||||
CPluginList::~CPluginList()
|
||||
{
|
||||
}
|
||||
|
||||
int CPluginList::GetPluginCount() const
|
||||
{
|
||||
return m_PluginList.size();
|
||||
}
|
||||
|
||||
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
|
||||
{
|
||||
if (indx < 0 || indx >= (int)m_PluginList.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &m_PluginList[indx];
|
||||
}
|
||||
|
||||
bool CPluginList::LoadList()
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
m_PluginList.clear();
|
||||
AddPluginFromDir(m_PluginDir);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPluginList::AddPluginFromDir(CPath Dir)
|
||||
{
|
||||
Dir.SetNameExtension("*.*");
|
||||
if (Dir.FindFirst(_A_SUBDIR))
|
||||
{
|
||||
do
|
||||
{
|
||||
AddPluginFromDir(Dir);
|
||||
} while (Dir.FindNext());
|
||||
Dir.UpDirectory();
|
||||
}
|
||||
|
||||
Dir.SetNameExtension("*.dll");
|
||||
if (Dir.FindFirst())
|
||||
{
|
||||
HMODULE hLib = NULL;
|
||||
do
|
||||
{
|
||||
if (hLib)
|
||||
{
|
||||
FreeLibrary(hLib);
|
||||
hLib = NULL;
|
||||
}
|
||||
|
||||
//UINT LastErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS );
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "loading %s", (LPCSTR)Dir);
|
||||
hLib = LoadLibrary(Dir);
|
||||
//SetErrorMode(LastErrorMode);
|
||||
|
||||
if (hLib == NULL)
|
||||
{
|
||||
DWORD LoadError = GetLastError();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "failed to loadi %s (error: %d)", (LPCSTR)Dir, LoadError);
|
||||
continue;
|
||||
}
|
||||
|
||||
void(CALL *GetDllInfo) (PLUGIN_INFO * PluginInfo);
|
||||
GetDllInfo = (void(CALL *)(PLUGIN_INFO *))GetProcAddress(hLib, "GetDllInfo");
|
||||
if (GetDllInfo == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PLUGIN Plugin = { 0 };
|
||||
Plugin.Info.MemoryBswaped = true;
|
||||
GetDllInfo(&Plugin.Info);
|
||||
if (!CPlugin::ValidPluginVersion(Plugin.Info))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Plugin.FullPath = Dir;
|
||||
Plugin.FileName = stdstr((const char *)Dir).substr(strlen(m_PluginDir));
|
||||
|
||||
if (GetProcAddress(hLib, "DllAbout") != NULL)
|
||||
{
|
||||
Plugin.AboutFunction = true;
|
||||
}
|
||||
m_PluginList.push_back(Plugin);
|
||||
} while (Dir.FindNext());
|
||||
|
||||
if (hLib)
|
||||
{
|
||||
FreeLibrary(hLib);
|
||||
hLib = NULL;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +1,41 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/Settings.h>
|
||||
|
||||
class CPluginList
|
||||
{
|
||||
public:
|
||||
typedef struct
|
||||
{
|
||||
PLUGIN_INFO Info;
|
||||
bool AboutFunction;
|
||||
CPath FullPath;
|
||||
stdstr FileName;
|
||||
} PLUGIN;
|
||||
|
||||
public:
|
||||
CPluginList(bool bAutoFill = true);
|
||||
~CPluginList();
|
||||
|
||||
bool LoadList(void);
|
||||
int GetPluginCount(void) const;
|
||||
const PLUGIN * GetPluginInfo(int indx) const;
|
||||
|
||||
private:
|
||||
typedef std::vector<PLUGIN> PluginList;
|
||||
|
||||
PluginList m_PluginList;
|
||||
CPath m_PluginDir;
|
||||
|
||||
void AddPluginFromDir(CPath Dir);
|
||||
};
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Project64-core/Settings/Settings.h>
|
||||
|
||||
class CPluginList
|
||||
{
|
||||
public:
|
||||
typedef struct
|
||||
{
|
||||
PLUGIN_INFO Info;
|
||||
bool AboutFunction;
|
||||
CPath FullPath;
|
||||
stdstr FileName;
|
||||
} PLUGIN;
|
||||
|
||||
public:
|
||||
CPluginList(bool bAutoFill = true);
|
||||
~CPluginList();
|
||||
|
||||
bool LoadList(void);
|
||||
int GetPluginCount(void) const;
|
||||
const PLUGIN * GetPluginInfo(int indx) const;
|
||||
|
||||
private:
|
||||
typedef std::vector<PLUGIN> PluginList;
|
||||
|
||||
PluginList m_PluginList;
|
||||
CPath m_PluginDir;
|
||||
|
||||
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"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}</ProjectGuid>
|
||||
<RootNamespace>Project64</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(SolutionDir)PropertySheets\Platform.$(Configuration).props" />
|
||||
</ImportGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion Condition="'$(Platform)'=='Win32'">5.01</MinimumRequiredVersion>
|
||||
<MinimumRequiredVersion Condition="'$(Platform)'=='x64'">5.02</MinimumRequiredVersion>
|
||||
<StackReserveSize>1</StackReserveSize>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
</Link>
|
||||
<Manifest Condition="'$(PlatformToolset)'!='v90'">
|
||||
<EnableDPIAwareness>true</EnableDPIAwareness>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Multilanguage\LanguageSelector.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger.cpp" />
|
||||
<ClCompile Include="Plugins\PluginList.cpp" />
|
||||
<ClCompile Include="Settings\GuiSettings.cpp" />
|
||||
<ClCompile Include="Settings\NotificationSettings.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\CheatClassUI.cpp" />
|
||||
<ClCompile Include="UserInterface\GuiClass.cpp" />
|
||||
<ClCompile Include="UserInterface\LoggingUI.cpp" />
|
||||
<ClCompile Include="UserInterface\MainMenuClass.cpp" />
|
||||
<ClCompile Include="UserInterface\MenuClass.cpp" />
|
||||
<ClCompile Include="UserInterface\MenuShortCuts.cpp" />
|
||||
<ClCompile Include="UserInterface\NotificationClass.cpp" />
|
||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp" />
|
||||
<ClCompile Include="UserInterface\RomInformationClass.cpp" />
|
||||
<ClCompile Include="UserInterface\SettingsConfig.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp" />
|
||||
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp" />
|
||||
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Multilanguage\LanguageSelector.h" />
|
||||
<ClInclude Include="N64System.h" />
|
||||
<ClInclude Include="N64System\Debugger\DebugDialog.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-TLB.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h" />
|
||||
<ClInclude Include="N64System\Debugger\debugger.h" />
|
||||
<ClInclude Include="N64System\Debugger\DebuggerUI.h" />
|
||||
<ClInclude Include="N64System\RomInformationClass.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="Support.h" />
|
||||
<ClInclude Include="UserInterface.h" />
|
||||
<ClInclude Include="UserInterface\CheatClassUI.h" />
|
||||
<ClInclude Include="UserInterface\GuiClass.h" />
|
||||
<ClInclude Include="UserInterface\LoggingUI.h" />
|
||||
<ClInclude Include="UserInterface\MainMenuClass.h" />
|
||||
<ClInclude Include="UserInterface\MenuClass.h" />
|
||||
<ClInclude Include="UserInterface\MenuShortCuts.h" />
|
||||
<ClInclude Include="UserInterface\NotificationClass.h" />
|
||||
<ClInclude Include="UserInterface\resource.h" />
|
||||
<ClInclude Include="UserInterface\RomBrowser.h" />
|
||||
<ClInclude Include="UserInterface\RomInformationClass.h" />
|
||||
<ClInclude Include="UserInterface\SettingsConfig.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\numberctrl.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h" />
|
||||
<ClInclude Include="WTLApp.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\3rdParty\7zip\7zip.vcxproj">
|
||||
<Project>{3326e128-33af-422c-bb7c-67cc6b915610}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\3rdParty\zlib\zlib.vcxproj">
|
||||
<Project>{731bd205-2826-4631-b7af-117658e88dbc}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Project64-core\Project64-core.vcxproj">
|
||||
<Project>{00c7b43a-ded7-4df0-b072-9a5783ef866d}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\divider.cur" />
|
||||
<None Include="res\hand.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\ListItems.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UserInterface\UIResources.rc" />
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}</ProjectGuid>
|
||||
<RootNamespace>Project64</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(SolutionDir)PropertySheets\Platform.$(Configuration).props" />
|
||||
</ImportGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion Condition="'$(Platform)'=='Win32'">5.01</MinimumRequiredVersion>
|
||||
<MinimumRequiredVersion Condition="'$(Platform)'=='x64'">5.02</MinimumRequiredVersion>
|
||||
<StackReserveSize>1</StackReserveSize>
|
||||
<DataExecutionPrevention>false</DataExecutionPrevention>
|
||||
</Link>
|
||||
<Manifest Condition="'$(PlatformToolset)'!='v90'">
|
||||
<EnableDPIAwareness>true</EnableDPIAwareness>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Multilanguage\LanguageSelector.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp" />
|
||||
<ClCompile Include="N64System\Debugger\Debugger.cpp" />
|
||||
<ClCompile Include="Plugins\PluginList.cpp" />
|
||||
<ClCompile Include="Settings\GuiSettings.cpp" />
|
||||
<ClCompile Include="Settings\NotificationSettings.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\CheatClassUI.cpp" />
|
||||
<ClCompile Include="UserInterface\GuiClass.cpp" />
|
||||
<ClCompile Include="UserInterface\LoggingUI.cpp" />
|
||||
<ClCompile Include="UserInterface\MainMenuClass.cpp" />
|
||||
<ClCompile Include="UserInterface\MenuClass.cpp" />
|
||||
<ClCompile Include="UserInterface\MenuShortCuts.cpp" />
|
||||
<ClCompile Include="UserInterface\NotificationClass.cpp" />
|
||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp" />
|
||||
<ClCompile Include="UserInterface\RomInformationClass.cpp" />
|
||||
<ClCompile Include="UserInterface\SettingsConfig.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp" />
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp" />
|
||||
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp" />
|
||||
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Multilanguage\LanguageSelector.h" />
|
||||
<ClInclude Include="N64System.h" />
|
||||
<ClInclude Include="N64System\Debugger\DebugDialog.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-TLB.h" />
|
||||
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h" />
|
||||
<ClInclude Include="N64System\Debugger\debugger.h" />
|
||||
<ClInclude Include="N64System\Debugger\DebuggerUI.h" />
|
||||
<ClInclude Include="N64System\RomInformationClass.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="Support.h" />
|
||||
<ClInclude Include="UserInterface.h" />
|
||||
<ClInclude Include="UserInterface\CheatClassUI.h" />
|
||||
<ClInclude Include="UserInterface\GuiClass.h" />
|
||||
<ClInclude Include="UserInterface\LoggingUI.h" />
|
||||
<ClInclude Include="UserInterface\MainMenuClass.h" />
|
||||
<ClInclude Include="UserInterface\MenuClass.h" />
|
||||
<ClInclude Include="UserInterface\MenuShortCuts.h" />
|
||||
<ClInclude Include="UserInterface\NotificationClass.h" />
|
||||
<ClInclude Include="UserInterface\resource.h" />
|
||||
<ClInclude Include="UserInterface\RomBrowser.h" />
|
||||
<ClInclude Include="UserInterface\RomInformationClass.h" />
|
||||
<ClInclude Include="UserInterface\SettingsConfig.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h" />
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\numberctrl.h" />
|
||||
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h" />
|
||||
<ClInclude Include="WTLApp.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\3rdParty\7zip\7zip.vcxproj">
|
||||
<Project>{3326e128-33af-422c-bb7c-67cc6b915610}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\3rdParty\zlib\zlib.vcxproj">
|
||||
<Project>{731bd205-2826-4631-b7af-117658e88dbc}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||
<Project>{b4a4b994-9111-42b1-93c2-6f1ca8bc4421}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Project64-core\Project64-core.vcxproj">
|
||||
<Project>{00c7b43a-ded7-4df0-b072-9a5783ef866d}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\divider.cur" />
|
||||
<None Include="res\hand.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\ListItems.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UserInterface\UIResources.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,303 +1,303 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{994eee48-3b61-4493-9a7f-6340a5a47175}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Settings Files">
|
||||
<UniqueIdentifier>{60e2fd87-7b6b-4147-82fe-e12516efe43c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source">
|
||||
<UniqueIdentifier>{7b81a6a8-b20b-464e-8184-864886bb00fd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source\Settings Source">
|
||||
<UniqueIdentifier>{bbef87b7-814a-4c87-9713-a07a2de577d4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source\WTL Controls Source">
|
||||
<UniqueIdentifier>{19f68e68-7068-4a3c-a11d-c3ff48fe78b2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source\Debugger Source">
|
||||
<UniqueIdentifier>{89244064-68f5-44d9-9021-7a592d910e43}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Multilanguage Source">
|
||||
<UniqueIdentifier>{94e87bf5-3b11-4f61-8a4a-333690ecf588}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Plugin Source">
|
||||
<UniqueIdentifier>{242ae4a5-b150-44e6-b31c-027acd6d38b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{1e3eb4f7-a0b1-4d09-9e50-b5c699f24050}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{bc88015e-37f7-4320-8aa4-d5043d17a386}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\User Interface Headers">
|
||||
<UniqueIdentifier>{54e8f51f-d81d-4f8f-b4f1-76584c1b29a5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\User Interface Headers\Settings Header">
|
||||
<UniqueIdentifier>{81b58fad-f73f-4098-8ebc-ffceaff53478}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\User Interface Headers\WTL Controls Headers">
|
||||
<UniqueIdentifier>{838a58e7-e1d2-45d3-bcf0-dcedad19610c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Multilanguage Headers">
|
||||
<UniqueIdentifier>{5531af4d-33bb-4e84-8a55-c971a18ec7bf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\N64 System Headers">
|
||||
<UniqueIdentifier>{6cfab019-2f8d-4e09-be41-1df513b5a680}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\N64 System Headers\Debugger Headers">
|
||||
<UniqueIdentifier>{c4249d55-df70-4453-b017-b548514ad094}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp">
|
||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp">
|
||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Plugins\PluginList.cpp">
|
||||
<Filter>Source Files\Plugin Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\CheatClassUI.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\GuiClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\LoggingUI.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\MainMenuClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\MenuClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\MenuShortCuts.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\NotificationClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\SettingsConfig.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Settings\GuiSettings.cpp">
|
||||
<Filter>Source Files\Settings Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Settings\NotificationSettings.cpp">
|
||||
<Filter>Source Files\Settings Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Multilanguage\LanguageSelector.cpp">
|
||||
<Filter>Source Files\Multilanguage Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\RomInformationClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UserInterface\resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Multilanguage\LanguageSelector.h">
|
||||
<Filter>Header Files\Multilanguage Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\RomInformationClass.h">
|
||||
<Filter>Header Files\N64 System Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\DebugDialog.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\debugger.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-TLB.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\DebuggerUI.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\CheatClassUI.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\GuiClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\LoggingUI.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\MainMenuClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\MenuClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\MenuShortCuts.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\NotificationClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\RomBrowser.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\SettingsConfig.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\numberctrl.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WTLApp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\RomInformationClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\divider.cur">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\hand.cur">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\ListItems.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UserInterface\UIResources.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{994eee48-3b61-4493-9a7f-6340a5a47175}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Settings Files">
|
||||
<UniqueIdentifier>{60e2fd87-7b6b-4147-82fe-e12516efe43c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source">
|
||||
<UniqueIdentifier>{7b81a6a8-b20b-464e-8184-864886bb00fd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source\Settings Source">
|
||||
<UniqueIdentifier>{bbef87b7-814a-4c87-9713-a07a2de577d4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source\WTL Controls Source">
|
||||
<UniqueIdentifier>{19f68e68-7068-4a3c-a11d-c3ff48fe78b2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\User Interface Source\Debugger Source">
|
||||
<UniqueIdentifier>{89244064-68f5-44d9-9021-7a592d910e43}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Multilanguage Source">
|
||||
<UniqueIdentifier>{94e87bf5-3b11-4f61-8a4a-333690ecf588}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Plugin Source">
|
||||
<UniqueIdentifier>{242ae4a5-b150-44e6-b31c-027acd6d38b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{1e3eb4f7-a0b1-4d09-9e50-b5c699f24050}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{bc88015e-37f7-4320-8aa4-d5043d17a386}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\User Interface Headers">
|
||||
<UniqueIdentifier>{54e8f51f-d81d-4f8f-b4f1-76584c1b29a5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\User Interface Headers\Settings Header">
|
||||
<UniqueIdentifier>{81b58fad-f73f-4098-8ebc-ffceaff53478}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\User Interface Headers\WTL Controls Headers">
|
||||
<UniqueIdentifier>{838a58e7-e1d2-45d3-bcf0-dcedad19610c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Multilanguage Headers">
|
||||
<UniqueIdentifier>{5531af4d-33bb-4e84-8a55-c971a18ec7bf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\N64 System Headers">
|
||||
<UniqueIdentifier>{6cfab019-2f8d-4e09-be41-1df513b5a680}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\N64 System Headers\Debugger Headers">
|
||||
<UniqueIdentifier>{c4249d55-df70-4453-b017-b548514ad094}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\WTLControls\ModifiedEditBox.cpp">
|
||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\WTLControls\PartialGroupBox.cpp">
|
||||
<Filter>Source Files\User Interface Source\WTL Controls Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-GameBrowser.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Status.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Options.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\Settings\SettingsPage-Plugin.cpp">
|
||||
<Filter>Source Files\User Interface Source\Settings Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Plugins\PluginList.cpp">
|
||||
<Filter>Source Files\Plugin Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\CheatClassUI.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\GuiClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\LoggingUI.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\MainMenuClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\MenuClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\MenuShortCuts.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\NotificationClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\RomBrowserClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\SettingsConfig.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemoryDump.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-MemorySearch.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-TLB.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="N64System\Debugger\Debugger-ViewMemory.cpp">
|
||||
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Settings\GuiSettings.cpp">
|
||||
<Filter>Source Files\Settings Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Settings\NotificationSettings.cpp">
|
||||
<Filter>Source Files\Settings Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Multilanguage\LanguageSelector.cpp">
|
||||
<Filter>Source Files\Multilanguage Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UserInterface\RomInformationClass.cpp">
|
||||
<Filter>Source Files\User Interface Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UserInterface\resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Multilanguage\LanguageSelector.h">
|
||||
<Filter>Header Files\Multilanguage Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\RomInformationClass.h">
|
||||
<Filter>Header Files\N64 System Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\DebugDialog.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\debugger.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemoryDump.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-MemorySearch.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-TLB.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\DebuggerUI.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System\Debugger\Debugger-ViewMemory.h">
|
||||
<Filter>Header Files\N64 System Headers\Debugger Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\CheatClassUI.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\GuiClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\LoggingUI.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\MainMenuClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\MenuClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\MenuShortCuts.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\NotificationClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\RomBrowser.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\SettingsConfig.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedCheckBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedComboBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\ModifiedEditBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\numberctrl.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\WTLControls\PartialGroupBox.h">
|
||||
<Filter>Header Files\User Interface Headers\WTL Controls Headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-GameBrowser.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Status.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-KeyboardShortcuts.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Options.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\Settings\SettingsPage-Plugin.h">
|
||||
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="N64System.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WTLApp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UserInterface\RomInformationClass.h">
|
||||
<Filter>Header Files\User Interface Headers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\divider.cur">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\hand.cur">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\ListItems.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="UserInterface\UIResources.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,43 +1,43 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
int CGuiSettings::m_RefCount = 0;
|
||||
bool CGuiSettings::m_bCPURunning;
|
||||
bool CGuiSettings::m_bAutoSleep;
|
||||
|
||||
CGuiSettings::CGuiSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CGuiSettings::~CGuiSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||
m_bAutoSleep = g_Settings->LoadBool(Setting_AutoSleep);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "stdafx.h"
|
||||
|
||||
int CGuiSettings::m_RefCount = 0;
|
||||
bool CGuiSettings::m_bCPURunning;
|
||||
bool CGuiSettings::m_bAutoSleep;
|
||||
|
||||
CGuiSettings::CGuiSettings()
|
||||
{
|
||||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CGuiSettings::~CGuiSettings()
|
||||
{
|
||||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(Setting_AutoSleep,NULL,RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||
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