mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 22:00:05 +00:00 
			
		
		
		
	citra_qt: Save ban list for room hosting
This commit is contained in:
		
							parent
							
								
									15540df140
								
							
						
					
					
						commit
						deb398d190
					
				
					 5 changed files with 57 additions and 2 deletions
				
			
		|  | @ -127,11 +127,16 @@ void HostRoomWindow::Host() { | |||
|         auto port = ui->port->isModified() ? ui->port->text().toInt() : Network::DefaultRoomPort; | ||||
|         auto password = ui->password->text().toStdString(); | ||||
|         const bool is_public = ui->host_type->currentIndex() == 0; | ||||
|         Network::Room::BanList ban_list{}; | ||||
|         if (ui->load_ban_list->isChecked()) { | ||||
|             ban_list = UISettings::values.ban_list; | ||||
|         } | ||||
|         if (auto room = Network::GetRoom().lock()) { | ||||
|             bool created = room->Create(ui->room_name->text().toStdString(), | ||||
|                                         ui->room_description->toPlainText().toStdString(), "", port, | ||||
|                                         password, ui->max_player->value(), game_name.toStdString(), | ||||
|                                         game_id, CreateVerifyBackend(is_public)); | ||||
|                                         password, ui->max_player->value(), | ||||
|                                         Settings::values.citra_username, game_name.toStdString(), | ||||
|                                         game_id, CreateVerifyBackend(is_public), ban_list); | ||||
|             if (!created) { | ||||
|                 NetworkMessage::ShowError(NetworkMessage::COULD_NOT_CREATE_ROOM); | ||||
|                 LOG_ERROR(Network, "Could not create room!"); | ||||
|  |  | |||
|  | @ -145,6 +145,20 @@ | |||
|      </item> | ||||
|     </layout> | ||||
|    </item> | ||||
|    <item> | ||||
|     <layout class="QHBoxLayout"> | ||||
|      <item> | ||||
|       <widget class="QCheckBox" name="load_ban_list"> | ||||
|        <property name="text"> | ||||
|         <string>Load Previous Ban List</string> | ||||
|        </property> | ||||
|        <property name="checked"> | ||||
|         <bool>true</bool> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|     </layout> | ||||
|    </item> | ||||
|    <item> | ||||
|     <layout class="QHBoxLayout" name="horizontalLayout"> | ||||
|      <property name="rightMargin"> | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ | |||
| #include "citra_qt/multiplayer/lobby.h" | ||||
| #include "citra_qt/multiplayer/message.h" | ||||
| #include "citra_qt/multiplayer/state.h" | ||||
| #include "citra_qt/ui_settings.h" | ||||
| #include "citra_qt/util/clickable_label.h" | ||||
| #include "common/announce_multiplayer_room.h" | ||||
| #include "common/logging/log.h" | ||||
|  | @ -213,6 +214,10 @@ bool MultiplayerState::OnCloseRoom() { | |||
|         if (room->GetState() != Network::Room::State::Open) { | ||||
|             return true; | ||||
|         } | ||||
|         // Save ban list
 | ||||
|         if (auto room = Network::GetRoom().lock()) { | ||||
|             UISettings::values.ban_list = std::move(room->GetBanList()); | ||||
|         } | ||||
|         room->Destroy(); | ||||
|         announce_multiplayer_session->Stop(); | ||||
|         LOG_DEBUG(Frontend, "Closed the room (as a server)"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue