MFC: Fix to use the new link API

git-svn-id: https://svn.code.sf.net/p/vbam/code/branches/bgk-link@1132 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
bgk 2012-09-16 14:41:49 +00:00
parent cb68ab423c
commit 4508a913c8
12 changed files with 238 additions and 1048 deletions

View File

@ -4,6 +4,10 @@
#include <malloc.h> #include <malloc.h>
#include <stdio.h> #include <stdio.h>
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
int vbaid = 0; int vbaid = 0;
const char *MakeInstanceFilename(const char *Input) const char *MakeInstanceFilename(const char *Input)
{ {
@ -1208,11 +1212,10 @@ ConnectionState InitLink(LinkMode mode)
} }
} }
// No errors, save the link mode // Save the link mode
if (gba_connection_state != LINK_ERROR) { gba_link_mode = mode;
gba_link_mode = mode; if (gba_connection_state == LINK_ERROR) {
} else { CloseLink();
gba_link_mode = LINK_DISCONNECTED;
} }
return gba_connection_state; return gba_connection_state;
@ -1382,6 +1385,7 @@ void CloseLink(void){
ls.tcpsocket[i].Close(); ls.tcpsocket[i].Close();
} }
} }
lanlink.tcpsocket.Close();
} }
if (gba_link_mode == LINK_CABLE_IPC || gba_link_mode == LINK_RFU_IPC) { if (gba_link_mode == LINK_CABLE_IPC || gba_link_mode == LINK_RFU_IPC) {

View File

@ -1,83 +0,0 @@
#ifndef NO_LINK
#include "stdafx.h"
#include "vba.h"
#include "JoybusOptions.h"
#include "../gba/GBALink.h"
// JoybusOptions dialog
IMPLEMENT_DYNAMIC(JoybusOptions, CDialog)
JoybusOptions::JoybusOptions(CWnd* pParent /*=NULL*/)
: CDialog(JoybusOptions::IDD, pParent)
{
}
JoybusOptions::~JoybusOptions()
{
}
void JoybusOptions::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_JOYBUS_ENABLE, enable_check);
DDX_Control(pDX, IDC_JOYBUS_HOSTNAME, hostname);
}
BEGIN_MESSAGE_MAP(JoybusOptions, CDialog)
ON_BN_CLICKED(IDC_JOYBUS_ENABLE, &JoybusOptions::OnBnClickedJoybusEnable)
ON_BN_CLICKED(IDOK, &JoybusOptions::OnBnClickedOk)
END_MESSAGE_MAP()
BOOL JoybusOptions::OnInitDialog()
{
CDialog::OnInitDialog();
enable_check.SetCheck(GetLinkMode() == LINK_GAMECUBE_DOLPHIN ? BST_CHECKED : BST_UNCHECKED);
hostname.EnableWindow(enable_check.GetCheck() == BST_CHECKED);
hostname.SetWindowText(joybusHostAddr.ToString().c_str());
return TRUE;
}
void JoybusOptions::OnBnClickedJoybusEnable()
{
hostname.EnableWindow(enable_check.GetCheck() == BST_CHECKED);
}
void JoybusOptions::OnBnClickedOk()
{
if ( (hostname.GetWindowTextLength() == 0)
&& (enable_check.GetCheck() == BST_CHECKED) )
{
hostname.SetWindowText("Enter IP or Hostname");
return;
}
CString address;
hostname.GetWindowText(address);
sf::IPAddress new_server;
new_server = std::string(address);
if (!new_server.IsValid())
{
hostname.SetWindowText("Enter IP or Hostname");
return;
}
joybusHostAddr = new_server;
if (enable_check.GetCheck() == BST_CHECKED)
{
CloseLink();
InitLink(LINK_GAMECUBE_DOLPHIN);
}
OnOK();
}
#endif // NO_LINK

View File

