mirror of
https://github.com/libretro/Play-.git
synced 2025-01-26 19:24:40 +00:00
Added configurable frame skip, some esthetic code changes and compilation fix.
git-svn-id: http://svn.purei.org/purei/trunk@355 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
1ba2aa5dde
commit
ee3ec9c361
@ -88,103 +88,78 @@ template <typename Type> Type* CConfig::FindPreference(const char* sName)
|
||||
|
||||
void CConfig::RegisterPreferenceInteger(const char* sName, int nValue)
|
||||
{
|
||||
CPreferenceInteger* pPref;
|
||||
|
||||
if(FindPreference<CPreference>(sName) != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pPref = new CPreferenceInteger(sName, nValue);
|
||||
|
||||
CPreferenceInteger* pPref = new CPreferenceInteger(sName, nValue);
|
||||
InsertPreference(pPref);
|
||||
}
|
||||
|
||||
void CConfig::RegisterPreferenceBoolean(const char* sName, bool nValue)
|
||||
{
|
||||
CPreferenceBoolean* pPref;
|
||||
|
||||
if(FindPreference<CPreference>(sName) != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pPref = new CPreferenceBoolean(sName, nValue);
|
||||
CPreferenceBoolean* pPref = new CPreferenceBoolean(sName, nValue);
|
||||
InsertPreference(pPref);
|
||||
}
|
||||
|
||||
void CConfig::RegisterPreferenceString(const char* sName, const char* sValue)
|
||||
{
|
||||
CPreferenceString* pPref;
|
||||
|
||||
if(FindPreference<CPreference>(sName) != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pPref = new CPreferenceString(sName, sValue);
|
||||
CPreferenceString* pPref = new CPreferenceString(sName, sValue);
|
||||
InsertPreference(pPref);
|
||||
}
|
||||
|
||||
int CConfig::GetPreferenceInteger(const char* sName)
|
||||
{
|
||||
CPreferenceInteger* pPref;
|
||||
|
||||
pPref = FindPreference<CPreferenceInteger>(sName);
|
||||
CPreferenceInteger* pPref = FindPreference<CPreferenceInteger>(sName);
|
||||
if(pPref == NULL) return 0;
|
||||
|
||||
return pPref->GetValue();
|
||||
}
|
||||
|
||||
bool CConfig::GetPreferenceBoolean(const char* sName)
|
||||
{
|
||||
CPreferenceBoolean* pPref;
|
||||
|
||||
pPref = FindPreference<CPreferenceBoolean>(sName);
|
||||
CPreferenceBoolean* pPref = FindPreference<CPreferenceBoolean>(sName);
|
||||
if(pPref == NULL) return false;
|
||||
|
||||
return pPref->GetValue();
|
||||
}
|
||||
|
||||
const char* CConfig::GetPreferenceString(const char* sName)
|
||||
{
|
||||
CPreferenceString* pPref;
|
||||
|
||||
pPref = FindPreference<CPreferenceString>(sName);
|
||||
CPreferenceString* pPref = FindPreference<CPreferenceString>(sName);
|
||||
if(pPref == NULL) return false;
|
||||
|
||||
return pPref->GetValue();
|
||||
}
|
||||
|
||||
bool CConfig::SetPreferenceInteger(const char* sName, int nValue)
|
||||
{
|
||||
CPreferenceInteger* pPref;
|
||||
|
||||
pPref = FindPreference<CPreferenceInteger>(sName);
|
||||
CPreferenceInteger* pPref = FindPreference<CPreferenceInteger>(sName);
|
||||
if(pPref == NULL) return false;
|
||||
|
||||
pPref->SetValue(nValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::SetPreferenceBoolean(const char* sName, bool nValue)
|
||||
{
|
||||
CPreferenceBoolean* pPref;
|
||||
|
||||
pPref = FindPreference<CPreferenceBoolean>(sName);
|
||||
CPreferenceBoolean* pPref = FindPreference<CPreferenceBoolean>(sName);
|
||||
if(pPref == NULL) return false;
|
||||
|
||||
pPref->SetValue(nValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::SetPreferenceString(const char* sName, const char* sValue)
|
||||
{
|
||||
CPreferenceString* pPref;
|
||||
|
||||
pPref = FindPreference<CPreferenceString>(sName);
|
||||
CPreferenceString* pPref = FindPreference<CPreferenceString>(sName);
|
||||
if(pPref == NULL) return false;
|
||||
|
||||
pPref->SetValue(sValue);
|
||||
return true;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
bool SetPreferenceString(const char*, const char*);
|
||||
|
||||
void Save();
|
||||
std::string GetConfigPath() const;
|
||||
|
||||
private:
|
||||
enum PREFERENCE_TYPE
|
||||
@ -94,7 +95,6 @@ private:
|
||||
CConfig();
|
||||
~CConfig();
|
||||
void Load();
|
||||
std::string GetConfigPath() const;
|
||||
template <typename Type> Type* FindPreference(const char*);
|
||||
template <typename Type> Type* CastPreference(CPreference*);
|
||||
void InsertPreference(CPreference*);
|
||||
|
@ -40,12 +40,10 @@
|
||||
#define STATE_VUMEM1 ("vumem1")
|
||||
#define STATE_MICROMEM1 ("micromem1")
|
||||
|
||||
#define PREF_PS2_HOST_DIRECTORY ("ps2.host.directory")
|
||||
#define PREF_PS2_MC0_DIRECTORY ("ps2.mc0.directory")
|
||||
#define PREF_PS2_MC1_DIRECTORY ("ps2.mc1.directory")
|
||||
#define PREF_PS2_HOST_DIRECTORY_DEFAULT ("./vfs/host")
|
||||
#define PREF_PS2_MC0_DIRECTORY_DEFAULT ("./vfs/mc0")
|
||||
#define PREF_PS2_MC1_DIRECTORY_DEFAULT ("./vfs/mc1")
|
||||
#define PREF_PS2_FRAMESKIP_DEFAULT (0)
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
@ -106,6 +104,7 @@ m_MAVU1(true)
|
||||
CConfig::GetInstance().RegisterPreferenceString(PREF_PS2_HOST_DIRECTORY, PREF_PS2_HOST_DIRECTORY_DEFAULT);
|
||||
CConfig::GetInstance().RegisterPreferenceString(PREF_PS2_MC0_DIRECTORY, PREF_PS2_MC0_DIRECTORY_DEFAULT);
|
||||
CConfig::GetInstance().RegisterPreferenceString(PREF_PS2_MC1_DIRECTORY, PREF_PS2_MC1_DIRECTORY_DEFAULT);
|
||||
CConfig::GetInstance().RegisterPreferenceInteger(PREF_PS2_FRAMESKIP, PREF_PS2_FRAMESKIP_DEFAULT);
|
||||
|
||||
m_iopOs = new CIopBios(0x100, m_iop, m_iopRam, PS2::IOPRAMSIZE, m_sif, m_pCDROM0);
|
||||
m_os = new CPS2OS(m_EE, m_VU1, m_pRAM, m_pBIOS, m_pGS, m_sif, *m_iopOs);
|
||||
@ -232,6 +231,12 @@ unsigned int CPS2VM::LoadState(const char* sPath)
|
||||
return result;
|
||||
}
|
||||
|
||||
void CPS2VM::SetFrameSkip(unsigned int frameSkip)
|
||||
{
|
||||
m_frameSkip = frameSkip;
|
||||
CConfig::GetInstance().SetPreferenceInteger(PREF_PS2_FRAMESKIP, m_frameSkip);
|
||||
}
|
||||
|
||||
//unsigned int CPS2VM::SendMessage(PS2VM_MSG nMsg, void* pParam)
|
||||
//{
|
||||
// return m_MsgBox.SendMessage(nMsg, pParam);
|
||||
@ -379,6 +384,8 @@ void CPS2VM::ResetVM()
|
||||
m_iopOs->GetIoman()->RegisterDevice("mc1", new Iop::Ioman::CDirectoryDevice(PREF_PS2_MC1_DIRECTORY));
|
||||
m_iopOs->GetIoman()->RegisterDevice("cdrom0", new Iop::Ioman::CIsoDevice(m_pCDROM0));
|
||||
|
||||
m_frameSkip = CConfig::GetInstance().GetPreferenceInteger(PREF_PS2_FRAMESKIP);
|
||||
|
||||
RegisterModulesInPadHandler();
|
||||
}
|
||||
|
||||
@ -536,8 +543,7 @@ void CPS2VM::DestroyPadHandlerImpl()
|
||||
void CPS2VM::OnGsNewFrame()
|
||||
{
|
||||
m_frameNumber++;
|
||||
bool drawFrame = (m_frameNumber & 7) == 0;
|
||||
// bool drawFrame = false;
|
||||
bool drawFrame = (m_frameSkip == 0) ? true : (m_frameNumber % (m_frameSkip + 1)) == 0;
|
||||
if(m_pGS != NULL)
|
||||
{
|
||||
m_pGS->SetEnabled(drawFrame);
|
||||
|
@ -43,6 +43,11 @@ enum PS2VM_MSG
|
||||
#define PROFILE_EEZONE "EE"
|
||||
#endif
|
||||
|
||||
#define PREF_PS2_HOST_DIRECTORY ("ps2.host.directory")
|
||||
#define PREF_PS2_MC0_DIRECTORY ("ps2.mc0.directory")
|
||||
#define PREF_PS2_MC1_DIRECTORY ("ps2.mc1.directory")
|
||||
#define PREF_PS2_FRAMESKIP ("ps2.frameskip")
|
||||
|
||||
class CPS2VM : public CVirtualMachine
|
||||
{
|
||||
public:
|
||||
@ -73,6 +78,8 @@ public:
|
||||
unsigned int SaveState(const char*);
|
||||
unsigned int LoadState(const char*);
|
||||
|
||||
void SetFrameSkip(unsigned int);
|
||||
|
||||
uint32 IOPortReadHandler(uint32);
|
||||
uint32 IOPortWriteHandler(uint32, uint32);
|
||||
|
||||
@ -161,6 +168,7 @@ private:
|
||||
CMA_VU m_MAVU0;
|
||||
CMA_VU m_MAVU1;
|
||||
unsigned int m_frameNumber;
|
||||
unsigned int m_frameSkip;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include "zip/ZipArchiveWriter.h"
|
||||
#include "zip/ZipArchiveReader.h"
|
||||
#include "CircularBuffer.h"
|
||||
|
||||
class CVPU
|
||||
{
|
||||
@ -34,8 +33,6 @@ public:
|
||||
uint8* GetVuMemory() const;
|
||||
bool IsRunning() const;
|
||||
|
||||
// CCircularBuffer m_cmdBuffer;
|
||||
|
||||
protected:
|
||||
struct STAT : public convertible<uint32>
|
||||
{
|
||||
|
Binary file not shown.
@ -32,6 +32,7 @@ private:
|
||||
void PauseWhenFocusLost();
|
||||
void SaveState();
|
||||
void LoadState();
|
||||
void ChangeFrameskip(bool);
|
||||
void ChangeStateSlot(unsigned int);
|
||||
void ShowDebugger();
|
||||
void ShowSysInfo();
|
||||
|
@ -206,22 +206,17 @@ void CMcManagerWnd::Import()
|
||||
|
||||
void CMcManagerWnd::Delete(const CSave* pSave)
|
||||
{
|
||||
int nReturn;
|
||||
|
||||
nReturn = MessageBox(m_hWnd, _T("Are you sure you want to delete the currently selected entry?"), NULL, MB_YESNO | MB_ICONQUESTION);
|
||||
int nReturn = MessageBox(m_hWnd, _T("Are you sure you want to delete the currently selected entry?"), NULL, MB_YESNO | MB_ICONQUESTION);
|
||||
|
||||
if(nReturn == IDNO) return;
|
||||
|
||||
tstring sPath;
|
||||
TCHAR* sFromList;
|
||||
|
||||
sPath = string_cast<tstring>(filesystem::complete(pSave->GetPath()).string());
|
||||
tstring sPath = string_cast<tstring>(filesystem::complete(pSave->GetPath()).string());
|
||||
m_pMemoryCardView->SetMemoryCard(NULL);
|
||||
|
||||
transform(sPath.begin(), sPath.end(), sPath.begin(), WinUtils::FixSlashes);
|
||||
|
||||
//Construct the file list
|
||||
sFromList = (TCHAR*)_alloca((sPath.size() + 2) * sizeof(TCHAR));
|
||||
TCHAR* sFromList = (TCHAR*)_alloca((sPath.size() + 2) * sizeof(TCHAR));
|
||||
_tcscpy(sFromList, sPath.c_str());
|
||||
sFromList[sPath.size() + 1] = 0;
|
||||
|
||||
|
@ -135,6 +135,11 @@ BEGIN
|
||||
MENUITEM "&Pause / Resume\tF5", ID_MAIN_VM_RESUME
|
||||
MENUITEM "R&eset", ID_MAIN_VM_RESET, GRAYED
|
||||
MENUITEM "Pause When Focus Lost", ID_MAIN_VM_PAUSEFOCUS
|
||||
POPUP "Frame Skip"
|
||||
BEGIN
|
||||
MENUITEM "Decrement Frameskip\t-", ID_MAIN_VM_FRAMESKIP_DECREMENT
|
||||
MENUITEM "Increment Frameskip\t+", ID_MAIN_VM_FRAMESKIP_INCREMENT
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "State Slot", ID_MAIN_VM_STATESLOT
|
||||
MENUITEM "Save State\tF7", ID_MAIN_VM_SAVESTATE
|
||||
@ -145,7 +150,6 @@ BEGIN
|
||||
MENUITEM "Renderer Settings...", ID_MAIN_OPTIONS_RENDERER
|
||||
MENUITEM "&Virtual File System Manager...", ID_MAIN_OPTIONS_VFSMANAGER
|
||||
MENUITEM "Memory Card Manager...", ID_MAIN_OPTIONS_MCMANAGER
|
||||
MENUITEM "Configuration Editor...", ID_MAIN_OPTIONS_CONFIGEDI, GRAYED
|
||||
END
|
||||
POPUP "Help"
|
||||
BEGIN
|
||||
|
@ -142,13 +142,21 @@
|
||||
#define ID_VIEW_TESTENGINECONSOLE 40139
|
||||
#define ID_VIEW_V 40140
|
||||
#define ID_VIEW_VU0VIEW 40141
|
||||
#define ID_MAIN_OPTIONS_OPENCONFIG 40142
|
||||
#define ID_VIRTUALMACHINE_FRAMESKIP 40143
|
||||
#define ID_FRAMESKIP_INCREMENTFRAMESKIP 40144
|
||||
#define ID_VM_FRAMESKIP_INCREMENT 40145
|
||||
#define ID_FRAMESKIP_DECREMENTFRAMESKIP 40146
|
||||
#define ID_VM_FRAMESKIP_DECREMENT 40147
|
||||
#define ID_MAIN_VM_FRAMESKIP_DECREMENT 40148
|
||||
#define ID_MAIN_VM_FRAMESKIP_INCREMENT 40149
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 118
|
||||
#define _APS_NEXT_COMMAND_VALUE 40142
|
||||
#define _APS_NEXT_COMMAND_VALUE 40150
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user