aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-07-16 00:57:26 +0200
committerStapleButter <thetotalworm@gmail.com>2017-07-16 00:57:26 +0200
commit08bdef481f1685e596fc2e45597a4bfe60aae8aa (patch)
tree00c03f45f169102c9b5e7ea15dd8dbada4dd7d09 /src
parentbb963c35a4b0ab035be39d0d95d1da50a01156a9 (diff)
add setting for whether to bind the wifi socket to any address or to loopback only
Diffstat (limited to 'src')
-rw-r--r--src/Config.cpp4
-rw-r--r--src/Config.h2
-rw-r--r--src/Wifi.h3
-rw-r--r--src/wx/EmuConfig.cpp5
-rw-r--r--src/wx/EmuConfig.h1
-rw-r--r--src/wx/Platform.cpp3
-rw-r--r--src/wx/main.cpp23
7 files changed, 35 insertions, 6 deletions
diff --git a/src/Config.cpp b/src/Config.cpp
index 5d7661d..95013fd 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -35,6 +35,8 @@ int DirectBoot;
int Threaded3D;
+int SocketBindAnyAddr;
+
typedef struct
{
char Name[16];
@@ -81,6 +83,8 @@ ConfigEntry ConfigFile[] =
{"Threaded3D", 0, &Threaded3D, 1, NULL, 0},
+ {"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0},
+
{"", -1, NULL, 0, NULL, 0}
};
diff --git a/src/Config.h b/src/Config.h
index af32130..370f102 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -37,6 +37,8 @@ extern int DirectBoot;
extern int Threaded3D;
+extern int SocketBindAnyAddr;
+
}
#endif // CONFIG_H
diff --git a/src/Wifi.h b/src/Wifi.h
index 65707f2..f0bf0ad 100644
--- a/src/Wifi.h
+++ b/src/Wifi.h
@@ -140,6 +140,9 @@ enum
};
+extern bool MPInited;
+
+
bool Init();
void DeInit();
void Reset();
diff --git a/src/wx/EmuConfig.cpp b/src/wx/EmuConfig.cpp
index bace238..a8822a6 100644
--- a/src/wx/EmuConfig.cpp
+++ b/src/wx/EmuConfig.cpp
@@ -40,6 +40,10 @@ EmuConfigDialog::EmuConfigDialog(wxWindow* parent)
vboxmain->Add(cbThreaded3D, 0, wxALL&(~wxBOTTOM), 15);
cbThreaded3D->SetValue(Config::Threaded3D != 0);
+ cbBindAnyAddr = new wxCheckBox(this, wxID_ANY, "Wifi: bind socket to any address");
+ vboxmain->Add(cbBindAnyAddr, 0, wxALL&(~wxBOTTOM), 15);
+ cbBindAnyAddr->SetValue(Config::SocketBindAnyAddr != 0);
+
{
wxPanel* p = new wxPanel(this);
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
@@ -67,6 +71,7 @@ void EmuConfigDialog::OnOk(wxCommandEvent& event)
{
Config::DirectBoot = cbDirectBoot->GetValue() ? 1:0;
Config::Threaded3D = cbThreaded3D->GetValue() ? 1:0;
+ Config::SocketBindAnyAddr = cbBindAnyAddr->GetValue() ? 1:0;
Config::Save();
Close();
diff --git a/src/wx/EmuConfig.h b/src/wx/EmuConfig.h
index d1f22a1..907692f 100644
--- a/src/wx/EmuConfig.h
+++ b/src/wx/EmuConfig.h
@@ -38,6 +38,7 @@ private:
wxCheckBox* cbDirectBoot;
wxCheckBox* cbThreaded3D;
+ wxCheckBox* cbBindAnyAddr;
};
#endif // WX_EMUCONFIG_H
diff --git a/src/wx/Platform.cpp b/src/wx/Platform.cpp
index 4085420..48c3bfa 100644
--- a/src/wx/Platform.cpp
+++ b/src/wx/Platform.cpp
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include "../Platform.h"
+#include "../Config.h"
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
@@ -154,7 +155,7 @@ bool MP_Init()
sockaddr_t saddr;
saddr.sa_family = AF_INET;
- *(u32*)&saddr.sa_data[2] = htonl(INADDR_LOOPBACK);//htonl(INADDR_ANY);
+ *(u32*)&saddr.sa_data[2] = htonl(Config::SocketBindAnyAddr ? INADDR_ANY : INADDR_LOOPBACK);
*(u16*)&saddr.sa_data[0] = htons(7064);
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
if (res < 0)
diff --git a/src/wx/main.cpp b/src/wx/main.cpp
index 4f15b94..3c2375b 100644
--- a/src/wx/main.cpp
+++ b/src/wx/main.cpp
@@ -24,6 +24,8 @@
#include "../GPU.h"
#include "../GPU3D.h"
#include "../SPU.h"
+#include "../Wifi.h"
+#include "../Platform.h"
#include "InputConfig.h"
#include "EmuConfig.h"
@@ -113,7 +115,7 @@ bool wxApp_melonDS::OnInit()
"bios7.bin -- ARM7 BIOS\n"
"bios9.bin -- ARM9 BIOS\n"
"firmware.bin -- firmware image\n\n"
- "Place the following files in the directory you run melonDS from.\n"
+ "Dump the files from your DS and place them in the directory you run melonDS from.\n"
"Make sure that the files can be accessed.",
"melonDS",
wxICON_ERROR);
@@ -315,15 +317,26 @@ void MainFrame::OnReset(wxCommandEvent& event)
void MainFrame::OnEmuConfig(wxCommandEvent& event)
{
bool oldpause = emuthread->EmuIsPaused();
- if (!oldpause) emuthread->EmuPause();
+ if (!oldpause && emuthread->EmuIsRunning())
+ emuthread->EmuPause();
EmuConfigDialog dlg(this);
dlg.ShowModal();
- // apply threaded 3D setting
- GPU3D::SoftRenderer::SetupRenderThread();
+ if (emuthread->EmuIsRunning())
+ {
+ // apply threaded 3D setting
+ GPU3D::SoftRenderer::SetupRenderThread();
- if (!oldpause) emuthread->EmuRun();
+ if (Wifi::MPInited)
+ {
+ Platform::MP_DeInit();
+ Platform::MP_Init();
+ }
+ }
+
+ if (!oldpause && emuthread->EmuIsRunning())
+ emuthread->EmuRun();
}
void MainFrame::OnInputConfig(wxCommandEvent& event)