finish proper window handling, fix the modal state of the config dialogs, plus some minor cleanup/changes :p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5129 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
luisr142004
2010-02-25 06:12:35 +00:00
parent 4915097d93
commit 816febd3b0
33 changed files with 422 additions and 454 deletions
+1 -1
View File
@@ -317,7 +317,7 @@ void *CPluginManager::LoadPlugin(const char *_rFilename)
return NULL;
}
// Check that the plugin has both all the common and all the type specific functions
// Check that the plugin has all the common and all the type specific functions
if (!plugin->IsValid())
{
PanicAlert("Can't open %s, it has a missing function", _rFilename);
+3 -3
View File
@@ -23,7 +23,7 @@
BEGIN_EVENT_TABLE(AboutDolphin, wxDialog)
EVT_CLOSE(AboutDolphin::OnClose)
EVT_BUTTON(ID_CLOSE, AboutDolphin::CloseClick)
EVT_BUTTON(wxID_CLOSE, AboutDolphin::CloseClick)
END_EVENT_TABLE()
AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
@@ -38,7 +38,7 @@ AboutDolphin::~AboutDolphin()
void AboutDolphin::CreateGUIControls()
{
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Close = new wxButton(this, wxID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
//miloszwl@miloszwl.com (miloszwl.deviantart.com)
wxMemoryInputStream istream(dolphin_logo_png, sizeof dolphin_logo_png);
@@ -79,8 +79,8 @@ void AboutDolphin::CreateGUIControls()
this->SetSizer(sMain);
sMain->Layout();
CenterOnParent();
Fit();
CenterOnParent();
}
void AboutDolphin::OnClose(wxCloseEvent& WXUNUSED (event))
+2 -3
View File
@@ -29,7 +29,7 @@ class AboutDolphin : public wxDialog
{
public:
AboutDolphin(wxWindow *parent,
wxWindowID id = 1,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("About Dolphin"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@@ -52,8 +52,7 @@ class AboutDolphin : public wxDialog
enum
{
ID_CLOSE = 1000,
ID_LOGO,
ID_LOGO = 1000,
ID_MESSAGE
};
+11 -6
View File
@@ -327,7 +327,7 @@ CFrame::CFrame(wxFrame* parent,
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL)
, m_LogWindow(NULL)
, UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
, m_bModalDialogOpen(false), m_bControlsCreated(false), m_StopDlg(NULL)
, m_bControlsCreated(false), m_StopDlg(NULL)
#if wxUSE_TIMER
#ifdef _WIN32
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
@@ -610,10 +610,15 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
break;
default:
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
break;
default:
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
return 0;
}
#endif
@@ -928,13 +933,13 @@ void X11_ShowFullScreen(bool bF)
void CFrame::DoFullscreen(bool bF)
{
#if defined HAVE_X11 && HAVE_X11
if ((Core::GetState() == Core::CORE_RUN) && !m_bModalDialogOpen)
if ((Core::GetState() == Core::CORE_RUN))
X11_ShowFullScreen(bF);
#endif
// Only switch this to fullscreen if we're rendering to main AND if we're running a game
// plus if a modal dialog is open, this will still process the keyboard events, and may cause
// the main window to become unresponsive, so we have to avoid that.
if ((bRenderToMain && Core::GetState() == Core::CORE_RUN) && !m_bModalDialogOpen)
if ((bRenderToMain && Core::GetState() == Core::CORE_RUN))
{
ShowFullScreen(bF);
@@ -1055,4 +1060,4 @@ void CFrame::ListTopWindows()
j++;
}
NOTICE_LOG(CONSOLE, "\n");
}
}
-1
View File
@@ -199,7 +199,6 @@ class CFrame : public wxFrame
bool m_bEdit;
bool m_bTabSplit;
bool m_bNoDocking;
bool m_bModalDialogOpen;
bool m_bControlsCreated;
char newDiscpath[2048];
wxMessageDialog *m_StopDlg;
@@ -282,6 +282,7 @@ void CMemcardManager::CreateGUIControls()
this->SetSizer(sMain);
sMain->SetSizeHints(this);
Fit();
Center();
for (int i = SLOT_A; i < SLOT_B + 1; i++)
{
+2 -3
View File
@@ -47,12 +47,11 @@
#endif
class CMemcardManager
: public wxDialog
class CMemcardManager : public wxDialog
{
public:
CMemcardManager(wxWindow *parent, wxWindowID id = 1, const wxString& title = wxT(MEMCARDMAN_TITLE),
CMemcardManager(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString& title = wxT(MEMCARDMAN_TITLE),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = MEMCARD_MANAGER_STYLE);
virtual ~CMemcardManager();
@@ -25,16 +25,13 @@ BEGIN_EVENT_TABLE(DSPConfigDialogHLE, wxDialog)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_RE0_FIX, DSPConfigDialogHLE::SettingsChanged)
EVT_CHOICE(wxID_ANY, DSPConfigDialogHLE::BackendChanged)
EVT_CHOICE(ID_BACKEND, DSPConfigDialogHLE::BackendChanged)
EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogHLE::VolumeChanged)
END_EVENT_TABLE()
DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style)
{
// Center window
CenterOnParent();
m_OK = new wxButton(this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxStaticBoxSizer *sbSettings = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Sound Settings"));
@@ -94,6 +91,9 @@ DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wx
sButtons->Add(m_OK, 0, wxALL, 1);
sMain->Add(sButtons, 0, wxALL|wxEXPAND, 4);
SetSizerAndFit(sMain);
// Center window
CenterOnParent();
}
// Add audio output options
@@ -28,7 +28,7 @@ class DSPConfigDialogHLE : public wxDialog
{
public:
DSPConfigDialogHLE(wxWindow *parent,
wxWindowID id = 1,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@@ -52,7 +52,6 @@ private:
enum
{
wxID_OK,
ID_ENABLE_HLE_AUDIO,
ID_ENABLE_DTK_MUSIC,
ID_ENABLE_THROTTLE,
+21 -22
View File
@@ -99,8 +99,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
wxUninitialize();
#endif
break;
default:
break;
}
g_hInstance = hinstDLL;
@@ -147,12 +145,12 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) ");
sprintf_s(_PluginInfo->Name, 100, "Dolphin DSP-HLE Plugin (DebugFast) ");
#else
#ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin ");
sprintf_s(_PluginInfo->Name, 100, "Dolphin DSP-HLE Plugin ");
#else
sprintf(_PluginInfo ->Name, "Dolphin DSP-HLE Plugin (Debug) ");
sprintf_s(_PluginInfo->Name, 100, "Dolphin DSP-HLE Plugin (Debug) ");
#endif
#endif
}
@@ -171,28 +169,29 @@ void DllConfig(HWND _hParent)
g_Config.Load();
g_Config.GameIniLoad(globals->game_ini);
if (!m_ConfigFrame)
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new DSPConfigDialogHLE(frame);
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter)
{
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new DSPConfigDialogHLE(frame);
m_ConfigFrame->AddBackend((*iter).c_str());
}
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
// Only allow one open at a time
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter)
{
m_ConfigFrame->AddBackend((*iter).c_str());
}
// Only allow one open at a time
m_ConfigFrame->ShowModal();
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
#ifdef _WIN32
frame->SetHWND(NULL);
frame->SetHWND(NULL);
#endif
delete frame;
frame->Destroy();
}
#endif
}
@@ -23,7 +23,7 @@ BEGIN_EVENT_TABLE(DSPConfigDialogLLE, wxDialog)
EVT_BUTTON(wxID_OK, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogLLE::SettingsChanged)
EVT_CHOICE(wxID_ANY, DSPConfigDialogLLE::BackendChanged)
EVT_CHOICE(ID_BACKEND, DSPConfigDialogLLE::BackendChanged)
EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogLLE::VolumeChanged)
END_EVENT_TABLE()
@@ -33,9 +33,6 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
// Load config settings
g_Config.Load();
// Center window
CenterOnParent();
m_OK = new wxButton(this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxStaticBoxSizer *sbSettings = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Sound Settings"));
@@ -89,6 +86,8 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
sMain->Add(sButtons, 0, wxALL|wxEXPAND, 4);
SetSizerAndFit(sMain);
// Center window
CenterOnParent();
}
// Add audio output options
@@ -28,7 +28,7 @@ class DSPConfigDialogLLE : public wxDialog
{
public:
DSPConfigDialogLLE(wxWindow *parent,
wxWindowID id = 1,
wxWindowID id = wxID_ANY,
const wxString &title = wxT("Dolphin DSP-LLE Plugin Settings"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@@ -50,7 +50,6 @@ private:
enum
{
wxID_OK,
ID_ENABLE_DTK_MUSIC,
ID_ENABLE_THROTTLE,
ID_BACKEND,
+24 -26
View File
@@ -86,8 +86,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
wxUninitialize();
#endif
break;
default:
break;
}
g_hInstance = hinstDLL;
@@ -117,12 +115,12 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DebugFast)");
sprintf_s(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DebugFast)");
#else
#ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin");
sprintf_s(_PluginInfo->Name, "Dolphin DSP-LLE Plugin");
#else
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (Debug)");
sprintf_s(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (Debug)");
#endif
#endif
}
@@ -136,29 +134,29 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
void DllConfig(HWND _hParent)
{
#if defined(HAVE_WX) && HAVE_WX
if (!m_ConfigFrame)
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new DSPConfigDialogLLE(frame);
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter)
{
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new DSPConfigDialogLLE(frame);
// add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter)
{
m_ConfigFrame->AddBackend((*iter).c_str());
}
// Only allow one open at a time
m_ConfigFrame->ShowModal();
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
#ifdef _WIN32
frame->SetHWND(NULL);
#endif
delete frame;
m_ConfigFrame->AddBackend((*iter).c_str());
}
// Only allow one open at a time
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
#ifdef _WIN32
frame->SetHWND(NULL);
#endif
frame->Destroy();
#endif
}
@@ -42,8 +42,8 @@
// The wxWidgets class
BEGIN_EVENT_TABLE(GCPadConfigDialog,wxDialog)
EVT_CLOSE(GCPadConfigDialog::OnClose)
EVT_BUTTON(ID_OK, GCPadConfigDialog::OnCloseClick)
EVT_BUTTON(ID_CANCEL, GCPadConfigDialog::OnCloseClick)
EVT_BUTTON(wxID_OK, GCPadConfigDialog::OnCloseClick)
EVT_BUTTON(wxID_CANCEL, GCPadConfigDialog::OnCloseClick)
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, GCPadConfigDialog::NotebookPageChanged)
EVT_CHOICE(IDC_JOYNAME, GCPadConfigDialog::ChangeSettings)
@@ -178,11 +178,11 @@ void GCPadConfigDialog::OnCloseClick(wxCommandEvent& event)
{
switch (event.GetId())
{
case ID_OK:
case wxID_OK:
g_Config.Save();
Close(); // Call OnClose()
break;
case ID_CANCEL:
case wxID_CANCEL:
g_Config.Load();
Close(); // Call OnClose()
break;
@@ -736,9 +736,9 @@ void GCPadConfigDialog::CreateGUIControls()
m_Controller[i]->SetSizer(m_sMain[i]);
}
m_OK = new wxButton(this, ID_OK, wxT("OK"));
m_OK = new wxButton(this, wxID_OK, wxT("OK"));
m_OK->SetToolTip(wxT("Save changes and close"));
m_Cancel = new wxButton(this, ID_CANCEL, wxT("Cancel"));
m_Cancel = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
m_Cancel->SetToolTip(wxT("Discard changes and close"));
wxBoxSizer* m_DlgButton = new wxBoxSizer(wxHORIZONTAL);
m_DlgButton->AddStretchSpacer();
+2 -4
View File
@@ -45,7 +45,7 @@
class GCPadConfigDialog : public wxDialog
{
public:
GCPadConfigDialog(wxWindow *parent, wxWindowID id = 1,
GCPadConfigDialog(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxString &title = wxT("Gamecube Pad Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
@@ -92,9 +92,7 @@ class GCPadConfigDialog : public wxDialog
IDB_TRIGGER_L, IDB_TRIGGER_R,
// Dialog controls
ID_OK = 1000,
ID_CANCEL,
ID_NOTEBOOK,
ID_NOTEBOOK = 1000,
ID_CONTROLLERPAGE1,
ID_CONTROLLERPAGE2,
ID_CONTROLLERPAGE3,
+11 -11
View File
@@ -96,8 +96,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
wxUninitialize();
#endif
break;
default:
break;
}
g_hInstance = hinstDLL;
@@ -163,17 +161,19 @@ void DllConfig(HWND _hParent)
}
#if defined(HAVE_WX) && HAVE_WX
if (!m_ConfigFrame)
{
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new GCPadConfigDialog(frame);
m_ConfigFrame->ShowModal();
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new GCPadConfigDialog(frame);
frame->Disable();
m_ConfigFrame->ShowModal();
frame->Enable();
m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
#ifdef _WIN32
frame->SetHWND(NULL);
frame->SetHWND(NULL);
#endif
delete frame;
frame->Destroy();
}
#endif
}
@@ -109,9 +109,6 @@ struct TabDirect3D : public W32Util::Tab
case IDC_WIDESCREEN_HACK:
g_Config.bWidescreenHack = Button_GetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK)) ? true : false;
break;
case IDC_WIREFRAME:
g_Config.bWireFrame = Button_GetCheck(GetDlgItem(hDlg,IDC_WIREFRAME)) ? true : false;
break;
case IDC_SAFE_TEXTURE_CACHE:
g_Config.bSafeTextureCache = Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE)) == 0 ? false : true;
break;
@@ -302,7 +302,7 @@ void PixelShaderCache::Init()
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
char cache_filename[MAX_PATH];
sprintf(cache_filename, "%s%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX), globals->unique_id);
sprintf(cache_filename, "%s%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX), globals->unique_id);
PixelShaderCacheInserter inserter;
int read_items = g_ps_disk_cache.OpenAndRead(cache_filename, &inserter);
}
+66 -70
View File
@@ -129,10 +129,10 @@ static const D3DBLEND d3dDestFactors[8] =
static const D3DBLENDOP d3dLogincOPop[16] =
{
D3DBLENDOP_ADD,//0
D3DBLENDOP_ADD,//1
D3DBLENDOP_SUBTRACT,//2
D3DBLENDOP_ADD,//3
D3DBLENDOP_REVSUBTRACT,//4
D3DBLENDOP_ADD,//1
D3DBLENDOP_SUBTRACT,//2
D3DBLENDOP_ADD,//3
D3DBLENDOP_REVSUBTRACT,//4
D3DBLENDOP_ADD,//5
D3DBLENDOP_MAX,//6
D3DBLENDOP_ADD,//7
@@ -284,7 +284,7 @@ bool Renderer::Init()
// TODO: Grab target width from configured resolution?
s_target_width = s_backbuffer_width;
s_target_height = s_backbuffer_height * ((float)EFB_HEIGHT / 480.0f);
s_target_height = s_backbuffer_height * ((float)EFB_HEIGHT / 480.0f);
s_LastAA = (g_ActiveConfig.iMultisampleMode > 3)?0:g_ActiveConfig.iMultisampleMode;
switch (s_LastAA)
@@ -308,7 +308,7 @@ bool Renderer::Init()
xScale = (float)s_target_width / (float)EFB_WIDTH;
yScale = (float)s_target_height / (float)EFB_HEIGHT;
s_Fulltarget_width = s_target_width;
s_Fulltarget_height = s_target_height;
s_Fulltarget_height = s_target_height;
s_LastFrameDumped = false;
s_AVIDumping = false;
@@ -345,19 +345,17 @@ bool Renderer::Init()
D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x0, 1.0f, 0);
D3D::BeginFrame();
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, true);
D3D::dev->CreateOffscreenPlainSurface(s_backbuffer_width,s_backbuffer_height, FBManager::GetEFBColorRTSurfaceFormat(), D3DPOOL_SYSTEMMEM, &ScreenShootMEMSurface, NULL );
D3D::dev->CreateOffscreenPlainSurface(s_backbuffer_width,s_backbuffer_height, FBManager::GetEFBColorRTSurfaceFormat(), D3DPOOL_SYSTEMMEM, &ScreenShootMEMSurface, NULL );
return true;
}
void Renderer::Shutdown()
{
TeardownDeviceObjects();
D3D::EndFrame();
D3D::Present();
D3D::Close();
if (s_AVIDumping)
{
AVIDump::Stop();
@@ -415,7 +413,7 @@ void Renderer::DrawDebugText()
break;
}
std::string OSDM22 =
g_ActiveConfig.bCrop ? " (crop)" : "";
g_ActiveConfig.bCrop ? " (crop)" : "";
std::string OSDM3 = g_ActiveConfig.bEFBCopyDisable ? "Disabled" :
g_ActiveConfig.bCopyEFBToTexture ? "To Texture" : "To RAM";
@@ -435,14 +433,14 @@ void Renderer::DrawDebugText()
T1 += (OSDChoice == -2) ? T0.at(1) : "\n";
T1 += (OSDChoice == -3) ? T0.at(2) : "\n";
T1 += (OSDChoice == -4) ? T0.at(3) : "\n";
T1 += (OSDChoice == -5) ? T0.at(4) : "\n";
T1 += (OSDChoice == -5) ? T0.at(4) : "\n";
// The other settings in cyan
T2 += (OSDChoice != -1) ? T0.at(0) : "\n";
T2 += (OSDChoice != -2) ? T0.at(1) : "\n";
T2 += (OSDChoice != -3) ? T0.at(2) : "\n";
T2 += (OSDChoice != -4) ? T0.at(3) : "\n";
T2 += (OSDChoice != -5) ? T0.at(4) : "\n";
T2 += (OSDChoice != -5) ? T0.at(4) : "\n";
// Render a shadow, and then the text
Renderer::RenderText(T1.c_str(), 21, 21, 0xDD000000);
@@ -570,7 +568,7 @@ static void EFBTextureToD3DBackBuffer(const EFBRectangle& sourceRc)
D3D::dev->SetViewport(&vp);
EFBRectangle efbRect;
EFBRectangle efbRect;
LPDIRECT3DTEXTURE9 read_texture = FBManager::GetEFBColorTexture(efbRect);
RECT destinationrect;
@@ -584,13 +582,13 @@ static void EFBTextureToD3DBackBuffer(const EFBRectangle& sourceRc)
sourcerect.right = src_rect.right;
sourcerect.top = src_rect.top;
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
int SSAAMode = ( g_ActiveConfig.iMultisampleMode > 3 )? 0 : g_ActiveConfig.iMultisampleMode;
D3D::drawShadedTexQuad(read_texture,&sourcerect,Renderer::GetFullTargetWidth(),Renderer::GetFullTargetHeight(),PixelShaderCache::GetColorCopyProgram(SSAAMode),(SSAAMode != 0)?VertexShaderCache::GetFSAAVertexShader():VertexShaderCache::GetSimpleVertexShader());
D3D::drawShadedTexQuad(read_texture,&sourcerect,Renderer::GetFullTargetWidth(),Renderer::GetFullTargetHeight(),PixelShaderCache::GetColorCopyProgram(SSAAMode),(SSAAMode != 0)?VertexShaderCache::GetFSAAVertexShader():VertexShaderCache::GetSimpleVertexShader());
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
D3D::RefreshSamplerState(0, D3DSAMP_MAGFILTER);
vp.X = 0;
@@ -638,7 +636,7 @@ static void EFBTextureToD3DBackBuffer(const EFBRectangle& sourceRc)
ScreenShootMEMSurface->UnlockRect();
}
}
s_LastFrameDumped = true;
s_LastFrameDumped = true;
}
else
{
@@ -674,8 +672,6 @@ static void EFBTextureToD3DBackBuffer(const EFBRectangle& sourceRc)
OSD::DrawMessages();
}
void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc)
{
if (g_bSkipCurrentFrame)
@@ -688,7 +684,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
Renderer::ResetAPIState();
// Set the backbuffer as the rendering target
D3D::dev->SetDepthStencilSurface(NULL);
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
EFBTextureToD3DBackBuffer(sourceRc);
@@ -704,13 +700,13 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
);
Swap(0,FIELD_PROGRESSIVE,0,0); // we used to swap the buffer here, now we will wait
// until the XFB pointer is updated by VI
// until the XFB pointer is updated by VI
D3D::BeginFrame();
Renderer::RestoreAPIState();
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
UpdateViewport();
VertexShaderManager::SetViewportChanged();
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
UpdateViewport();
VertexShaderManager::SetViewportChanged();
}
bool Renderer::SetScissorRect()
@@ -734,7 +730,7 @@ bool Renderer::SetScissorRect()
if (rc.left < 0) rc.left = 0;
if (rc.right < 0) rc.right = 0;
if (rc.left > s_target_width) rc.left = s_target_width;
if (rc.right > s_target_width) rc.right = s_target_width;
if (rc.right > s_target_width) rc.right = s_target_width;
if (rc.top < 0) rc.top = 0;
if (rc.bottom < 0) rc.bottom = 0;
if (rc.top > s_target_height) rc.top = s_target_height;
@@ -886,7 +882,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
Renderer::GetFullTargetWidth() ,
Renderer::GetFullTargetHeight(),
(BufferFormat == FOURCC_RAWZ)?PixelShaderCache::GetColorMatrixProgram(0):PixelShaderCache::GetDepthMatrixProgram(0),
VertexShaderCache::GetSimpleVertexShader());
VertexShaderCache::GetSimpleVertexShader());
D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER);
@@ -928,7 +924,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
if ((hr = pOffScreenBuffer->LockRect(&drect, &RectToLock, D3DLOCK_READONLY)) != D3D_OK)
{
PanicAlert("ERROR: %s", hr == D3DERR_WASSTILLDRAWING ? "Still drawing" :
hr == D3DERR_INVALIDCALL ? "Invalid call" : "w00t");
hr == D3DERR_INVALIDCALL ? "Invalid call" : "w00t");
return 0;
}
@@ -938,7 +934,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
switch (ReadBufferFormat)
{
case D3DFMT_R32F:
val = ((float *)drect.pBits)[6];
val = ((float *)drect.pBits)[6];
break;
default:
float ffrac = 1.0f/255.0f;
@@ -947,12 +943,12 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
ffrac*= 1 / 255.0f;
val += ((float)((z>>8) & 0xFF)) * ffrac;
ffrac*= 1 / 255.0f;
val += ((float)(z & 0xFF)) * ffrac;
val += ((float)(z & 0xFF)) * ffrac;
break;
};
z = ((u32)(val * 0xffffff));
}
break;
break;
case POKE_Z:
// TODO: Get that Z value to poke from somewhere
//((float *)drect.pBits)[0] = val;
@@ -980,12 +976,12 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
void UpdateViewport()
{
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
// [0] = width/2
// [1] = height/2
// [2] = 16777215 * (farz - nearz)
// [3] = xorig + width/2 + 342
// [4] = yorig + height/2 + 342
// [5] = 16777215 * farz
// [0] = width/2
// [1] = height/2
// [2] = 16777215 * (farz - nearz)
// [3] = xorig + width/2 + 342
// [4] = yorig + height/2 + 342
// [5] = 16777215 * farz
int scissorXOff = bpmem.scissorOffset.x * 2;
int scissorYOff = bpmem.scissorOffset.y * 2;
@@ -998,19 +994,19 @@ void UpdateViewport()
D3DVIEWPORT9 vp;
// Stretch picture with increased internal resolution
int X = (int)(ceil(xfregs.rawViewport[3] - xfregs.rawViewport[0] - (scissorXOff)) * MValueX) + Xstride;
int X = (int)(ceil(xfregs.rawViewport[3] - xfregs.rawViewport[0] - (scissorXOff)) * MValueX) + Xstride;
int Y = (int)(ceil(xfregs.rawViewport[4] + xfregs.rawViewport[1] - (scissorYOff)) * MValueY) + Ystride;
int Width = (int)ceil((int)(2 * xfregs.rawViewport[0]) * MValueX);
int Height = (int)ceil((int)(-2 * xfregs.rawViewport[1]) * MValueY);
if (Width < 0)
{
X += Width;
Width*=-1;
Width*=-1;
}
if (Height < 0)
{
Y += Height;
Height *= -1;
Height *= -1;
}
bool sizeChanged = false;
if(X < 0)
@@ -1062,7 +1058,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
{
// Update the view port for clearing the picture
D3DVIEWPORT9 vp;
D3DVIEWPORT9 vp;
vp.X = 0;
vp.Y = 0;
vp.Width = Renderer::GetFullTargetWidth();
@@ -1079,13 +1075,13 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
sirc.top = targetRc.top;
sirc.right = targetRc.right;
sirc.bottom = targetRc.bottom;
D3D::dev->SetScissorRect(&sirc);
D3D::dev->SetScissorRect(&sirc);
if (zEnable)
D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
D3D::drawClearQuad(color ,(z & 0xFFFFFF) / float(0xFFFFFF),PixelShaderCache::GetClearProgram(),VertexShaderCache::GetClearVertexShader());
D3D::drawClearQuad(color ,(z & 0xFFFFFF) / float(0xFFFFFF),PixelShaderCache::GetClearProgram(),VertexShaderCache::GetClearVertexShader());
if (zEnable)
D3D::RefreshRenderState(D3DRS_ZFUNC);
//D3D::dev->Clear(0, NULL, (colorEnable ? D3DCLEAR_TARGET : 0)| ( zEnable ? D3DCLEAR_ZBUFFER : 0), color | ((alphaEnable)?0:0xFF000000),(z & 0xFFFFFF) / float(0xFFFFFF), 0);
//D3D::dev->Clear(0, NULL, (colorEnable ? D3DCLEAR_TARGET : 0)| ( zEnable ? D3DCLEAR_ZBUFFER : 0), color | ((alphaEnable)?0:0xFF000000),(z & 0xFFFFFF) / float(0xFFFFFF), 0);
UpdateViewport();
SetScissorRect();
}
@@ -1101,9 +1097,9 @@ void Renderer::SetBlendMode(bool forceUpdate)
return;
u32 newval = bpmem.blendmode.subtract << 2;
if (bpmem.blendmode.subtract) {
newval |= 0x0049; // enable blending src 1 dst 1
} else if (bpmem.blendmode.blendenable) {
if (bpmem.blendmode.subtract) {
newval |= 0x0049; // enable blending src 1 dst 1
} else if (bpmem.blendmode.blendenable) {
newval |= 1; // enable blending
newval |= bpmem.blendmode.srcfactor << 3;
newval |= bpmem.blendmode.dstfactor << 6;
@@ -1112,12 +1108,12 @@ void Renderer::SetBlendMode(bool forceUpdate)
u32 changes = forceUpdate ? 0xFFFFFFFF : newval ^ s_blendMode;
if (changes & 1) {
// blend enable change
// blend enable change
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, (newval & 1));
}
if (changes & 4) {
if (changes & 4) {
// subtract enable change
D3D::SetRenderState(D3DRS_BLENDOP, newval & 4 ? D3DBLENDOP_REVSUBTRACT : D3DBLENDOP_ADD);
}
@@ -1125,7 +1121,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
if (changes & 0x1F8) {
// blend RGB change
D3D::SetRenderState(D3DRS_SRCBLEND, d3dSrcFactors[(newval >> 3) & 7]);
D3D::SetRenderState(D3DRS_DESTBLEND, d3dDestFactors[(newval >> 6) & 7]);
D3D::SetRenderState(D3DRS_DESTBLEND, d3dDestFactors[(newval >> 6) & 7]);
}
s_blendMode = newval;
@@ -1155,7 +1151,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
if(newAA != s_LastAA)
{
s_target_width = s_backbuffer_width;
s_target_height = s_backbuffer_height * ((float)EFB_HEIGHT / 480.0f);
s_target_height = s_backbuffer_height * ((float)EFB_HEIGHT / 480.0f);
s_LastAA = newAA;
switch (s_LastAA)
{
@@ -1190,14 +1186,14 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
// Count FPS.
// -------------
static int fpscount = 0;
static unsigned long lasttime;
++fpscount;
static unsigned long lasttime;
++fpscount;
if (Common::Timer::GetTimeMs() - lasttime > 1000)
{
lasttime = Common::Timer::GetTimeMs();
s_fps = fpscount - 1;
fpscount = 0;
}
{
lasttime = Common::Timer::GetTimeMs();
s_fps = fpscount - 1;
fpscount = 0;
}
// Begin new frame
// Set default viewport and scissor, for the clear to work correctly
@@ -1210,11 +1206,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
void Renderer::ResetAPIState()
{
D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
D3D::SetRenderState(D3DRS_ZENABLE, FALSE);
D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
D3D::SetRenderState(D3DRS_ZENABLE, FALSE);
D3D::SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
DWORD color_mask = D3DCOLORWRITEENABLE_ALPHA| D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
DWORD color_mask = D3DCOLORWRITEENABLE_ALPHA| D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, color_mask);
}
@@ -1225,14 +1221,14 @@ void Renderer::RestoreAPIState()
UpdateViewport();
SetScissorRect();
if (bpmem.zmode.testenable) D3D::SetRenderState(D3DRS_ZENABLE, TRUE);
if (bpmem.zmode.updateenable) D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
SetColorMask();
if (bpmem.zmode.updateenable) D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
SetColorMask();
SetLogicOpMode();
}
void Renderer::SetGenerationMode()
{
D3D::SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
D3D::SetRenderState(D3DRS_CULLMODE, d3dCullModes[bpmem.genMode.cullmode]);
}
void Renderer::SetDepthMode()
@@ -1241,13 +1237,13 @@ void Renderer::SetDepthMode()
{
D3D::SetRenderState(D3DRS_ZENABLE, TRUE);
D3D::SetRenderState(D3DRS_ZWRITEENABLE, bpmem.zmode.updateenable);
D3D::SetRenderState(D3DRS_ZFUNC, d3dCmpFuncs[bpmem.zmode.func]);
D3D::SetRenderState(D3DRS_ZFUNC, d3dCmpFuncs[bpmem.zmode.func]);
}
else
{
D3D::SetRenderState(D3DRS_ZENABLE, FALSE);
D3D::SetRenderState(D3DRS_ZWRITEENABLE, FALSE); // ??
}
D3D::SetRenderState(D3DRS_ZWRITEENABLE, FALSE); // ??
}
}
void Renderer::SetLogicOpMode()
@@ -1255,7 +1251,7 @@ void Renderer::SetLogicOpMode()
if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3)
{
s_blendMode = 0;
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
D3D::SetRenderState(D3DRS_BLENDOP, d3dLogincOPop[bpmem.blendmode.logicmode]);
D3D::SetRenderState(D3DRS_SRCBLEND, d3dLogicOpSrcFactors[bpmem.blendmode.logicmode]);
D3D::SetRenderState(D3DRS_DESTBLEND, d3dLogicOpDestFactors[bpmem.blendmode.logicmode]);
@@ -1268,7 +1264,7 @@ void Renderer::SetLogicOpMode()
void Renderer::SetDitherMode()
{
D3D::SetRenderState(D3DRS_DITHERENABLE,bpmem.blendmode.dither);
D3D::SetRenderState(D3DRS_DITHERENABLE,bpmem.blendmode.dither);
}
void Renderer::SetLineWidth()
+1 -3
View File
@@ -150,8 +150,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
wxUninitialize();
#endif
break;
default:
break;
}
g_hInstance = hinstDLL;
@@ -201,7 +199,7 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
void DllAbout(HWND _hParent)
{
DialogBoxA(g_hInstance,(LPCSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc);
DialogBox(g_hInstance,(LPCTSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc);
}
void DllConfig(HWND _hParent)

Some files were not shown because too many files have changed in this diff Show More