Working screenshots for everyone! This may not be the 'best' way to implement it but it's the most compatible, working and least mutually exclusive as possible (works with DC too). More coming soon.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2449 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY
2009-02-27 03:56:34 +00:00
parent 8f303fb63e
commit c19210b641
11 changed files with 110 additions and 71 deletions

View File

@ -649,12 +649,8 @@ EState GetState()
}
return CORE_UNINITIALIZED;
}
///////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Save or recreate the emulation state
// ----------
void SaveState() {
State_Save(0);
}
@ -662,28 +658,9 @@ void SaveState() {
void LoadState() {
State_Load(0);
}
///////////////////////////////////////
bool MakeScreenshot(const std::string &filename)
{
bool bResult = false;
CPluginManager &pManager = CPluginManager::GetInstance();
if (pManager.GetVideo()->IsValid())
{
TCHAR szTmpFilename[MAX_PATH];
strcpy(szTmpFilename, filename.c_str());
bResult = pManager.GetVideo()->Video_Screenshot(szTmpFilename) ? true : false;
}
return bResult;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// --- Callbacks for plugins / engine ---
/////////////////////////////////////////////////////////////////////////////////////////////////////
// __________________________________________________________________________________________________
// Callback_VideoLog

View File

@ -55,8 +55,6 @@ namespace Core
const SCoreStartupParameter& GetStartupParameter();
extern SCoreStartupParameter g_CoreStartupParameter;
// Make a screen shot
bool MakeScreenshot(const std::string& _rFilename);
void* GetWindowHandle();
bool GetRealWiimote();
void ReconnectWiimote();

View File

@ -248,6 +248,7 @@ EVT_MENU(IDM_HELPABOUT, CFrame::OnHelp)
EVT_MENU(wxID_REFRESH, CFrame::OnRefresh)
EVT_MENU(IDM_PLAY, CFrame::OnPlay)
EVT_MENU(IDM_STOP, CFrame::OnStop)
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
EVT_MENU(IDM_CONFIG_MAIN, CFrame::OnConfigMain)
EVT_MENU(IDM_CONFIG_GFX_PLUGIN, CFrame::OnPluginGFX)
EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)

View File

@ -125,6 +125,7 @@ class CFrame : public wxFrame
Toolbar_Play,
Toolbar_Stop,
Toolbar_Pause,
Toolbar_Screenshot,
Toolbar_FullScreen,
Toolbar_PluginOptions,
Toolbar_PluginGFX,
@ -180,6 +181,7 @@ class CFrame : public wxFrame
void OnPlay(wxCommandEvent& event); // Emulation
void OnChangeDisc(wxCommandEvent& event);
void OnStop(wxCommandEvent& event);
void OnScreenshot(wxCommandEvent& event);
void OnClose(wxCloseEvent &event);
void OnLoadState(wxCommandEvent& event);
void OnSaveState(wxCommandEvent& event);

View File

@ -195,6 +195,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
#ifdef _WIN32
toolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
#endif
toolBar->AddTool(IDM_SCREENSHOT, _T("Screenshot"), m_Bitmaps[Toolbar_FullScreen], _T("Screenshot"));
toolBar->AddSeparator();
toolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
toolBar->AddTool(IDM_CONFIG_GFX_PLUGIN, _T("Gfx"), m_Bitmaps[Toolbar_PluginGFX], _T("Graphics settings"));
@ -512,12 +513,32 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
{
m_GameListCtrl->BrowseForDirectory();
}
////////////////////////////////////////////////////
static inline void GenerateScreenshotName(std::string& name)
{
int index = 1;
std::string tempname;
tempname = FULL_SCREENSHOTS_DIR;
tempname += Core::GetStartupParameter().GetUniqueID();
name = StringFromFormat("%s-%d.bmp", tempname.c_str(), index);
while(File::Exists(name.c_str()))
name = StringFromFormat("%s-%d.bmp", tempname.c_str(), ++index);
}
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
{
std::string name;
GenerateScreenshotName(name);
Core::SetState(Core::CORE_PAUSE);
CPluginManager::GetInstance().GetVideo()->Video_Screenshot(name.c_str());
Core::SetState(Core::CORE_RUN);
}
//////////////////////////////////////////////////////////////////////////////////////
// Stop the emulation
// -------------
void CFrame::DoStop()
{
// Music modification
@ -741,6 +762,7 @@ void CFrame::UpdateGUI()
GetToolBar()->EnableTool(wxID_OPEN, !initialized);
GetToolBar()->EnableTool(wxID_REFRESH, !initialized); // Don't allow refresh when we don't show the list
GetToolBar()->EnableTool(IDM_STOP, running || paused);
GetToolBar()->EnableTool(IDM_SCREENSHOT, running || paused);
}
// File

View File

@ -52,6 +52,7 @@ enum
IDM_LOADSLOT10,
IDM_PLAY,
IDM_STOP,
IDM_SCREENSHOT,
IDM_BROWSE,
IDM_DRIVE1,
IDM_DRIVE24 = IDM_DRIVE1 + 23,//248,