port MPSettings
This commit is contained in:
parent
f391c39592
commit
c0c78553e6
|
@ -62,9 +62,6 @@ int GL_ScaleFactor;
|
|||
bool GL_BetterPolygons;
|
||||
bool GL_HiresCoordinates;
|
||||
|
||||
int MPAudioMode;
|
||||
int MPRecvTimeout;
|
||||
|
||||
std::string LANDevice;
|
||||
bool DirectLAN;
|
||||
|
||||
|
@ -124,6 +121,7 @@ RangeList IntRanges =
|
|||
{"Instance*.Window*.ScreenSizing", {0, Frontend::screenSizing_MAX-1}},
|
||||
{"Instance*.Window*.ScreenAspectTop", {0, AspectRatiosNum-1}},
|
||||
{"Instance*.Window*.ScreenAspectBot", {0, AspectRatiosNum-1}},
|
||||
{"MP.AudioMode", {0, 2}},
|
||||
};
|
||||
|
||||
DefaultList<bool> DefaultBools =
|
||||
|
|
|
@ -176,9 +176,6 @@ extern int GL_ScaleFactor;
|
|||
extern bool GL_BetterPolygons;
|
||||
extern bool GL_HiresCoordinates;
|
||||
|
||||
extern int MPAudioMode;
|
||||
extern int MPRecvTimeout;
|
||||
|
||||
extern std::string LANDevice;
|
||||
extern bool DirectLAN;
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ EmuInstance::EmuInstance(int inst) : instanceID(inst),
|
|||
maxFPS = globalCfg.GetInt("MaxFPS");
|
||||
doAudioSync = globalCfg.GetBool("AudioSync");
|
||||
|
||||
mpAudioMode = globalCfg.GetInt("MP.AudioMode");
|
||||
|
||||
nds = nullptr;
|
||||
updateConsole(nullptr, nullptr);
|
||||
|
||||
|
|
|
@ -247,6 +247,8 @@ private:
|
|||
SDL_cond* audioSyncCond;
|
||||
SDL_mutex* audioSyncLock;
|
||||
|
||||
int mpAudioMode;
|
||||
|
||||
SDL_AudioDeviceID micDevice;
|
||||
melonDS::s16 micExtBuffer[2048];
|
||||
melonDS::u32 micExtBufferWritePos;
|
||||
|
|
|
@ -117,13 +117,12 @@ void EmuInstance::micCallback(void* data, Uint8* stream, int len)
|
|||
|
||||
void EmuInstance::audioMute()
|
||||
{
|
||||
int inst = Platform::InstanceID();
|
||||
audioMuted = false;
|
||||
|
||||
switch (Config::MPAudioMode)
|
||||
switch (mpAudioMode)
|
||||
{
|
||||
case 1: // only instance 1
|
||||
if (inst > 0) audioMuted = true;
|
||||
if (instanceID > 0) audioMuted = true;
|
||||
break;
|
||||
|
||||
case 2: // only currently focused instance
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "types.h"
|
||||
#include "Platform.h"
|
||||
#include "Config.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "LAN_Socket.h"
|
||||
#include "LAN_PCap.h"
|
||||
|
@ -41,13 +42,16 @@ MPSettingsDialog::MPSettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui
|
|||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
grpAudioMode = new QButtonGroup(this);
|
||||
grpAudioMode->addButton(ui->rbAudioAll, 0);
|
||||
grpAudioMode->addButton(ui->rbAudioOneOnly, 1);
|
||||
grpAudioMode->addButton(ui->rbAudioActiveOnly, 2);
|
||||
grpAudioMode->button(Config::MPAudioMode)->setChecked(true);
|
||||
grpAudioMode->button(cfg.GetInt("MP.AudioMode"))->setChecked(true);
|
||||
|
||||
ui->sbReceiveTimeout->setValue(Config::MPRecvTimeout);
|
||||
ui->sbReceiveTimeout->setValue(cfg.GetInt("MP.RecvTimeout"));
|
||||
}
|
||||
|
||||
MPSettingsDialog::~MPSettingsDialog()
|
||||
|
@ -59,8 +63,9 @@ void MPSettingsDialog::done(int r)
|
|||
{
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
Config::MPAudioMode = grpAudioMode->checkedId();
|
||||
Config::MPRecvTimeout = ui->sbReceiveTimeout->value();
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
cfg.SetInt("MP.AudioMode", grpAudioMode->checkedId());
|
||||
cfg.SetInt("MP.RecvTimeout", ui->sbReceiveTimeout->value());
|
||||
|
||||
Config::Save();
|
||||
}
|
||||
|
@ -69,5 +74,3 @@ void MPSettingsDialog::done(int r)
|
|||
|
||||
closeDlg();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
namespace Ui { class MPSettingsDialog; }
|
||||
class MPSettingsDialog;
|
||||
|
||||
class EmuInstance;
|
||||
|
||||
class MPSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -58,6 +60,7 @@ private slots:
|
|||
|
||||
private:
|
||||
Ui::MPSettingsDialog* ui;
|
||||
EmuInstance* emuInstance;
|
||||
|
||||
QButtonGroup* grpAudioMode;
|
||||
};
|
||||
|
|
|
@ -1843,8 +1843,9 @@ void MainWindow::onOpenMPSettings()
|
|||
|
||||
void MainWindow::onMPSettingsFinished(int res)
|
||||
{
|
||||
emuInstance->mpAudioMode = globalCfg.GetInt("MP.AudioMode");
|
||||
emuInstance->audioMute();
|
||||
LocalMP::SetRecvTimeout(Config::MPRecvTimeout);
|
||||
LocalMP::SetRecvTimeout(globalCfg.GetInt("MP.RecvTimeout"));
|
||||
|
||||
emuThread->emuUnpause();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue