Moved the link functions to their own menu

This commit is contained in:
skidau 2015-05-01 15:15:32 +00:00
parent def2c61993
commit a42eac7f91
14 changed files with 427 additions and 505 deletions

View File

@ -179,10 +179,10 @@ int languageOption;
int layerEnable = 0xff00;
int layerSettings = 0xff00;
int linkAuto;
int linkHacks;
int linkHacks = 1;
int linkMode;
int linkNumPlayers;
int linkTimeout;
int linkTimeout = 1;
int maxScale;
int mouseCounter = 0;
int movieFrame;
@ -500,7 +500,7 @@ void LoadConfig()
linkHostAddr = ReadPrefString("LinkHostAddr", "localhost");
linkMode = ReadPref("LinkMode", 0); // LINK_DISCONNECTED = 0
linkNumPlayers = ReadPref("LinkNumPlayers", 2);
linkTimeout = ReadPref("LinkTimeout", 1000);
linkTimeout = ReadPref("LinkTimeout", 1);
loadDotCodeFile = ReadPrefString("loadDotCodeFile");
maxScale = ReadPref("maxScale", 0);
movieRecordDir = ReadPrefString("movieRecordDir");

View File

@ -455,7 +455,7 @@ public:
};
static int i, j;
static int linktimeout = 1000;
static int linktimeout = 1;
static LANLINKDATA lanlink;
static u16 cable_data[4];
static CableServer ls;

View File

@ -1675,7 +1675,7 @@ void VBA::loadSettings()
updateThrottle( (unsigned short)regQueryDwordValue( "throttle", 0 ) );
#ifndef NO_LINK
linkTimeout = regQueryDwordValue("LinkTimeout", 1000);
linkTimeout = regQueryDwordValue("LinkTimeout", 1);
linkMode = regQueryDwordValue("LinkMode", LINK_DISCONNECTED);

View File

