remove dedicated_room dependence on core

This commit is contained in:
Vitor Kiguchi 2020-08-20 16:54:01 -03:00
parent fa0cb52a5d
commit 28188f13f5
15 changed files with 25 additions and 27 deletions

View File

@ -20,7 +20,7 @@
#include "citra_qt/multiplayer/chat_room.h" #include "citra_qt/multiplayer/chat_room.h"
#include "citra_qt/multiplayer/message.h" #include "citra_qt/multiplayer/message.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/announce_multiplayer_session.h" #include "network/announce_multiplayer_session.h"
#include "ui_chat_room.h" #include "ui_chat_room.h"
#ifdef ENABLE_WEB_SERVICE #ifdef ENABLE_WEB_SERVICE
#include "web_service/web_backend.h" #include "web_service/web_backend.h"

View File

@ -16,7 +16,7 @@ namespace Ui {
class ChatRoom; class ChatRoom;
} }
namespace Core { namespace Network {
class AnnounceMultiplayerSession; class AnnounceMultiplayerSession;
} }

View File

@ -16,7 +16,7 @@
#include "citra_qt/multiplayer/moderation_dialog.h" #include "citra_qt/multiplayer/moderation_dialog.h"
#include "citra_qt/multiplayer/state.h" #include "citra_qt/multiplayer/state.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/announce_multiplayer_session.h" #include "network/announce_multiplayer_session.h"
#include "ui_client_room.h" #include "ui_client_room.h"
ClientRoomWindow::ClientRoomWindow(QWidget* parent) ClientRoomWindow::ClientRoomWindow(QWidget* parent)

View File

