citra_room: Merge functionality into citra_meta

This commit is contained in:
OpenSauce04 2025-03-31 22:43:21 +01:00 committed by OpenSauce
parent e90930b0b9
commit 2670b517e8
6 changed files with 48 additions and 21 deletions

View file

@ -118,6 +118,9 @@ endif()
if (ENABLE_QT_TRANSLATION) if (ENABLE_QT_TRANSLATION)
add_definitions(-DENABLE_QT_TRANSLATION) add_definitions(-DENABLE_QT_TRANSLATION)
endif() endif()
if (ENABLE_ROOM)
add_definitions(-DENABLE_ROOM)
endif()
if (ENABLE_SDL2_FRONTEND) if (ENABLE_SDL2_FRONTEND)
add_definitions(-DENABLE_SDL2_FRONTEND) add_definitions(-DENABLE_SDL2_FRONTEND)
endif() endif()
@ -484,10 +487,6 @@ if (NOT ANDROID AND NOT IOS)
elseif (ENABLE_SDL2_FRONTEND) elseif (ENABLE_SDL2_FRONTEND)
bundle_target(citra_meta) bundle_target(citra_meta)
endif() endif()
if (ENABLE_ROOM)
bundle_target(citra_room)
endif()
endif() endif()
# Installation instructions # Installation instructions

View file

@ -52,6 +52,10 @@ if (ENABLE_QT)
target_link_libraries(citra_meta PRIVATE Boost::boost Qt6::Widgets) target_link_libraries(citra_meta PRIVATE Boost::boost Qt6::Widgets)
endif() endif()
if (ENABLE_ROOM)
target_link_libraries(citra_meta PRIVATE citra_room)
endif()
if (ENABLE_QT AND UNIX AND NOT APPLE) if (ENABLE_QT AND UNIX AND NOT APPLE)
target_link_libraries(citra_meta PRIVATE Qt6::DBus gamemode) target_link_libraries(citra_meta PRIVATE Qt6::DBus gamemode)
endif() endif()

View file

@ -1,4 +1,4 @@
// Copyright Citra Emulator Project / Lime3DS Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -7,6 +7,9 @@
#ifdef ENABLE_QT #ifdef ENABLE_QT
#include "citra_qt/citra_qt.h" #include "citra_qt/citra_qt.h"
#endif #endif
#ifdef ENABLE_ROOM
#include "citra_room/citra_room.h"
#endif
#ifdef ENABLE_SDL2_FRONTEND #ifdef ENABLE_SDL2_FRONTEND
#include "citra_sdl/citra_sdl.h" #include "citra_sdl/citra_sdl.h"
#endif #endif
@ -19,6 +22,20 @@ __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
#endif #endif
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
#if ENABLE_ROOM
bool launch_room = false;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--room") == 0) {
launch_room = true;
}
}
if (launch_room) {
LaunchRoom(argc, argv);
return 0;
}
#endif
#if ENABLE_QT #if ENABLE_QT
bool no_gui = false; bool no_gui = false;
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
@ -42,4 +59,4 @@ int main(int argc, char* argv[]) {
#endif #endif
return 0; return 0;
} }

View file

@ -1,13 +1,12 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
add_executable(citra_room add_library(citra_room STATIC EXCLUDE_FROM_ALL
precompiled_headers.h precompiled_headers.h
citra_room.cpp citra_room.cpp
citra_room.h
citra_room.rc citra_room.rc
) )
set_target_properties(citra_room PROPERTIES OUTPUT_NAME "azahar-room")
create_target_directory_groups(citra_room) create_target_directory_groups(citra_room)
target_link_libraries(citra_room PRIVATE citra_common network) target_link_libraries(citra_room PRIVATE citra_common network)

View file

