add dialog for audio settings, flesh it out

not functional yet tho
This commit is contained in:
StapleButter 2018-12-14 04:09:51 +01:00
parent a64e59bf99
commit fd54abd900
5 changed files with 190 additions and 6 deletions

View File

@ -8,6 +8,7 @@ PROJECT(${PROJECT_WX})
SET(SOURCES
src/libui_sdl/main.cpp
src/libui_sdl/Platform.cpp
src/libui_sdl/DlgAudioSettings.cpp
src/libui_sdl/DlgEmuSettings.cpp
src/libui_sdl/DlgInputConfig.cpp
src/ARM.cpp

View File

@ -144,6 +144,8 @@
<Unit filename="src/Wifi.h" />
<Unit filename="src/WifiAP.cpp" />
<Unit filename="src/WifiAP.h" />
<Unit filename="src/libui_sdl/DlgAudioSettings.cpp" />
<Unit filename="src/libui_sdl/DlgAudioSettings.h" />
<Unit filename="src/libui_sdl/DlgEmuSettings.cpp" />
<Unit filename="src/libui_sdl/DlgEmuSettings.h" />
<Unit filename="src/libui_sdl/DlgInputConfig.cpp" />

View File

@ -0,0 +1,142 @@
/*
Copyright 2016-2019 StapleButter
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#include <stdlib.h>
#include <stdio.h>
#include "libui/ui.h"
#include "../types.h"
#include "../Config.h"
#include "DlgAudioSettings.h"
namespace DlgAudioSettings
{
bool opened;
uiWindow* win;
//
int OnCloseWindow(uiWindow* window, void* blarg)
{
opened = false;
return 1;
}
void OnCancel(uiButton* btn, void* blarg)
{
uiControlDestroy(uiControl(win));
opened = false;
}
void OnOk(uiButton* btn, void* blarg)
{
/*Config::DirectBoot = uiCheckboxChecked(cbDirectBoot);
Config::Threaded3D = uiCheckboxChecked(cbThreaded3D);
Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr);*/
Config::Save();
uiControlDestroy(uiControl(win));
opened = false;
}
void Open()
{
if (opened)
{
uiControlSetFocus(uiControl(win));
return;
}
opened = true;
win = uiNewWindow("Audio settings - melonDS", 400, 100, 0, 0);
uiWindowSetMargined(win, 1);
uiWindowOnClosing(win, OnCloseWindow, NULL);
uiBox* top = uiNewVerticalBox();
uiWindowSetChild(win, uiControl(top));
uiBoxSetPadded(top, 1);
{
uiGroup* grp = uiNewGroup("Audio output");
uiBoxAppend(top, uiControl(grp), 0);
uiGroupSetMargined(grp, 1);
uiBox* in_ctrl = uiNewVerticalBox();
uiGroupSetChild(grp, uiControl(in_ctrl));
uiLabel* label_vol = uiNewLabel("Volume:");
uiBoxAppend(in_ctrl, uiControl(label_vol), 0);
uiSlider* volslider = uiNewSlider(0, 255);
uiBoxAppend(in_ctrl, uiControl(volslider), 0);
}
{
uiGroup* grp = uiNewGroup("Microphone input");
uiBoxAppend(top, uiControl(grp), 0);
uiGroupSetMargined(grp, 1);
uiBox* in_ctrl = uiNewVerticalBox();
uiGroupSetChild(grp, uiControl(in_ctrl));
uiRadioButtons* mictypes = uiNewRadioButtons();
uiRadioButtonsAppend(mictypes, "None");
uiRadioButtonsAppend(mictypes, "Microphone");
uiRadioButtonsAppend(mictypes, "White noise");
uiRadioButtonsAppend(mictypes, "WAV file:");
uiBoxAppend(in_ctrl, uiControl(mictypes), 0);
uiBox* path_box = uiNewHorizontalBox();
uiBoxAppend(in_ctrl, uiControl(path_box), 0);
uiEntry* path_entry = uiNewEntry();
uiBoxAppend(path_box, uiControl(path_entry), 1);
uiButton* path_browse = uiNewButton("...");
uiBoxAppend(path_box, uiControl(path_browse), 0);
}
{
uiBox* in_ctrl = uiNewHorizontalBox();
uiBoxSetPadded(in_ctrl, 1);
uiBoxAppend(top, uiControl(in_ctrl), 0);
uiLabel* dummy = uiNewLabel("");
uiBoxAppend(in_ctrl, uiControl(dummy), 1);
uiButton* btncancel = uiNewButton("Cancel");
uiButtonOnClicked(btncancel, OnCancel, NULL);
uiBoxAppend(in_ctrl, uiControl(btncancel), 0);
uiButton* btnok = uiNewButton("Ok");
uiButtonOnClicked(btnok, OnOk, NULL);
uiBoxAppend(in_ctrl, uiControl(btnok), 0);
}
// shit
uiControlShow(uiControl(win));
}
}

View File

@ -0,0 +1,29 @@
/*
Copyright 2016-2019 StapleButter
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#ifndef DLGAUDIOSETTINGS_H
#define DLGAUDIOSETTINGS_H
namespace DlgAudioSettings
{
void Open();
}
#endif // DLGAUDIOSETTINGS_H

View File

@ -31,6 +31,7 @@
#include "DlgEmuSettings.h"
#include "DlgInputConfig.h"
#include "DlgAudioSettings.h"
#include "../NDS.h"
#include "../GPU.h"
@ -1350,6 +1351,11 @@ void OnOpenHotkeyConfig(uiMenuItem* item, uiWindow* window, void* blarg)
DlgInputConfig::Open(1);
}
void OnOpenAudioSettings(uiMenuItem* item, uiWindow* window, void* blarg)
{
DlgAudioSettings::Open();
}
void OnSetSavestateSRAMReloc(uiMenuItem* item, uiWindow* window, void* param)
{
@ -1615,12 +1621,16 @@ int main(int argc, char** argv)
MenuItem_Stop = menuitem;
menu = uiNewMenu("Config");
{
menuitem = uiMenuAppendItem(menu, "Emu settings");
uiMenuItemOnClicked(menuitem, OnOpenEmuSettings, NULL);
menuitem = uiMenuAppendItem(menu, "Input config");
uiMenuItemOnClicked(menuitem, OnOpenInputConfig, NULL);
menuitem = uiMenuAppendItem(menu, "Hotkey config");
uiMenuItemOnClicked(menuitem, OnOpenHotkeyConfig, NULL);
menuitem = uiMenuAppendItem(menu, "Audio settings");
uiMenuItemOnClicked(menuitem, OnOpenAudioSettings, NULL);
}
uiMenuAppendSeparator(menu);
{
uiMenu* submenu = uiNewMenu("Savestate settings");