Merge pull request #598 from turtleli/wxwidgets3_prep

Changes to make transition to wxWidgets3.0 on Windows easier
This commit is contained in:
Gregory Hainaut 2015-06-26 15:18:13 +02:00
commit 0c2dcf26f2
20 changed files with 274 additions and 178 deletions

View File

@ -183,12 +183,22 @@ public:
#include <wx/intl.h>
#include <wx/log.h>
#if defined(_WIN32) && wxMAJOR_VERSION >= 3
#include <wx/crt.h>
// This deals with a mode_t redefinition conflict. The mode_t doesn't seem to be
// used anywhere in w32pthreads, so I've chosen to use the wxWidgets mode_t
// (I think it's unsigned int vs signed int)
#include <wx/filefn.h>
#define HAVE_MODE_T
#endif
#include <stdexcept>
#include <cstring> // string.h under c++
#include <cstdio> // stdio.h under c++
#include <cstdlib>
#include <vector>
#include <list>
#include <algorithm>
#include "Pcsx2Defs.h"

View File

@ -21,12 +21,16 @@
#include <wx/tokenzr.h>
#if _WIN32
#define WX_STR(str) (str.wc_str())
#else
// Stupid wx3.0 doesn't support c_str for vararg function
#if wxMAJOR_VERSION >= 3
#define WX_STR(str) (static_cast<const char*>(str.c_str()))
#else
#define WX_STR(str) (str.c_str())
#endif
#endif
// --------------------------------------------------------------------------------------
// pxToUTF8

View File

@ -58,11 +58,7 @@ public:
virtual void OnActionButtonClicked( wxCommandEvent& evt );
};
#ifdef _MSC_VER
typedef std::list< wxEvent*, WXObjectAllocator(wxEvent*) > wxEventList;
#else
typedef std::list< wxEvent* > wxEventList;
#endif
typedef std::list< wxEvent* > wxEventList;
// --------------------------------------------------------------------------------------
// wxAppWithHelpers

View File

@ -26,11 +26,11 @@ bool pxIsEnglish( int id )
// --------------------------------------------------------------------------------------
const wxChar* __fastcall pxExpandMsg( const wxChar* englishContent )
{
#if wxMAJOR_VERSION >= 3
#if _WIN32 || wxMAJOR_VERSION < 3
return wxGetTranslation(englishContent);
#else
wxString translation = wxGetTranslation( englishContent );
return translation.wc_str();
#else
return wxGetTranslation( englishContent );
#endif
}
@ -50,10 +50,10 @@ const wxChar* __fastcall pxGetTranslation( const wxChar* message )
Console.WriteLn( Color_Green, L"Message: %s", message );
}
}
#if wxMAJOR_VERSION >= 3
#if _WIN32 || wxMAJOR_VERSION < 3
return wxGetTranslation(message);
#else
wxString translation = wxGetTranslation( message );
return translation.wc_str();
#else
return wxGetTranslation( message );
#endif
}

View File

@ -10,22 +10,16 @@
<PreprocessorDefinitions>wxUSE_UNICODE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
<Link Condition="'$(Configuration)'=='Release'
or '$(Configuration)'=='Release SSE2'
or '$(Configuration)'=='Release SSE4'
or '$(Configuration)'=='Release SSSE3'">
<AdditionalDependencies>wxAdv28.lib;wxBase28.lib;wxCore28.lib;zlib.lib;libjpeg7.lib;%(AdditionalDependencies)</AdditionalDependencies>
<Link Condition="'$(Configuration)'=='Release' &#xD;&#xA; or '$(Configuration)'=='Release SSE2'&#xD;&#xA; or '$(Configuration)'=='Release SSE4'&#xD;&#xA; or '$(Configuration)'=='Release SSSE3'">
<AdditionalDependencies>zlib.lib;libjpeg7.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SvnRootDir)\deps\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<Link Condition="'$(Configuration)'=='Debug'
or '$(Configuration)'=='Debug SSE2'
or '$(Configuration)'=='Debug SSE4'
or '$(Configuration)'=='Debug SSSE3'">
<AdditionalDependencies>wxAdv28-dbg.lib;wxBase28-dbg.lib;wxCore28-dbg.lib;zlib-dbg.lib;libjpeg7-dbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<Link Condition="'$(Configuration)'=='Debug' &#xD;&#xA; or '$(Configuration)'=='Debug SSE2'&#xD;&#xA; or '$(Configuration)'=='Debug SSE4'&#xD;&#xA; or '$(Configuration)'=='Debug SSSE3'">
<AdditionalDependencies>zlib-dbg.lib;libjpeg7-dbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SvnRootDir)\deps\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<Link Condition="'$(Configuration)'=='Devel'">
<AdditionalDependencies>wxAdv28-dev.lib;wxBase28-dev.lib;wxCore28-dev.lib;zlib-dev.lib;libjpeg7-dev.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlib-dev.lib;libjpeg7-dev.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SvnRootDir)\deps\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>

View File

@ -24,7 +24,7 @@
// Maybe some day we'll convert all file related ops to wxWidgets, which means also the
// instances at zlib_indexed.h (which use plain stdio FILE*)
#ifdef WIN32
# define PX_wfilename(name_wxstr) (WX_STR(name_wxstr))
# define PX_wfilename(name_wxstr) (name_wxstr.wc_str())
# define PX_fopen_rb(name_wxstr) (_wfopen(PX_wfilename(name_wxstr), L"rb"))
#else
# define PX_wfilename(name_wxstr) (name_wxstr.mbc_str())

View File

@ -271,7 +271,6 @@ set(pcsx2GuiSources
gui/Panels/MemoryCardListView.cpp
gui/Panels/ThemeSelectorPanel.cpp
gui/Dialogs/BaseConfigurationDialog.cpp
gui/Dialogs/BiosSelectorDialog.cpp
gui/Dialogs/ConfirmationDialogs.cpp
gui/Dialogs/CreateMemoryCardDialog.cpp
gui/Dialogs/FirstTimeWizard.cpp

View File

@ -95,7 +95,7 @@ static bool HandlePluginError( BaseException& ex )
return false;
}
g_Conf->SysSettingsTabName = L"Plugins";
g_Conf->ComponentsTabName = L"Plugins";
// TODO: Send a message to the panel to select the failed plugin.
@ -161,6 +161,59 @@ void PluginInitErrorEvent::InvokeEvent()
}
}
// Returns a string message telling the user to consult guides for obtaining a legal BIOS.
// This message is in a function because it's used as part of several dialogs in PCSX2 (there
// are multiple variations on the BIOS and BIOS folder checks).
wxString BIOS_GetMsg_Required()
{
return pxE(L"PCSX2 requires a PS2 BIOS in order to run. For legal reasons, you *must* obtain a BIOS from an actual PS2 unit that you own (borrowing doesn't count). Please consult the FAQs and Guides for further instructions."
);
}
class BIOSLoadErrorEvent : public pxExceptionEvent
{
typedef pxExceptionEvent _parent;
public:
BIOSLoadErrorEvent(BaseException* ex = NULL) : _parent(ex) {}
BIOSLoadErrorEvent(const BaseException& ex) : _parent(ex) {}
virtual ~BIOSLoadErrorEvent() throw() { }
virtual BIOSLoadErrorEvent *Clone() const { return new BIOSLoadErrorEvent(*this); }
protected:
void InvokeEvent();
};
static bool HandleBIOSError(BaseException& ex)
{
if (!pxDialogExists(L"CoreSettings"))
{
if (!Msgbox::OkCancel(ex.FormatDisplayMessage() + L"\n\n" + BIOS_GetMsg_Required()
+ L"\n\n" + _("Press Ok to go to the BIOS Configuration Panel."), _("PS2 BIOS Error")))
return false;
}
g_Conf->ComponentsTabName = L"BIOS";
return AppOpenModalDialog<Dialogs::ComponentsConfigDialog>() != wxID_CANCEL;
}
void BIOSLoadErrorEvent::InvokeEvent()
{
if (!m_except) return;
ScopedExcept deleteMe(m_except);
m_except = NULL;
if (!HandleBIOSError(*deleteMe))
{
Console.Warning("User canceled BIOS configuration.");
Msgbox::Alert(_("Warning! Valid BIOS has not been selected. PCSX2 may be inoperable."));
}
}
// Allows for activating menu actions from anywhere in PCSX2.
// And it's Thread Safe!
void Pcsx2App::PostMenuAction( MenuIdentifiers menu_id ) const
@ -227,7 +280,9 @@ protected:
IMPLEMENT_DYNAMIC_CLASS( Pcsx2AppMethodEvent, pxActionEvent )
#ifdef __WXGTK__
#ifdef __WXMSW__
extern int TranslateVKToWXK( u32 keysym );
#elif defined( __WXGTK__ )
extern int TranslateGDKtoWXK( u32 keysym );
#endif
@ -236,8 +291,9 @@ void Pcsx2App::PadKeyDispatch( const keyEvent& ev )
m_kevt.SetEventType( ( ev.evt == KEYPRESS ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP );
const bool isDown = (ev.evt == KEYPRESS);
//returns 0 for normal keys and a WXK_* value for special keys
#ifdef __WXMSW__
const int vkey = wxCharCodeMSWToWX( ev.key ); //returns 0 if plain ascii value or a WXK_... (<=32 or >=300) if a special key
const int vkey = TranslateVKToWXK(ev.key);
#elif defined( __WXGTK__ )
const int vkey = TranslateGDKtoWXK( ev.key );
#else
@ -277,12 +333,22 @@ void Pcsx2App::PadKeyDispatch( const keyEvent& ev )
// displaying a readable --help command line list, so I replace it here with a custom one
// that formats things nicer.
//
// This is only used in Windows. It's not possible to have wxWidgets show a localised
// command line help message in cmd/powershell/mingw bash. It can be done in English
// locales ( using AttachConsole, WriteConsole, FreeConsole combined with
// wxMessageOutputStderr), but completely fails for some other languages (i.e. Japanese).
#ifdef _WIN32
class pxMessageOutputMessageBox : public wxMessageOutput
{
public:
pxMessageOutputMessageBox() { }
#if wxMAJOR_VERSION < 3
virtual void Printf(const wxChar* format, ...);
#endif
// DoPrintf in wxMessageOutputBase (wxWidgets 3.0) uses this.
virtual void Output(const wxString &out);
};
// EXTRAORDINARY HACK! wxWidgets does not provide a clean way of overriding the commandline options
@ -291,21 +357,31 @@ public:
// wxMessageOutputMessageBox::PrintF is only used in like two places, so we can just check for the
// commandline window using an identifier we know is contained in it, and then format our own window
// display. :D --air
#if wxMAJOR_VERSION < 3
void pxMessageOutputMessageBox::Printf(const wxChar* format, ...)
{
using namespace pxSizerFlags;
va_list args;
va_start(args, format);
wxString out;
out.PrintfV(format, args);
va_end(args);
FastFormatUnicode isoFormatted;
isoFormatted.Write( L"[%s]", _("IsoFile") );
int pos = out.Find( isoFormatted.c_str() );
if(pos == wxNOT_FOUND)
Output(out);
}
#endif
void pxMessageOutputMessageBox::Output(const wxString& out)
{
using namespace pxSizerFlags;
wxString isoFormatted;
isoFormatted.Printf(L"[%s]", _("IsoFile"));
int pos = out.Find(isoFormatted.c_str());
// I've no idea when this is true.
if (pos == wxNOT_FOUND)
{
Msgbox::Alert( out ); return;
}
@ -337,6 +413,7 @@ void pxMessageOutputMessageBox::Printf(const wxChar* format, ...)
pxIssueConfirmation(popup, MsgButtons().Close() );
}
#endif
wxMessageOutput* Pcsx2AppTraits::CreateMessageOutput()
{
@ -531,16 +608,6 @@ void Pcsx2App::OnEmuKeyDown( wxKeyEvent& evt )
cmd->Invoke();
}
// Returns a string message telling the user to consult guides for obtaining a legal BIOS.
// This message is in a function because it's used as part of several dialogs in PCSX2 (there
// are multiple variations on the BIOS and BIOS folder checks).
wxString BIOS_GetMsg_Required()
{
return pxE( L"PCSX2 requires a PS2 BIOS in order to run. For legal reasons, you *must* obtain a BIOS from an actual PS2 unit that you own (borrowing doesn't count). Please consult the FAQs and Guides for further instructions."
);
}
void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event) const
{
const_cast<Pcsx2App*>(this)->HandleEvent( handler, func, event );
@ -560,17 +627,15 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent&
// ----------------------------------------------------------------------------
catch( Exception::BiosLoadFailed& ex )
{
wxDialogWithHelpers dialog( NULL, _("PS2 BIOS Error") );
dialog += dialog.Heading( ex.FormatDisplayMessage() + L"\n\n" + BIOS_GetMsg_Required() + L"\n\n" + _("Press Ok to go to the BIOS Configuration Panel.") );
dialog += new ModalButtonPanel( &dialog, MsgButtons().OKCancel() );
if( dialog.ShowModal() == wxID_CANCEL )
Console.Warning( "User denied option to re-configure BIOS." );
// Commandline 'nogui' users will not receive an error message, but at least PCSX2 will
// terminate properly.
GSFrame* gsframe = wxGetApp().GetGsFramePtr();
gsframe->Close();
if( AppOpenModalDialog<Dialogs::BiosSelectorDialog>() != wxID_CANCEL )
SysExecute();
else
Console.Warning( "User canceled BIOS configuration." );
Console.Error(ex.FormatDiagnosticMessage());
if (wxGetApp().HasGUI())
AddIdleEvent(BIOSLoadErrorEvent(ex));
}
// ----------------------------------------------------------------------------
catch( Exception::SaveStateLoadError& ex)

View File

@ -42,8 +42,14 @@ PipeRedirectionBase::~PipeRedirectionBase() throw() {}
// ----------------------------------------------------------------------------
//
#if wxMAJOR_VERSION < 3
void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
{
wxString message(szString);
#else
void pxLogConsole::DoLogRecord(wxLogLevel level, const wxString &message, const wxLogRecordInfo &info)
{
#endif
switch ( level )
{
case wxLOG_Trace:
@ -51,7 +57,7 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
{
wxString str;
TimeStamp( &str );
MSW_OutputDebugString( str + szString + L"\n" );
MSW_OutputDebugString( str + message + L"\n" );
}
break;
@ -70,15 +76,15 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
// fallthrough!
case wxLOG_Message:
Console.WriteLn( L"[wx] %ls", szString );
Console.WriteLn( L"[wx] %s", WX_STR(message));
break;
case wxLOG_Error:
Console.Error( L"[wx] %ls", szString );
Console.Error(L"[wx] %s", WX_STR(message));
break;
case wxLOG_Warning:
Console.Warning( L"[wx] %ls", szString );
Console.Warning(L"[wx] %s", WX_STR(message));
break;
}
}

View File

@ -57,7 +57,11 @@ public:
pxLogConsole() {}
protected:
#if wxMAJOR_VERSION >= 3
virtual void DoLogRecord(wxLogLevel level, const wxString &message, const wxLogRecordInfo &info);
#else
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t);
#endif
};

View File

@ -1,76 +0,0 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2010 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "PrecompiledHeader.h"
#include "System.h"
#include "App.h"
#include "ConfigurationDialog.h"
#include "ModalPopups.h"
#include "Panels/ConfigurationPanels.h"
#include <wx/filepicker.h>
using namespace Panels;
using namespace pxSizerFlags;
// ----------------------------------------------------------------------------
Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent )
: BaseApplicableDialog( parent, _("BIOS Selector") )
{
m_selpan = new Panels::BiosSelectorPanel( this );
*this += m_selpan | StdExpand();
AddOkCancel();
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BiosSelectorDialog::OnOk_Click) );
Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(BiosSelectorDialog::OnDoubleClicked) );
}
bool Dialogs::BiosSelectorDialog::Show( bool show )
{
if( show && m_selpan )
m_selpan->OnShown();
return _parent::Show( show );
}
int Dialogs::BiosSelectorDialog::ShowModal()
{
if( m_selpan )
m_selpan->OnShown();
return _parent::ShowModal();
}
void Dialogs::BiosSelectorDialog::OnOk_Click( wxCommandEvent& evt )
{
wxWindowDisabler disableOk( FindWindow( wxID_OK ) );
if( m_ApplyState.ApplyAll() )
{
Close();
evt.Skip();
}
}
void Dialogs::BiosSelectorDialog::OnDoubleClicked( wxCommandEvent& evt )
{
wxWindow* forwardButton = FindWindow( wxID_OK );
if( forwardButton == NULL ) return;
wxCommandEvent nextpg( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK );
nextpg.SetEventObject( forwardButton );
forwardButton->GetEventHandler()->ProcessEvent( nextpg );
}

