make it somewhat functional. move wifi socket bind setting to wifi settings dialog.

This commit is contained in:
Arisotura 2019-02-21 02:12:33 +01:00
parent 81eae0e3ea
commit 616f2b494b
3 changed files with 29 additions and 80 deletions

View File

@ -27,7 +27,7 @@
#include "DlgEmuSettings.h" #include "DlgEmuSettings.h"
void ApplyNewSettings(); void ApplyNewSettings(int type);
namespace DlgEmuSettings namespace DlgEmuSettings
@ -38,7 +38,6 @@ uiWindow* win;
uiCheckbox* cbDirectBoot; uiCheckbox* cbDirectBoot;
uiCheckbox* cbThreaded3D; uiCheckbox* cbThreaded3D;
uiCheckbox* cbBindAnyAddr;
int OnCloseWindow(uiWindow* window, void* blarg) int OnCloseWindow(uiWindow* window, void* blarg)
@ -57,14 +56,13 @@ void OnOk(uiButton* btn, void* blarg)
{ {
Config::DirectBoot = uiCheckboxChecked(cbDirectBoot); Config::DirectBoot = uiCheckboxChecked(cbDirectBoot);
Config::Threaded3D = uiCheckboxChecked(cbThreaded3D); Config::Threaded3D = uiCheckboxChecked(cbThreaded3D);
Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr);
Config::Save(); Config::Save();
uiControlDestroy(uiControl(win)); uiControlDestroy(uiControl(win));
opened = false; opened = false;
ApplyNewSettings(); ApplyNewSettings(0);
} }
void Open() void Open()
@ -92,9 +90,6 @@ void Open()
cbThreaded3D = uiNewCheckbox("Threaded 3D renderer"); cbThreaded3D = uiNewCheckbox("Threaded 3D renderer");
uiBoxAppend(in_ctrl, uiControl(cbThreaded3D), 0); uiBoxAppend(in_ctrl, uiControl(cbThreaded3D), 0);
cbBindAnyAddr = uiNewCheckbox("Wifi: bind socket to any address");
uiBoxAppend(in_ctrl, uiControl(cbBindAnyAddr), 0);
} }
{ {
@ -116,7 +111,6 @@ void Open()
uiCheckboxSetChecked(cbDirectBoot, Config::DirectBoot); uiCheckboxSetChecked(cbDirectBoot, Config::DirectBoot);
uiCheckboxSetChecked(cbThreaded3D, Config::Threaded3D); uiCheckboxSetChecked(cbThreaded3D, Config::Threaded3D);
uiCheckboxSetChecked(cbBindAnyAddr, Config::SocketBindAnyAddr);
uiControlShow(uiControl(win)); uiControlShow(uiControl(win));
} }

View File

@ -28,17 +28,16 @@
#include "DlgWifiSettings.h" #include "DlgWifiSettings.h"
void ApplyNewSettings(int type);
namespace DlgWifiSettings namespace DlgWifiSettings
{ {
bool opened; bool opened;
uiWindow* win; uiWindow* win;
/*uiSlider* slVolume; uiCheckbox* cbBindAnyAddr;
uiRadioButtons* rbMicInputType;
uiEntry* txMicWavPath;
int oldvolume;*/
int OnCloseWindow(uiWindow* window, void* blarg) int OnCloseWindow(uiWindow* window, void* blarg)
@ -47,46 +46,22 @@ int OnCloseWindow(uiWindow* window, void* blarg)
return 1; return 1;
} }
void OnVolumeChanged(uiSlider* slider, void* blarg)
{
//Config::AudioVolume = uiSliderValue(slVolume);
}
/*void OnMicWavBrowse(uiButton* btn, void* blarg)
{
char* file = uiOpenFile(win, "WAV file (*.wav)|*.wav|Any file|*.*", NULL);
if (!file)
{
return;
}
uiEntrySetText(txMicWavPath, file);
uiFreeText(file);
}*/
void OnCancel(uiButton* btn, void* blarg) void OnCancel(uiButton* btn, void* blarg)
{ {
Config::AudioVolume = oldvolume;
uiControlDestroy(uiControl(win)); uiControlDestroy(uiControl(win));
opened = false; opened = false;
} }
void OnOk(uiButton* btn, void* blarg) void OnOk(uiButton* btn, void* blarg)
{ {
/*Config::AudioVolume = uiSliderValue(slVolume); Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr);
Config::MicInputType = uiRadioButtonsSelected(rbMicInputType);
char* wavpath = uiEntryText(txMicWavPath);
strncpy(Config::MicWavPath, wavpath, 511);
uiFreeText(wavpath);*/
Config::Save(); Config::Save();
//if (Config::MicInputType == 3) MicLoadWav(Config::MicWavPath);
uiControlDestroy(uiControl(win)); uiControlDestroy(uiControl(win));
opened = false; opened = false;
ApplyNewSettings(1);
} }
void Open() void Open()
@ -106,47 +81,29 @@ void Open()
uiWindowSetChild(win, uiControl(top)); uiWindowSetChild(win, uiControl(top));
uiBoxSetPadded(top, 1); uiBoxSetPadded(top, 1);
/*{ {
uiGroup* grp = uiNewGroup("Audio output"); uiGroup* grp = uiNewGroup("Local");
uiBoxAppend(top, uiControl(grp), 0); uiBoxAppend(top, uiControl(grp), 0);
uiGroupSetMargined(grp, 1); uiGroupSetMargined(grp, 1);
uiBox* in_ctrl = uiNewVerticalBox(); uiBox* in_ctrl = uiNewVerticalBox();
uiGroupSetChild(grp, uiControl(in_ctrl)); uiGroupSetChild(grp, uiControl(in_ctrl));
uiLabel* label_vol = uiNewLabel("Volume:"); cbBindAnyAddr = uiNewCheckbox("Bind socket to any address");
uiBoxAppend(in_ctrl, uiControl(label_vol), 0); uiBoxAppend(in_ctrl, uiControl(cbBindAnyAddr), 0);
slVolume = uiNewSlider(0, 256);
uiSliderOnChanged(slVolume, OnVolumeChanged, NULL);
uiBoxAppend(in_ctrl, uiControl(slVolume), 0);
} }
{ {
uiGroup* grp = uiNewGroup("Microphone input"); uiGroup* grp = uiNewGroup("Online");
uiBoxAppend(top, uiControl(grp), 0); uiBoxAppend(top, uiControl(grp), 0);
uiGroupSetMargined(grp, 1); uiGroupSetMargined(grp, 1);
uiBox* in_ctrl = uiNewVerticalBox(); uiBox* in_ctrl = uiNewVerticalBox();
uiGroupSetChild(grp, uiControl(in_ctrl)); uiGroupSetChild(grp, uiControl(in_ctrl));
rbMicInputType = uiNewRadioButtons(); uiLabel* dorp = uiNewLabel("placeholder");
uiRadioButtonsAppend(rbMicInputType, "None"); uiBoxAppend(in_ctrl, uiControl(dorp), 0);
uiRadioButtonsAppend(rbMicInputType, "Microphone"); }
uiRadioButtonsAppend(rbMicInputType, "White noise");
uiRadioButtonsAppend(rbMicInputType, "WAV file:");
uiBoxAppend(in_ctrl, uiControl(rbMicInputType), 0);
uiBox* path_box = uiNewHorizontalBox();
uiBoxAppend(in_ctrl, uiControl(path_box), 0);
txMicWavPath = uiNewEntry();
uiBoxAppend(path_box, uiControl(txMicWavPath), 1);
uiButton* path_browse = uiNewButton("...");
uiButtonOnClicked(path_browse, OnMicWavBrowse, NULL);
uiBoxAppend(path_box, uiControl(path_browse), 0);
}*/
{ {
uiBox* in_ctrl = uiNewHorizontalBox(); uiBox* in_ctrl = uiNewHorizontalBox();
@ -165,14 +122,7 @@ void Open()
uiBoxAppend(in_ctrl, uiControl(btnok), 0); uiBoxAppend(in_ctrl, uiControl(btnok), 0);
} }
/*if (Config::AudioVolume < 0) Config::AudioVolume = 0; uiCheckboxSetChecked(cbBindAnyAddr, Config::SocketBindAnyAddr);
else if (Config::AudioVolume > 256) Config::AudioVolume = 256;
oldvolume = Config::AudioVolume;
uiSliderSetValue(slVolume, Config::AudioVolume);
uiRadioButtonsSetSelected(rbMicInputType, Config::MicInputType);
uiEntrySetText(txMicWavPath, Config::MicWavPath);*/
uiControlShow(uiControl(win)); uiControlShow(uiControl(win));
} }

View File

@ -1659,7 +1659,7 @@ void OnSetLimitFPS(uiMenuItem* item, uiWindow* window, void* blarg)
else Config::LimitFPS = false; else Config::LimitFPS = false;
} }
void ApplyNewSettings() void ApplyNewSettings(int type)
{ {
if (!RunningSomething) return; if (!RunningSomething) return;
@ -1667,13 +1667,18 @@ void ApplyNewSettings()
EmuRunning = 2; EmuRunning = 2;
while (EmuStatus != 2); while (EmuStatus != 2);
if (type == 0) // general emu settings)
{
GPU3D::SoftRenderer::SetupRenderThread(); GPU3D::SoftRenderer::SetupRenderThread();
}
else if (type == 1) // wifi settings
{
if (Wifi::MPInited) if (Wifi::MPInited)
{ {
Platform::MP_DeInit(); Platform::MP_DeInit();
Platform::MP_Init(); Platform::MP_Init();
} }
}
EmuRunning = prevstatus; EmuRunning = prevstatus;
} }