* Fixed fullscreen default-to-on behavior; the bug was caused by wxWidgets being a bit ficle and expecting the window to be Shown prior to being made fullscreen (even though the docs say ShowFullscreen() will show the window itself).

* Much header file cleanup and used forward declarations to remove a lot of excess includes; might help improve build times a wee bit.
 * Preliminary hash-table implementation for the Game database.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3264 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-06-22 04:29:24 +00:00
parent 856968812a
commit 0941434749
34 changed files with 955 additions and 930 deletions

View File

@ -204,6 +204,11 @@ public:
return Hash( (const char *)src.data(), src.length() * sizeof( wchar_t ) );
}
hash_key_t operator()( const wxString& src ) const
{
return Hash( (const char *)src.data(), src.length() * sizeof( wchar_t ) );
}
// Returns a hashcode for a character.
// This has function has been optimized to return an even distribution
// across the range of an int value. In theory that should be more rewarding
@ -322,6 +327,8 @@ public:
hash_key_t key = (hash_key_t) addr;
return (hash_key_t)((key >> 3) * 2654435761ul);
}
};
/// <summary>
@ -528,7 +535,7 @@ public:
const T& GetValue( Key key ) const
{
return (this->find( key ))->second;
return (find( key ))->second;
}
};
@ -549,6 +556,8 @@ public:
template< class Key, class T >
class HashMap : public google::dense_hash_map<Key, T, CommonHashClass>
{
DeclareNoncopyableObject( HashMap );
typedef typename google::dense_hash_map<Key, T, CommonHashClass> _parent;
public:
@ -589,7 +598,12 @@ public:
const T& GetValue( Key key ) const
{
return (this->find( key ))->second;
return (find( key ))->second;
}
bool Find( Key key ) const
{
return find(key) != end();
}
};
@ -607,12 +621,10 @@ class Dictionary : public HashMap<std::string, T>
public:
virtual ~Dictionary() {}
Dictionary( int initialCapacity=33, const std::string& emptyKey = "@@-EMPTY-@@", const std::string& deletedKey = "@@-DELETED-@@" ) :
HashMap<std::string, T>( emptyKey, deletedKey, initialCapacity)
Dictionary( int initialCapacity=33, const std::string& emptyKey = "@@-EMPTY-@@", const std::string& deletedKey = "@@-DELETED-@@" )
: HashMap<std::string, T>( emptyKey, deletedKey, initialCapacity)
{
}
private:
Dictionary( const Dictionary& src ) {}
};
/// <summary>
@ -631,13 +643,22 @@ class UnicodeDictionary : public HashMap<std::wstring, T>
public:
virtual ~UnicodeDictionary() {}
UnicodeDictionary( int initialCapacity=33, const std::wstring& emptyKey = L"@@-EMPTY-@@", const std::wstring& deletedKey = L"@@-DELETED-@@" ) :
HashMap<std::wstring, T>( emptyKey, deletedKey, initialCapacity)
UnicodeDictionary( int initialCapacity=33, const std::wstring& emptyKey = L"@@-EMPTY-@@", const std::wstring& deletedKey = L"@@-DELETED-@@" )
: HashMap<std::wstring, T>( emptyKey, deletedKey, initialCapacity)
{
}
private:
UnicodeDictionary( const UnicodeDictionary& src ) {}
};
}
template< class T >
class pxDictionary : public HashTools::HashMap<wxString, T>
{
public:
virtual ~pxDictionary() {}
pxDictionary( int initialCapacity=33, const wxString& emptyKey = L"@@-EMPTY-@@", const wxString& deletedKey = L"@@-DELETED-@@" )
: HashMap<wxString, T>( emptyKey, deletedKey, initialCapacity)
{
}
};

View File

@ -14,7 +14,6 @@
*/
#include "PrecompiledHeader.h"
#include "HashMap.h"
#include "wxGuiTools.h"
#include "pxStaticText.h"
#include "Threading.h"

View File

@ -356,13 +356,23 @@ static __forceinline void _reloadElfInfo(wxString elfpath)
// Set the Game DataBase to the correct game based on Game Serial Code...
if (IGameDatabase* GameDB = AppHost_GetGameDatabase()) {
wxString gameSerial = DiscID;
if (DiscID.IsEmpty()) { // Search for crc if no Serial Code
gameSerial = wxString(wxsFormat( L"%8.8x", ElfCRC ));
if (gameSerial.IsEmpty()) { // Search for crc if no Serial Code
gameSerial = wxsFormat( L"%8.8x", ElfCRC );
}
if (GameDB->setGame(gameSerial)) { // Game Found
Console.WriteLn ("Game = %s (%s)", GameDB->getString("Name").c_str(), GameDB->getString("Region").c_str());
wxString serialMsg;
if(!DiscID.IsEmpty())
serialMsg = L"serial=" + DiscID + L" ";
//Game_Data CurrentGame;
//if (GameDB->getGame(CurrentGame, gameSerial))
if (GameDB->setGame(gameSerial))
{
Console.WriteLn(L"(GameDB) Found Game! %s [CRC=%8.8x]", serialMsg.c_str(), ElfCRC );
// [TODO] Display lots of other info from the database here!
}
else Console.Warning(L"Game not found in database [%s]", gameSerial.c_str());
else
Console.Warning(L"(GameDB) Game not found! %s [CRC=%8.8x]", serialMsg.c_str(), ElfCRC );
}
}

View File

@ -199,7 +199,6 @@ set(pcsx2Headers
Gif.h
GS.h
Hardware.h
HostGui.h
Hw.h
IopBios.h
IopCommon.h

View File

@ -19,19 +19,19 @@
// Sets the current game to the one matching the serial id given
// Returns true if game found, false if not found...
bool BaseGameDatabaseVector::setGame(const wxString& id) {
GameDataArray::iterator it( gList.begin() );
for ( ; it != gList.end(); ++it) {
if (it[0].CompareId(id)) {
curGame = &it[0];
return true;
}
GameDataHash::const_iterator iter( gHash.find(id) );
if( iter == gHash.end() ) {
curGame = NULL;
return false;
}
curGame = NULL;
return false;
curGame = &gList[iter->second];
return true;
}
Game_Data* BaseGameDatabaseVector::createNewGame(const wxString& id) {
gList.push_back(Game_Data(id));
gHash[id] = gList.size()-1;
curGame = &(gList.end()-1)[0];
return curGame;
}
@ -94,8 +94,7 @@ void BaseGameDatabaseVector::writeString(const wxString& key, const wxString& va
}
}
if( !value.IsEmpty() ) {
key_pair tKey(key, value);
curGame->kList.push_back(tKey);
curGame->kList.push_back(key_pair(key, value));
}
}
else Console.Error("(GameDB) Game not set!");

View File

@ -17,6 +17,8 @@
#include "Common.h"
#include "AppConfig.h"
#include "Utilities/HashMap.h"
#include <wx/wfstream.h>
struct key_pair;
@ -161,7 +163,8 @@ public:
virtual void writeBool(const wxString& key, bool value)=0;
};
typedef std::vector<Game_Data> GameDataArray;
typedef std::vector<Game_Data> GameDataArray;
typedef pxDictionary<int> GameDataHash;
// --------------------------------------------------------------------------------------
// BaseGameDatabaseVector
@ -172,6 +175,7 @@ class BaseGameDatabaseVector : public IGameDatabase
{
public:
GameDataArray gList; // List of all game data
GameDataHash gHash; // hash table of game serials matched to their gList indexes!
Game_Data* curGame; // Current game data (index into gList)
wxString m_baseKey;

View File

@ -1,66 +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/>.
*/
#pragma once
#include "CDVD/CDVD.h"
//////////////////////////////////////////////////////////////////////////////////////////
// Startup Parameters.
enum StartupModeType
{
Startup_FromCDVD = 0,
Startup_FromELF = 1, // not compatible with bios flag, probably
};
enum CDVD_SourceType;
class StartupParams
{
public:
// Name of the CDVD image to load.
// if NULL, the CDVD plugin configured settings are used.
const char* ImageName;
// Name of the ELF file to load. If null, the CDVD is booted instead.
const char* ElfFile;
bool NoGui;
bool Enabled;
StartupModeType StartupMode;
CDVD_SourceType CdvdSource;
// Ignored when booting ELFs.
bool SkipBios;
// Plugin overrides
const char* gsdll, *cdvddll, *spudll;
const char* pad1dll, *pad2dll, *dev9dll;
StartupParams() { memzero(*this); }
};
extern StartupParams g_Startup;
extern bool States_isSlotUsed(int num);
extern void States_FreezeCurrentSlot();
extern void States_DefrostCurrentSlot();
extern void States_FreezeCurrentSlot();
extern void States_CycleSlotForward();
extern void States_CycleSlotBackward();
extern void States_SetCurrentSlot( int slot );
extern int States_GetCurrentSlot( int slot );

View File

@ -231,7 +231,6 @@
<Unit filename="../Gif.cpp" />
<Unit filename="../Gif.h" />
<Unit filename="../Hardware.h" />
<Unit filename="../HostGui.h" />
<Unit filename="../Hw.cpp" />
<Unit filename="../Hw.h" />
<Unit filename="../HwRead.cpp" />

View File

@ -20,7 +20,6 @@
#include <wx/file.h>
#include "GS.h"
#include "HostGui.h"
#include "CDVD/CDVDisoReader.h"
#include "Utilities/ScopedPtr.h"

View File

@ -18,7 +18,6 @@
#include "Utilities/wxAppWithHelpers.h"
#include <wx/fileconf.h>
#include <wx/imaglist.h>
#include <wx/apptrait.h>
#include "pxEventThread.h"
@ -26,15 +25,10 @@
#include "AppCommon.h"
#include "AppCoreThread.h"
#include "RecentIsoList.h"
#include "AppGameDatabase.h"
#include "System.h"
#include "System/SysThreads.h"
#include "Utilities/HashMap.h"
class Pcsx2App;
typedef void FnType_OnThreadComplete(const wxCommandEvent& evt);
typedef void (Pcsx2App::*FnPtr_Pcsx2App)();
@ -174,93 +168,6 @@ namespace Exception
}
// --------------------------------------------------------------------------------------
// KeyAcceleratorCode
// A custom keyboard accelerator that I like better than wx's wxAcceleratorEntry.
// --------------------------------------------------------------------------------------
struct KeyAcceleratorCode
{
union
{
struct
{
u16 keycode;
u16 win:1, // win32 only.
cmd:1, // ctrl in win32, Command in Mac
alt:1,
shift:1;
};
u32 val32;
};
KeyAcceleratorCode() : val32( 0 ) {}
KeyAcceleratorCode( const wxKeyEvent& evt );
KeyAcceleratorCode( wxKeyCode code )
{
val32 = 0;
keycode = code;
}
KeyAcceleratorCode& Shift()
{
shift = true;
return *this;
}
KeyAcceleratorCode& Alt()
{
alt = true;
return *this;
}
KeyAcceleratorCode& Win()
{
win = true;
return *this;
}
KeyAcceleratorCode& Cmd()
{
cmd = true;
return *this;
}
wxString ToString() const;
};
// --------------------------------------------------------------------------------------
// GlobalCommandDescriptor
// Describes a global command which can be invoked from the main GUI or GUI plugins.
// --------------------------------------------------------------------------------------
struct GlobalCommandDescriptor
{
const char* Id; // Identifier string
void (*Invoke)(); // Do it!! Do it NOW!!!
const char* Fullname; // Name displayed in pulldown menus
const char* Tooltip; // text displayed in toolbar tooltips and menu status bars.
int ToolbarIconId; // not implemented yet, leave 0 for now.
};
typedef HashTools::Dictionary<const GlobalCommandDescriptor*> CommandDictionary;
class AcceleratorDictionary : public HashTools::HashMap<int, const GlobalCommandDescriptor*>
{
typedef HashTools::HashMap<int, const GlobalCommandDescriptor*> _parent;
protected:
public:
using _parent::operator[];
AcceleratorDictionary();
void Map( const KeyAcceleratorCode& acode, const char *searchfor );
};
// --------------------------------------------------------------------------------------
// AppImageIds - Config and Toolbar Images and Icons
// --------------------------------------------------------------------------------------
@ -310,8 +217,9 @@ struct AppImageIds
// Container class for resources that should (or must) be unloaded prior to the ~wxApp() destructor.
// (typically this object is deleted at OnExit() or just prior to OnExit()).
//
struct pxAppResources
class pxAppResources
{
public:
AppImageIds ImageId;
ScopedPtr<wxImageList> ConfigImages;
@ -321,19 +229,7 @@ struct pxAppResources
ScopedPtr<AppGameDatabase> GameDB;
pxAppResources();
virtual ~pxAppResources() throw() { }
};
// --------------------------------------------------------------------------------------
// RecentIsoList
// --------------------------------------------------------------------------------------
struct RecentIsoList
{
ScopedPtr<RecentIsoManager> Manager;
ScopedPtr<wxMenu> Menu;
RecentIsoList();
virtual ~RecentIsoList() throw() { }
virtual ~pxAppResources() throw();
};
// --------------------------------------------------------------------------------------
@ -550,8 +446,8 @@ protected:
public:
FramerateManager FpsManager;
CommandDictionary GlobalCommands;
AcceleratorDictionary GlobalAccels;
ScopedPtr<CommandDictionary> GlobalCommands;
ScopedPtr<AcceleratorDictionary> GlobalAccels;
StartupOptions Startup;
CommandlineOverrides Overrides;
@ -640,11 +536,7 @@ public:
wxImageList& GetImgList_Config();
wxImageList& GetImgList_Toolbars();
const AppImageIds& GetImgId() const
{
return m_Resources->ImageId;
}
const AppImageIds& GetImgId() const;
AppGameDatabase* GetGameDatabase();
// --------------------------------------------------------------------------