View File

@ -207,31 +207,6 @@ namespace Dialogs
virtual wxString& GetConfSettingsTabName() const { return g_Conf->ComponentsTabName; }
};
// --------------------------------------------------------------------------------------
// BiosSelectorDialog
// --------------------------------------------------------------------------------------
class BiosSelectorDialog : public BaseApplicableDialog
{
typedef BaseApplicableDialog _parent;
protected:
Panels::BaseSelectorPanel* m_selpan;
public:
virtual ~BiosSelectorDialog() throw() {}
BiosSelectorDialog( wxWindow* parent=NULL );
static wxString GetNameStatic() { return L"BiosSelector"; }
wxString GetDialogName() const { return GetNameStatic(); }
virtual bool Show( bool show=true );
virtual int ShowModal();
protected:
void OnOk_Click( wxCommandEvent& evt );
void OnDoubleClicked( wxCommandEvent& evt );
};
// --------------------------------------------------------------------------------------
// CreateMemoryCardDialog
// --------------------------------------------------------------------------------------

View File

@ -171,11 +171,7 @@ protected:
}
};
#ifdef _MSC_VER
typedef std::list< SysExecEvent*, WXObjectAllocator(SysExecEvent*) > pxEvtList;
#else
typedef std::list<SysExecEvent*> pxEvtList;
#endif
typedef std::list<SysExecEvent*> pxEvtList;
// --------------------------------------------------------------------------------------
// pxEvtQueue

