wxWidgets: Added multitap toggles to config menu. Note that currently have to enable multitap both in Pcsx2 and LilyPad for extra pads to work.

Also added suggested interface for plugins for whenever the plugin apis are updated.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1907 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
mattmenke 2009-09-23 05:50:23 +00:00
parent cd7f88aa73
commit 2046b8e7b4
5 changed files with 145 additions and 23 deletions

View File

@ -747,6 +747,105 @@ typedef struct _PS2E_ComponentAPI_Mcd
} PS2E_ComponentAPI_Mcd;
// ------------------------------------------------------------------------------------
// KeyEvent type enumerations
// ------------------------------------------------------------------------------------
enum PS2E_KeyEventTypes
{
PS2E_KEY_UP = 0,
PS2E_KEY_DOWN
};
#define PS2E_SHIFT 1
#define PS2E_CONTROL 2
#define PS2E_ALT 4
// --------------------------------------------------------------------------------------
// PS2E_KeyEvent
// --------------------------------------------------------------------------------------
// Structure used to key event data from pad plugin to emulator.
//
typedef struct _PS2E_KeyEvent
{
PS2E_KeyEventTypes event;
// Value of the key being pressed or released
uint value;
// Combination of PS2E_SHIFT, PS2E_CONTROL, and/or PS2E_ALT, indicating which
// modifier keys were also down when the key was pressed.
uint flags;
} PS2E_KeyEvent;
// --------------------------------------------------------------------------------------
// PS2E_ComponentAPI_Pad
// --------------------------------------------------------------------------------------
// Thread Safety:
// * Thread affinity is not guaranteed, except for PadKeyEvent, which is called in the
// GUI thread. Other calls may be made from either the main emu thread or an
// IOP child thread (if the emulator uses one).
//
typedef struct _PS2E_ComponentAPI_Pad
{
// Base Component API (inherited structure)
struct _PS2E_ComponentAPI Base;
// PadIsPresent
// Called by the emulator to detect the availability of a pad. This function
// will be called frequently -- essentially whenever the SIO port for the pad
// has its status polled - so its overhead should be minimal when possible.
//
// A plugin should behave reasonably when a pad that's not plugged in is polled.
//
// Returns:
// 0 if the card is not available, or 1 if it is available.
//
// Exceptions:
// None. This function should not throw.
//
BOOL (PS2E_CALLBACK* PadIsPresent)( PS2E_THISPTR thisptr, uint port, uint slot );
// PadStartPoll
// Called by the emulator to start polling the specified pad.
//
// Returns:
// First byte in response to the poll (Typically 0xff).
//
// Exceptions:
// None. This function should not throw.
//
u8 (PS2E_CALLBACK* PadStartPoll)( PS2E_THISPTR thisptr, uint port, uint slot );
// PadPoll
// Continues polling the specified pad, sending the given value.
//
// Returns:
// Next byte in response to the poll.
//
// Exceptions:
// None. This function should not throw.
//
u8 (PS2E_CALLBACK* PadPoll)( PS2E_THISPTR thisptr, u8 value );
// PadKeyEvent
// Called by the emulator in the gui thread to check for keys being pressed or released.
//
// Returns:
// PS2E_KeyEvent: Key being pressed or released. Should stay valid until next call to
// PadKeyEvent or plugin is closed with EmuClose.
//
// Exceptions:
// None. This function should not throw.
//
typedef PS2E_KeyEvent* (CALLBACK* PadKeyEvent)();
void* reserved[8];
} PS2E_ComponentAPI_Pad;
// --------------------------------------------------------------------------------------
// PS2E_InitAPI
// --------------------------------------------------------------------------------------

View File

@ -105,6 +105,9 @@ enum MenuIdentifiers
MenuId_Config_DEV9,
MenuId_Config_Patches,
MenuId_Config_Multitap0Toggle,
MenuId_Config_Multitap1Toggle,
// Video Subsection
// Top items are PCSX2-controlled. GS plugin items are inserted beneath.
MenuId_Video_Basics, // includes frame timings and skippings settings

View File

@ -194,6 +194,9 @@ void MainEmuFrame::ConnectMenus()
ConnectMenu( MenuId_Config_Settings, Menu_ConfigSettings_Click );
ConnectMenu( MenuId_Config_BIOS, Menu_SelectBios_Click );
ConnectMenu( MenuId_Config_Multitap0Toggle, Menu_MultitapToggle_Click );
ConnectMenu( MenuId_Config_Multitap1Toggle, Menu_MultitapToggle_Click );
ConnectMenuRange(wxID_FILE1, 20, Menu_IsoRecent_Click);
ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_ConfigPlugin_Click);
ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click);
@ -400,6 +403,10 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
m_menuConfig.Append(MenuId_Config_Patches, _("Patches"), wxEmptyString);
m_menuConfig.Append(MenuId_Config_BIOS, _("BIOS") );
m_menuConfig.AppendSeparator();
m_menuConfig.Append(MenuId_Config_Multitap0Toggle, _("Multitap 1"), wxEmptyString, wxITEM_CHECK );
m_menuConfig.Append(MenuId_Config_Multitap1Toggle, _("Multitap 2"), wxEmptyString, wxITEM_CHECK );
m_menuConfig.AppendSeparator();
m_menuConfig.Append(MenuId_Config_ResetAll, _("Reset all..."),
_("Clears all PCSX2 settings and re-runs the startup wizard."));
@ -473,6 +480,10 @@ void MainEmuFrame::ReloadRecentLists()
void MainEmuFrame::ApplySettings()
{
GetMenuBar()->Check( MenuId_SkipBiosToggle, g_Conf->EmuOptions.SkipBiosSplash );
GetMenuBar()->Check( MenuId_Config_Multitap0Toggle, g_Conf->EmuOptions.MultitapPort0_Enabled );
GetMenuBar()->Check( MenuId_Config_Multitap1Toggle, g_Conf->EmuOptions.MultitapPort1_Enabled );
GetMenuBar()->Enable( MenuId_Emu_SuspendResume, SysHasValidState() );
bool result = false;

View File

@ -111,6 +111,8 @@ protected:
void Menu_ConfigPlugin_Click(wxCommandEvent &event);
void Menu_MultitapToggle_Click(wxCommandEvent &event);
void Menu_Debug_Open_Click(wxCommandEvent &event);
void Menu_Debug_MemoryDump_Click(wxCommandEvent &event);
void Menu_Debug_Logging_Click(wxCommandEvent &event);

View File

@ -139,6 +139,13 @@ void MainEmuFrame::Menu_IsoRecent_Click(wxCommandEvent &event)
#include "IniInterface.h"
void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event )
{
g_Conf->EmuOptions.MultitapPort0_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap0Toggle );
g_Conf->EmuOptions.MultitapPort1_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap1Toggle );
AppSaveSettings();
}
void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent &event )
{
g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle );