mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
actually save shit
This commit is contained in:
@ -54,6 +54,10 @@ int SocketBindAnyAddr;
|
|||||||
|
|
||||||
int SavestateRelocSRAM;
|
int SavestateRelocSRAM;
|
||||||
|
|
||||||
|
int AudioVolume;
|
||||||
|
int MicInputType;
|
||||||
|
char MicWavPath[512];
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char Name[16];
|
char Name[16];
|
||||||
@ -61,7 +65,7 @@ typedef struct
|
|||||||
void* Value;
|
void* Value;
|
||||||
int DefaultInt;
|
int DefaultInt;
|
||||||
char* DefaultStr;
|
char* DefaultStr;
|
||||||
int StrLength;
|
int StrLength; // should be set to actual array length minus one
|
||||||
|
|
||||||
} ConfigEntry;
|
} ConfigEntry;
|
||||||
|
|
||||||
@ -116,6 +120,10 @@ ConfigEntry ConfigFile[] =
|
|||||||
|
|
||||||
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 1, NULL, 0},
|
{"SavStaRelocSRAM", 0, &SavestateRelocSRAM, 1, NULL, 0},
|
||||||
|
|
||||||
|
{"AudioVolume", 0, &AudioVolume, 255, NULL, 0},
|
||||||
|
{"MicInputType", 0, &MicInputType, 1, NULL, 0},
|
||||||
|
{"MicWavPath", 1, MicWavPath, 0, "", 511},
|
||||||
|
|
||||||
{"", -1, NULL, 0, NULL, 0}
|
{"", -1, NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -130,7 +138,10 @@ void Load()
|
|||||||
if (entry->Type == 0)
|
if (entry->Type == 0)
|
||||||
*(int*)entry->Value = entry->DefaultInt;
|
*(int*)entry->Value = entry->DefaultInt;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
strncpy((char*)entry->Value, entry->DefaultStr, entry->StrLength);
|
strncpy((char*)entry->Value, entry->DefaultStr, entry->StrLength);
|
||||||
|
((char*)entry->Value)[entry->StrLength] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
entry++;
|
entry++;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,10 @@ extern int SocketBindAnyAddr;
|
|||||||
|
|
||||||
extern int SavestateRelocSRAM;
|
extern int SavestateRelocSRAM;
|
||||||
|
|
||||||
|
extern int AudioVolume;
|
||||||
|
extern int MicInputType;
|
||||||
|
extern char MicWavPath[512];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "libui/ui.h"
|
#include "libui/ui.h"
|
||||||
|
|
||||||
@ -33,7 +34,9 @@ namespace DlgAudioSettings
|
|||||||
bool opened;
|
bool opened;
|
||||||
uiWindow* win;
|
uiWindow* win;
|
||||||
|
|
||||||
//
|
uiSlider* slVolume;
|
||||||
|
uiRadioButtons* rbMicInputType;
|
||||||
|
uiEntry* txMicWavPath;
|
||||||
|
|
||||||
|
|
||||||
int OnCloseWindow(uiWindow* window, void* blarg)
|
int OnCloseWindow(uiWindow* window, void* blarg)
|
||||||
@ -50,9 +53,12 @@ void OnCancel(uiButton* btn, void* blarg)
|
|||||||
|
|
||||||
void OnOk(uiButton* btn, void* blarg)
|
void OnOk(uiButton* btn, void* blarg)
|
||||||
{
|
{
|
||||||
/*Config::DirectBoot = uiCheckboxChecked(cbDirectBoot);
|
Config::AudioVolume = uiSliderValue(slVolume);
|
||||||
Config::Threaded3D = uiCheckboxChecked(cbThreaded3D);
|
Config::MicInputType = uiRadioButtonsSelected(rbMicInputType);
|
||||||
Config::SocketBindAnyAddr = uiCheckboxChecked(cbBindAnyAddr);*/
|
|
||||||
|
char* wavpath = uiEntryText(txMicWavPath);
|
||||||
|
strncpy(Config::MicWavPath, wavpath, 511);
|
||||||
|
uiFreeText(wavpath);
|
||||||
|
|
||||||
Config::Save();
|
Config::Save();
|
||||||
|
|
||||||
@ -88,8 +94,8 @@ void Open()
|
|||||||
uiLabel* label_vol = uiNewLabel("Volume:");
|
uiLabel* label_vol = uiNewLabel("Volume:");
|
||||||
uiBoxAppend(in_ctrl, uiControl(label_vol), 0);
|
uiBoxAppend(in_ctrl, uiControl(label_vol), 0);
|
||||||
|
|
||||||
uiSlider* volslider = uiNewSlider(0, 255);
|
slVolume = uiNewSlider(0, 255);
|
||||||
uiBoxAppend(in_ctrl, uiControl(volslider), 0);
|
uiBoxAppend(in_ctrl, uiControl(slVolume), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -100,18 +106,18 @@ void Open()
|
|||||||
uiBox* in_ctrl = uiNewVerticalBox();
|
uiBox* in_ctrl = uiNewVerticalBox();
|
||||||
uiGroupSetChild(grp, uiControl(in_ctrl));
|
uiGroupSetChild(grp, uiControl(in_ctrl));
|
||||||
|
|
||||||
uiRadioButtons* mictypes = uiNewRadioButtons();
|
rbMicInputType = uiNewRadioButtons();
|
||||||
uiRadioButtonsAppend(mictypes, "None");
|
uiRadioButtonsAppend(rbMicInputType, "None");
|
||||||
uiRadioButtonsAppend(mictypes, "Microphone");
|
uiRadioButtonsAppend(rbMicInputType, "Microphone");
|
||||||
uiRadioButtonsAppend(mictypes, "White noise");
|
uiRadioButtonsAppend(rbMicInputType, "White noise");
|
||||||
uiRadioButtonsAppend(mictypes, "WAV file:");
|
uiRadioButtonsAppend(rbMicInputType, "WAV file:");
|
||||||
uiBoxAppend(in_ctrl, uiControl(mictypes), 0);
|
uiBoxAppend(in_ctrl, uiControl(rbMicInputType), 0);
|
||||||
|
|
||||||
uiBox* path_box = uiNewHorizontalBox();
|
uiBox* path_box = uiNewHorizontalBox();
|
||||||
uiBoxAppend(in_ctrl, uiControl(path_box), 0);
|
uiBoxAppend(in_ctrl, uiControl(path_box), 0);
|
||||||
|
|
||||||
uiEntry* path_entry = uiNewEntry();
|
txMicWavPath = uiNewEntry();
|
||||||
uiBoxAppend(path_box, uiControl(path_entry), 1);
|
uiBoxAppend(path_box, uiControl(txMicWavPath), 1);
|
||||||
|
|
||||||
uiButton* path_browse = uiNewButton("...");
|
uiButton* path_browse = uiNewButton("...");
|
||||||
uiBoxAppend(path_box, uiControl(path_browse), 0);
|
uiBoxAppend(path_box, uiControl(path_browse), 0);
|
||||||
@ -134,7 +140,12 @@ void Open()
|
|||||||
uiBoxAppend(in_ctrl, uiControl(btnok), 0);
|
uiBoxAppend(in_ctrl, uiControl(btnok), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// shit
|
if (Config::AudioVolume < 0) Config::AudioVolume = 0;
|
||||||
|
else if (Config::AudioVolume > 255) Config::AudioVolume = 255;
|
||||||
|
|
||||||
|
uiSliderSetValue(slVolume, Config::AudioVolume);
|
||||||
|
uiRadioButtonsSetSelected(rbMicInputType, Config::MicInputType);
|
||||||
|
uiEntrySetText(txMicWavPath, Config::MicWavPath);
|
||||||
|
|
||||||
uiControlShow(uiControl(win));
|
uiControlShow(uiControl(win));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user