@ -1,27 +0,0 @@
#pragma once
#include "afxwin.h"
// JoybusOptions dialog
class JoybusOptions : public CDialog
{
DECLARE_DYNAMIC(JoybusOptions)
public:
JoybusOptions(CWnd* pParent = NULL); // standard constructor
virtual ~JoybusOptions();
// Dialog Data
enum { IDD = IDD_JOYBUS_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
afx_msg void OnBnClickedJoybusEnable();
CButton enable_check;
CEdit hostname;
afx_msg void OnBnClickedOk();
};

View File

@ -5,39 +5,46 @@
#include "LinkOptions.h" #include "LinkOptions.h"
#include "../gba/GBALink.h" #include "../gba/GBALink.h"
extern lserver ls;
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
template <class T>
void DDX_CBData(CDataExchange* pDX, int nIDC, T& data)
{
HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
if (pDX->m_bSaveAndValidate)
{
int index = static_cast<int>(::SendMessage(hWndCtrl, CB_GETCURSEL, 0, 0L));
data = (index == CB_ERR ? NULL : static_cast<T>(::SendMessage(hWndCtrl, CB_GETITEMDATA, index, 0L)));
}
else
{
int count = static_cast<int>(::SendMessage(hWndCtrl, CB_GETCOUNT, 0, 0L));
for (int i = 0; i != count; ++i)
{
if (static_cast<T>(::SendMessage(hWndCtrl, CB_GETITEMDATA, i, 0L)) == data)
{
::SendMessage(hWndCtrl, CB_SETCURSEL, i, 0L);
return;
}
}
::SendMessage(hWndCtrl, CB_SETCURSEL, -1, 0L);
}
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// LinkOptions dialog // LinkOptions dialog
CMyTabCtrl::CMyTabCtrl(){
m_tabdialog[0] = new LinkGeneral;
m_tabdialog[1] = new LinkServer;
m_tabdialog[2] = new LinkClient;
}
CMyTabCtrl::~CMyTabCtrl()
{
m_tabdialog[0]->DestroyWindow();
m_tabdialog[1]->DestroyWindow();
m_tabdialog[2]->DestroyWindow();
delete m_tabdialog[0];
delete m_tabdialog[1];
delete m_tabdialog[2];
}
LinkOptions::LinkOptions(CWnd* pParent /*=NULL*/) LinkOptions::LinkOptions(CWnd* pParent /*=NULL*/)
: CDialog(LinkOptions::IDD, pParent) : CDialog(LinkOptions::IDD, pParent)
{ {
//{{AFX_DATA_INIT(LinkOptions) //{{AFX_DATA_INIT(LinkOptions)
// NOTE: the ClassWizard will add member initialization here m_numplayers = 0;
m_type = theApp.linkMode;
m_server = FALSE;
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
} }
@ -46,55 +53,52 @@ void LinkOptions::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(LinkOptions) //{{AFX_DATA_MAP(LinkOptions)
DDX_CBData(pDX, IDC_LINK_MODE, m_type);
DDX_Control(pDX, IDC_LINKTIMEOUT, m_timeout);
DDX_Control(pDX, IDC_LINK_MODE, m_mode);
DDX_Control(pDX, IDC_SERVERIP, m_serverip);
DDX_Check(pDX, IDC_SSPEED, m_hacks);
DDX_Radio(pDX, IDC_LINK2P, m_numplayers);
DDX_Radio(pDX, IDC_LINK_CLIENT, m_server);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }
BOOL LinkOptions::OnInitDialog(){ BOOL LinkOptions::OnInitDialog(){
TCITEM tabitem; char timeout[6];
char tabtext[3][8] = {"General", "Server", "Client"};
int i;
CDialog::OnInitDialog(); CDialog::OnInitDialog();
m_tabctrl.SubclassDlgItem(IDC_TAB1, this); AddMode("Nothing (Disconnect)", LINK_DISCONNECTED);
AddMode("Cable - Single Computer", LINK_CABLE_IPC);
AddMode("Cable - Network", LINK_CABLE_SOCKET);
AddMode("GameCube - Dolphin", LINK_GAMECUBE_DOLPHIN);
AddMode("Wireless adapter - Single Computer", LINK_RFU_IPC);
tabitem.mask = TCIF_TEXT; sprintf(timeout, "%d", linktimeout);
for(i=0;i<3;i++){ m_timeout.LimitText(5);
tabitem.pszText = tabtext[i]; m_timeout.SetWindowText(timeout);
m_tabctrl.InsertItem(i, &tabitem);
}
m_tabctrl.m_tabdialog[0]->Create(IDD_LINKTAB1, this);
m_tabctrl.m_tabdialog[1]->Create(IDD_LINKTAB2, this);
m_tabctrl.m_tabdialog[2]->Create(IDD_LINKTAB3, this);
m_tabctrl.m_tabdialog[0]->ShowWindow(SW_SHOW); m_serverip.SetWindowText(theApp.linkHost);
m_tabctrl.m_tabdialog[1]->ShowWindow(SW_HIDE);
m_tabctrl.m_tabdialog[2]->ShowWindow(SW_HIDE);
m_tabctrl.SetCurSel(0); UpdateAvailability();
m_tabctrl.OnSwitchTabs();
UpdateData(FALSE);
return TRUE; return TRUE;
} }
BOOL LinkOptions::PreTranslateMessage(MSG* pMsg) BEGIN_MESSAGE_MAP(LinkOptions, CDialog)
{
return m_tabctrl.TranslatePropSheetMsg(pMsg) ? TRUE :
CDialog::PreTranslateMessage(pMsg);
}
BEGIN_MESSAGE_MAP(LinkOptions, CDialog)
//{{AFX_MSG_MAP(LinkOptions) //{{AFX_MSG_MAP(LinkOptions)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1) ON_CBN_SELCHANGE(IDC_LINK_MODE, &LinkOptions::OnCbnSelchangeLinkMode)
ON_BN_CLICKED(ID_OK, OnOk) ON_BN_CLICKED(ID_OK, OnOk)
ON_BN_CLICKED(ID_CANCEL, OnCancel) ON_BN_CLICKED(ID_CANCEL, OnCancel)
ON_BN_CLICKED(IDC_LINK_SERVER, &LinkOptions::OnBnClickedLinkServer)
ON_BN_CLICKED(IDC_LINK_CLIENT, &LinkOptions::OnBnClickedLinkClient)
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
END_MESSAGE_MAP()
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// LinkOptions message handlers // LinkOptions message handlers
@ -102,601 +106,120 @@ END_MESSAGE_MAP()
// LinkGeneral dialog // LinkGeneral dialog
LinkGeneral::LinkGeneral(CWnd* pParent /*=NULL*/) void LinkOptions::AddMode(LPCTSTR name, int value) {
: CDialog(LinkGeneral::IDD, pParent) m_mode.AddString(name);
{ int index = m_mode.FindStringExact(-1, name);
//{{AFX_DATA_INIT(LinkGeneral) m_mode.SetItemData(index, value);
//}}AFX_DATA_INIT
} }
void LinkGeneral::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(LinkGeneral)
DDX_Radio(pDX, IDC_LINK_DISCONNECTED, m_type);
DDX_Control(pDX, IDC_LINKTIMEOUT, m_timeout);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(LinkGeneral, CDialog)
//{{AFX_MSG_MAP(LinkGeneral)
ON_BN_CLICKED(IDC_LINK_SINGLE, OnRadio1)
ON_BN_CLICKED(IDC_LINK_LAN, OnRadio2)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_LINK_DISCONNECTED, &LinkGeneral::OnBnClickedLinkDisconnected)
ON_BN_CLICKED(IDC_LINK_RFU, &LinkGeneral::OnBnClickedLinkRfu)
ON_BN_CLICKED(IDC_LINK_GAMECUBE, &LinkGeneral::OnBnClickedLinkGamecube)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// LinkGeneral message handlers
/////////////////////////////////////////////////////////////////////////////
// LinkServer dialog
LinkServer::LinkServer(CWnd* pParent /*=NULL*/)
: CDialog(LinkServer::IDD, pParent)
{
//{{AFX_DATA_INIT(LinkServer)
m_numplayers = -1;
m_prottype = -1;
m_speed = FALSE;
//}}AFX_DATA_INIT
}
void LinkServer::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(LinkServer)
DDX_Radio(pDX, IDC_LINK2P, m_numplayers);
DDX_Radio(pDX, IDC_LINKTCP, m_prottype);
DDX_Check(pDX, IDC_SSPEED, m_speed);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(LinkServer, CDialog)
//{{AFX_MSG_MAP(LinkServer)
ON_BN_CLICKED(IDC_SERVERSTART, OnServerStart)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// LinkServer message handlers
LinkClient::LinkClient(CWnd* pParent /*=NULL*/)
: CDialog(LinkClient::IDD, pParent)
{
//{{AFX_DATA_INIT(LinkClient)
m_prottype = -1;
m_hacks = -1;
//}}AFX_DATA_INIT
}
void LinkClient::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(LinkClient)
DDX_Control(pDX, IDC_SERVERIP, m_serverip);
DDX_Radio(pDX, IDC_CLINKTCP, m_prottype);
DDX_Radio(pDX, IDC_SPEEDOFF, m_hacks);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(LinkClient, CDialog)
//{{AFX_MSG_MAP(LinkClient)
ON_BN_CLICKED(IDC_LINKCONNECT, OnLinkConnect)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// LinkClient message handlers
BOOL LinkServer::OnInitDialog()
{
CDialog::OnInitDialog();
m_numplayers = lanlink.numslaves;
m_prottype = lanlink.type;
m_speed = lanlink.speed;
UpdateData(FALSE);
return TRUE;
}
void LinkOptions::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
m_tabctrl.OnSwitchTabs();
*pResult = 0;
}
IMPLEMENT_DYNAMIC(CMyTabCtrl, CTabCtrl)
BEGIN_MESSAGE_MAP(CMyTabCtrl, CTabCtrl)
ON_NOTIFY_REFLECT(TCN_SELCHANGING, OnSelChanging)
END_MESSAGE_MAP()
BOOL CMyTabCtrl::SubclassDlgItem(UINT nID, CWnd* pParent)
{
if (!CTabCtrl::SubclassDlgItem(nID, pParent))
return FALSE;
ModifyStyle(0, TCS_OWNERDRAWFIXED);
// If first tab is disabled, go to next enabled tab
if (!IsTabEnabled(0)) {
int iTab = NextEnabledTab(0, TRUE);
SetActiveTab(iTab);
}
return TRUE;
}
BOOL CMyTabCtrl::IsTabEnabled(int iTab)
{
LinkGeneral *general = (LinkGeneral*)m_tabdialog[0];
if (general->m_type != LINK_CABLE_SOCKET && iTab > 0)
return false;
return true;
}
//////////////////
// Draw the tab: mimic SysTabControl32, except use gray if tab is disabled
//
void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
DRAWITEMSTRUCT& ds = *lpDrawItemStruct;
int iItem = ds.itemID;
// Get tab item info
char text[128];
TCITEM tci;
tci.mask = TCIF_TEXT;
tci.pszText = text;
tci.cchTextMax = sizeof(text);
GetItem(iItem, &tci);
// use draw item DC
CDC dc;
dc.Attach(ds.hDC);
// calculate text rectangle and color
CRect rc = ds.rcItem;
rc += CPoint(1,4); // ?? by trial and error
// draw the text
OnDrawText(dc, rc, text, !IsTabEnabled(iItem));
dc.Detach();
}
//////////////////
// Draw tab text. You can override to use different color/font.
//
void CMyTabCtrl::OnDrawText(CDC& dc, CRect rc,
CString sText, BOOL bDisabled)
{
dc.SetTextColor(GetSysColor(bDisabled ? COLOR_3DHILIGHT : COLOR_BTNTEXT));
dc.DrawText(sText, &rc, DT_CENTER|DT_VCENTER);
if (bDisabled) {
// disabled: draw again shifted northwest for shadow effect
rc += CPoint(-1,-1);
dc.SetTextColor(GetSysColor(COLOR_GRAYTEXT));
dc.DrawText(sText, &rc, DT_CENTER|DT_VCENTER);
}
}
//////////////////
// Selection is changing: disallow if tab is disabled
//
void CMyTabCtrl::OnSelChanging(NMHDR* pnmh, LRESULT* pRes)
{
TRACE("CMyTabCtrl::OnSelChanging\n");
// Figure out index of new tab we are about to go to, as opposed
// to the current one we're at. Believe it or not, Windows doesn't
// pass this info
//
TC_HITTESTINFO htinfo;
GetCursorPos(&htinfo.pt);
ScreenToClient(&htinfo.pt);
int iNewTab = HitTest(&htinfo);
if (iNewTab >= 0 && !IsTabEnabled(iNewTab))
*pRes = TRUE; // tab disabled: prevent selection
}
//////////////////
// Trap arrow-left key to skip disabled tabs.
// This is the only way to know where we're coming from--ie from
// arrow-left (prev) or arrow-right (next).
//
BOOL CMyTabCtrl::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN &&
(pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) {
int iNewTab = (pMsg->wParam == VK_LEFT) ?
PrevEnabledTab(GetCurSel(), FALSE) :
NextEnabledTab(GetCurSel(), FALSE);
if (iNewTab >= 0)
SetActiveTab(iNewTab);
return TRUE;
}
return CTabCtrl::PreTranslateMessage(pMsg);
}
////////////////
// Translate parent property sheet message. Translates Control-Tab and
// Control-Shift-Tab keys. These are normally handled by the property
// sheet, so you must call this function from your prop sheet's
// PreTranslateMessage function.
//
BOOL CMyTabCtrl::TranslatePropSheetMsg(MSG* pMsg)
{
WPARAM key = pMsg->wParam;
if (pMsg->message == WM_KEYDOWN && GetAsyncKeyState(VK_CONTROL) < 0 &&
(key == VK_TAB || key == VK_PRIOR || key == VK_NEXT)) {
int iNewTab = (key==VK_PRIOR || GetAsyncKeyState(VK_SHIFT) < 0) ?
PrevEnabledTab(GetCurSel(), TRUE) :
NextEnabledTab(GetCurSel(), TRUE);
if (iNewTab >= 0)
SetActiveTab(iNewTab);
return TRUE;
}
return FALSE;
}
//////////////////
// Helper to set the active page, when moving backwards (left-arrow and
// Control-Shift-Tab). Must simulate Windows messages to tell parent I
// am changing the tab; SetCurSel does not do this!!
//
// In normal operation, this fn will always succeed, because I don't call it
// unless I already know IsTabEnabled() = TRUE; but if you call SetActiveTab
// with a random value, it could fail.
//
BOOL CMyTabCtrl::SetActiveTab(UINT iNewTab)
{
TRACE("CMyTabCtrl::SetActiveTab\n");
// send the parent TCN_SELCHANGING
NMHDR nmh;
nmh.hwndFrom = m_hWnd;
nmh.idFrom = GetDlgCtrlID();
nmh.code = TCN_SELCHANGING;
if (GetParent()->SendMessage(WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh) >=0) {
// OK to change: set the new tab
SetCurSel(iNewTab);
// send parent TCN_SELCHANGE
nmh.code = TCN_SELCHANGE;
GetParent()->SendMessage(WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh);
return TRUE;
}
return FALSE;
}
/////////////////
// Return the index of the next enabled tab after a given index, or -1 if none
// (0 = first tab).
// If bWrap is TRUE, wrap from beginning to end; otherwise stop at zero.
//
int CMyTabCtrl::NextEnabledTab(int iCurrentTab, BOOL bWrap)
{
int nTabs = GetItemCount();
for (int iTab = iCurrentTab+1; iTab != iCurrentTab; iTab++) {
if (iTab >= nTabs) {
if (!bWrap)
return -1;
iTab = 0;
}
if (IsTabEnabled(iTab)) {
return iTab;
}
}
return -1;
}
/////////////////
// Return the index of the previous enabled tab before a given index, or -1.
// (0 = first tab).
// If bWrap is TRUE, wrap from beginning to end; otherwise stop at zero.
//
int CMyTabCtrl::PrevEnabledTab(int iCurrentTab, BOOL bWrap)
{
for (int iTab = iCurrentTab-1; iTab != iCurrentTab; iTab--) {
if (iTab < 0) {
if (!bWrap)
return -1;
iTab = GetItemCount() - 1;
}
if (IsTabEnabled(iTab)) {
return iTab;
}
}
return -1;
}
void CMyTabCtrl::OnSwitchTabs(void)
{
CRect clientRect, wndRect;
int i;
LinkGeneral *general = (LinkGeneral*)m_tabdialog[0];
GetClientRect(clientRect);
AdjustRect(FALSE, clientRect);
GetWindowRect(wndRect);
GetParent()->ScreenToClient(wndRect);
clientRect.OffsetRect(wndRect.left, wndRect.top);
if (general->m_type != LINK_CABLE_SOCKET)
SetCurSel(0);
for(i=0;i<3;i++){
if(i==GetCurSel()){
m_tabdialog[i]->SetWindowPos(&wndTop, clientRect.left, clientRect.top, clientRect.Width(), clientRect.Height(), SWP_SHOWWINDOW);
} else {
m_tabdialog[i]->ShowWindow(SW_HIDE);
}
}
return;
}
void LinkOptions::OnOk() void LinkOptions::OnOk()
{ {
GetAllData((LinkGeneral*)m_tabctrl.m_tabdialog[0]); static const int length = 256;
CString timeout;
CString host;
CString title;
CString addressMessage;
UpdateData(TRUE);
// Close any previous link
CloseLink();
m_serverip.GetWindowText(host);
m_timeout.GetWindowText(timeout);
sscanf(timeout, "%d", &linktimeout);
LinkMode newMode = (LinkMode) m_type;
bool needsServerHost = newMode == LINK_GAMECUBE_DOLPHIN || (newMode == LINK_CABLE_SOCKET && !m_server);
if (needsServerHost) {
bool valid = SetLinkServerHost(host);
if (!valid) {
AfxMessageBox("You must enter a valid host name", MB_OK | MB_ICONSTOP);
return;
}
}
EnableSpeedHacks(m_hacks);
EnableLinkServer(m_server, m_numplayers + 1);
if (m_server) {
char localhost[length];
GetLinkServerHost(localhost, length);
title = "Waiting for clients...";
addressMessage.Format("Server IP address is: %s\n", localhost);
} else {
title = "Waiting for connection...";
addressMessage.Format("Connecting to %s\n", host);
}
// Init link
ConnectionState state = InitLink(newMode);
// Display a progress dialog while the connection is establishing
if (state == LINK_NEEDS_UPDATE) {
ServerWait *dlg = new ServerWait();
dlg->Create(ServerWait::IDD, this);
dlg->m_plconn[1] = title;
dlg->m_serveraddress = addressMessage;
dlg->ShowWindow(SW_SHOW);
while (state == LINK_NEEDS_UPDATE) {
// Ask the core for updates
char message[length];
state = ConnectLinkUpdate(message, length);
// Update the wait message
if (strlen(message)) {
dlg->m_plconn[1] = message;
}
// Step the progress bar and update dialog data
dlg->m_prgctrl.StepIt();
dlg->UpdateData(false);
// Process Windows messages
MSG msg;
while (PeekMessage (&msg, 0, 0, 0, PM_NOREMOVE)) {
AfxGetApp()->PumpMessage();
}
// Check whether the user has aborted
if (dlg->m_userAborted) {
state = LINK_ABORT;
}
}
delete dlg;
}
// The user canceled the connection attempt
if (state == LINK_ABORT) {
CloseLink();
return;
}
// Something failed during init
if (state == LINK_ERROR) {
AfxMessageBox("Error occurred.\nPlease try again.", MB_OK | MB_ICONSTOP);
return;
}
theApp.linkMode = GetLinkMode();
theApp.linkHost = host;
CDialog::OnOK(); CDialog::OnOK();
return; return;
} }
void LinkGeneral::OnRadio1()
{
m_type = LINK_CABLE_IPC;
GetParent()->Invalidate();
}
void LinkGeneral::OnRadio2()
{
m_type = LINK_CABLE_SOCKET;
GetParent()->Invalidate();
}
BOOL LinkGeneral::OnInitDialog(){
char timeout[6];
CDialog::OnInitDialog();
m_type = GetLinkMode();
m_timeout.LimitText(5);
sprintf(timeout, "%d", linktimeout);
m_timeout.SetWindowText(timeout);
UpdateData(FALSE);
return TRUE;
}
void LinkOptions::OnCancel() void LinkOptions::OnCancel()
{ {
CDialog::OnCancel(); CDialog::OnCancel();
return; return;
} }
class Win32ServerInfoDisplay : public ServerInfoDisplay
{
public:
Win32ServerInfoDisplay(ServerWait *_dlg)
{
dlg = _dlg;
}
~Win32ServerInfoDisplay()
{
if (dlg)
{
// not connected
MessageBox(NULL, "Failed to connect.", "Link", MB_OK);
dlg->SendMessage(WM_CLOSE, 0, 0);
}
delete dlg;
dlg = NULL;
}
void ShowServerIP(const sf::IPAddress& addr)
{
dlg->m_serveraddress.Format("Server IP address is: %s", addr.ToString());
}
void ShowConnect(const int player)
{
dlg->m_plconn[0].Format("Player %d connected", player);
dlg->UpdateData(false);
}
void Ping()
{
dlg->m_prgctrl.StepIt();
}
void Connected()
{
MessageBox(NULL, "All players connected", "Link", MB_OK);
dlg->SendMessage(WM_CLOSE, 0, 0);
delete dlg;
dlg = NULL;
}
private:
ServerWait *dlg;
};
void LinkServer::OnServerStart()
{
UpdateData(TRUE);
lanlink.numslaves = m_numplayers+1;
lanlink.type = m_prottype;
lanlink.server = true;
lanlink.speed = m_speed==1 ? true : false;
sf::IPAddress addr;
// These must be created on the heap - referenced from the connection thread
ServerWait *dlg = new ServerWait();
dlg->Create(IDD_SERVERWAIT, this);
dlg->ShowWindow(SW_SHOW);
// Owns the ServerWait*
Win32ServerInfoDisplay *dlginfo = new Win32ServerInfoDisplay(dlg);
// ls thread will own the dlginfo
if (!ls.Init(dlginfo))
{
// Thread didn't get created
delete dlginfo;
MessageBox("Error occurred.\nPlease try again.", "Error", MB_OK);
}
return;
}
BOOL LinkClient::OnInitDialog()
{
CDialog::OnInitDialog();
m_prottype = lanlink.type;
m_hacks = lanlink.speed;
UpdateData(FALSE);
return TRUE;
}
class Win32ClientInfoDisplay : public ClientInfoDisplay
{
public:
Win32ClientInfoDisplay(ServerWait *_dlg)
{
dlg = _dlg;
}
~Win32ClientInfoDisplay()
{
if (dlg)
{
// not connected
MessageBox(NULL, "Failed to connect.", "Link", MB_OK);
dlg->SendMessage(WM_CLOSE, 0, 0);
}
delete dlg;
dlg = NULL;
}
void ConnectStart(const sf::IPAddress& addr)
{
dlg->SetWindowText("Connecting...");
}
void ShowConnect(const int player, const int togo)
{
dlg->m_serveraddress.Format("Connected as #%d", player);
if (togo)
dlg->m_plconn[0].Format("Waiting for %d players to join", togo);
else
dlg->m_plconn[0].Format("All players joined.");
}
void Ping()
{
dlg->m_prgctrl.StepIt();
}
void Connected()
{
MessageBox(NULL, "Connected.", "Link", MB_OK);
dlg->SendMessage(WM_CLOSE, 0, 0);
delete dlg;
dlg = NULL;
}
private:
ServerWait *dlg;
};
void LinkClient::OnLinkConnect()
{
char ipaddress[31];
UpdateData(TRUE);
lanlink.type = m_prottype;
lanlink.server = false;
lanlink.speed = m_hacks==1 ? true : false;
m_serverip.GetWindowText(ipaddress, 30);
// These must be created on the heap - referenced from the connection thread
ServerWait *dlg = new ServerWait();
dlg->Create(IDD_SERVERWAIT, this);
dlg->ShowWindow(SW_SHOW);
// Owns the ServerWait*
Win32ClientInfoDisplay *dlginfo = new Win32ClientInfoDisplay(dlg);
// lc thread will own the dlginfo
if (!lc.Init(sf::IPAddress(std::string(ipaddress)), dlginfo))
{
// Thread didn't get created
delete dlginfo;
MessageBox("Error occurred.\nPlease try again.", "Error", MB_OK);
}
return;
}
void LinkOptions::GetAllData(LinkGeneral *src)
{
char timeout[6];
src->UpdateData(true);
src->m_timeout.GetWindowText(timeout, 5);
sscanf(timeout, "%d", &linktimeout);
if(src->m_type == LINK_CABLE_SOCKET){
lanlink.speed = 0;
}
LinkMode oldMode = GetLinkMode();
LinkMode newMode = (LinkMode) src->m_type;
if (newMode != oldMode) {
CloseLink();
ConnectionState state = InitLink(newMode);
if (state != LINK_OK) {
CloseLink();
}
}
return;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// ServerWait dialog // ServerWait dialog
@ -710,6 +233,8 @@ ServerWait::ServerWait(CWnd* pParent /*=NULL*/)
m_plconn[1] = _T(""); m_plconn[1] = _T("");
m_plconn[2] = _T(""); m_plconn[2] = _T("");
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
m_userAborted = false;
} }
@ -736,56 +261,47 @@ END_MESSAGE_MAP()
void ServerWait::OnCancel() void ServerWait::OnCancel()
{ {
lanlink.terminate = true; m_userAborted = true;
CDialog::OnCancel(); ShowWindow(SW_HIDE);
} }
BOOL LinkGeneral::PreTranslateMessage(MSG* pMsg) void LinkOptions::OnCbnSelchangeLinkMode()
{ {
if(pMsg->message==WM_KEYDOWN) UpdateData(TRUE);
if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) UpdateAvailability();
pMsg->wParam = NULL;
return CDialog::PreTranslateMessage(pMsg);
} }
BOOL LinkClient::PreTranslateMessage(MSG* pMsg) void LinkOptions::UpdateAvailability()
{ {
if(pMsg->message==WM_KEYDOWN) bool isDisconnected = m_type == LINK_DISCONNECTED;
if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE) bool isNetwork = m_type == LINK_CABLE_SOCKET;
pMsg->wParam = NULL; bool canHaveServer = (m_type == LINK_CABLE_SOCKET && !m_server) || m_type == LINK_GAMECUBE_DOLPHIN;
bool hasHacks = m_type == LINK_CABLE_SOCKET;
return CDialog::PreTranslateMessage(pMsg); GetDlgItem(IDC_LINK_CLIENT)->EnableWindow(isNetwork);
} GetDlgItem(IDC_LINK_SERVER)->EnableWindow(isNetwork);
GetDlgItem(IDC_SSPEED)->EnableWindow(isNetwork);
BOOL LinkServer::PreTranslateMessage(MSG* pMsg) m_serverip.EnableWindow(canHaveServer);
{ m_timeout.EnableWindow(!isDisconnected);
if(pMsg->message==WM_KEYDOWN)
if(pMsg->wParam==VK_RETURN||pMsg->wParam==VK_ESCAPE)
pMsg->wParam = NULL;
return CDialog::PreTranslateMessage(pMsg); GetDlgItem(IDC_LINK2P)->EnableWindow(isNetwork && m_server);
GetDlgItem(IDC_LINK3P)->EnableWindow(isNetwork && m_server);
GetDlgItem(IDC_LINK4P)->EnableWindow(isNetwork && m_server);
} }
#endif // NO_LINK #endif // NO_LINK
void LinkGeneral::OnBnClickedLinkDisconnected() void LinkOptions::OnBnClickedLinkServer()
{ {
m_type = LINK_DISCONNECTED; UpdateData(TRUE);
GetParent()->Invalidate(); UpdateAvailability();
} }
void LinkGeneral::OnBnClickedLinkRfu() void LinkOptions::OnBnClickedLinkClient()
{ {
m_type = LINK_RFU_IPC; UpdateData(TRUE);
GetParent()->Invalidate(); UpdateAvailability();
}
void LinkGeneral::OnBnClickedLinkGamecube()
{
m_type = LINK_GAMECUBE_DOLPHIN;
GetParent()->Invalidate();
} }