123
pcsx2/gui/AppAccelerators.h Normal file
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/>.
*/
#pragma once
#include "AppCommon.h"
#include "Utilities/HashMap.h"
// --------------------------------------------------------------------------------------
// KeyAcceleratorCode
// A custom keyboard accelerator that I like better than wx's wxAcceleratorEntry.
// --------------------------------------------------------------------------------------
struct KeyAcceleratorCode
{
union
{
struct
{
u16 keycode;
u16 win:1, // win32 only.
cmd:1, // ctrl in win32, Command in Mac
alt:1,
shift:1;
};
u32 val32;
};
KeyAcceleratorCode() : val32( 0 ) {}
KeyAcceleratorCode( const wxKeyEvent& evt );
KeyAcceleratorCode( wxKeyCode code )
{
val32 = 0;
keycode = code;
}
KeyAcceleratorCode& Shift()
{
shift = true;
return *this;
}
KeyAcceleratorCode& Alt()
{
alt = true;
return *this;
}
KeyAcceleratorCode& Win()
{
win = true;
return *this;
}
KeyAcceleratorCode& Cmd()
{
cmd = true;
return *this;
}
wxString ToString() const;
};
// --------------------------------------------------------------------------------------
// GlobalCommandDescriptor
// Describes a global command which can be invoked from the main GUI or GUI plugins.
// --------------------------------------------------------------------------------------
struct GlobalCommandDescriptor
{
const char* Id; // Identifier string
void (*Invoke)(); // Do it!! Do it NOW!!!
const char* Fullname; // Name displayed in pulldown menus
const char* Tooltip; // text displayed in toolbar tooltips and menu status bars.
int ToolbarIconId; // not implemented yet, leave 0 for now.
};
// --------------------------------------------------------------------------------------
//
// --------------------------------------------------------------------------------------
class CommandDictionary : public HashTools::Dictionary<const GlobalCommandDescriptor*>
{
typedef HashTools::Dictionary<const GlobalCommandDescriptor*> _parent;
protected:
public:
using _parent::operator[];
CommandDictionary();
virtual ~CommandDictionary() throw();
};
// --------------------------------------------------------------------------------------
//
// --------------------------------------------------------------------------------------
class AcceleratorDictionary : public HashTools::HashMap<int, const GlobalCommandDescriptor*>
{
typedef HashTools::HashMap<int, const GlobalCommandDescriptor*> _parent;
protected:
public:
using _parent::operator[];
AcceleratorDictionary();
virtual ~AcceleratorDictionary() throw();
void Map( const KeyAcceleratorCode& acode, const char *searchfor );
};

