From 2c67e0f9284cdac436008b6942de6e0cf704d5f9 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Tue, 6 Aug 2024 20:39:48 +0200 Subject: [PATCH] bare minimum to get it to build --- src/frontend/qt_sdl/LAN.cpp | 24 ++++++++--------- src/frontend/qt_sdl/LAN.h | 3 ++- src/frontend/qt_sdl/Netplay.cpp | 38 ++++++++++++++++----------- src/frontend/qt_sdl/NetplayDialog.cpp | 8 +++--- 4 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/frontend/qt_sdl/LAN.cpp b/src/frontend/qt_sdl/LAN.cpp index 9a86b2eb..387a8da2 100644 --- a/src/frontend/qt_sdl/LAN.cpp +++ b/src/frontend/qt_sdl/LAN.cpp @@ -263,8 +263,8 @@ bool StartHost(const char* playername, int numplayers) Active = true; IsHost = true; - if (lanDlg) - lanDlg->updatePlayerList(); + //if (lanDlg) + // lanDlg->updatePlayerList(); StartDiscovery(); return true; @@ -467,8 +467,8 @@ void ProcessDiscovery() // update the list in the connect dialog if needed - if (lanClientDlg) - lanClientDlg->updateDiscoveryList(); + //if (lanClientDlg) + // lanClientDlg->updateDiscoveryList(); } } @@ -481,14 +481,14 @@ void HostUpdatePlayerList() ENetPacket* pkt = enet_packet_create(cmd, 2+sizeof(Players), ENET_PACKET_FLAG_RELIABLE); enet_host_broadcast(Host, 0, pkt); - if (lanDlg) - lanDlg->updatePlayerList(); + //if (lanDlg) + // lanDlg->updatePlayerList(); } void ClientUpdatePlayerList() { - if (lanDlg) - lanDlg->updatePlayerList(); + //if (lanDlg) + // lanDlg->updatePlayerList(); } void ProcessHostEvent(ENetEvent& event) @@ -701,8 +701,8 @@ void ProcessClientEvent(ENetEvent& event) Players[i].Name[31] = '\0'; } - if (lanDlg) - lanDlg->updatePlayerList(); + //if (lanDlg) + // lanDlg->updatePlayerList(); // establish connections to any new clients for (int i = 0; i < 16; i++) @@ -878,8 +878,8 @@ void ProcessFrame() PlayerPing[i] = RemotePeers[i]->roundTripTime; } - if (lanDlg) - lanDlg->updatePlayerList(); + //if (lanDlg) + // lanDlg->updatePlayerList(); } } diff --git a/src/frontend/qt_sdl/LAN.h b/src/frontend/qt_sdl/LAN.h index c78faa20..d66318cc 100644 --- a/src/frontend/qt_sdl/LAN.h +++ b/src/frontend/qt_sdl/LAN.h @@ -21,6 +21,7 @@ #include #include +#include #include "types.h" @@ -50,7 +51,7 @@ struct DiscoveryData extern bool Active; extern std::map DiscoveryList; -extern QMutex DiscoveryMutex; +extern QMutex DiscoveryMutex; // TODO: turn into Platform::Mutex or rework this to be nicer extern Player Players[16]; extern melonDS::u32 PlayerPing[16]; diff --git a/src/frontend/qt_sdl/Netplay.cpp b/src/frontend/qt_sdl/Netplay.cpp index c2a148fb..1e1a3a36 100644 --- a/src/frontend/qt_sdl/Netplay.cpp +++ b/src/frontend/qt_sdl/Netplay.cpp @@ -29,10 +29,10 @@ #include "NDS.h" #include "NDSCart.h" #include "main.h" -#include "IPC.h" +//#include "IPC.h" #include "Netplay.h" -#include "Input.h" -#include "ROMManager.h" +//#include "Input.h" +//#include "ROMManager.h" #include "Config.h" #include "Savestate.h" #include "Platform.h" @@ -170,7 +170,7 @@ printf("host mirror host connecting to %08X:%d\n", mirroraddr.host, mirroraddr.p IsHost = true; IsMirror = false; - netplayDlg->updatePlayerList(Players, NumPlayers); + //netplayDlg->updatePlayerList(Players, NumPlayers); } void StartClient(const char* playername, const char* host, int port) @@ -295,6 +295,7 @@ u32 PlayerAddress(int id) bool SpawnMirrorInstance(Player player) { +#if 0 u16 curmask = IPC::GetInstanceBitmask(); QProcess newinst; @@ -341,8 +342,9 @@ bool SpawnMirrorInstance(Player player) //IPC::SendCommandStr(1<dataLength != 2) return; bool res = false; - +#if 0 // reset NDS::SetConsoleType(buf[1]); NDS::EjectCart(); @@ -494,7 +496,7 @@ printf("[MC] finish blob type=%d len=%d\n", type, len); //LoadCheats(); } - +#endif // load initial state // TODO: terrible hack!! #if 0 @@ -532,7 +534,7 @@ void SyncMirrorClients() { printf("[MIRROR HOST] syncing clients\n"); - //SendBlobToMirrorClients(Blob_CartROM, NDSCart::CartROMSize, NDSCart::CartROM); +#if 0 SendBlobToMirrorClients(Blob_CartSRAM, NDSCart::GetSaveMemoryLength(), NDSCart::GetSaveMemory()); // send initial state @@ -592,6 +594,7 @@ void SyncMirrorClients() //enet_host_flush(MirrorHost); StartLocal(); +#endif } void StartGame() @@ -641,8 +644,8 @@ void StartLocal() InputQueue.push(frame); } - NDS::Start(); - emuThread->emuRun(); + //NDS::Start(); + //emuThread->emuRun(); } @@ -725,7 +728,7 @@ void ProcessHost() ENetPacket* pkt = enet_packet_create(cmd, 2+sizeof(Players), ENET_PACKET_FLAG_RELIABLE); enet_host_broadcast(Host, 0, pkt); - netplayDlg->updatePlayerList(Players, NumPlayers); + //netplayDlg->updatePlayerList(Players, NumPlayers); } break; } @@ -802,7 +805,7 @@ printf("client mirror host connecting to %08X:%d\n", mirroraddr.host, mirroraddr Players[i].Name[31] = '\0'; } - netplayDlg->updatePlayerList(Players, NumPlayers); + //netplayDlg->updatePlayerList(Players, NumPlayers); } break; @@ -834,7 +837,7 @@ printf("birf\n"); void ProcessMirrorHost() { if (!MirrorHost) return; - +#if 0 bool block = false; ENetEvent event; while (enet_host_service(MirrorHost, &event, block ? 5000 : 0) > 0) @@ -920,12 +923,13 @@ void ProcessMirrorHost() break; } } +#endif } void ProcessMirrorClient() { if (!MirrorHost) return; - +#if 0 bool block = false; if (emuThread->emuIsRunning())// && NDS::NumFrames > 4) { @@ -986,6 +990,7 @@ printf("mirror client lag notify: %d\n", lag); if (block) break; } +#endif } void ProcessFrame() @@ -1025,7 +1030,7 @@ void ProcessInput() // apply each input to the frame it's assigned to // before running a frame, we need to wait to have received input for it // TODO: alert host if we are running too far behind - +#if 0 if (!IsMirror) { u32 lag = 4; // TODO: make configurable!! @@ -1081,6 +1086,7 @@ void ProcessInput() else NDS::ReleaseScreen(); InputQueue.pop(); +#endif } } diff --git a/src/frontend/qt_sdl/NetplayDialog.cpp b/src/frontend/qt_sdl/NetplayDialog.cpp index f28823ab..e9ed6022 100644 --- a/src/frontend/qt_sdl/NetplayDialog.cpp +++ b/src/frontend/qt_sdl/NetplayDialog.cpp @@ -29,10 +29,10 @@ #include "NDS.h" #include "NDSCart.h" #include "main.h" -#include "IPC.h" -#include "Netplay.h" -#include "Input.h" -#include "ROMManager.h" +//#include "IPC.h" +#include "NetplayDialog.h" +//#include "Input.h" +//#include "ROMManager.h" #include "Config.h" #include "Savestate.h" #include "Platform.h"