View File

@ -1,78 +1,5 @@
#pragma once #pragma once
class CMyTabCtrl : public CTabCtrl {
DECLARE_DYNAMIC(CMyTabCtrl)
public:
CMyTabCtrl(void);
~CMyTabCtrl(void);
BOOL IsTabEnabled(int iTab); // you must override
BOOL TranslatePropSheetMsg(MSG* pMsg); // call from prop sheet
BOOL SubclassDlgItem(UINT nID, CWnd* pParent); // non-virtual override
// helpers
int NextEnabledTab(int iTab, BOOL bWrap); // get next enabled tab
int PrevEnabledTab(int iTab, BOOL bWrap); // get prev enabled tab
BOOL SetActiveTab(UINT iNewTab); // set tab (fail if disabled)
CDialog *m_tabdialog[3];
void OnSwitchTabs(void);
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnSelChanging(NMHDR* pNmh, LRESULT* pRes);
// MFC overrides
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
// override to draw text only; eg, colored text or different font
virtual void OnDrawText(CDC& dc, CRect rc, CString sText, BOOL bDisabled);
};
/////////////////////////////////////////////////////////////////////////////
// LinkGeneral dialog
class LinkGeneral : public CDialog
{
// Construction
public:
LinkGeneral(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(LinkGeneral)
enum { IDD = IDD_LINKTAB1 };
int m_type;
CEdit m_timeout;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(LinkGeneral)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(LinkGeneral)
virtual BOOL OnInitDialog();
afx_msg void OnRadio1();
afx_msg void OnRadio2();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedLinkDisconnected();
afx_msg void OnBnClickedLinkRfu();
afx_msg void OnBnClickedLinkGamecube();
};
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// LinkOptions dialog // LinkOptions dialog
@ -81,19 +8,22 @@ class LinkOptions : public CDialog
// Construction // Construction
public: public:
LinkOptions(CWnd* pParent = NULL); // standard constructor LinkOptions(CWnd* pParent = NULL); // standard constructor
void GetAllData(LinkGeneral*);
// Dialog Data // Dialog Data
//{{AFX_DATA(LinkOptions) //{{AFX_DATA(LinkOptions)
enum { IDD = IDD_LINKTAB }; enum { IDD = IDD_LINKTAB };
CMyTabCtrl m_tabctrl; int m_type;
CEdit m_timeout;
CComboBox m_mode;
CEdit m_serverip;
BOOL m_server;
int m_numplayers;
BOOL m_hacks;
//}}AFX_DATA //}}AFX_DATA
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(LinkOptions) //{{AFX_VIRTUAL(LinkOptions)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
@ -101,88 +31,22 @@ public:
// Implementation // Implementation
protected: protected:
void AddMode(LPCTSTR name, int value);
void UpdateAvailability();
// Generated message map functions // Generated message map functions
//{{AFX_MSG(LinkOptions) //{{AFX_MSG(LinkOptions)
afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnCbnSelchangeLinkMode();
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
afx_msg void OnOk(); afx_msg void OnOk();
afx_msg void OnCancel(); afx_msg void OnCancel();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// LinkServer dialog
class LinkServer : public CDialog
{
// Construction
public: public:
LinkServer(CWnd* pParent = NULL); // standard constructor afx_msg void OnBnClickedLinkServer();
afx_msg void OnBnClickedLinkClient();
// Dialog Data
//{{AFX_DATA(LinkServer)
enum { IDD = IDD_LINKTAB2 };
int m_numplayers;
int m_prottype;
BOOL m_speed;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(LinkServer)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(LinkServer)
virtual BOOL OnInitDialog();
afx_msg void OnServerStart();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
}; };
class LinkClient : public CDialog
{
// Construction
public:
LinkClient(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(LinkClient)
enum { IDD = IDD_LINKTAB3 };
CEdit m_serverip;
int m_prottype;
int m_hacks;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(LinkClient)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(LinkClient)
virtual BOOL OnInitDialog();
afx_msg void OnLinkConnect();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -200,10 +64,9 @@ public:
CProgressCtrl m_prgctrl; CProgressCtrl m_prgctrl;
CString m_serveraddress; CString m_serveraddress;
CString m_plconn[3]; CString m_plconn[3];
//CString m_p2conn;
//CString m_p3conn;
//}}AFX_DATA //}}AFX_DATA
bool m_userAborted;
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides

View File

@ -323,7 +323,6 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_GAMEOVERRIDES, OnUpdateOptionsEmulatorGameoverrides) ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_GAMEOVERRIDES, OnUpdateOptionsEmulatorGameoverrides)
ON_COMMAND(ID_HELP_GNUPUBLICLICENSE, OnHelpGnupubliclicense) ON_COMMAND(ID_HELP_GNUPUBLICLICENSE, OnHelpGnupubliclicense)
ON_COMMAND(ID_OPTIONS_LINK_OPTIONS, OnLinkOptions) ON_COMMAND(ID_OPTIONS_LINK_OPTIONS, OnLinkOptions)
ON_COMMAND(ID_OPTIONS_JOYBUS, &MainWnd::OnOptionsJoybus)
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
ON_COMMAND_EX_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE10, OnFileRecentFile) ON_COMMAND_EX_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE10, OnFileRecentFile)

