Basic VBA-style save state system implemented - kb shortcuts only working on Windows. Keyboard shortcut system added. More cleanup in GFX plugins.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@390 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-30 22:06:53 +00:00
parent 85565688d7
commit 005cbbb379
23 changed files with 148 additions and 379 deletions

View File

@ -73,9 +73,11 @@ void Callback_VideoLog(const TCHAR* _szMessage, BOOL _bDoBreak);
void Callback_VideoCopiedToXFB();
void Callback_DSPLog(const TCHAR* _szMessage);
void Callback_DSPInterrupt();
void Callback_DVDLog(const TCHAR* _szMessage);
void Callback_DVDSetStatusbar(TCHAR* _szMessage);
void Callback_PADLog(const TCHAR* _szMessage);
// For keyboard shortcuts.
void Callback_KeyPress(int key, BOOL shift, BOOL control);
TPeekMessages Callback_PeekMessages = NULL;
TUpdateFPSDisplay g_pUpdateFPSDisplay = NULL;
@ -270,6 +272,7 @@ THREAD_RETURN EmuThread(void *pArg)
VideoInitialize.pCPFifo = (SCPFifoStruct*)&CommandProcessor::fifo;
VideoInitialize.pUpdateInterrupts = &(CommandProcessor::UpdateInterruptsFromVideoPlugin);
VideoInitialize.pMemoryBase = Memory::base;
VideoInitialize.pKeyPress = Callback_KeyPress;
PluginVideo::Video_Initialize(&VideoInitialize);
// Under linux, this is an X11 Display, not an HWND!
@ -414,11 +417,11 @@ EState GetState()
}
void SaveState() {
State_Save("state.dlp");
State_Save(0);
}
void LoadState() {
State_Load("state.dlp");
State_Load(0);
}
const SCoreStartupParameter& GetStartupParameter()
@ -517,25 +520,6 @@ void Callback_DSPInterrupt()
DSP::GenerateDSPInterruptFromPlugin(DSP::INT_DSP);
}
// __________________________________________________________________________________________________
// Callback_DVDLog
//
void Callback_DVDLog(TCHAR* _szMessage)
{
LOG(DVDINTERFACE, _szMessage);
}
// __________________________________________________________________________________________________
// Callback_DVDSetStatusbar
//
void Callback_DVDSetStatusbar(TCHAR* _szMessage)
{
//Todo: PostMessage to main window to set the string
// strDVDMessage = _szMessage;
// if (g_CoreStartupParameter.m_StatusUpdate != NULL)
// g_CoreStartupParameter.m_StatusUpdate();
}
// __________________________________________________________________________________________________
// Callback_PADLog
//
@ -544,4 +528,20 @@ void Callback_PADLog(const TCHAR* _szMessage)
LOG(SERIALINTERFACE, _szMessage);
}
// Called from ANY thread!
void Callback_KeyPress(int key, BOOL shift, BOOL control)
{
// 0x70 == VK_F1
if (key >= 0x70 && key < 0x79) {
// F-key
int slot_number = key - 0x70 + 1;
if (shift) {
State_Save(slot_number);
} else {
State_Load(slot_number);
}
}
}
} // end of namespace Core

View File

@ -195,7 +195,8 @@ CSIDevice_GCController::SendCommand(u32 _Cmd)
{
unsigned int uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
unsigned int uStrength = command.Parameter2;
PluginPAD::PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength);
if (PluginPAD::PAD_Rumble)
PluginPAD::PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength);
}
break;

View File

