GTK: dummy gui for netplay
unix-net: use DispMessage to inform user of connection problems/success
This commit is contained in:
parent
9633b71cf5
commit
560890f2e5
|
@ -260,6 +260,64 @@ void openPaletteConfig()
|
|||
return;
|
||||
}
|
||||
|
||||
void openNetworkConfig()
|
||||
{
|
||||
GtkWidget* win;
|
||||
GtkWidget* box;
|
||||
GtkWidget* frame;
|
||||
GtkWidget* vbox;
|
||||
GtkWidget* ipBox;
|
||||
GtkWidget* ipLbl;
|
||||
GtkWidget* ipEntry;
|
||||
GtkWidget* portBox;
|
||||
GtkWidget* portLbl;
|
||||
GtkWidget* portSpin;
|
||||
//GtkWidget* localPlayersCbo;
|
||||
GtkWidget* pwBox;
|
||||
GtkWidget* pwLbl;
|
||||
GtkWidget* pwEntry;
|
||||
GtkWidget* btn;
|
||||
|
||||
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
box = gtk_vbox_new(FALSE, 3);
|
||||
frame = gtk_frame_new("Network options");
|
||||
vbox = gtk_vbox_new(FALSE, 5);
|
||||
ipBox = gtk_hbox_new(FALSE, 5);
|
||||
ipLbl = gtk_label_new("Server IP:");
|
||||
ipEntry = gtk_entry_new();
|
||||
portBox = gtk_hbox_new(FALSE, 5);
|
||||
portLbl = gtk_label_new("Server port:");
|
||||
portSpin = gtk_spin_button_new_with_range(0, 999999, 1);
|
||||
//localPlayersCbo = gtk_combo_box_new_text();
|
||||
pwBox = gtk_hbox_new(FALSE, 3);
|
||||
pwLbl = gtk_label_new("Server password:");
|
||||
pwEntry = gtk_entry_new();
|
||||
btn = gtk_button_new_from_stock(GTK_STOCK_CONNECT);
|
||||
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(portSpin), 4046);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(portBox), portLbl, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start(GTK_BOX(portBox), portSpin, FALSE , FALSE, 3);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(ipBox), ipLbl, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start(GTK_BOX(ipBox), ipEntry, TRUE , TRUE, 3);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(pwBox), pwLbl, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start(GTK_BOX(pwBox), pwEntry, TRUE , TRUE, 3);
|
||||
|
||||
gtk_box_pack_start_defaults(GTK_BOX(vbox), ipBox);
|
||||
gtk_box_pack_start_defaults(GTK_BOX(vbox), portBox);
|
||||
//gtk_box_pack_start_defaults(GTK_BOX(vbox), localPlayersCbo);
|
||||
gtk_box_pack_start_defaults(GTK_BOX(vbox), pwBox);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox);
|
||||
|
||||
gtk_box_pack_start_defaults(GTK_BOX(box), frame);
|
||||
gtk_box_pack_start(GTK_BOX(box), btn, FALSE, FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(win), box);
|
||||
|
||||
gtk_widget_show_all(win);
|
||||
}
|
||||
|
||||
// creates and opens the gamepad config window
|
||||
void openGamepadConfig()
|
||||
|
@ -1143,6 +1201,7 @@ static GtkItemFactoryEntry menu_items[] = {
|
|||
{ "/Options/_Sound Config", NULL , openSoundConfig, 0, "<Item>" },
|
||||
{ "/Options/_Video Config", NULL , openVideoConfig, 0, "<Item>" },
|
||||
{ "/Options/_Palette Config", NULL , openPaletteConfig, 0, "<Item>" },
|
||||
{ "/Options/_Network Config", NULL , openNetworkConfig, 0, "<Item>" },
|
||||
{ "/Options/sep1", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/Options/_Fullscreen", NULL, enableFullscreen, 0, "<Item>" },
|
||||
{ "/_Help", NULL, NULL, 0, "<LastBranch>" },
|
||||
|
|
|
@ -109,7 +109,9 @@ FCEUD_NetworkConnect(void)
|
|||
|
||||
TSocket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(TSocket < 0) {
|
||||
puts("Error creating stream socket.");
|
||||
char* s = "Error creating stream socket.";
|
||||
puts(s);
|
||||
FCEU_DispMessage(s);
|
||||
FCEUD_NetworkClose();
|
||||
return 0;
|
||||
}
|
||||
|
@ -138,6 +140,7 @@ FCEUD_NetworkConnect(void)
|
|||
phostentb = gethostbyname(server.c_str());
|
||||
if(!phostentb) {
|
||||
puts("Error getting host network information.");
|
||||
FCEU_DispMessage("Error getting host info");
|
||||
close(TSocket);
|
||||
FCEUD_NetworkClose();
|
||||
return(0);
|
||||
|
@ -150,6 +153,7 @@ FCEUD_NetworkConnect(void)
|
|||
error = connect(TSocket, (struct sockaddr *)&sockin, sizeof(sockin));
|
||||
if(error < 0) {
|
||||
puts("Error connecting to remote host.");
|
||||
FCEU_DispMessage("Error connecting to server");
|
||||
close(TSocket);
|
||||
FCEUD_NetworkClose();
|
||||
return 0;
|
||||
|
@ -218,6 +222,7 @@ FCEUD_NetworkConnect(void)
|
|||
netdivisor = buf[0];
|
||||
|
||||
puts("*** Connection established.");
|
||||
FCEU_DispMessage("Connection established.");
|
||||
|
||||
FCEUDnetplay = 1;
|
||||
FCEUI_NetplayStart(localPlayers, netdivisor);
|
||||
|
|
Loading…
Reference in New Issue