View File

@ -330,7 +330,6 @@ protected:
afx_msg void OnOptionsSoundHardwareacceleration(); afx_msg void OnOptionsSoundHardwareacceleration();
afx_msg void OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI);
afx_msg void OnLinkOptions(); afx_msg void OnLinkOptions();
afx_msg void OnOptionsJoybus();
afx_msg void OnOutputapiDirectsound(); afx_msg void OnOutputapiDirectsound();
afx_msg void OnUpdateOutputapiDirectsound(CCmdUI *pCmdUI); afx_msg void OnUpdateOutputapiDirectsound(CCmdUI *pCmdUI);

View File

@ -7,7 +7,6 @@
#include "FileDlg.h" #include "FileDlg.h"
#include "GameOverrides.h" #include "GameOverrides.h"
#include "LinkOptions.h" #include "LinkOptions.h"
#include "JoybusOptions.h"
#include "GBColorDlg.h" #include "GBColorDlg.h"
#include "Joypad.h" #include "Joypad.h"
#include "MaxScale.h" #include "MaxScale.h"
@ -1555,14 +1554,8 @@ void MainWnd::OnLinkOptions()
dlg.DoModal(); dlg.DoModal();
} }
void MainWnd::OnOptionsJoybus()
{
JoybusOptions dlg;
dlg.DoModal();
}
#else #else
void MainWnd::OnLinkOptions() { } void MainWnd::OnLinkOptions() { }
void MainWnd::OnOptionsJoybus() { }
#endif #endif
void MainWnd::OnOptionsEmulatorGameoverrides() void MainWnd::OnOptionsEmulatorGameoverrides()