@ -140,70 +140,70 @@ EVT_HANDLER(wxID_FILE1, "Load recent ROM 1")
{
panel->LoadGame(gopts.recent->GetHistoryFile(0));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE2, "Load recent ROM 2")
{
panel->LoadGame(gopts.recent->GetHistoryFile(1));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE3, "Load recent ROM 3")
{
panel->LoadGame(gopts.recent->GetHistoryFile(2));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE4, "Load recent ROM 4")
{
panel->LoadGame(gopts.recent->GetHistoryFile(3));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE5, "Load recent ROM 5")
{
panel->LoadGame(gopts.recent->GetHistoryFile(4));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE6, "Load recent ROM 6")
{
panel->LoadGame(gopts.recent->GetHistoryFile(5));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE7, "Load recent ROM 7")
{
panel->LoadGame(gopts.recent->GetHistoryFile(6));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE8, "Load recent ROM 8")
{
panel->LoadGame(gopts.recent->GetHistoryFile(7));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE9, "Load recent ROM 9")
{
panel->LoadGame(gopts.recent->GetHistoryFile(8));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER(wxID_FILE10, "Load recent ROM 10")
{
panel->LoadGame(gopts.recent->GetHistoryFile(9));
if (gdbBreakOnLoad)
GDBBreak(this);
GDBBreak();
}
static const struct rom_maker {
@ -1225,29 +1225,6 @@ EVT_HANDLER(JoypadAutofireR, "Autofire R (toggle)")
GetMenuOptionInt("JoypadAutofireR", autofire, KEYM_RIGHT);
}
// new
EVT_HANDLER_MASK(LanLink, "Start LAN link", CMDEN_LINK_ANY)
{
#ifndef NO_LINK
LinkMode mode = GetLinkMode();
if (mode == LINK_CABLE_SOCKET) {
// while we could deactivate the command when connected, it is more
// user-friendly to display a message indidcating why
wxLogError(_("LAN link is already active. Disable link mode to disconnect."));
return;
}
if (mode == LINK_RFU_IPC || mode == LINK_GAMECUBE_DOLPHIN) {
// see above comment
wxLogError(_("RFU and Joybus are only supported in local mode."));
return;
}
wxDialog *dlg = GetXRCDialog("NetLink");
ShowModal(dlg);
panel->SetFrameTitle();
#endif
}
EVT_HANDLER_MASK(LoadGameRecent, "Load most recent save", CMDEN_SAVST)
{
panel->LoadState();
@ -1741,13 +1718,13 @@ EVT_HANDLER(DebugGDBBreakOnLoad, "Break on load")
update_opts();
}
void GDBBreak(MainFrame* mf)
void MainFrame::GDBBreak()
{
ModalPause mp;
if (gdbPort == 0)
{
gdbPort = GetGDBPort(mf);
gdbPort = GetGDBPort(this);
update_opts();
}
@ -1768,7 +1745,7 @@ void GDBBreak(MainFrame* mf)
return;
msg.Printf(_("Waiting for connection on port %d"), gdbPort);
}
wxProgressDialog dlg(_("Waiting for GDB..."), msg, 100, mf,
wxProgressDialog dlg(_("Waiting for GDB..."), msg, 100, this,
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME);
bool connected = false;
while (dlg.Pulse()) {
@ -1792,9 +1769,9 @@ void GDBBreak(MainFrame* mf)
dbgMain = remoteStubMain;
dbgSignal = remoteStubSignal;
dbgOutput = remoteOutput;
mf->cmd_enable &= ~(CMDEN_NGDB_ANY | CMDEN_NGDB_GBA);
mf->cmd_enable |= CMDEN_GDB;
mf->enable_menus();
cmd_enable &= ~(CMDEN_NGDB_ANY | CMDEN_NGDB_GBA);
cmd_enable |= CMDEN_GDB;
enable_menus();
}
else
{
@ -1818,7 +1795,7 @@ void GDBBreak(MainFrame* mf)
EVT_HANDLER_MASK(DebugGDBBreak, "Break into GDB", CMDEN_NGDB_GBA | CMDEN_GDB)
{
GDBBreak(this);
GDBBreak();
}
EVT_HANDLER_MASK(DebugGDBDisconnect, "Disconnect GDB", CMDEN_GDB)
@ -1903,11 +1880,14 @@ EVT_HANDLER(GameBoyConfigure, "Game Boy options...")
// don't want to have to reset to change colors
memcpy(gbPalette, &systemGbPalette[gbPaletteOption * 8], 8 * sizeof(systemGbPalette[0]));
}
#if (defined __WIN32__ || defined _WIN32)
gbSerialFunction = gbStartLink;
#else
gbSerialFunction = NULL;
#endif
if(printeron != gopts.gbprint) {
if(gopts.gbprint)
gbSerialFunction = gbPrinterSend;
else
gbSerialFunction = NULL;
if(gopts.gbprint)
gbSerialFunction = gbPrinterSend;
}
}
@ -2176,45 +2156,6 @@ EVT_HANDLER(JoypadConfigure, "Joypad options...")
SetJoystick();
}
// new
EVT_HANDLER(LinkConfigure, "Link options...")
{
#ifndef NO_LINK
wxString jh = gopts.joybus_host;
wxDialog *dlg = GetXRCDialog("LinkConfig");
if (ShowModal(dlg) != wxID_OK)
return;
bool valid = SetLinkServerHost(gopts.joybus_host.mb_str());
if (!valid) {
wxMessageBox(_("You must enter a valid host name"),
_("Host name invalid"), wxICON_ERROR | wxOK);
return;
}
update_opts();
SetLinkTimeout(gopts.linktimeout);
LinkMode oldLinkMode = GetLinkMode();
LinkMode newLinkMode = getOptionsLinkMode();
bool dolphinHostChanged = jh != gopts.joybus_host;
if (newLinkMode != oldLinkMode || dolphinHostChanged) {
CloseLink();
InitLink(newLinkMode);
}
cmd_enable &= ~CMDEN_LINK_ANY;
if (GetLinkMode() != LINK_DISCONNECTED) {
cmd_enable |= CMDEN_LINK_ANY;
}
enable_menus();
#endif
}
EVT_HANDLER(Customize, "Customize UI...")
{
wxDialog *dlg = GetXRCDialog("AccelConfig");
@ -2319,30 +2260,6 @@ EVT_HANDLER(PrintSnap, "Automatically save printouts as screen captures with -pr
update_opts();
}
EVT_HANDLER(Joybus, "Enable joybus")
{
GetMenuOptionBool("Joybus", gopts.gba_joybus_enabled);
update_opts();
}
EVT_HANDLER(Link, "Enable link cable")
{
GetMenuOptionBool("Link", gopts.gba_link_enabled);
update_opts();
}
EVT_HANDLER(SpeedOn, "Enable faster network protocol by default")
{
GetMenuOptionBool("SpeedOn", gopts.lanlink_speed);
update_opts();
}
EVT_HANDLER(RFU, "Enable RFU for link")
{
GetMenuOptionBool("RFU", gopts.rfu_enabled);
update_opts();
}
EVT_HANDLER(GBASoundInterpolation, "GBA sound interpolation")
{
GetMenuOptionBool("GBASoundInterpolation", gopts.soundInterpolation);
@ -2451,6 +2368,118 @@ EVT_HANDLER(VSync, "Wait for vertical sync")
update_opts();
}
#ifndef NO_LINK
void MainFrame::EnableNetworkMenu()
{
cmd_enable &= ~CMDEN_LINK_ANY;
if (gopts.gba_link_type != 0)
cmd_enable |= CMDEN_LINK_ANY;
if (gopts.link_proto)
cmd_enable &= ~CMDEN_LINK_ANY;
enable_menus();
}
void SetLinkTypeMenu(const char *type, int value)
{
MainFrame *mf = wxGetApp().frame;
mf->SetMenuOption("LinkType0Nothing", 0);
mf->SetMenuOption("LinkType1Cable", 0);
mf->SetMenuOption("LinkType2Wireless", 0);
mf->SetMenuOption("LinkType3GameCube", 0);
mf->SetMenuOption("LinkType4Gameboy", 0);
mf->SetMenuOption(type, 1);
gopts.gba_link_type = value;
update_opts();
mf->EnableNetworkMenu();
}
EVT_HANDLER_MASK(LanLink, "Start Network link", CMDEN_LINK_ANY)
{
LinkMode mode = GetLinkMode();
if (mode != LINK_DISCONNECTED) {
// while we could deactivate the command when connected, it is more
// user-friendly to display a message indidcating why
wxLogError(_("LAN link is already active. Disable link mode to disconnect."));
return;
}
if (gopts.link_proto) {
// see above comment
wxLogError(_("Network is not supported in local mode."));
return;
}
wxDialog *dlg = GetXRCDialog("NetLink");
ShowModal(dlg);
panel->SetFrameTitle();
}
EVT_HANDLER(LinkType0Nothing, "Link nothing")
{
SetLinkTypeMenu("LinkType0Nothing", 0);
}
EVT_HANDLER(LinkType1Cable, "Link cable")
{
SetLinkTypeMenu("LinkType1Cable", 1);
}
EVT_HANDLER(LinkType2Wireless, "Link wireless")
{
SetLinkTypeMenu("LinkType2Wireless", 2);
}
EVT_HANDLER(LinkType3GameCube, "Link GameCube")
{
SetLinkTypeMenu("LinkType3GameCube", 3);
}
EVT_HANDLER(LinkType4Gameboy, "Link Gameboy")
{
SetLinkTypeMenu("LinkType4Gameboy", 4);
}
EVT_HANDLER(LinkAuto, "Enable link at boot")
{
GetMenuOptionBool("LinkAuto", gopts.link_auto);
update_opts();
}
EVT_HANDLER(SpeedOn, "Enable faster network protocol by default")
{
GetMenuOptionInt("SpeedOn", linkHacks, 1);
update_opts();
}
EVT_HANDLER(LinkProto, "Local host IPC")
{
GetMenuOptionInt("LinkProto", gopts.link_proto, 1);
update_opts();
enable_menus();
EnableNetworkMenu();
}
EVT_HANDLER(LinkConfigure, "Link options...")
{
wxDialog *dlg = GetXRCDialog("LinkConfig");
if (ShowModal(dlg) != wxID_OK)
return;
SetLinkTimeout(linkTimeout);
update_opts();
EnableNetworkMenu();
}
#endif
// Dummy for disabling system key bindings

View File

@ -78,77 +78,82 @@ public:
if(!dlg->Validate() || !dlg->TransferDataFromWindow())
return;
if (!server) {
if (!server)
{
bool valid = SetLinkServerHost(gopts.link_host.mb_str());
if (!valid) {
wxMessageBox(_("You must enter a valid host name"),
_("Host name invalid"), wxICON_ERROR | wxOK);
return;
}
}
update_opts(); // save fast flag and client host
// Close any previous link
CloseLink();
wxString connmsg;
wxString title;
SetLinkTimeout(gopts.linktimeout);
EnableSpeedHacks(gopts.lanlink_speed);
EnableLinkServer(server, n_players - 1);
if (server) {
char host[length];
GetLinkServerHost(host, length);
title.Printf(_("Waiting for clients..."));
connmsg.Printf(_("Server IP address is: %s\n"), wxString(host, wxConvLibc).c_str());
} else {
title.Printf(_("Waiting for connection..."));
connmsg.Printf(_("Connecting to %s\n"), gopts.link_host.c_str());
}
// Init link
ConnectionState state = InitLink(LINK_CABLE_SOCKET);
// Display a progress dialog while the connection is establishing
if (state == LINK_NEEDS_UPDATE) {
wxProgressDialog pdlg(title, connmsg,
100, dlg, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME);
while (state == LINK_NEEDS_UPDATE) {
// Ask the core for updates
char message[length];
state = ConnectLinkUpdate(message, length);
connmsg = wxString(message, wxConvLibc);
// Does the user want to abort?
if (!pdlg.Pulse(connmsg)) {
state = LINK_ABORT;
if (!valid)
{
wxMessageBox(_("You must enter a valid host name"),
_("Host name invalid"), wxICON_ERROR | wxOK);
return;
}
}
}
// The user canceled the connection attempt
if (state == LINK_ABORT) {
linkNumPlayers = n_players;
update_opts(); // save fast flag and client host
// Close any previous link
CloseLink();
}
// Something failed during init
if (state == LINK_ERROR) {
CloseLink();
wxLogError(_("Error occurred.\nPlease try again."));
}
wxString connmsg;
wxString title;
if(GetLinkMode() != LINK_DISCONNECTED) {
connmsg.Replace(wxT("\n"), wxT(" "));
systemScreenMessage(connmsg);
SetLinkTimeout(linkTimeout);
EnableSpeedHacks(linkHacks);
EnableLinkServer(server, linkNumPlayers - 1);
ev.Skip(); // all OK
}
if (server) {
char host[length];
GetLinkServerHost(host, length);
title.Printf(_("Waiting for clients..."));
connmsg.Printf(_("Server IP address is: %s\n"), wxString(host, wxConvLibc).c_str());
} else {
title.Printf(_("Waiting for connection..."));
connmsg.Printf(_("Connecting to %s\n"), gopts.link_host.c_str());
}
// Init link
MainFrame *mf = wxGetApp().frame;
ConnectionState state = InitLink(mf->GetConfiguredLinkMode());
// Display a progress dialog while the connection is establishing
if (state == LINK_NEEDS_UPDATE) {
wxProgressDialog pdlg(title, connmsg,
100, dlg, wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME);
while (state == LINK_NEEDS_UPDATE) {
// Ask the core for updates
char message[length];
state = ConnectLinkUpdate(message, length);
connmsg = wxString(message, wxConvLibc);
// Does the user want to abort?
if (!pdlg.Pulse(connmsg)) {
state = LINK_ABORT;
}
}
}
// The user canceled the connection attempt
if (state == LINK_ABORT) {
CloseLink();
}
// Something failed during init
if (state == LINK_ERROR) {
CloseLink();
wxLogError(_("Error occurred.\nPlease try again."));
}
if(GetLinkMode() != LINK_DISCONNECTED) {
connmsg.Replace(wxT("\n"), wxT(" "));
systemScreenMessage(connmsg);
ev.Skip(); // all OK
}
}
} net_link_handler;
#endif
@ -2120,7 +2125,7 @@ void MainFrame::set_global_accels()
SetRecentAccels();
}
void MainFrame::MenuOptionBool(const char* menuName, bool field)
void MainFrame::MenuOptionBool(const char* menuName, bool &field)
{
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) {
@ -2132,7 +2137,7 @@ void MainFrame::MenuOptionBool(const char* menuName, bool field)
}
}
void MainFrame::MenuOptionInt(const char* menuName, int field, int mask)
void MainFrame::MenuOptionIntMask(const char* menuName, int &field, int mask)
{
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
int value = mask;
@ -2147,6 +2152,19 @@ void MainFrame::MenuOptionInt(const char* menuName, int field, int mask)
}
}
void MainFrame::MenuOptionIntRadioValue(const char* menuName, int &field, int value)
{
int id = wxXmlResource::GetXRCID(wxString(menuName, wxConvUTF8));
for (int i = 0; i < checkable_mi.size(); i++) {
if (checkable_mi[i].cmd != id)
continue;
checkable_mi[i].intopt = &field;
checkable_mi[i].val = field;
checkable_mi[i].mi->Check(field == value);
break;
}
}
// If there is a menubar, store all special menuitems
#define XRCITEM_I(id) menubar->FindItem(id, NULL)
#define XRCITEM_D(s) XRCITEM_I(XRCID_D(s))
@ -2306,7 +2324,7 @@ bool MainFrame::BindControls()
if (menuName == cmdtab[i].cmd)
{
if (opts[j].intopt)
MenuOptionInt(opts[j].cmd, *opts[j].intopt, (1 << 0));
MenuOptionIntMask(opts[j].cmd, *opts[j].intopt, (1 << 0));
else if (opts[j].boolopt)
MenuOptionBool(opts[j].cmd, *opts[j].boolopt);
}
@ -2348,30 +2366,36 @@ bool MainFrame::BindControls()
if (checkable_mi.size()) {
MenuOptionBool("RecentFreeze", gopts.recent_freeze);
MenuOptionBool("Pause", paused);
MenuOptionInt("SoundChannel1", gopts.sound_en, (1 << 0));
MenuOptionInt("SoundChannel2", gopts.sound_en, (1 << 1));
MenuOptionInt("SoundChannel3", gopts.sound_en, (1 << 2));
MenuOptionInt("SoundChannel4", gopts.sound_en, (1 << 3));
MenuOptionInt("DirectSoundA", gopts.sound_en, (1 << 8));
MenuOptionInt("DirectSoundB", gopts.sound_en, (1 << 9));
MenuOptionInt("VideoLayersBG0", layerSettings, (1 << 8));
MenuOptionInt("VideoLayersBG1", layerSettings, (1 << 9));
MenuOptionInt("VideoLayersBG2", layerSettings, (1 << 10));
MenuOptionInt("VideoLayersBG3", layerSettings, (1 << 11));
MenuOptionInt("VideoLayersOBJ", layerSettings, (1 << 12));
MenuOptionInt("VideoLayersWIN0", layerSettings, (1 << 13));
MenuOptionInt("VideoLayersWIN1", layerSettings, (1 << 14));
MenuOptionInt("VideoLayersOBJWIN", layerSettings, (1 << 15));
MenuOptionIntMask("SoundChannel1", gopts.sound_en, (1 << 0));
MenuOptionIntMask("SoundChannel2", gopts.sound_en, (1 << 1));
MenuOptionIntMask("SoundChannel3", gopts.sound_en, (1 << 2));
MenuOptionIntMask("SoundChannel4", gopts.sound_en, (1 << 3));
MenuOptionIntMask("DirectSoundA", gopts.sound_en, (1 << 8));
MenuOptionIntMask("DirectSoundB", gopts.sound_en, (1 << 9));
MenuOptionIntMask("VideoLayersBG0", layerSettings, (1 << 8));
MenuOptionIntMask("VideoLayersBG1", layerSettings, (1 << 9));
MenuOptionIntMask("VideoLayersBG2", layerSettings, (1 << 10));
MenuOptionIntMask("VideoLayersBG3", layerSettings, (1 << 11));
MenuOptionIntMask("VideoLayersOBJ", layerSettings, (1 << 12));
MenuOptionIntMask("VideoLayersWIN0", layerSettings, (1 << 13));
MenuOptionIntMask("VideoLayersWIN1", layerSettings, (1 << 14));
MenuOptionIntMask("VideoLayersOBJWIN", layerSettings, (1 << 15));
MenuOptionBool("CheatsAutoSaveLoad", gopts.autoload_cheats);
MenuOptionBool("CheatsEnable", cheatsEnabled);
MenuOptionBool("KeepSaves", skipSaveGameBattery);
MenuOptionBool("KeepCheats", skipSaveGameCheats);
MenuOptionIntMask("CheatsEnable", cheatsEnabled, 1);
MenuOptionIntMask("KeepSaves", skipSaveGameBattery, 1);
MenuOptionIntMask("KeepCheats", skipSaveGameCheats, 1);
MenuOptionBool("LoadGameAutoLoad", gopts.autoload_state);
MenuOptionInt("JoypadAutofireA", autofire, KEYM_A);
MenuOptionInt("JoypadAutofireB", autofire, KEYM_B);
MenuOptionInt("JoypadAutofireL", autofire, KEYM_LEFT);
MenuOptionInt("JoypadAutofireR", autofire, KEYM_RIGHT);
MenuOptionIntMask("JoypadAutofireA", autofire, KEYM_A);
MenuOptionIntMask("JoypadAutofireB", autofire, KEYM_B);
MenuOptionIntMask("JoypadAutofireL", autofire, KEYM_LEFT);
MenuOptionIntMask("JoypadAutofireR", autofire, KEYM_RIGHT);
MenuOptionBool("EmulatorSpeedupToggle", turbo);
MenuOptionIntRadioValue("LinkType0Nothing", gopts.gba_link_type, 0);
MenuOptionIntRadioValue("LinkType1Cable", gopts.gba_link_type, 1);
MenuOptionIntRadioValue("LinkType2Wireless", gopts.gba_link_type, 2);
MenuOptionIntRadioValue("LinkType3GameCube", gopts.gba_link_type, 3);
MenuOptionIntRadioValue("LinkType4Gameboy", gopts.gba_link_type, 4);
}
for (int i = 0; i < checkable_mi.size(); i++)
if (!checkable_mi[i].boolopt && !checkable_mi[i].intopt) {
@ -2513,6 +2537,7 @@ bool MainFrame::BindControls()
#ifndef NO_LINK
{
net_link_handler.dlg = d;
net_link_handler.n_players = linkNumPlayers;
getrbbe("Server", net_link_handler.server);
getrbbd("Client", net_link_handler.server);
getlab("PlayersLab");
@ -2527,8 +2552,6 @@ bool MainFrame::BindControls()
addrber(lab, true);
gettc("ServerIP", gopts.link_host);
addrber(tc, true);
getrbbr("SpeedOff", gopts.lanlink_speed);
getrbb("SpeedOn", gopts.lanlink_speed);
wxWindow *okb = d->FindWindow(wxID_OK);
if (okb) { // may be gone if style guidlines removed it
net_link_handler.okb = wxStaticCast(okb, wxButton);
@ -3114,17 +3137,9 @@ bool MainFrame::BindControls()
#ifndef NO_LINK
d = LoadXRCDialog("LinkConfig");
{
getcbbe("Joybus", gopts.gba_joybus_enabled);
getlab("JoybusHostLab");
addbe(lab);
gettc("JoybusHost", gopts.joybus_host);
addbe(tc);
getcbbe("Link", gopts.gba_link_enabled);
getcbb("RFU", gopts.rfu_enabled);
addbe(cb);
getlab("LinkTimeoutLab");
addbe(lab);
getsc("LinkTimeout", gopts.linktimeout);
getsc("LinkTimeout", linkTimeout);
addbe(sc);
d->Fit();
}
@ -3252,17 +3267,16 @@ bool MainFrame::BindControls()
panel->ShowFullScreen(true);
#ifndef NO_LINK
LinkMode linkMode = getOptionsLinkMode();
LinkMode linkMode = GetConfiguredLinkMode();
if (linkMode == LINK_GAMECUBE_DOLPHIN) {
bool isv = !gopts.joybus_host.empty();
bool isv = !gopts.link_host.empty();
if (isv) {
isv = SetLinkServerHost(gopts.joybus_host.mb_str());
isv = SetLinkServerHost(gopts.link_host.mb_str());
}
if (!isv) {
wxLogError(_("JoyBus host invalid; disabling"));
gopts.gba_joybus_enabled = false;
}
else {
linkMode = LINK_DISCONNECTED;
@ -3275,7 +3289,14 @@ bool MainFrame::BindControls()
}
if (GetLinkMode() != LINK_DISCONNECTED)
{
cmd_enable |= CMDEN_LINK_ANY;
SetLinkTimeout(linkTimeout);
EnableSpeedHacks(linkHacks);
}
EnableNetworkMenu();
#endif
enable_menus();

View File

@ -14,7 +14,7 @@
/* not sure how well other compilers support field-init syntax */
#define STROPT(c, n, d, v) {wxT(c), (n), d, &v}
#define INTOPT(c, n, d, v, max, min) {wxT(c), (n), d, NULL, &v, NULL, max, min}
#define INTOPT(c, n, d, v, min, max) {wxT(c), (n), d, NULL, &v, NULL, min, max}
#define BOOLOPT(c, n, d, v) {wxT(c), (n), d, NULL, NULL, NULL, 0, 0, &v}
#define ENUMOPT(c, n, d, v, e) {wxT(c), (n), d, NULL, &v, e}
@ -161,14 +161,12 @@ opt_desc opts[] = {
/// GBA
STROPT ("GBA/BiosFile", "", wxTRANSLATE("BIOS file to use, if enabled"), gopts.gba_bios),
#ifndef NO_LINK
BOOLOPT("GBA/Joybus", "Joybus", wxTRANSLATE("Enable joybus"), gopts.gba_joybus_enabled),
STROPT ("GBA/JoybusHost", "", wxTRANSLATE("Joybus host address"), gopts.joybus_host),
BOOLOPT("GBA/Link", "Link", wxTRANSLATE("Enable link cable"), gopts.gba_link_enabled),
BOOLOPT("GBA/LinkFast", "SpeedOn", wxTRANSLATE("Enable faster network protocol by default"), gopts.lanlink_speed),
BOOLOPT("GBA/LinkAuto", "LinkAuto", wxTRANSLATE("Enable link at boot"), gopts.link_auto),
INTOPT ("GBA/LinkFast", "SpeedOn", wxTRANSLATE("Enable faster network protocol by default"), linkHacks, 0, 1),
STROPT ("GBA/LinkHost", "", wxTRANSLATE("Default network link client host"), gopts.link_host),
ENUMOPT("GBA/LinkProto", "", wxTRANSLATE("Default network protocol"), gopts.link_proto, wxTRANSLATE("tcp|udp")),
BOOLOPT("GBA/LinkRFU", "RFU", wxTRANSLATE("Enable RFU for link"), gopts.rfu_enabled),
INTOPT ("GBA/LinkTimeout", "", wxTRANSLATE("Link timeout (ms)"), gopts.linktimeout, 0, 9999999),
INTOPT ("GBA/LinkProto", "LinkProto", wxTRANSLATE("Default network protocol"), gopts.link_proto, 0, 1),
INTOPT ("GBA/LinkTimeout", "LinkTimeout", wxTRANSLATE("Link timeout (ms)"), linkTimeout, 0, 9999999),
INTOPT ("GBA/LinkType", "LinkType", wxTRANSLATE("Link cable type"), gopts.gba_link_type, 0, 5),
#endif
STROPT ("GBA/ROMDir", "", wxTRANSLATE("Directory to look for ROM files"), gopts.gba_rom_dir),
@ -215,6 +213,7 @@ opt_desc opts[] = {
ENUMOPT("preferences/gbPaletteOption", "", wxTRANSLATE("The palette to use"), gbPaletteOption, wxTRANSLATE("default|user1|user2")),
INTOPT ("preferences/gdbBreakOnLoad", "DebugGDBBreakOnLoad", wxTRANSLATE("Break into GDB after loading the game."), gdbBreakOnLoad, 0, 1),
INTOPT ("preferences/gdbPort", "DebugGDBPort", wxTRANSLATE("Port to connect GDB to."), gdbPort, 0, 65535),
INTOPT ("preferences/LinkNumPlayers", "", wxTRANSLATE("Number of players in network"), linkNumPlayers, 2, 4),
INTOPT ("preferences/maxScale", "", wxTRANSLATE("Maximum scale factor (0 = no limit)"), maxScale, 0, 100),
INTOPT ("preferences/pauseWhenInactive", "PauseWhenInactive", wxTRANSLATE("Pause game when main window loses focus"), pauseWhenInactive, 0, 1),
INTOPT ("preferences/rtcEnabled", "RTC", wxTRANSLATE("Enable RTC (vba-over.ini override is rtcEnabled"), rtcEnabled, 0, 1),

View File

@ -33,14 +33,10 @@ extern struct opts_t {
/// GBA
wxString gba_bios;
bool gba_joybus_enabled;
wxString joybus_host;
bool gba_link_enabled;
bool lanlink_speed;
int gba_link_type;
wxString link_host;
int link_proto;
bool rfu_enabled;
int linktimeout;
bool link_auto;
wxString gba_rom_dir;
/// General

View File

@ -1,11 +1,12 @@
#include <wx/dcbuffer.h>
#include "wxvbam.h"
#include "drawing.h"
#include "../common/ConfigManager.h"
#include "../common/Patch.h"
#include "../gb/gbPrinter.h"
#include "../gba/RTC.h"
#include "../gba/agbprint.h"
#include "../gb/gbPrinter.h"
#include "../common/Patch.h"
#include <wx/dcbuffer.h>
#include "../sdl/text.h"
#include "filters.h"
#include "../../svnrev.h"
@ -271,11 +272,14 @@ void GameArea::LoadGame(const wxString &name)
mf->cmd_enable |= loaded == IMAGE_GB ? CMDEN_GB : (CMDEN_GBA | CMDEN_NGDB_GBA);
mf->enable_menus();
#if (defined __WIN32__ || defined _WIN32)
gbSerialFunction = gbStartLink;
#else
gbSerialFunction = NULL;
#endif
// probably only need to do this for GB carts
if(gopts.gbprint)
gbSerialFunction = gbPrinterSend;
else
gbSerialFunction = NULL;
gbSerialFunction = gbPrinterSend;
// probably only need to do this for GBA carts
agbPrintEnable(agbPrint);
@ -336,6 +340,14 @@ void GameArea::LoadGame(const wxString &name)
}
}
}
#ifndef NO_LINK
if (gopts.link_auto)
{
linkMode = mf->GetConfiguredLinkMode();
BootLink(linkMode, gopts.link_host.mb_str(wxConvUTF8), linkTimeout, linkHacks, linkNumPlayers);
}
#endif
}
void GameArea::SetFrameTitle()
@ -785,14 +797,17 @@ void GameArea::OnIdle(wxIdleEvent &event)
{
wxString pl = wxGetApp().pending_load;
if(pl.size()) {
// sometimes this gets into a loop if LoadGame() called before
// clearing pending_load. weird.
wxGetApp().pending_load = wxEmptyString;
LoadGame(pl);
if(debugger && loaded != IMAGE_GBA) {
wxLogError(_("Not a valid GBA cartridge"));
UnloadGame();
}
// sometimes this gets into a loop if LoadGame() called before
// clearing pending_load. weird.
wxGetApp().pending_load = wxEmptyString;
LoadGame(pl);
MainFrame* mf = wxGetApp().frame;
if (gdbBreakOnLoad)
mf->GDBBreak();
if(debugger && loaded != IMAGE_GBA) {
wxLogError(_("Not a valid GBA cartridge"));
UnloadGame();
}
}
// stupid wx doesn't resize to screen size
// forcing it this way just puts it in an infinite loop, though

View File

@ -665,13 +665,33 @@ void MainFrame::StopModal()
panel->Resume();
}
LinkMode MainFrame::getOptionsLinkMode() {
if (gopts.gba_joybus_enabled) {
LinkMode MainFrame::GetConfiguredLinkMode() {
switch (gopts.gba_link_type)
{
case 0:
return LINK_DISCONNECTED;
break;
case 1:
if (gopts.link_proto)
return LINK_CABLE_IPC;
else
return LINK_CABLE_SOCKET;
break;
case 2:
if (gopts.link_proto)
return LINK_RFU_IPC;
else
return LINK_RFU_SOCKET;
break;
case 3:
return LINK_GAMECUBE_DOLPHIN;
} else if (gopts.rfu_enabled) {
return LINK_RFU_IPC;
} else if (gopts.gba_link_enabled) {
return LINK_CABLE_IPC;
break;
case 4:
return LINK_GAMEBOY;
break;
default:
return LINK_DISCONNECTED;
break;
}
return LINK_DISCONNECTED;

View File

@ -171,8 +171,9 @@ public:
~MainFrame();
bool BindControls();
void MenuOptionInt(const char* menuName, int field, int mask);
void MenuOptionBool(const char* menuName, bool field);
void MenuOptionIntMask(const char* menuName, int &field, int mask);
void MenuOptionIntRadioValue(const char* menuName, int &field, int mask);
void MenuOptionBool(const char* menuName, bool &field);
void GetMenuOptionInt(const char* menuName, int &field, int mask);
void GetMenuOptionBool(const char* menuName, bool &field);
void SetMenuOption(const char* menuName, int value);
@ -198,6 +199,7 @@ public:
// adjust menus based on current cmd_enable
void enable_menus();
void EnableNetworkMenu();
// adjust menus based on available save game states
void update_state_ts(bool force = false);
@ -220,6 +222,12 @@ public:
// 2.8 has no HasFocus(), and FindFocus() doesn't work right
bool HasFocus() { return focused; }
// Returns the link mode to set according to the options
LinkMode GetConfiguredLinkMode();
// Start GDB listener
void GDBBreak();
// The various viewer popups; these can be popped up as often as
// desired
void Disassemble();
@ -291,8 +299,6 @@ private:
wxDialog * LoadXRCDialog(const char * name);
// Load a named wxDialog from the XRC file
wxDialog * LoadXRCropertySheetDialog(const char * name);
// Returns the link mode to set according to the options
LinkMode getOptionsLinkMode();
#include "cmdhandlers.h"
};

View File

@ -150,9 +150,6 @@
<checkable>1</checkable>
</object>
</object>
<object class="wxMenuItem" name="LanLink">
<label>Start _Network Link...</label>
</object>
<object class="separator"/>
<object class="wxMenu">
<object class="wxMenuItem" name="LoadGameRecent">
@ -448,9 +445,6 @@
<object class="wxMenuItem" name="JoypadConfigure">
<label>_Joypads ...</label>
</object>
<object class="wxMenuItem" name="LinkConfigure">
<label>_Link ...</label>
</object>
<object class="wxMenuItem" name="Customize">
<label>_Key Shortcuts ...</label>
</object>
@ -482,22 +476,6 @@
<label>_Save printouts as screen captures</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="Joybus">
<label>_Joybus</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="Link">
<label>_Link cable</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="SpeedOn">
<label>_Faster network protocol by default</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="RFU">
<label>_RFU (Wireless adapter)</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="GBASoundInterpolation">
<label>_GBA sound interpolation</label>
<checkable>1</checkable>
@ -566,7 +544,51 @@
<label>_VSync</label>
<checkable>1</checkable>
</object>
</object>
</object>
<object class="wxMenu">
<label>_Link</label>
<object class="wxMenuItem" name="LanLink">
<label>Start _Network Link...</label>
</object>
<object class="wxMenu">
<label>_Type</label>
<object class="wxMenuItem" name="LinkType0Nothing">
<label>_Nothing</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType1Cable">
<label>_Cable</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType2Wireless">
<label>_Wireless</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType3GameCube">
<label>_GameCube</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType4Gameboy">
<label>_Gameboy</label>
<checkable>1</checkable>
</object>
</object>
<object class="wxMenuItem" name="LinkProto">
<label>_Local mode</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkAuto">
<label>_Link at boot</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="SpeedOn">
<label>_Speed hack</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkConfigure">
<label>_Configure...</label>
</object>
</object>
<object class="wxMenu">
<label>_Help</label>
<object class="wxMenuItem" name="BugReport">
@ -1116,68 +1138,6 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Protocol:</label>
<hidden>1</hidden>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxGridSizer">
<cols>2</cols>
<object class="sizeritem">
<object class="wxRadioButton" name="TCP">
<label>TCP</label>
<hidden>1</hidden>
<style>wxRB_GROUP</style>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="UDP">
<label>UDP</label>
<hidden>1</hidden>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Speed hacks:</label>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxGridSizer">
<cols>2</cols>
<rows>2</rows>
<object class="sizeritem">
<object class="wxRadioButton" name="SpeedOff">
<label>Off (accurate)</label>
<style>wxRB_GROUP</style>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="SpeedOn">
<label>On (fast)</label>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
<cols>2</cols>
<growablecols>1</growablecols>
</object>
<flag>wxEXPAND</flag>
</object>
@ -3704,48 +3664,6 @@
<title>Link Options</title>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxCheckBox" name="Joybus">
<label>Enable joybus</label>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxStaticText" name="JoybusHostLab">
<label>Joybus host</label>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxTextCtrl" name="JoybusHost"/>
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<orient>wxHORIZONTAL</orient>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="Link">
<label>Enable link</label>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="RFU">
<label>Enable wireless</label>
<tooltip>Please note that this is the first version of RFU emulation code and it's probably got more bugs than the link code. Also, it is only supported with 2 players in local mode.</tooltip>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">

View File

@ -3,48 +3,6 @@
<object class="wxDialog" name="LinkConfig">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxCheckBox" name="Joybus">
<label>Enable joybus</label>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">
<object class="wxStaticText" name="JoybusHostLab">
<label>Joybus host</label>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxTextCtrl" name="JoybusHost"/>
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<orient>wxHORIZONTAL</orient>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="Link">
<label>Enable link</label>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="RFU">
<label>Enable wireless</label>
<tooltip>Please note that this is the first version of RFU emulation code and it's probably got more bugs than the link code. Also, it is only supported with 2 players in local mode.</tooltip>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<object class="sizeritem">

View File

@ -130,9 +130,6 @@
<checkable>1</checkable>
</object>
</object>
<object class="wxMenuItem" name="LanLink">
<label>Start _Network Link...</label>
</object>
<object class="separator"/>
<object class="wxMenu">
<object class="wxMenuItem" name="LoadGameRecent">
@ -428,9 +425,6 @@
<object class="wxMenuItem" name="JoypadConfigure">
<label>_Joypads ...</label>
</object>
<object class="wxMenuItem" name="LinkConfigure">
<label>_Link ...</label>
</object>
<object class="wxMenuItem" name="Customize">
<label>_Key Shortcuts ...</label>
</object>
@ -462,22 +456,6 @@
<label>_Save printouts as screen captures</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="Joybus">
<label>_Joybus</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="Link">
<label>_Link cable</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="SpeedOn">
<label>_Faster network protocol by default</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="RFU">
<label>_RFU (Wireless adapter)</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="GBASoundInterpolation">
<label>_GBA sound interpolation</label>
<checkable>1</checkable>
@ -547,6 +525,50 @@
<checkable>1</checkable>
</object>
</object>
<object class="wxMenu">
<label>_Link</label>
<object class="wxMenuItem" name="LanLink">
<label>Start _Network Link...</label>
</object>
<object class="wxMenu">
<label>_Type</label>
<object class="wxMenuItem" name="LinkType0Nothing">
<label>_Nothing</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType1Cable">
<label>_Cable</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType2Wireless">
<label>_Wireless</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType3GameCube">
<label>_GameCube</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkType4Gameboy">
<label>_Gameboy</label>
<checkable>1</checkable>
</object>
</object>
<object class="wxMenuItem" name="LinkProto">
<label>_Local mode</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkAuto">
<label>_Link at boot</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="SpeedOn">
<label>_Speed hack</label>
<checkable>1</checkable>
</object>
<object class="wxMenuItem" name="LinkConfigure">
<label>_Configure...</label>
</object>
</object>
<object class="wxMenu">
<label>_Help</label>
<object class="wxMenuItem" name="BugReport">

View File

@ -75,68 +75,6 @@
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Protocol:</label>
<hidden>1</hidden>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxGridSizer">
<cols>2</cols>
<object class="sizeritem">
<object class="wxRadioButton" name="TCP">
<label>TCP</label>
<hidden>1</hidden>
<style>wxRB_GROUP</style>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="UDP">
<label>UDP</label>
<hidden>1</hidden>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxStaticText">
<label>Speed hacks:</label>
</object>
<flag>wxALL|wxALIGN_CENTRE_VERTICAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxGridSizer">
<cols>2</cols>
<rows>2</rows>
<object class="sizeritem">
<object class="wxRadioButton" name="SpeedOff">
<label>Off (accurate)</label>
<style>wxRB_GROUP</style>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
<object class="sizeritem">
<object class="wxRadioButton" name="SpeedOn">
<label>On (fast)</label>
</object>
<flag>wxALL|wxALIGN_CENTRE</flag>
<border>5</border>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
<cols>2</cols>
<growablecols>1</growablecols>
</object>
<flag>wxEXPAND</flag>
</object>