View File

@ -216,7 +216,7 @@ static void MapUnknownSource( uint Eip )
return;
}
Module tmp((sz==0) ? modulenam.c_str() : NULL, (void*)Eip);
Module tmp((sz==0) ? modulenam.wc_str() : NULL, (void*)Eip);
tmp.ticks++;
ProfUnknownHash.insert(MapType::value_type(modulenam, tmp));

View File

@ -129,7 +129,7 @@
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<AdditionalDependencies>zlib-dev.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlib-dev.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
@ -151,7 +151,7 @@
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlib.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
@ -534,6 +534,7 @@
<ClCompile Include="..\..\IopDma.cpp" />
<ClCompile Include="..\..\IopIrq.cpp" />
<ClCompile Include="..\..\IopMem.cpp" />
<ClCompile Include="..\WinKeyCodes.cpp" />
<ClCompile Include="IopSif.cpp" />
<ClCompile Include="..\..\IopSio2.cpp" />
<ClCompile Include="..\..\R3000A.cpp" />
@ -643,7 +644,6 @@
<ClCompile Include="..\..\gui\Dialogs\AboutBoxDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\AssertionDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp" />
<ClCompile Include="..\..\gui\Dialogs\CreateMemoryCardDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\FirstTimeWizard.cpp" />

View File