View File

@ -475,9 +475,6 @@ BOOL VBA::InitInstance()
loadSettings(); loadSettings();
if(!InitLink((LinkMode) linkMode))
return FALSE;
if(!initDisplay()) { if(!initDisplay()) {
if(videoOption >= VIDEO_320x240) { if(videoOption >= VIDEO_320x240) {
regSetDwordValue("video", VIDEO_2X); regSetDwordValue("video", VIDEO_2X);
@ -1257,8 +1254,8 @@ BOOL VBA::OnIdle(LONG lCount)
emulator.emuMain(emulator.emuCount); emulator.emuMain(emulator.emuCount);
#ifndef NO_LINK #ifndef NO_LINK
if (lanlink.connected && linkid && lc.numtransfers == 0) if (GetLinkMode() != LINK_DISCONNECTED)
lc.CheckConn(); CheckLinkConnection();
#endif #endif
if(rewindSaveNeeded && rewindMemory && emulator.emuWriteMemState) { if(rewindSaveNeeded && rewindMemory && emulator.emuWriteMemState) {
@ -1628,11 +1625,7 @@ void VBA::loadSettings()
linkMode = regQueryDwordValue("LinkMode", LINK_DISCONNECTED); linkMode = regQueryDwordValue("LinkMode", LINK_DISCONNECTED);
buffer = regQueryStringValue("joybusHostAddr", ""); linkHost = regQueryStringValue("LinkHostAddr", "localhost");
if(!buffer.IsEmpty()) {
joybusHostAddr = std::string(buffer);
}
#endif #endif
@ -2561,8 +2554,8 @@ void VBA::saveSettings()
#ifndef NO_LINK #ifndef NO_LINK
regSetDwordValue("LinkTimeout", linktimeout); regSetDwordValue("LinkTimeout", linktimeout);
regSetDwordValue("LinkMode", GetLinkMode()); regSetDwordValue("LinkMode", linkMode);
regSetStringValue("joybusHostAddr", joybusHostAddr.ToString().c_str()); regSetStringValue("LinkHostAddr", linkHost);
#endif #endif
regSetDwordValue("lastFullscreen", lastFullscreen); regSetDwordValue("lastFullscreen", lastFullscreen);

View File

@ -204,6 +204,7 @@ class VBA : public CWinApp
CString wndClass; CString wndClass;
int linkMode; int linkMode;
CString linkHost;
public: public:
VBA(); VBA();

View File

@ -112,57 +112,28 @@ BEGIN
LTEXT "Please select filter plugin:",IDC_STATIC,6,6,162,8 LTEXT "Please select filter plugin:",IDC_STATIC,6,6,162,8
END END
IDD_LINKTAB DIALOGEX 0, 0, 254, 203 IDD_LINKTAB DIALOGEX 0, 0, 254, 198
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Link Options" CAPTION "Connect Link"
FONT 8, "MS Sans Serif", 0, 0, 0x1 FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,9,7,240,162 CONTROL "Client",IDC_LINK_CLIENT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,53,46,33,10
PUSHBUTTON "OK",ID_OK,57,180,60,15 CONTROL "Server",IDC_LINK_SERVER,"Button",BS_AUTORADIOBUTTON,95,46,37,10
PUSHBUTTON "Cancel",ID_CANCEL,140,180,57,15 LTEXT "Link with",IDC_LINK_WITH,11,10,38,10
END COMBOBOX IDC_LINK_MODE,50,8,194,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Link timeout (in milliseconds)",IDC_STATIC_TIMEOUT,11,153,92,12
IDD_LINKTAB1 DIALOGEX 0, 0, 184, 113 EDITTEXT IDC_LINKTIMEOUT,111,150,53,14,ES_AUTOHSCROLL | ES_NUMBER
STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE LTEXT "Server IP address or hostname:",IDC_STATIC,25,70,75,18
FONT 8, "MS Sans Serif", 0, 0, 0x1 EDITTEXT IDC_SERVERIP,114,73,105,12,ES_AUTOHSCROLL | WS_GROUP
BEGIN LTEXT "Expected number of players:",IDC_STATIC,25,94,89,10
CONTROL "Disconnected",IDC_LINK_DISCONNECTED,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,23,152,16 CONTROL "2",IDC_LINK2P,"Button",BS_AUTORADIOBUTTON | WS_GROUP,53,106,21,13
CONTROL "Cable - Single Computer",IDC_LINK_SINGLE,"Button",BS_AUTORADIOBUTTON,15,39,152,16 CONTROL "3",IDC_LINK3P,"Button",BS_AUTORADIOBUTTON,99,106,21,13
CONTROL "Cable - Network",IDC_LINK_LAN,"Button",BS_AUTORADIOBUTTON,15,55,154,16 CONTROL "4",IDC_LINK4P,"Button",BS_AUTORADIOBUTTON,145,106,21,13
CONTROL "Wireless adapter",IDC_LINK_RFU,"Button",BS_AUTORADIOBUTTON,15,71,152,16 CONTROL "Enable speed hacks",IDC_SSPEED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,121,138,12
CONTROL "GameCube",IDC_LINK_GAMECUBE,"Button",BS_AUTORADIOBUTTON,15,87,152,16 PUSHBUTTON "OK",ID_OK,60,176,60,15
LTEXT "Link timeout (in milliseconds)",IDC_STATIC,17,12,92,12 PUSHBUTTON "Cancel",ID_CANCEL,136,176,57,15
EDITTEXT IDC_LINKTIMEOUT,116,10,53,14,ES_AUTOHSCROLL | ES_NUMBER GROUPBOX "Network options",IDC_GROUP_NETWORK,11,28,231,113
END LTEXT "Role:",IDC_LINK_ROLE,25,46,18,8
IDD_LINKTAB2 DIALOGEX 0, 0, 210, 113
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "2",IDC_LINK2P,"Button",BS_AUTORADIOBUTTON | WS_GROUP,46,16,21,13
CONTROL "3",IDC_LINK3P,"Button",BS_AUTORADIOBUTTON,94,16,21,13
CONTROL "4",IDC_LINK4P,"Button",BS_AUTORADIOBUTTON,142,16,21,13
CONTROL "TCP/IP",IDC_LINKTCP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,54,47,42,14
CONTROL "UDP",IDC_LINKUDP,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,121,47,33,14
PUSHBUTTON "Start!",IDC_SERVERSTART,79,89,50,17
LTEXT "Select number of players:",IDC_STATIC,60,7,89,10
LTEXT "Select protocol:",IDC_STATIC,78,33,53,11
CONTROL "Speed hacks",IDC_SSPEED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,70,57,12
END
IDD_LINKTAB3 DIALOGEX 0, 0, 188, 108
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "TCP/IP",IDC_CLINKTCP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,58,20,39,12
CONTROL "UDP",IDC_CLINKUDP,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,118,20,32,12
EDITTEXT IDC_SERVERIP,84,39,79,12,ES_AUTOHSCROLL | WS_GROUP
PUSHBUTTON "Connect",IDC_LINKCONNECT,75,81,59,16
LTEXT "Select protocol:",IDC_STATIC,78,7,53,9
LTEXT "Server IP address or hostname:",IDC_STATIC,7,37,62,18
LTEXT "Speed hacks:",IDC_STATIC,7,64,47,10
CONTROL "Off (accurate)",IDC_SPEEDOFF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,60,63,57,12
CONTROL "On (fast)",IDC_SPEEDON,"Button",BS_AUTORADIOBUTTON,128,63,48,12
END END
IDD_SERVERWAIT DIALOG 0, 0, 186, 90 IDD_SERVERWAIT DIALOG 0, 0, 186, 90
@ -1206,17 +1177,6 @@ BEGIN
COMBOBOX IDC_SAMPLE_RATE,66,54,66,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_SAMPLE_RATE,66,54,66,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END END
IDD_JOYBUS_DIALOG DIALOGEX 0, 0, 209, 57
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Joybus Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,152,36,50,14
CONTROL "Enable Joybus Connection",IDC_JOYBUS_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,195,10
EDITTEXT IDC_JOYBUS_HOSTNAME,7,20,195,14,ES_AUTOHSCROLL
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -1246,16 +1206,7 @@ BEGIN
BEGIN BEGIN
END END
IDD_LINKTAB1, DIALOG IDD_SERVERWAIT, DIALOG
BEGIN
BOTTOMMARGIN, 79
END
IDD_LINKTAB2, DIALOG
BEGIN
END
IDD_LINKTAB3, DIALOG
BEGIN BEGIN
END END
@ -1591,14 +1542,6 @@ BEGIN
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 163 BOTTOMMARGIN, 163
END END
IDD_JOYBUS_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 202
TOPMARGIN, 7
BOTTOMMARGIN, 50
END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@ -1657,6 +1600,8 @@ BEGIN
MENUITEM "Open GB...", ID_FILE_OPEN_GB MENUITEM "Open GB...", ID_FILE_OPEN_GB
MENUITEM "Close", ID_FILE_CLOSE MENUITEM "Close", ID_FILE_CLOSE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Link with...", ID_OPTIONS_LINK_OPTIONS
MENUITEM SEPARATOR
POPUP "Recent" POPUP "Recent"
BEGIN BEGIN
MENUITEM "&Reset", ID_FILE_RECENT_RESET MENUITEM "&Reset", ID_FILE_RECENT_RESET
@ -1973,12 +1918,6 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Colors...", ID_OPTIONS_GAMEBOY_COLORS MENUITEM "&Colors...", ID_OPTIONS_GAMEBOY_COLORS
END END
POPUP "&Link"
BEGIN
MENUITEM "&Options...", ID_OPTIONS_LINK_OPTIONS
MENUITEM SEPARATOR
MENUITEM "&Joybus Options...", ID_OPTIONS_JOYBUS
END
END END
POPUP "&Cheats" POPUP "&Cheats"
BEGIN BEGIN

View File

@ -107,7 +107,6 @@
#define IDD_FULLSCREEN 162 #define IDD_FULLSCREEN 162
#define IDD_XAUDIO2_CONFIG 163 #define IDD_XAUDIO2_CONFIG 163
#define IDD_AUDIO_CORE_SETTINGS 164 #define IDD_AUDIO_CORE_SETTINGS 164
#define IDD_JOYBUS_DIALOG 165
#define IDC_R0 1000 #define IDC_R0 1000
#define IDC_EDIT_UP 1000 #define IDC_EDIT_UP 1000
#define IDC_R1 1001 #define IDC_R1 1001
@ -564,8 +563,13 @@
#define IDC_SOUND_FILTERING 1294 #define IDC_SOUND_FILTERING 1294
#define IDC_COMBO1 1296 #define IDC_COMBO1 1296
#define IDC_SAMPLE_RATE 1296 #define IDC_SAMPLE_RATE 1296
#define IDC_JOYBUS_HOSTNAME 1297 #define IDC_LINK_MODE 1296
#define IDC_JOYBUS_ENABLE 1298 #define IDC_LINK_WITH 1300
#define IDC_STATIC_TIMEOUT 1301
#define IDC_LINK_SERVER 1302
#define IDC_LINK_CLIENT 1303
#define IDC_GROUP_NETWORK 1304
#define IDC_LINK_ROLE 1305
#define IDS_OAL_NODEVICE 2000 #define IDS_OAL_NODEVICE 2000
#define IDS_OAL_NODLL 2001 #define IDS_OAL_NODLL 2001
#define IDS_AVI_CANNOT_CREATE_AVI 2002 #define IDS_AVI_CANNOT_CREATE_AVI 2002
@ -815,10 +819,7 @@
#define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296 #define ID_OPTIONS_SOUND_PCMINTERPOLATION_CUBIC 40296
#define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297 #define ID_OPTIONS_SOUND_PCMINTERPOLATION_FIR 40297
#define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298 #define ID_OPTIONS_SOUND_PCMINTERPOLATION_LIBRESAMPLE 40298
#define IDD_LINKTAB1 40300
#define IDD_LINKTAB 40301 #define IDD_LINKTAB 40301
#define IDD_LINKTAB2 40302
#define IDD_LINKTAB3 40303
#define IDD_SERVERWAIT 40304 #define IDD_SERVERWAIT 40304
#define IDC_TAB1 40305 #define IDC_TAB1 40305
#define IDC_LINK_SINGLE 40306 #define IDC_LINK_SINGLE 40306
@ -827,25 +828,17 @@
#define IDC_LINK_LAN 40308 #define IDC_LINK_LAN 40308
#define IDC_LINK2P 40309 #define IDC_LINK2P 40309
#define IDC_LINK_RFU 40309 #define IDC_LINK_RFU 40309
#define IDC_LINKTCP 40310
#define IDC_LINK_GAMECUBE 40310 #define IDC_LINK_GAMECUBE 40310
#define IDC_SSPEED 40311 #define IDC_SSPEED 40311
#define IDC_SERVERSTART 40312
#define IDC_SERVERIP 40313 #define IDC_SERVERIP 40313
#define IDC_CLINKIP 40314 #define IDC_CLINKIP 40314
#define IDC_SPEEDOFF 40315
#define IDC_LINKCONNECT 40316
#define ID_OPTIONS_LINK_OPTIONS 40318 #define ID_OPTIONS_LINK_OPTIONS 40318
#define ID_OPTIONS_LINK_LOG 40319 #define ID_OPTIONS_LINK_LOG 40319
#define ID_OPTIONS_LINK_WIRELESSADAPTER 40320 #define ID_OPTIONS_LINK_WIRELESSADAPTER 40320
#define IDC_LINKTIMEOUT 40321 #define IDC_LINKTIMEOUT 40321
#define IDC_CLINKTCP 40322
#define IDC_SERVERWAIT 40323 #define IDC_SERVERWAIT 40323
#define IDC_LINKUDP 40324
#define IDC_LINK3P 40325 #define IDC_LINK3P 40325
#define IDC_LINK4P 40326 #define IDC_LINK4P 40326
#define IDC_CLINKUDP 40327
#define IDC_SPEEDON 40328
#define ID_OPTIONS_EMULATOR_REMOVEINTROSGBA 40331 #define ID_OPTIONS_EMULATOR_REMOVEINTROSGBA 40331
#define ID_Menu 40332 #define ID_Menu 40332
#define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLANISOTROPIC 40333 #define ID_OPTIONS_VIDEO_RENDEROPTIONS_GLANISOTROPIC 40333
@ -891,9 +884,9 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 166 #define _APS_NEXT_RESOURCE_VALUE 167
#define _APS_NEXT_COMMAND_VALUE 40377 #define _APS_NEXT_COMMAND_VALUE 40377
#define _APS_NEXT_CONTROL_VALUE 1299 #define _APS_NEXT_CONTROL_VALUE 1306
#define _APS_NEXT_SYMED_VALUE 103 #define _APS_NEXT_SYMED_VALUE 103
#endif #endif
#endif #endif