@ -37,8 +37,18 @@ static int ev_Load;
static std::string cur_filename;
enum {
version = 1
};
void DoState(PointerWrap &p)
{
u32 cookie = 0xBAADBABE + version;
p.Do(cookie);
if (cookie != 0xBAADBABE + version) {
PanicAlert("Can't load states from other versions.");
return;
}
// Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM
PluginVideo::Video_DoState(p.GetPPtr(), p.GetMode());
PluginDSP::DSP_DoState(p.GetPPtr(), p.GetMode());
@ -50,7 +60,6 @@ void DoState(PointerWrap &p)
void SaveStateCallback(u64 userdata, int cyclesLate)
{
Jit64::ClearCache();
u8 *ptr = 0;
PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
DoState(p);
@ -65,14 +74,17 @@ void SaveStateCallback(u64 userdata, int cyclesLate)
delete [] buffer;
Core::DisplayMessage("Saved State", 2000);
Core::DisplayMessage(StringFromFormat("Saved State to %s", cur_filename.c_str()).c_str(), 2000);
}
void LoadStateCallback(u64 userdata, int cyclesLate)
{
Jit64::ClearCache();
FILE *f = fopen(cur_filename.c_str(), "rb");
if (!f) {
Core::DisplayMessage("State not found", 2000);
return;
}
Jit64::ClearCache();
fseek(f, 0, SEEK_END);
int sz = ftell(f);
fseek(f, 0, SEEK_SET);
@ -87,7 +99,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
DoState(p);
delete [] buffer;
Core::DisplayMessage("Loaded State", 2000);
Core::DisplayMessage(StringFromFormat("Loaded state from %s", cur_filename.c_str()).c_str(), 2000);
}
void State_Init()
@ -101,18 +113,18 @@ void State_Shutdown()
// nothing to do, here for consistency.
}
std::string GetStateFilename(int state_number) {
std::string MakeStateFilename(int state_number) {
return StringFromFormat("StateSaves/%s.s%02i", Core::GetStartupParameter().GetUniqueID().c_str(), state_number);
}
void State_Save(const char *filename)
void State_Save(int slot)
{
cur_filename = GetStateFilename(0);
cur_filename = MakeStateFilename(slot);
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Save);
}
void State_Load(const char *filename)
void State_Load(int slot)
{
cur_filename = GetStateFilename(0);
cur_filename = MakeStateFilename(slot);
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Load);
}

View File

@ -22,7 +22,8 @@ void State_Init();
void State_Shutdown();
// These don't happen instantly - they get scheduled as events.
void State_Save(const char *filename);
void State_Load(const char *filename);
// Slots from 0-99.
void State_Save(int slot);
void State_Load(int slot);
#endif

View File

@ -25,6 +25,7 @@
#include "Common.h"
#include "Config.h"
#include "Core.h"
#include "State.h"
#include "PluginOptions.h"
#include "PluginManager.h"
#include "MemcardManager.h"
@ -95,8 +96,26 @@ EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
EVT_MENU(IDM_LOADSTATE, CFrame::OnLoadState)
EVT_MENU(IDM_SAVESTATE, CFrame::OnSaveState)
EVT_MENU(IDM_LOADSLOT1, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT2, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT3, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT4, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT5, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT6, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT7, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT8, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT9, CFrame::OnLoadState)
EVT_MENU(IDM_LOADSLOT10, CFrame::OnLoadState)
EVT_MENU(IDM_SAVESLOT1, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT2, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT3, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT4, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT5, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT6, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT7, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT8, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT9, CFrame::OnSaveState)
EVT_MENU(IDM_SAVESLOT10, CFrame::OnSaveState)
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
END_EVENT_TABLE()
@ -167,32 +186,32 @@ void CFrame::CreateMenu()
// file menu
wxMenu* fileMenu = new wxMenu;
fileMenu->Append(wxID_OPEN, _T("&Open..."));
fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O"));
fileMenu->Append(wxID_REFRESH, _T("&Refresh"));
fileMenu->Append(IDM_BROWSE, _T("&Browse for ISOs..."));
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("E&xit"), _T(""));
fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Alt+F4"));
m_pMenuBar->Append(fileMenu, _T("&File"));
// emulation menu
wxMenu* emulationMenu = new wxMenu;
m_pMenuItemPlay = new wxMenuItem(fileMenu, IDM_PLAY, _T("&Play"));
emulationMenu->Append(m_pMenuItemPlay);
m_pMenuItemStop = new wxMenuItem(fileMenu, IDM_STOP, _T("&Stop"));
emulationMenu->Append(m_pMenuItemStop);
m_pMenuItemPlay = emulationMenu->Append(IDM_PLAY, _T("&Play"));
m_pMenuItemStop = emulationMenu->Append(IDM_STOP, _T("&Stop"));
emulationMenu->AppendSeparator();
m_pMenuItemLoad = new wxMenuItem(fileMenu, IDM_LOADSTATE, _T("&Load State"));
emulationMenu->Append(m_pMenuItemLoad);
m_pMenuItemSave = new wxMenuItem(fileMenu, IDM_SAVESTATE, _T("Sa&ve State"));
emulationMenu->Append(m_pMenuItemSave);
wxMenu *saveMenu = new wxMenu;
wxMenu *loadMenu = new wxMenu;
m_pMenuItemLoad = emulationMenu->AppendSubMenu(saveMenu, _T("&Load State"));
m_pMenuItemSave = emulationMenu->AppendSubMenu(loadMenu, _T("Sa&ve State"));
for (int i = 1; i < 10; i++) {
saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i F%i"), i, i));
loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i Shift+F%i"), i, i));
}
m_pMenuBar->Append(emulationMenu, _T("&Emulation"));
// options menu
wxMenu* pOptionsMenu = new wxMenu;
m_pPluginOptions = new wxMenuItem(pOptionsMenu, IDM_PLUGIN_OPTIONS, _T("&Select plugins"));
pOptionsMenu->Append(m_pPluginOptions);
m_pPluginOptions = pOptionsMenu->Append(IDM_PLUGIN_OPTIONS, _T("&Select plugins"));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&GFX settings"));
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP settings"));
@ -501,14 +520,18 @@ void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
SConfig::GetInstance().SaveSettings();
}
void CFrame::OnLoadState(wxCommandEvent& WXUNUSED (event))
void CFrame::OnLoadState(wxCommandEvent& event)
{
Core::LoadState();
int id = event.GetId();
int slot = id - IDM_LOADSLOT1 + 1;
State_Load(slot);
}
void CFrame::OnSaveState(wxCommandEvent& WXUNUSED (event))
void CFrame::OnSaveState(wxCommandEvent& event)
{
Core::SaveState();
int id = event.GetId();
int slot = id - IDM_SAVESLOT1 + 1;
State_Save(slot);
}
void CFrame::OnToggleToolbar(wxCommandEvent& event)

View File

@ -22,6 +22,26 @@ enum
{
IDM_LOADSTATE = 200,
IDM_SAVESTATE,
IDM_SAVESLOT1,
IDM_SAVESLOT2,
IDM_SAVESLOT3,
IDM_SAVESLOT4,
IDM_SAVESLOT5,
IDM_SAVESLOT6,
IDM_SAVESLOT7,
IDM_SAVESLOT8,
IDM_SAVESLOT9,
IDM_SAVESLOT10,
IDM_LOADSLOT1,
IDM_LOADSLOT2,
IDM_LOADSLOT3,
IDM_LOADSLOT4,
IDM_LOADSLOT5,
IDM_LOADSLOT6,
IDM_LOADSLOT7,
IDM_LOADSLOT8,
IDM_LOADSLOT9,
IDM_LOADSLOT10,
IDM_PLAY,
IDM_STOP,
IDM_BROWSE,

View File

@ -9,6 +9,7 @@ files = [
"XFBConvert.cpp",
"Fifo.cpp",
"VideoState.cpp",
"Profiler.cpp",
]
env_common = env.Copy()

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="VideoCommon"
ProjectGUID="{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}"
RootNamespace="VideoCommon"
@ -437,6 +437,14 @@
RelativePath=".\Src\OpcodeDecoding.h"
>
</File>
<File
RelativePath=".\Src\Profiler.cpp"
>
</File>
<File
RelativePath=".\Src\Profiler.h"
>
</File>
<File
RelativePath=".\Src\SConscript"
>

View File

@ -18,6 +18,7 @@ typedef void (*TCopiedToXFB)(void);
typedef BOOL (*TPeekMessages)(void);
typedef void (*TUpdateInterrupts)(void);
typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title
typedef void (*TKeyPressed)(int keycode, BOOL shift, BOOL control); // sets the window title
typedef struct
{
@ -54,8 +55,9 @@ typedef struct
TPeekMessages pPeekMessages;
TUpdateInterrupts pUpdateInterrupts;
TUpdateFPSDisplay pUpdateFPSDisplay;
SCPFifoStruct *pCPFifo;
TKeyPressed pKeyPress;
SCPFifoStruct *pCPFifo;
unsigned char *pVIRegs;
void *pMemoryBase;
} SVideoInitialize;

View File

@ -740,6 +740,14 @@
RelativePath=".\Src\W32Util\DialogManager.h"
>
</File>
<File
RelativePath=".\Src\EmuWindow.cpp"
>
</File>
<File
RelativePath=".\Src\EmuWindow.h"
>
</File>
<File
RelativePath=".\Src\W32Util\File.cpp"
>
@ -1366,14 +1374,6 @@
RelativePath=".\Src\D3DUtil.h"
>
</File>
<File
RelativePath=".\Src\EmuWindow.cpp"
>
</File>
<File
RelativePath=".\Src\EmuWindow.h"
>
</File>
</Filter>
<Filter
Name="UI"

View File

@ -3,6 +3,7 @@
#include "../../Core/Src/Core.h"
#include "Globals.h"
#include "main.h"
#include "EmuWindow.h"
namespace EmuWindow
@ -47,6 +48,7 @@ namespace EmuWindow
hypotheticalScene->sendMessage(KEYDOWN...);
*/
}
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
break;
case WM_CLOSE:
@ -157,6 +159,6 @@ namespace EmuWindow
rc.right = rc.left + w;
rc.top = (1024 - h)/2;
rc.bottom = rc.top + h;
::MoveWindow(m_hWnd, rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top, TRUE);
::MoveWindow(m_hWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
}
}

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "Profiler.h"
#include "VertexLoader.h"

View File

@ -182,269 +182,6 @@ bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int he
return SaveTGA(filename, width, height, &data[0]);
}
////////////////////
// Small profiler //
////////////////////
#include <list>
#include <string>
#include <map>
using namespace std;
int g_bWriteProfile=0;
#ifdef _WIN32
#if defined (_MSC_VER) && _MSC_VER >= 1400
#include <intrin.h>
#pragma intrinsic(__rdtsc)
#endif
static u64 luPerfFreq=0;
inline u64 GET_PROFILE_TIME()
{
#if defined (_MSC_VER) && _MSC_VER >= 1400
return __rdtsc();
#else
LARGE_INTEGER lu;
QueryPerformanceCounter(&lu);
return lu.QuadPart;
#endif
}
#else
static u64 luPerfFreq=1000000;
#define GET_PROFILE_TIME() //GetCpuTick()
#endif
struct DVPROFSTRUCT;
struct DVPROFSTRUCT
{
struct DATA
{
DATA(u64 time, u32 user = 0) : dwTime(time), dwUserData(user) {}
DATA() : dwTime(0), dwUserData(0) {}
u64 dwTime;
u32 dwUserData;
};
~DVPROFSTRUCT() {
list<DVPROFSTRUCT*>::iterator it = listpChild.begin();
while(it != listpChild.end() ) {
delete *it; *it = NULL;
++it;
}
}
list<DATA> listTimes; // before DVProfEnd is called, contains the global time it started
// after DVProfEnd is called, contains the time it lasted
// the list contains all the tracked times
char pname[256];
list<DVPROFSTRUCT*> listpChild; // other profilers called during this profiler period
};
struct DVPROFTRACK
{
u32 dwUserData;
DVPROFSTRUCT::DATA* pdwTime;
DVPROFSTRUCT* pprof;
};
list<DVPROFTRACK> g_listCurTracking; // the current profiling functions, the back element is the
// one that will first get popped off the list when DVProfEnd is called
// the pointer is an element in DVPROFSTRUCT::listTimes
list<DVPROFSTRUCT> g_listProfilers; // the current profilers, note that these are the parents
// any profiler started during the time of another is held in
// DVPROFSTRUCT::listpChild
list<DVPROFSTRUCT*> g_listAllProfilers; // ignores the hierarchy, pointer to elements in g_listProfilers
void DVProfRegister(const char *pname)
{
if (!g_bWriteProfile)
return;
#ifdef _WIN32
if (luPerfFreq <= 1) {
#if defined (_MSC_VER) && _MSC_VER >= 1400
luPerfFreq = 1000000;
#else
LARGE_INTEGER temp;
QueryPerformanceFrequency(&temp);
luPerfFreq = temp.QuadPart;
#endif
}
#endif
list<DVPROFSTRUCT*>::iterator it = g_listAllProfilers.begin();
// while(it != g_listAllProfilers.end() ) {
//
// if( _tcscmp(pname, (*it)->pname) == 0 ) {
// (*it)->listTimes.push_back(timeGetTime());
// DVPROFTRACK dvtrack;
// dvtrack.pdwTime = &(*it)->listTimes.back();
// dvtrack.pprof = *it;
// g_listCurTracking.push_back(dvtrack);
// return;
// }
//
// ++it;
// }
// else add in a new profiler to the appropriate parent profiler
DVPROFSTRUCT* pprof = NULL;
if (g_listCurTracking.size() > 0) {
_assert_( g_listCurTracking.back().pprof != NULL );
g_listCurTracking.back().pprof->listpChild.push_back(new DVPROFSTRUCT());
pprof = g_listCurTracking.back().pprof->listpChild.back();
}
else {
g_listProfilers.push_back(DVPROFSTRUCT());
pprof = &g_listProfilers.back();
}
strncpy(pprof->pname, pname, 256);
// setup the profiler for tracking
pprof->listTimes.push_back(DVPROFSTRUCT::DATA(GET_PROFILE_TIME()));
DVPROFTRACK dvtrack;
dvtrack.pdwTime = &pprof->listTimes.back();
dvtrack.pprof = pprof;
dvtrack.dwUserData = 0;
g_listCurTracking.push_back(dvtrack);
// add to all profiler list
g_listAllProfilers.push_back(pprof);
}
void DVProfEnd(u32 dwUserData)
{
if (!g_bWriteProfile)
return;
if (g_listCurTracking.size() == 0)
return;
DVPROFTRACK dvtrack = g_listCurTracking.back();
_assert_( dvtrack.pdwTime != NULL && dvtrack.pprof != NULL );
dvtrack.pdwTime->dwTime = GET_PROFILE_TIME()- dvtrack.pdwTime->dwTime;
dvtrack.pdwTime->dwUserData= dwUserData;
g_listCurTracking.pop_back();
}
struct DVTIMEINFO
{
DVTIMEINFO() : uInclusive(0), uExclusive(0) {}
u64 uInclusive, uExclusive;
};
map<string, DVTIMEINFO> mapAggregateTimes;
u64 DVProfWriteStruct(FILE* f, DVPROFSTRUCT* p, int ident)
{
fprintf(f, "%*s%s - ", ident, "", p->pname);
list<DVPROFSTRUCT::DATA>::iterator ittime = p->listTimes.begin();
u64 utime = 0;
while(ittime != p->listTimes.end() ) {
utime += ittime->dwTime;
if (ittime->dwUserData)
fprintf(f, "time: %d, user: 0x%8.8x", (u32)ittime->dwTime, ittime->dwUserData);
else
fprintf(f, "time: %d", (u32)ittime->dwTime);
++ittime;
}
// yes this is necessary, maps have problems with constructors on their type
map<string, DVTIMEINFO>::iterator ittimes = mapAggregateTimes.find(p->pname);
if (ittimes == mapAggregateTimes.end()) {
ittimes = mapAggregateTimes.insert(map<string, DVTIMEINFO>::value_type(p->pname, DVTIMEINFO())).first;
ittimes->second.uExclusive = 0;
ittimes->second.uInclusive = 0;
}
ittimes->second.uInclusive += utime;
fprintf(f, "\n");
list<DVPROFSTRUCT*>::iterator itprof = p->listpChild.begin();
u64 uex = utime;
while(itprof != p->listpChild.end() ) {
uex -= DVProfWriteStruct(f, *itprof, ident+4);
++itprof;
}
if (uex > utime) {
uex = 0;
}
ittimes->second.uExclusive += uex;
return utime;
}
void DVProfWrite(const char* pfilename, u32 frames)
{
_assert_( pfilename != NULL );
FILE* f = fopen(pfilename, "w");
// pop back any unused
mapAggregateTimes.clear();
list<DVPROFSTRUCT>::iterator it = g_listProfilers.begin();
while(it != g_listProfilers.end() ) {
DVProfWriteStruct(f, &(*it), 0);
++it;
}
{
map<string, DVTIMEINFO>::iterator it;
fprintf(f, "\n\n-------------------------------------------------------------------\n\n");
u64 uTotal[2] = {0};
double fiTotalTime[2];
for(it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) {
uTotal[0] += it->second.uExclusive;
uTotal[1] += it->second.uInclusive;
}
fprintf(f, "total times (%d): ex: %Lu ", frames, 1000000*uTotal[0]/(luPerfFreq*(u64)frames));
fprintf(f, "inc: %Lu\n", 1000000 * uTotal[1]/(luPerfFreq*(u64)frames));
fiTotalTime[0] = 1.0 / (double)uTotal[0];
fiTotalTime[1] = 1.0 / (double)uTotal[1];
// output the combined times
for(it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) {
fprintf(f, "%s - ex: %f inc: %f\n", it->first.c_str(), (float)((double)it->second.uExclusive * fiTotalTime[0]),
(float)((double)it->second.uInclusive * fiTotalTime[1]));
}
}
fclose(f);
}
void DVProfClear()
{
g_listCurTracking.clear();
g_listProfilers.clear();
g_listAllProfilers.clear();
}
#ifdef _WIN32
// The one for Linux is in Linux/Linux.cpp
static HANDLE hConsole = NULL;

View File

@ -269,54 +269,4 @@ inline float Memory_Read_Float(u32 _uAddress)
return temp.f;
}
////
// profiling
///
extern int g_bWriteProfile; // global variable to enable/disable profiling (if DVPROFILE is defined)
// IMPORTANT: For every Reigster there must be an End
void DVProfRegister(const char* pname); // first checks if this profiler exists in g_listProfilers
void DVProfEnd(u32 dwUserData);
void DVProfWrite(const char* pfilename, u32 frames = 0);
void DVProfClear(); // clears all the profilers
//#define DVPROFILE // comment out to disable profiling
#if defined(DVPROFILE) && (defined(_WIN32)||defined(WIN32))
#ifdef _MSC_VER
#ifndef __PRETTY_FUNCTION__
#define __PRETTY_FUNCTION__ __FUNCTION__
#endif
#endif
#define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__);
class DVProfileFunc
{
public:
u32 dwUserData;
DVProfileFunc(const char* pname) { DVProfRegister(pname); dwUserData = 0; }
DVProfileFunc(const char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); }
~DVProfileFunc() { DVProfEnd(dwUserData); }
};
#else
#define DVSTARTPROFILE()
class DVProfileFunc
{
public:
u32 dwUserData;
__forceinline DVProfileFunc(const char* pname) {}
__forceinline DVProfileFunc(const char* pname, u32 dwUserData) { }
~DVProfileFunc() {}
};
#endif
#endif

View File

@ -25,6 +25,7 @@
#include <wx/aboutdlg.h>
#include "../Globals.h"
#include "main.h"
#include "../../Core/Src/Core.h"
#include "Win32.h"
@ -118,6 +119,7 @@ namespace EmuWindow
hypotheticalScene->sendMessage(KEYDOWN...);
*/
}
g_VideoInitialize.pKeyPress(LOWORD(wParam), GetAsyncKeyState(VK_SHIFT) != 0, GetAsyncKeyState(VK_CONTROL) != 0);
break;
case WM_CLOSE:

View File

@ -25,6 +25,7 @@
// called. The reason is that the vertex format affects the sizes of the vertices.
#include "Globals.h"
#include "Profiler.h"
#include "OpcodeDecoding.h"
#include "VertexLoader.h"
#include "VertexShaderManager.h"

View File

@ -21,6 +21,7 @@
#include <cmath>
#include <assert.h>
#include "Profiler.h"
#include "PixelShader.h"
#include "XFMemory.h" // for texture projection mode
#include "BPMemory.h"

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "Profiler.h"
#include <cmath>

View File

@ -23,6 +23,7 @@
#endif
#include "GLInit.h"
#include "Profiler.h"
#include "Render.h"
#include "OpcodeDecoding.h"
#include "BPStructs.h"

View File

@ -20,6 +20,7 @@
#endif
#include "Globals.h"
#include "Profiler.h"
#include "Render.h"

View File

@ -20,6 +20,7 @@
#include <assert.h>
#include "x64Emitter.h"
#include "Profiler.h"
#include "Render.h"
#include "VertexLoader.h"

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "Profiler.h"
#include <math.h>
#include "BPStructs.h"

View File

@ -18,6 +18,8 @@
#include "Globals.h"
#include "Profiler.h"
#include <math.h>
#include "Render.h"
#include "VertexShader.h"