DEV9: Prepare for Qt

This commit is contained in:
Connor McLaughlin 2021-12-19 00:33:30 +10:00 committed by refractionpcsx2
parent 4305e17cbe
commit 47d046c5fe
6 changed files with 28 additions and 4 deletions

View File

@ -20,6 +20,7 @@
void HddCreate::Start()
{
#ifndef PCSX2_CORE
//This can be called from the EE Core thread
//ensure that UI creation/deletaion is done on main thread
if (!wxIsMainThread())
@ -33,6 +34,7 @@ void HddCreate::Start()
//This creates a modeless dialog
progressDialog = new wxProgressDialog(_("Creating HDD file"), _("Creating HDD file"), neededSize, nullptr, wxPD_APP_MODAL | wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_REMAINING_TIME);
#endif
fileThread = std::thread(&HddCreate::WriteImage, this, filePath, neededSize);
@ -47,8 +49,10 @@ void HddCreate::Start()
{
msg.Printf(_("%i / %i MiB"), written.load(), neededSize);
#ifndef PCSX2_CORE
if (!progressDialog->Update(currentSize, msg))
canceled.store(true);
#endif
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
@ -57,11 +61,15 @@ void HddCreate::Start()
if (errored.load())
{
#ifndef PCSX2_CORE
wxMessageDialog dialog(nullptr, _("Failed to create HDD file"), _("Info"), wxOK);
dialog.ShowModal();
#endif
}
#ifndef PCSX2_CORE
delete progressDialog;
#endif
//Signal calling thread to resume
{
std::lock_guard ioSignallock(completedMutex);

View File

@ -15,7 +15,9 @@
#pragma once
#ifndef PCSX2_CORE
#include <wx/progdlg.h>
#endif
#include <string>
#include <thread>
@ -33,7 +35,9 @@ public:
std::atomic_bool errored{false};
private:
#ifndef PCSX2_CORE
wxProgressDialog* progressDialog;
#endif
std::atomic_int written{0};
std::thread fileThread;

View File

@ -16,7 +16,7 @@
#include "PrecompiledHeader.h"
#ifdef _WIN32
//#include <winsock2.h>
#include "common/RedtapeWindows.h"
#include <Winioctl.h>
#include <windows.h>
#else

View File

@ -19,9 +19,12 @@
#include <wx/fileconf.h>
#include "DEV9.h"
#include "gui/AppConfig.h"
#include "common/IniInterface.h"
#ifndef PCSX2_CORE
#include "gui/AppConfig.h"
#endif
#ifdef _WIN32
#include "ws2tcpip.h"
#elif defined(__POSIX__)
@ -34,7 +37,11 @@
void SaveDnsHosts()
{
#ifndef PCSX2_CORE
std::unique_ptr<wxFileConfig> hini(OpenFileConfig(EmuFolders::Settings.Combine(wxString("DEV9Hosts.ini")).GetFullPath()));
#else
std::unique_ptr<wxFileConfig> hini(new wxFileConfig(wxEmptyString, wxEmptyString, EmuFolders::Settings.Combine(wxString("DEV9Hosts.ini")).GetFullPath(), wxEmptyString, wxCONFIG_USE_RELATIVE_PATH));
#endif
IniSaver ini((wxConfigBase*)hini.get());
for (size_t i = 0; i < config.EthHosts.size(); i++)
@ -77,7 +84,11 @@ void LoadDnsHosts()
return;
}
#ifndef PCSX2_CORE
std::unique_ptr<wxFileConfig> hini(OpenFileConfig(iniPath.GetFullPath()));
#else
std::unique_ptr<wxFileConfig> hini(new wxFileConfig(wxEmptyString, wxEmptyString, iniPath.GetFullPath(), wxEmptyString, wxCONFIG_USE_RELATIVE_PATH));
#endif
IniLoader ini((wxConfigBase*)hini.get());
int i = 0;

View File

@ -15,6 +15,8 @@
#include "PrecompiledHeader.h"
#include "common/RedtapeWindows.h"
#include <stdio.h>
#include <windows.h>
#include <winsock2.h>

View File

@ -16,9 +16,8 @@
#include "PrecompiledHeader.h"
#ifdef _WIN32
//#include <winsock2.h>
#include "common/RedtapeWindows.h"
#include <Winioctl.h>
#include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>