diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index 998a03ec..5997d543 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -71,7 +71,8 @@ DefaultList DefaultInts = #ifdef GDBSTUB_ENABLED {"Instance*.Gdb.ARM7.Port", 3334}, {"Instance*.Gdb.ARM9.Port", 3333}, -#endif +#endif, + {"LAN.HostNumPlayers", 16}, }; RangeList IntRanges = @@ -90,6 +91,7 @@ RangeList IntRanges = {"Instance*.Window*.ScreenAspectTop", {0, AspectRatiosNum-1}}, {"Instance*.Window*.ScreenAspectBot", {0, AspectRatiosNum-1}}, {"MP.AudioMode", {0, 2}}, + {"LAN.HostNumPlayers", {2, 16}}, }; DefaultList DefaultBools = diff --git a/src/frontend/qt_sdl/LANDialog.cpp b/src/frontend/qt_sdl/LANDialog.cpp index 58baf908..32539e3f 100644 --- a/src/frontend/qt_sdl/LANDialog.cpp +++ b/src/frontend/qt_sdl/LANDialog.cpp @@ -51,10 +51,11 @@ LANStartHostDialog::LANStartHostDialog(QWidget* parent) : QDialog(parent), ui(ne setMPInterface(MPInterface_LAN); - // TODO: remember the last setting? so this doesn't suck massively - // we could also remember the player name (and auto-init it from the firmware name or whatever) + auto cfg = Config::GetGlobalTable(); + ui->txtPlayerName->setText(cfg.GetQString("LAN.PlayerName")); + ui->sbNumPlayers->setRange(2, 16); - ui->sbNumPlayers->setValue(16); + ui->sbNumPlayers->setValue(cfg.GetInt("LAN.HostNumPlayers")); } LANStartHostDialog::~LANStartHostDialog() @@ -82,6 +83,11 @@ void LANStartHostDialog::done(int r) } lanDlg = LANDialog::openDlg(parentWidget()); + + auto cfg = Config::GetGlobalTable(); + cfg.SetString("LAN.PlayerName", player); + cfg.SetInt("LAN.HostNumPlayers", numplayers); + Config::Save(); } else { @@ -99,6 +105,9 @@ LANStartClientDialog::LANStartClientDialog(QWidget* parent) : QDialog(parent), u setMPInterface(MPInterface_LAN); + auto cfg = Config::GetGlobalTable(); + ui->txtPlayerName->setText(cfg.GetQString("LAN.PlayerName")); + QStandardItemModel* model = new QStandardItemModel(); ui->tvAvailableGames->setModel(model); const QStringList listheader = {"Name", "Players", "Status", "Host IP"}; @@ -209,6 +218,10 @@ void LANStartClientDialog::done(int r) setEnabled(true); lanDlg = LANDialog::openDlg(parentWidget()); + + auto cfg = Config::GetGlobalTable(); + cfg.SetString("LAN.PlayerName", player); + Config::Save(); } else {