mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
add setting for whether to bind the wifi socket to any address or to loopback only
This commit is contained in:
@ -35,6 +35,8 @@ int DirectBoot;
|
|||||||
|
|
||||||
int Threaded3D;
|
int Threaded3D;
|
||||||
|
|
||||||
|
int SocketBindAnyAddr;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char Name[16];
|
char Name[16];
|
||||||
@ -81,6 +83,8 @@ ConfigEntry ConfigFile[] =
|
|||||||
|
|
||||||
{"Threaded3D", 0, &Threaded3D, 1, NULL, 0},
|
{"Threaded3D", 0, &Threaded3D, 1, NULL, 0},
|
||||||
|
|
||||||
|
{"SockBindAnyAddr", 0, &SocketBindAnyAddr, 0, NULL, 0},
|
||||||
|
|
||||||
{"", -1, NULL, 0, NULL, 0}
|
{"", -1, NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ extern int DirectBoot;
|
|||||||
|
|
||||||
extern int Threaded3D;
|
extern int Threaded3D;
|
||||||
|
|
||||||
|
extern int SocketBindAnyAddr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
@ -140,6 +140,9 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern bool MPInited;
|
||||||
|
|
||||||
|
|
||||||
bool Init();
|
bool Init();
|
||||||
void DeInit();
|
void DeInit();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
@ -40,6 +40,10 @@ EmuConfigDialog::EmuConfigDialog(wxWindow* parent)
|
|||||||
vboxmain->Add(cbThreaded3D, 0, wxALL&(~wxBOTTOM), 15);
|
vboxmain->Add(cbThreaded3D, 0, wxALL&(~wxBOTTOM), 15);
|
||||||
cbThreaded3D->SetValue(Config::Threaded3D != 0);
|
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);
|
wxPanel* p = new wxPanel(this);
|
||||||
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
@ -67,6 +71,7 @@ void EmuConfigDialog::OnOk(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
Config::DirectBoot = cbDirectBoot->GetValue() ? 1:0;
|
Config::DirectBoot = cbDirectBoot->GetValue() ? 1:0;
|
||||||
Config::Threaded3D = cbThreaded3D->GetValue() ? 1:0;
|
Config::Threaded3D = cbThreaded3D->GetValue() ? 1:0;
|
||||||
|
Config::SocketBindAnyAddr = cbBindAnyAddr->GetValue() ? 1:0;
|
||||||
Config::Save();
|
Config::Save();
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
@ -38,6 +38,7 @@ private:
|
|||||||
|
|
||||||
wxCheckBox* cbDirectBoot;
|
wxCheckBox* cbDirectBoot;
|
||||||
wxCheckBox* cbThreaded3D;
|
wxCheckBox* cbThreaded3D;
|
||||||
|
wxCheckBox* cbBindAnyAddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WX_EMUCONFIG_H
|
#endif // WX_EMUCONFIG_H
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../Platform.h"
|
#include "../Platform.h"
|
||||||
|
#include "../Config.h"
|
||||||
|
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
@ -154,7 +155,7 @@ bool MP_Init()
|
|||||||
|
|
||||||
sockaddr_t saddr;
|
sockaddr_t saddr;
|
||||||
saddr.sa_family = AF_INET;
|
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);
|
*(u16*)&saddr.sa_data[0] = htons(7064);
|
||||||
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
|
res = bind(MPSocket, &saddr, sizeof(sockaddr_t));
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "../GPU.h"
|
#include "../GPU.h"
|
||||||
#include "../GPU3D.h"
|
#include "../GPU3D.h"
|
||||||
#include "../SPU.h"
|
#include "../SPU.h"
|
||||||
|
#include "../Wifi.h"
|
||||||
|
#include "../Platform.h"
|
||||||
|
|
||||||
#include "InputConfig.h"
|
#include "InputConfig.h"
|
||||||
#include "EmuConfig.h"
|
#include "EmuConfig.h"
|
||||||
@ -113,7 +115,7 @@ bool wxApp_melonDS::OnInit()
|
|||||||
"bios7.bin -- ARM7 BIOS\n"
|
"bios7.bin -- ARM7 BIOS\n"
|
||||||
"bios9.bin -- ARM9 BIOS\n"
|
"bios9.bin -- ARM9 BIOS\n"
|
||||||
"firmware.bin -- firmware image\n\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.",
|
"Make sure that the files can be accessed.",
|
||||||
"melonDS",
|
"melonDS",
|
||||||
wxICON_ERROR);
|
wxICON_ERROR);
|
||||||
@ -315,15 +317,26 @@ void MainFrame::OnReset(wxCommandEvent& event)
|
|||||||
void MainFrame::OnEmuConfig(wxCommandEvent& event)
|
void MainFrame::OnEmuConfig(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
bool oldpause = emuthread->EmuIsPaused();
|
bool oldpause = emuthread->EmuIsPaused();
|
||||||
if (!oldpause) emuthread->EmuPause();
|
if (!oldpause && emuthread->EmuIsRunning())
|
||||||
|
emuthread->EmuPause();
|
||||||
|
|
||||||
EmuConfigDialog dlg(this);
|
EmuConfigDialog dlg(this);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
||||||
// apply threaded 3D setting
|
if (emuthread->EmuIsRunning())
|
||||||
GPU3D::SoftRenderer::SetupRenderThread();
|
{
|
||||||
|
// 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)
|
void MainFrame::OnInputConfig(wxCommandEvent& event)
|
||||||
|
Reference in New Issue
Block a user