@ -19,8 +19,8 @@
#include "citra_qt/multiplayer/validation.h" #include "citra_qt/multiplayer/validation.h"
#include "citra_qt/uisettings.h" #include "citra_qt/uisettings.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/announce_multiplayer_session.h"
#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg.h"
#include "network/announce_multiplayer_session.h"
#include "network/network_settings.h" #include "network/network_settings.h"
#include "ui_host_room.h" #include "ui_host_room.h"
#ifdef ENABLE_WEB_SERVICE #ifdef ENABLE_WEB_SERVICE
@ -28,7 +28,7 @@
#endif #endif
HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list, HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session) std::shared_ptr<Network::AnnounceMultiplayerSession> session)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), : QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
ui(std::make_unique<Ui::HostRoom>()), announce_multiplayer_session(session) { ui(std::make_unique<Ui::HostRoom>()), announce_multiplayer_session(session) {
ui->setupUi(this); ui->setupUi(this);

View File

@ -17,7 +17,7 @@ namespace Ui {
class HostRoom; class HostRoom;
} }
namespace Core { namespace Network {
class AnnounceMultiplayerSession; class AnnounceMultiplayerSession;
} }
@ -35,7 +35,7 @@ class HostRoomWindow : public QDialog {
public: public:
explicit HostRoomWindow(QWidget* parent, QStandardItemModel* list, explicit HostRoomWindow(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session); std::shared_ptr<Network::AnnounceMultiplayerSession> session);
~HostRoomWindow(); ~HostRoomWindow();
/** /**
@ -50,7 +50,7 @@ private:
std::unique_ptr<Network::VerifyUser::Backend> CreateVerifyBackend(bool use_validation) const; std::unique_ptr<Network::VerifyUser::Backend> CreateVerifyBackend(bool use_validation) const;
std::unique_ptr<Ui::HostRoom> ui; std::unique_ptr<Ui::HostRoom> ui;
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session; std::weak_ptr<Network::AnnounceMultiplayerSession> announce_multiplayer_session;
QStandardItemModel* game_list; QStandardItemModel* game_list;
ComboBoxProxyModel* proxy; ComboBoxProxyModel* proxy;
Validation validation; Validation validation;

View File

@ -24,7 +24,7 @@
#endif #endif
Lobby::Lobby(QWidget* parent, QStandardItemModel* list, Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session) std::shared_ptr<Network::AnnounceMultiplayerSession> session)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), : QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
ui(std::make_unique<Ui::Lobby>()), announce_multiplayer_session(session) { ui(std::make_unique<Ui::Lobby>()), announce_multiplayer_session(session) {
ui->setupUi(this); ui->setupUi(this);

View File

@ -11,7 +11,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
#include "citra_qt/multiplayer/validation.h" #include "citra_qt/multiplayer/validation.h"
#include "common/announce_multiplayer_room.h" #include "common/announce_multiplayer_room.h"
#include "core/announce_multiplayer_session.h" #include "network/announce_multiplayer_session.h"
#include "network/network.h" #include "network/network.h"
namespace Ui { namespace Ui {
@ -30,7 +30,7 @@ class Lobby : public QDialog {
public: public:
explicit Lobby(QWidget* parent, QStandardItemModel* list, explicit Lobby(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session); std::shared_ptr<Network::AnnounceMultiplayerSession> session);
~Lobby() override; ~Lobby() override;
/** /**
@ -91,7 +91,7 @@ private:
LobbyFilterProxyModel* proxy{}; LobbyFilterProxyModel* proxy{};
QFutureWatcher<AnnounceMultiplayerRoom::RoomList> room_list_watcher; QFutureWatcher<AnnounceMultiplayerRoom::RoomList> room_list_watcher;
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session; std::weak_ptr<Network::AnnounceMultiplayerSession> announce_multiplayer_session;
QFutureWatcher<void>* watcher; QFutureWatcher<void>* watcher;
Validation validation; Validation validation;
}; };

View File

@ -37,7 +37,7 @@ MultiplayerState::MultiplayerState(QWidget* parent, QStandardItemModel* game_lis
qRegisterMetaType<Network::RoomMember::State>(); qRegisterMetaType<Network::RoomMember::State>();
qRegisterMetaType<Network::RoomMember::Error>(); qRegisterMetaType<Network::RoomMember::Error>();
qRegisterMetaType<Common::WebResult>(); qRegisterMetaType<Common::WebResult>();
announce_multiplayer_session = std::make_shared<Core::AnnounceMultiplayerSession>(); announce_multiplayer_session = std::make_shared<Network::AnnounceMultiplayerSession>();
announce_multiplayer_session->BindErrorCallback( announce_multiplayer_session->BindErrorCallback(
[this](const Common::WebResult& result) { emit AnnounceFailed(result); }); [this](const Common::WebResult& result) { emit AnnounceFailed(result); });
connect(this, &MultiplayerState::AnnounceFailed, this, &MultiplayerState::OnAnnounceFailed); connect(this, &MultiplayerState::AnnounceFailed, this, &MultiplayerState::OnAnnounceFailed);

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#include <QWidget> #include <QWidget>
#include "core/announce_multiplayer_session.h" #include "network/announce_multiplayer_session.h"
#include "network/network.h" #include "network/network.h"
class QStandardItemModel; class QStandardItemModel;
@ -80,7 +80,7 @@ private:
QStandardItemModel* game_list_model = nullptr; QStandardItemModel* game_list_model = nullptr;
QAction* leave_room; QAction* leave_room;
QAction* show_room; QAction* show_room;
std::shared_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session; std::shared_ptr<Network::AnnounceMultiplayerSession> announce_multiplayer_session;
Network::RoomMember::State current_state = Network::RoomMember::State::Uninitialized; Network::RoomMember::State current_state = Network::RoomMember::State::Uninitialized;
bool has_mod_perms = false; bool has_mod_perms = false;
Network::RoomMember::CallbackHandle<Network::RoomMember::State> state_callback_handle; Network::RoomMember::CallbackHandle<Network::RoomMember::State> state_callback_handle;

View File

@ -1,7 +1,5 @@
add_library(core STATIC add_library(core STATIC
3ds.h 3ds.h
announce_multiplayer_session.cpp
announce_multiplayer_session.h
arm/arm_interface.h arm/arm_interface.h
arm/dyncom/arm_dyncom.cpp arm/dyncom/arm_dyncom.cpp
arm/dyncom/arm_dyncom.h arm/dyncom/arm_dyncom.h

View File

@ -7,13 +7,13 @@ add_executable(citra-room
create_target_directory_groups(citra-room) create_target_directory_groups(citra-room)
target_link_libraries(citra-room PRIVATE common core network) target_link_libraries(citra-room PRIVATE common network)
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
target_compile_definitions(citra-room PRIVATE -DENABLE_WEB_SERVICE) target_compile_definitions(citra-room PRIVATE -DENABLE_WEB_SERVICE)
target_link_libraries(citra-room PRIVATE web_service) target_link_libraries(citra-room PRIVATE web_service)
endif() endif()
target_link_libraries(citra-room PRIVATE cryptopp glad) target_link_libraries(citra-room PRIVATE cryptopp)
if (MSVC) if (MSVC)
target_link_libraries(citra-room PRIVATE getopt) target_link_libraries(citra-room PRIVATE getopt)
endif() endif()

View File

@ -26,7 +26,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/scm_rev.h" #include "common/scm_rev.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/announce_multiplayer_session.h" #include "network/announce_multiplayer_session.h"
#include "network/network.h" #include "network/network.h"
#include "network/network_settings.h" #include "network/network_settings.h"
#include "network/room.h" #include "network/room.h"
@ -342,7 +342,7 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
std::cout << "Room is open. Close with Q+Enter...\n\n"; std::cout << "Room is open. Close with Q+Enter...\n\n";
auto announce_session = std::make_unique<Core::AnnounceMultiplayerSession>(); auto announce_session = std::make_unique<Network::AnnounceMultiplayerSession>();
if (announce) { if (announce) {
announce_session->Start(); announce_session->Start();
} }

View File

@ -1,4 +1,6 @@
add_library(network STATIC add_library(network STATIC
announce_multiplayer_session.cpp
announce_multiplayer_session.h
network.cpp network.cpp
network.h network.h
network_settings.cpp network_settings.cpp

View File

@ -15,7 +15,7 @@
#include "web_service/announce_room_json.h" #include "web_service/announce_room_json.h"
#endif #endif
namespace Core { namespace Network {
// Time between room is announced to web_service // Time between room is announced to web_service
static constexpr std::chrono::seconds announce_time_interval(15); static constexpr std::chrono::seconds announce_time_interval(15);
@ -161,4 +161,4 @@ void AnnounceMultiplayerSession::UpdateCredentials() {
#endif #endif
} }
} // namespace Core } // namespace Network

View File

@ -15,10 +15,8 @@
#include "common/thread.h" #include "common/thread.h"
namespace Network { namespace Network {
class Room;
}
namespace Core { class Room;
/** /**
* Instruments AnnounceMultiplayerRoom::Backend. * Instruments AnnounceMultiplayerRoom::Backend.
@ -93,4 +91,4 @@ private:
void AnnounceMultiplayerLoop(); void AnnounceMultiplayerLoop();
}; };
} // namespace Core } // namespace Network