@ -1,4 +1,4 @@
// Copyright 2017 Citra Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -161,7 +161,7 @@ static void InitializeLogging(const std::string& log_file) {
} }
/// Application entry point /// Application entry point
int main(int argc, char** argv) { void LaunchRoom(int argc, char** argv) {
Common::DetachedTasks detached_tasks; Common::DetachedTasks detached_tasks;
int option_index = 0; int option_index = 0;
char* endarg; char* endarg;
@ -199,6 +199,8 @@ int main(int argc, char** argv) {
// Removed options // Removed options
{"preferred-game", optional_argument, 0, 'g'}, {"preferred-game", optional_argument, 0, 'g'},
{"preferred-game-id", optional_argument, 0, 0}, {"preferred-game-id", optional_argument, 0, 0},
// Entry option
{"room", 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0},
}; };
@ -248,17 +250,17 @@ int main(int argc, char** argv) {
break; break;
case 'h': case 'h':
PrintHelp(argv[0]); PrintHelp(argv[0]);
return 0; exit(0);
case 'v': case 'v':
PrintVersion(); PrintVersion();
return 0; exit(0);
case 'g': case 'g':
PrintRemovedOptionWarning(argv[0], "--preferred-game/-g"); PrintRemovedOptionWarning(argv[0], "--preferred-game/-g");
return 255; exit(255);
case 0: case 0:
if (strcmp(long_options[option_index].name, "preferred-game-id") == 0) { if (strcmp(long_options[option_index].name, "preferred-game-id") == 0) {
PrintRemovedOptionWarning(argv[0], "--preferred-game-id"); PrintRemovedOptionWarning(argv[0], "--preferred-game-id");
return 255; exit(255);
} }
} }
} }
@ -267,12 +269,12 @@ int main(int argc, char** argv) {
if (room_name.empty()) { if (room_name.empty()) {
std::cout << "room name is empty!\n\n"; std::cout << "room name is empty!\n\n";
PrintHelp(argv[0]); PrintHelp(argv[0]);
return -1; exit(-1);
} }
if (preferred_game.empty()) { if (preferred_game.empty()) {
std::cout << "preferred application is empty!\n\n"; std::cout << "preferred application is empty!\n\n";
PrintHelp(argv[0]); PrintHelp(argv[0]);
return -1; exit(-1);
} }
if (preferred_game_id == 0) { if (preferred_game_id == 0) {
std::cout std::cout
@ -283,12 +285,12 @@ int main(int argc, char** argv) {
std::cout << "max_members needs to be in the range 2 - " std::cout << "max_members needs to be in the range 2 - "
<< Network::MaxConcurrentConnections << "!\n\n"; << Network::MaxConcurrentConnections << "!\n\n";
PrintHelp(argv[0]); PrintHelp(argv[0]);
return -1; exit(-1);
} }
if (port > 65535) { if (port > 65535) {
std::cout << "port needs to be in the range 0 - 65535!\n\n"; std::cout << "port needs to be in the range 0 - 65535!\n\n";
PrintHelp(argv[0]); PrintHelp(argv[0]);
return -1; exit(-1);
} }
if (ban_list_file.empty()) { if (ban_list_file.empty()) {
std::cout << "Ban list file not set!\nThis should get set to load and save room ban " std::cout << "Ban list file not set!\nThis should get set to load and save room ban "
@ -350,7 +352,7 @@ int main(int argc, char** argv) {
preferred_game, preferred_game_id, std::move(verify_backend), ban_list, preferred_game, preferred_game_id, std::move(verify_backend), ban_list,
enable_citra_mods)) { enable_citra_mods)) {
std::cout << "Failed to create room: \n\n"; std::cout << "Failed to create room: \n\n";
return -1; exit(-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<Network::AnnounceMultiplayerSession>(); auto announce_session = std::make_unique<Network::AnnounceMultiplayerSession>();
@ -377,5 +379,4 @@ int main(int argc, char** argv) {
} }
Network::Shutdown(); Network::Shutdown();
detached_tasks.WaitForAllTasks(); detached_tasks.WaitForAllTasks();
return 0;
} }

View file

@ -0,0 +1,7 @@
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
void LaunchRoom(int argc, char** argv);