Add support for choosing network service (incl Pretendo+Custom) (#302)

This commit is contained in:
MythicalPlayz 2022-10-11 04:04:47 +02:00 committed by GitHub
parent 52cc7c5996
commit b07e9efba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 345 additions and 22 deletions

View file

@ -14,6 +14,7 @@
#include <wx/hyperlink.h>
#include "config/CemuConfig.h"
#include "config/NetworkSettings.h"
#include "audio/IAudioAPI.h"
#if BOOST_OS_WINDOWS
@ -604,6 +605,18 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
content->Add(m_delete_account, 0, wxEXPAND | wxALL | wxALIGN_RIGHT, 5);
m_delete_account->Bind(wxEVT_BUTTON, &GeneralSettings2::OnAccountDelete, this);
if (NetworkConfig::XMLExists()) {
wxString choices[] = { _("Nintendo"), _("Pretendo"), _("Custom") };
m_active_service= new wxRadioBox(online_panel, wxID_ANY, _("Network Service"), wxDefaultPosition, wxDefaultSize, std::size(choices), choices, 3, wxRA_SPECIFY_COLS);
}
else {
wxString choices[] = { _("Nintendo"), _("Pretendo") };
m_active_service= new wxRadioBox(online_panel, wxID_ANY, _("Network Service"), wxDefaultPosition, wxDefaultSize, std::size(choices), choices, 2, wxRA_SPECIFY_COLS);
}
m_active_service->SetToolTip(_("Connect to which Network Service"));
m_active_service->Bind(wxEVT_RADIOBOX, &GeneralSettings2::OnAccountServiceChanged,this);
content->Add(m_active_service, 0, wxEXPAND | wxALL, 5);
box_sizer->Add(content, 1, wxEXPAND, 5);
online_panel_sizer->Add(box_sizer, 0, wxEXPAND | wxALL, 5);
@ -613,6 +626,7 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
m_active_account->Enable(false);
m_create_account->Enable(false);
m_delete_account->Enable(false);
m_active_service->Enable(false);
}
}
@ -919,6 +933,7 @@ void GeneralSettings2::StoreConfig()
config.account.m_persistent_id = dynamic_cast<wxAccountData*>(m_active_account->GetClientObject(active_account))->GetAccount().GetPersistentId();
config.account.online_enabled = m_online_enabled->GetValue();
config.account.active_service = m_active_service->GetSelection();
// debug
config.crash_dump = (CrashDump)m_crash_dump->GetSelection();
@ -1488,6 +1503,7 @@ void GeneralSettings2::ApplyConfig()
}
m_online_enabled->SetValue(config.account.online_enabled);
m_active_service->SetSelection(config.account.active_service);
UpdateAccountInformation();
// debug
@ -1722,6 +1738,13 @@ void GeneralSettings2::OnActiveAccountChanged(wxCommandEvent& event)
m_has_account_change = true;
}
void GeneralSettings2::OnAccountServiceChanged(wxCommandEvent& event)
{
LaunchSettings::ChangeNetworkServiceURL(m_active_service->GetSelection());
UpdateAccountInformation();
}
void GeneralSettings2::OnMLCPathSelect(wxCommandEvent& event)
{
if (!CemuApp::SelectMLCPath(this))

View file

@ -65,6 +65,7 @@ private:
// Account
wxButton* m_create_account, * m_delete_account;
wxChoice* m_active_account;
wxRadioBox* m_active_service;
wxCheckBox* m_online_enabled;
wxCollapsiblePane* m_account_information;
wxPropertyGrid* m_account_grid;
@ -93,6 +94,7 @@ private:
void OnMLCPathChar(wxKeyEvent& event);
void OnShowOnlineValidator(wxCommandEvent& event);
void OnOnlineEnable(wxCommandEvent& event);
void OnAccountServiceChanged(wxCommandEvent& event);
// updates cemu audio devices
void UpdateAudioDevice();

View file

@ -5,6 +5,7 @@
#include "gui/debugger/DebuggerWindow2.h"
#include "Cafe/HW/Latte/Core/Latte.h"
#include "config/ActiveSettings.h"
#include "config/NetworkSettings.h"
#include "config/CemuConfig.h"
#include "Cafe/HW/Latte/Renderer/Renderer.h"
#include "Cafe/CafeSystem.h"
@ -96,9 +97,18 @@ void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps)
const uint64 titleId = CafeSystem::GetForegroundTitleId();
windowText.append(fmt::format(" - FPS: {:.2f} {} {} [TitleId: {:08x}-{:08x}]", (double)fps, renderer, graphicMode, (uint32)(titleId >> 32), (uint32)(titleId & 0xFFFFFFFF)));
if (ActiveSettings::IsOnlineEnabled())
if (ActiveSettings::IsOnlineEnabled()){
windowText.append(" [Online]");
if (ActiveSettings::GetNetworkService() == NetworkService::Nintendo) {
windowText.append("[Nintendo]");
}
else if (ActiveSettings::GetNetworkService() == NetworkService::Pretendo) {
windowText.append("[Pretendo]");
}
else if (ActiveSettings::GetNetworkService() == NetworkService::Custom) {
windowText.append("[" + GetNetworkConfig().networkname.GetValue() + "]");
}
}
windowText.append(" ");
windowText.append(CafeSystem::GetForegroundTitleName());
// append region