View File

@ -23,7 +23,6 @@
#include "Plugins.h"
#include "GS.h"
#include "HostGui.h"
#include "AppConfig.h"
using namespace Threading;

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "App.h"
#include "AppSaveStates.h"
#include "AppGameDatabase.h"
#include "Utilities/TlsVariable.inl"

View File

@ -25,12 +25,22 @@
// inter-dependence.
//
class Pcsx2App;
class MainEmuFrame;
class GSFrame;
class ConsoleLogFrame;
class PipeRedirectionBase;
class AppCoreThread;
class Pcsx2AppMethodEvent;
class pxAppResources;
class AppGameDatabase;
class IScopedCoreThread;
struct KeyAcceleratorCode;
struct GlobalCommandDescriptor;
class CommandDictionary;
class AcceleratorDictionary;
class IniInterface;
// wxWidgets forward declarations
@ -48,3 +58,5 @@ class wxSpinCtrl;
class wxBookCtrlBase;
class wxListEvent;
class wxImageList;
class wxBitmap;

View File

@ -144,7 +144,7 @@ AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& file, const wxStr
{
if (!wxFileExists(file))
{
Console.Error(L"GameDatabase: DataBase Not Found! [%s]", file.c_str());
Console.Error(L"(GameDB) Database Not Found! [%s]", file.c_str());
return *this;
}
@ -153,7 +153,7 @@ AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& file, const wxStr
if (!reader.IsOk())
{
//throw Exception::FileNotFound( file );
Console.Error(L"GameDatabase: Could not access file (permission denied?) [%s]", file.c_str());
Console.Error(L"(GameDB) Could not access file (permission denied?) [%s]", file.c_str());
}
DBLoaderHelper loader( reader, *this );
@ -161,10 +161,6 @@ AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& file, const wxStr
header = loader.ReadHeader();
loader.ReadGames();
//if (setGame(value)) Console.WriteLn(L"GameDatabase: Found Game! [%s]", value.c_str());
//else Console.Warning(L"GameDatabase: Game Not Found! [%s]", value.c_str());
// Clear the current key after loading.
curGame = NULL;
return *this;

View File

@ -15,10 +15,12 @@
#include "PrecompiledHeader.h"
#include "MainFrame.h"
#include "AppAccelerators.h"
#include "ConsoleLogger.h"
#include "MSWstuff.h"
#include "Utilities/IniInterface.h"
#include "Utilities/HashMap.h"
#include "DebugTools/Debug.h"
#include "Dialogs/ModalPopups.h"
@ -796,6 +798,6 @@ struct CrtDebugBreak
}
};
//CrtDebugBreak breakAt( 2014 );
//CrtDebugBreak breakAt( 737 );
#endif

View File

@ -16,9 +16,11 @@
#include "PrecompiledHeader.h"
#include "MainFrame.h"
#include "GSFrame.h"
#include "AppSaveStates.h"
#include "AppGameDatabase.h"
#include "AppAccelerators.h"
#include "Plugins.h"
#include "AppSaveStates.h"
#include "ps2/BiosTools.h"
#include "Dialogs/ModalPopups.h"
@ -26,7 +28,6 @@
#include "Dialogs/LogOptionsDialog.h"
#include "Utilities/IniInterface.h"
#include "Utilities/HashMap.h"
#ifdef __WXMSW__
# include <wx/msw/wrapwin.h> // needed to implement the app!
@ -405,24 +406,19 @@ void Pcsx2App::LogicalVsync()
}
}
HashTools::HashMap<int, const GlobalCommandDescriptor*> GlobalAccels( 0, 0xffffffff );
void Pcsx2App::OnEmuKeyDown( wxKeyEvent& evt )
{
const GlobalCommandDescriptor* cmd = NULL;
GlobalAccels.TryGetValue( KeyAcceleratorCode( evt ).val32, cmd );
if( GlobalAccels ) GlobalAccels->TryGetValue( KeyAcceleratorCode( evt ).val32, cmd );
if( cmd == NULL )
{
evt.Skip();
return;
}
if( cmd != NULL )
{
DbgCon.WriteLn( "(app) Invoking command: %s", cmd->Id );
cmd->Invoke();
}
DbgCon.WriteLn( "(app) Invoking command: %s", cmd->Id );
cmd->Invoke();
}
// Returns a string message telling the user to consult guides for obtaining a legal BIOS.
@ -833,8 +829,8 @@ void Pcsx2App::OpenGsPanel()
GSFrame* gsFrame = GetGsFramePtr();
if( gsFrame == NULL )
{
gsFrame = new GSFrame( GetMainFramePtr(), L"PCSX2" );
gsFrame->SetFocus();
gsFrame = new GSFrame( GetMainFramePtr(), GetAppName() );
//gsFrame->SetFocus();
m_id_GsFrame = gsFrame->GetId();
}
else
@ -861,7 +857,22 @@ void Pcsx2App::OpenGsPanel()
pxAssumeDev( !GetCorePlugins().IsOpen( PluginId_GS ), "GS Plugin must be closed prior to opening a new Gs Panel!" );
gsFrame->Show();
switch( wxGetApp().Overrides.GsWindowMode )
{
case GsWinMode_Windowed:
g_Conf->GSWindow.IsFullscreen = false;
break;
case GsWinMode_Fullscreen:
g_Conf->GSWindow.IsFullscreen = true;
break;
case GsWinMode_Unspecified:
g_Conf->GSWindow.IsFullscreen = g_Conf->GSWindow.DefaultToFullscreen;
break;
}
gsFrame->ShowFullScreen( g_Conf->GSWindow.IsFullscreen );
pDsp = (uptr)gsFrame->GetViewport()->GetHandle();
// The "in the main window" quickie hack...

View File

@ -15,6 +15,7 @@
#include "PrecompiledHeader.h"
#include "MainFrame.h"
#include "AppGameDatabase.h"
#include <wx/zipstrm.h>
#include <wx/wfstream.h>
@ -34,7 +35,6 @@
#include "Resources/AppIcon32.h"
#include "Resources/AppIcon64.h"
// ------------------------------------------------------------------------
const wxImage& LoadImageAny(
wxImage& dest, bool useTheme, wxFileName& base, const wxChar* filename, IEmbeddedImage& onFail )
{
@ -75,6 +75,8 @@ pxAppResources::pxAppResources()
{
}
pxAppResources::~pxAppResources() throw() {}
wxMenu& Pcsx2App::GetRecentIsoMenu()
{
pxAssert( !!m_RecentIsoList->Menu );
@ -110,7 +112,6 @@ const wxIconBundle& Pcsx2App::GetIconBundle()
return *bundle;
}
// ------------------------------------------------------------------------
const wxBitmap& Pcsx2App::GetLogoBitmap()
{
ScopedPtr<wxBitmap>& logo( GetResourceCache().Bitmap_Logo );
@ -146,7 +147,6 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
return *logo;
}
// ------------------------------------------------------------------------
wxImageList& Pcsx2App::GetImgList_Config()
{
ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages );
@ -216,3 +216,7 @@ wxImageList& Pcsx2App::GetImgList_Toolbars()
return *images;
}
const AppImageIds& Pcsx2App::GetImgId() const
{
return m_Resources->ImageId;
}

View File

