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