@ -659,9 +659,6 @@
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp">
<Filter>AppHost\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp">
<Filter>AppHost\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp">
<Filter>AppHost\Dialogs</Filter>
</ClCompile>
@ -865,6 +862,9 @@
<ClCompile Include="..\..\CDVD\ChunksCache.cpp">
<Filter>System\ISO</Filter>
</ClCompile>
<ClCompile Include="..\WinKeyCodes.cpp">
<Filter>AppHost\Win32</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Patch.h">

View File

@ -129,7 +129,7 @@
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<AdditionalDependencies>zlib-dev.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlib-dev.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
@ -151,7 +151,7 @@
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>zlib.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
@ -534,6 +534,7 @@
<ClCompile Include="..\..\IopDma.cpp" />
<ClCompile Include="..\..\IopIrq.cpp" />
<ClCompile Include="..\..\IopMem.cpp" />
<ClCompile Include="..\WinKeyCodes.cpp" />
<ClCompile Include="IopSif.cpp" />
<ClCompile Include="..\..\IopSio2.cpp" />
<ClCompile Include="..\..\R3000A.cpp" />
@ -643,7 +644,6 @@
<ClCompile Include="..\..\gui\Dialogs\AboutBoxDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\AssertionDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp" />
<ClCompile Include="..\..\gui\Dialogs\CreateMemoryCardDialog.cpp" />
<ClCompile Include="..\..\gui\Dialogs\FirstTimeWizard.cpp" />

View File

@ -659,9 +659,6 @@
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp">
<Filter>AppHost\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp">
<Filter>AppHost\Dialogs</Filter>
</ClCompile>
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp">
<Filter>AppHost\Dialogs</Filter>
</ClCompile>
@ -865,6 +862,9 @@
<ClCompile Include="..\..\CDVD\ChunksCache.cpp">
<Filter>System\ISO</Filter>
</ClCompile>
<ClCompile Include="..\WinKeyCodes.cpp">
<Filter>AppHost\Win32</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Patch.h">

View File