@ -60,3 +60,12 @@ extern void StateCopy_SaveToFile( const wxString& file );
extern void StateCopy_LoadFromFile( const wxString& file );
extern void StateCopy_SaveToSlot( uint num );
extern void StateCopy_LoadFromSlot( uint slot );
extern bool States_isSlotUsed(int num);
extern void States_DefrostCurrentSlot();
extern void States_FreezeCurrentSlot();
extern void States_CycleSlotForward();
extern void States_CycleSlotBackward();
extern void States_SetCurrentSlot( int slot );
extern int States_GetCurrentSlot( int slot );

View File

@ -16,7 +16,6 @@
#pragma once
#include <wx/wx.h>
#include <wx/image.h>
#include <wx/propdlg.h>
#include "AppCommon.h"

View File

@ -20,9 +20,6 @@
#include "Utilities/wxGuiTools.h"
#include "Utilities/CheckedStaticBox.h"
#include "Utilities/HashMap.h"
using namespace HashTools;
namespace Dialogs {

View File

@ -19,7 +19,6 @@
#include "ConfigurationDialog.h"
#include "Panels/ConfigurationPanels.h"
#include <wx/image.h>
#include <wx/wizard.h>
static const wxWindowID pxID_CUSTOM = wxID_LOWEST - 1;

View File

@ -14,8 +14,9 @@
*/
#include "PrecompiledHeader.h"
#include "MainFrame.h"
#include "App.h"
#include "GSFrame.h"
#include "AppAccelerators.h"
#include "GS.h"
#include "MSWstuff.h"
@ -29,24 +30,24 @@ void GSPanel::InitDefaultAccelerators()
typedef KeyAcceleratorCode AAC;
m_Accels.Map( AAC( WXK_F1 ), "States_FreezeCurrentSlot" );
m_Accels.Map( AAC( WXK_F3 ), "States_DefrostCurrentSlot");
m_Accels.Map( AAC( WXK_F2 ), "States_CycleSlotForward" );
m_Accels.Map( AAC( WXK_F2 ).Shift(), "States_CycleSlotBackward" );
m_Accels->Map( AAC( WXK_F1 ), "States_FreezeCurrentSlot" );
m_Accels->Map( AAC( WXK_F3 ), "States_DefrostCurrentSlot");
m_Accels->Map( AAC( WXK_F2 ), "States_CycleSlotForward" );
m_Accels->Map( AAC( WXK_F2 ).Shift(), "States_CycleSlotBackward" );
m_Accels.Map( AAC( WXK_F4 ), "Frameskip_Toggle" );
m_Accels.Map( AAC( WXK_TAB ), "Framelimiter_TurboToggle" );
m_Accels.Map( AAC( WXK_TAB ).Shift(), "Framelimiter_MasterToggle" );
m_Accels->Map( AAC( WXK_F4 ), "Frameskip_Toggle" );
m_Accels->Map( AAC( WXK_TAB ), "Framelimiter_TurboToggle" );
m_Accels->Map( AAC( WXK_TAB ).Shift(), "Framelimiter_MasterToggle" );
m_Accels.Map( AAC( WXK_ESCAPE ), "Sys_Suspend" );
m_Accels.Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" );
m_Accels.Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle" );
m_Accels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend" );
m_Accels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" );
m_Accels->Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle" );
//m_Accels.Map( AAC( WXK_F10 ), "Sys_LoggingToggle" );
m_Accels.Map( AAC( WXK_F11 ), "Sys_FreezeGS" );
m_Accels.Map( AAC( WXK_F12 ), "Sys_RecordingToggle" );
//m_Accels->Map( AAC( WXK_F10 ), "Sys_LoggingToggle" );
m_Accels->Map( AAC( WXK_F11 ), "Sys_FreezeGS" );
m_Accels->Map( AAC( WXK_F12 ), "Sys_RecordingToggle" );
m_Accels.Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" );
m_Accels->Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" );
}
GSPanel::GSPanel( wxWindow* parent )
@ -184,7 +185,7 @@ void GSPanel::OnKeyDown( wxKeyEvent& evt )
if( (PADopen != NULL) && CoreThread.IsOpen() ) return;
const GlobalCommandDescriptor* cmd = NULL;
m_Accels.TryGetValue( KeyAcceleratorCode( evt ).val32, cmd );
m_Accels->TryGetValue( KeyAcceleratorCode( evt ).val32, cmd );
if( cmd == NULL )
{
evt.Skip(); // Let the global APP handle it if it wants
@ -285,16 +286,21 @@ bool GSFrame::ShowFullScreen(bool show, long style)
if( show != IsFullScreen() )
Console.WriteLn( Color_StrongMagenta, "(gsFrame) Switching to %s mode...", show ? "Fullscreen" : "Windowed" );
_parent::ShowFullScreen( show );
if( g_Conf->GSWindow.IsFullscreen != show )
{
g_Conf->GSWindow.IsFullscreen = show;
AppSaveSettings();
return true;
wxGetApp().PostIdleMethod( AppSaveSettings );
}
return false;
// IMPORTANT! On MSW platforms you must ALWAYS show the window prior to calling
// ShowFullscreen(), otherwise the window will be oddly unstable (lacking input and unable
// to properly flip back into fullscreen mode after alt-enter). I don't know if that
// also happens on Linux.
if( !IsShown() ) Show();
bool retval = _parent::ShowFullScreen( show );
return retval;
}
wxStaticText* GSFrame::GetLabel_OutputDisabled() const
@ -336,23 +342,8 @@ bool GSFrame::Show( bool shown )
if( wxStaticText* label = GetLabel_OutputDisabled() )
label->Show( EmuConfig.GS.DisableOutput );
switch( wxGetApp().Overrides.GsWindowMode )
{
case GsWinMode_Windowed:
g_Conf->GSWindow.IsFullscreen = false;
break;
case GsWinMode_Fullscreen:
g_Conf->GSWindow.IsFullscreen = true;
break;
case GsWinMode_Unspecified:
g_Conf->GSWindow.IsFullscreen = g_Conf->GSWindow.DefaultToFullscreen;
break;
}
ShowFullScreen( g_Conf->GSWindow.IsFullscreen );
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
if( !m_timer_UpdateTitle.IsRunning() )
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
}
else
{

View File

@ -16,7 +16,7 @@
#pragma once
#include "App.h"
#include "AppCommon.h"
#include "CpuUsageProvider.h"
@ -38,10 +38,11 @@ class GSPanel : public wxWindow
typedef wxWindow _parent;
protected:
AcceleratorDictionary m_Accels;
wxTimer m_HideMouseTimer;
bool m_CursorShown;
bool m_HasFocus;
ScopedPtr<AcceleratorDictionary> m_Accels;
wxTimer m_HideMouseTimer;
bool m_CursorShown;
bool m_HasFocus;
public:
GSPanel( wxWindow* parent );

View File

@ -17,12 +17,16 @@
#include "MainFrame.h"
#include "GSFrame.h"
#include "HostGui.h"
#include "AppAccelerators.h"
#include "AppSaveStates.h"
#include "GS.h"
#include "Utilities/HashMap.h"
// Various includes needed for dumping...
#include "GS.h"
#include "Dump.h"
#include "DebugTools/Debug.h"
#include "R3000A.h"
using namespace HashTools;
@ -325,11 +329,18 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
{ NULL }
};
AcceleratorDictionary::AcceleratorDictionary() :
_parent( 0, 0xffffffff )
CommandDictionary::CommandDictionary() {}
CommandDictionary::~CommandDictionary() throw() {}
AcceleratorDictionary::AcceleratorDictionary()
: _parent( 0, 0xffffffff )
{
}
AcceleratorDictionary::~AcceleratorDictionary() throw() {}
void AcceleratorDictionary::Map( const KeyAcceleratorCode& acode, const char *searchfor )
{
const GlobalCommandDescriptor* result = NULL;
@ -344,7 +355,7 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& acode, const char *se
);
}
wxGetApp().GlobalCommands.TryGetValue( searchfor, result );
wxGetApp().GlobalCommands->TryGetValue( searchfor, result );
if( result == NULL )
{
@ -360,42 +371,45 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& acode, const char *se
void Pcsx2App::BuildCommandHash()
{
if( !GlobalCommands ) GlobalCommands = new CommandDictionary;
const GlobalCommandDescriptor* curcmd = CommandDeclarations;
while( curcmd->Invoke != NULL )
{
GlobalCommands[curcmd->Id] = curcmd;
(*GlobalCommands)[curcmd->Id] = curcmd;
curcmd++;
}
}
void Pcsx2App::InitDefaultGlobalAccelerators()
{
typedef KeyAcceleratorCode AAC;
GlobalAccels.Map( AAC( WXK_F1 ), "States_FreezeCurrentSlot" );
GlobalAccels.Map( AAC( WXK_F3 ), "States_DefrostCurrentSlot" );
GlobalAccels.Map( AAC( WXK_F2 ), "States_CycleSlotForward" );
GlobalAccels.Map( AAC( WXK_F2 ).Shift(), "States_CycleSlotBackward" );
if( !GlobalAccels ) GlobalAccels = new AcceleratorDictionary;
GlobalAccels.Map( AAC( WXK_F4 ), "Framelimiter_MasterToggle");
GlobalAccels.Map( AAC( WXK_F4 ).Shift(), "Frameskip_Toggle");
GlobalAccels.Map( AAC( WXK_TAB ), "Framelimiter_TurboToggle" );
GlobalAccels.Map( AAC( WXK_TAB ).Shift(), "Framelimiter_SlomoToggle" );
GlobalAccels->Map( AAC( WXK_F1 ), "States_FreezeCurrentSlot" );
GlobalAccels->Map( AAC( WXK_F3 ), "States_DefrostCurrentSlot" );
GlobalAccels->Map( AAC( WXK_F2 ), "States_CycleSlotForward" );
GlobalAccels->Map( AAC( WXK_F2 ).Shift(), "States_CycleSlotBackward" );
GlobalAccels->Map( AAC( WXK_F4 ), "Framelimiter_MasterToggle");
GlobalAccels->Map( AAC( WXK_F4 ).Shift(), "Frameskip_Toggle");
GlobalAccels->Map( AAC( WXK_TAB ), "Framelimiter_TurboToggle" );
GlobalAccels->Map( AAC( WXK_TAB ).Shift(), "Framelimiter_SlomoToggle" );
// Hack! The following bindings are temporary hacks which are needed because of issues
// with PAD plugin interfacing (the local window-based accelerators in GSPanel are
// currently ignored).
GlobalAccels.Map( AAC( WXK_ESCAPE ), "Sys_Suspend");
GlobalAccels.Map( AAC( WXK_F8 ), "Sys_TakeSnapshot");
GlobalAccels.Map( AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
GlobalAccels.Map( AAC( WXK_F8 ).Shift().Cmd(),"Sys_TakeSnapshot");
GlobalAccels.Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle");
GlobalAccels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend");
GlobalAccels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot");
GlobalAccels->Map( AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
GlobalAccels->Map( AAC( WXK_F8 ).Shift().Cmd(),"Sys_TakeSnapshot");
GlobalAccels->Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle");
GlobalAccels.Map( AAC( WXK_F10 ), "Sys_LoggingToggle");
GlobalAccels.Map( AAC( WXK_F11 ), "Sys_FreezeGS");
GlobalAccels.Map( AAC( WXK_F12 ), "Sys_RecordingToggle");
GlobalAccels->Map( AAC( WXK_F10 ), "Sys_LoggingToggle");
GlobalAccels->Map( AAC( WXK_F11 ), "Sys_FreezeGS");
GlobalAccels->Map( AAC( WXK_F12 ), "Sys_RecordingToggle");
GlobalAccels.Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" );
GlobalAccels->Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" );
}

View File

@ -14,8 +14,6 @@
*/
#include "PrecompiledHeader.h"
#include "App.h"
#include "MainFrame.h"
#include "IsoDropTarget.h"
#include "Dialogs/ModalPopups.h"

View File

@ -15,6 +15,7 @@
#pragma once
#include "AppCommon.h"
#include <wx/dnd.h>
// --------------------------------------------------------------------------------------

View File

@ -14,7 +14,6 @@
*/
#include "PrecompiledHeader.h"
#include "HostGui.h"
#include "CDVD/CDVD.h"
#include "GS.h"

View File

@ -21,7 +21,6 @@
#pragma once
#include <wx/image.h>
#include <wx/statline.h>
#include <wx/dnd.h>

View File

@ -15,6 +15,7 @@
#include "PrecompiledHeader.h"
#include "App.h"
#include "AppGameDatabase.h"
#include "ConfigurationPanels.h"
extern wxString DiscID;

View File

@ -14,7 +14,8 @@
*/
#include "PrecompiledHeader.h"
#include "MainFrame.h"
#include "AppCoreThread.h"
#include "RecentIsoList.h"
#include "IsoDropTarget.h"
#include "Utilities/IniInterface.h"

View File

@ -15,6 +15,8 @@
#pragma once
#include "AppCommon.h"
// --------------------------------------------------------------------------------------
// RecentIsoManager
// --------------------------------------------------------------------------------------
@ -61,3 +63,16 @@ protected:
void AppStatusEvent_OnSettingsApplied();
};
// --------------------------------------------------------------------------------------
// RecentIsoList
// --------------------------------------------------------------------------------------
struct RecentIsoList
{
ScopedPtr<RecentIsoManager> Manager;
ScopedPtr<wxMenu> Menu;
RecentIsoList();
virtual ~RecentIsoList() throw() { }
};

View File

@ -18,13 +18,10 @@
#include "AppSaveStates.h"
#include "Common.h"
#include "HostGui.h"
#include "GS.h"
#include "Elfheader.h"
StartupParams g_Startup;
// --------------------------------------------------------------------------------------
// Saveslot Section
// --------------------------------------------------------------------------------------

View File

@ -2625,6 +2625,10 @@
RelativePath="..\..\gui\App.h"
>
</File>
<File
RelativePath="..\..\gui\AppAccelerators.h"
>
</File>
<File
RelativePath="..\..\gui\AppCommon.h"
>
@ -2677,10 +2681,6 @@
RelativePath="..\..\gui\GSFrame.h"
>
</File>
<File
RelativePath="..\..\HostGui.h"
>
</File>
<File
RelativePath="..\..\gui\IsoDropTarget.h"
>