@ -0,0 +1,123 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2010 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "PrecompiledHeader.h"
#include <Windows.h>
// Returns a WXK_* keycode translated from a VK_* virtual key. wxCharCodeMSWToWx was
// removed from wxWidgets 3, this should work as a replacement.
int TranslateVKToWXK(u32 keysym)
{
int key_code;
switch (keysym)
{
// Shift, Control, Alt and Menu
case VK_LSHIFT:
case VK_RSHIFT: key_code = WXK_SHIFT; break;
case VK_LCONTROL:
case VK_RCONTROL: key_code = WXK_CONTROL; break;
case VK_LMENU:
case VK_RMENU:
case VK_MENU: key_code = WXK_ALT; break;
case VK_LWIN: key_code = WXK_WINDOWS_LEFT; break;
case VK_RWIN: key_code = WXK_WINDOWS_RIGHT; break;
case VK_APPS: key_code = WXK_WINDOWS_MENU; break;
// Scroll, Caps and numlocks
case VK_SCROLL: key_code = WXK_SCROLL; break;
case VK_CAPITAL: key_code = WXK_CAPITAL; break;
case VK_NUMLOCK: key_code = WXK_NUMLOCK; break;
// cursor and other extended keyboard keys
case VK_PRIOR: key_code = WXK_PAGEUP; break;
case VK_NEXT: key_code = WXK_PAGEDOWN; break;
case VK_HOME: key_code = WXK_HOME; break;
case VK_END: key_code = WXK_END; break;
case VK_LEFT: key_code = WXK_LEFT; break;
case VK_UP: key_code = WXK_UP; break;
case VK_RIGHT: key_code = WXK_RIGHT; break;
case VK_DOWN: key_code = WXK_DOWN; break;
case VK_INSERT: key_code = WXK_INSERT; break;
case VK_DELETE: key_code = WXK_DELETE; break;
// numpad keys
case VK_NUMPAD0: key_code = WXK_NUMPAD0; break;
case VK_NUMPAD1: key_code = WXK_NUMPAD1; break;
case VK_NUMPAD2: key_code = WXK_NUMPAD2; break;
case VK_NUMPAD3: key_code = WXK_NUMPAD3; break;
case VK_NUMPAD4: key_code = WXK_NUMPAD4; break;
case VK_NUMPAD5: key_code = WXK_NUMPAD5; break;
case VK_NUMPAD6: key_code = WXK_NUMPAD6; break;
case VK_NUMPAD7: key_code = WXK_NUMPAD7; break;
case VK_NUMPAD8: key_code = WXK_NUMPAD8; break;
case VK_NUMPAD9: key_code = WXK_NUMPAD9; break;
case VK_MULTIPLY: key_code = WXK_NUMPAD_MULTIPLY; break;
case VK_ADD: key_code = WXK_NUMPAD_ADD; break;
case VK_SEPARATOR:key_code = WXK_NUMPAD_SEPARATOR; break;
case VK_SUBTRACT: key_code = WXK_NUMPAD_SUBTRACT; break;
case VK_DECIMAL: key_code = WXK_NUMPAD_DECIMAL; break;
case VK_DIVIDE: key_code = WXK_NUMPAD_DIVIDE; break;
// Function keys
case VK_F1: key_code = WXK_F1; break;
case VK_F2: key_code = WXK_F2; break;
case VK_F3: key_code = WXK_F3; break;
case VK_F4: key_code = WXK_F4; break;
case VK_F5: key_code = WXK_F5; break;
case VK_F6: key_code = WXK_F6; break;
case VK_F7: key_code = WXK_F7; break;
case VK_F8: key_code = WXK_F8; break;
case VK_F9: key_code = WXK_F9; break;
case VK_F10: key_code = WXK_F10; break;
case VK_F11: key_code = WXK_F11; break;
case VK_F12: key_code = WXK_F12; break;
case VK_F13: key_code = WXK_F13; break;
case VK_F14: key_code = WXK_F14; break;
case VK_F15: key_code = WXK_F15; break;
case VK_F16: key_code = WXK_F16; break;
case VK_F17: key_code = WXK_F17; break;
case VK_F18: key_code = WXK_F18; break;
case VK_F19: key_code = WXK_F19; break;
case VK_F20: key_code = WXK_F20; break;
case VK_F21: key_code = WXK_F21; break;
case VK_F22: key_code = WXK_F22; break;
case VK_F23: key_code = WXK_F23; break;
case VK_F24: key_code = WXK_F24; break;
// various other special keys
case VK_BACK: key_code = WXK_BACK; break;
case VK_TAB: key_code = WXK_TAB; break;
case VK_RETURN: key_code = WXK_RETURN; break;
case VK_ESCAPE: key_code = WXK_ESCAPE; break;
case VK_SNAPSHOT: key_code = WXK_SNAPSHOT; break;
case VK_PAUSE: key_code = WXK_PAUSE; break;
// Not sure what these keys are
case VK_CLEAR: key_code = WXK_CLEAR; break;
case VK_HELP: key_code = WXK_HELP; break;
case VK_SELECT: key_code = WXK_SELECT; break;
case VK_EXECUTE: key_code = WXK_EXECUTE; break;
case VK_PRINT: key_code = WXK_PRINT; break;
default: key_code = 0;
}
return key_code;
}

View File

@ -297,7 +297,7 @@ private:
tSel=-1;
for(int i=0;i<ndevs;i++)
{
SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_ADDSTRING,0,(LPARAM)m_devices[i].name.c_str());
SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_ADDSTRING,0,(LPARAM)m_devices[i].name.wc_str());
if(haveGuid && IsEqualGUID(m_devices[i].guid,DevGuid) || tSel < 0 && !m_devices[i].hasGuid)
tSel = i;
}