bare minimum to get it to build

This commit is contained in:
Arisotura
2024-08-06 20:39:48 +02:00
parent 5d84f3831c
commit 2c67e0f928
4 changed files with 40 additions and 33 deletions

View File

@ -263,8 +263,8 @@ bool StartHost(const char* playername, int numplayers)
Active = true; Active = true;
IsHost = true; IsHost = true;
if (lanDlg) //if (lanDlg)
lanDlg->updatePlayerList(); // lanDlg->updatePlayerList();
StartDiscovery(); StartDiscovery();
return true; return true;
@ -467,8 +467,8 @@ void ProcessDiscovery()
// update the list in the connect dialog if needed // update the list in the connect dialog if needed
if (lanClientDlg) //if (lanClientDlg)
lanClientDlg->updateDiscoveryList(); // lanClientDlg->updateDiscoveryList();
} }
} }
@ -481,14 +481,14 @@ void HostUpdatePlayerList()
ENetPacket* pkt = enet_packet_create(cmd, 2+sizeof(Players), ENET_PACKET_FLAG_RELIABLE); ENetPacket* pkt = enet_packet_create(cmd, 2+sizeof(Players), ENET_PACKET_FLAG_RELIABLE);
enet_host_broadcast(Host, 0, pkt); enet_host_broadcast(Host, 0, pkt);
if (lanDlg) //if (lanDlg)
lanDlg->updatePlayerList(); // lanDlg->updatePlayerList();
} }
void ClientUpdatePlayerList() void ClientUpdatePlayerList()
{ {
if (lanDlg) //if (lanDlg)
lanDlg->updatePlayerList(); // lanDlg->updatePlayerList();
} }
void ProcessHostEvent(ENetEvent& event) void ProcessHostEvent(ENetEvent& event)
@ -701,8 +701,8 @@ void ProcessClientEvent(ENetEvent& event)
Players[i].Name[31] = '\0'; Players[i].Name[31] = '\0';
} }
if (lanDlg) //if (lanDlg)
lanDlg->updatePlayerList(); // lanDlg->updatePlayerList();
// establish connections to any new clients // establish connections to any new clients
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
@ -878,8 +878,8 @@ void ProcessFrame()
PlayerPing[i] = RemotePeers[i]->roundTripTime; PlayerPing[i] = RemotePeers[i]->roundTripTime;
} }
if (lanDlg) //if (lanDlg)
lanDlg->updatePlayerList(); // lanDlg->updatePlayerList();
} }
} }

View File

@ -21,6 +21,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <QMutex>
#include "types.h" #include "types.h"
@ -50,7 +51,7 @@ struct DiscoveryData
extern bool Active; extern bool Active;
extern std::map<melonDS::u32, DiscoveryData> DiscoveryList; extern std::map<melonDS::u32, DiscoveryData> DiscoveryList;
extern QMutex DiscoveryMutex; extern QMutex DiscoveryMutex; // TODO: turn into Platform::Mutex or rework this to be nicer
extern Player Players[16]; extern Player Players[16];
extern melonDS::u32 PlayerPing[16]; extern melonDS::u32 PlayerPing[16];

View File

@ -29,10 +29,10 @@
#include "NDS.h" #include "NDS.h"
#include "NDSCart.h" #include "NDSCart.h"
#include "main.h" #include "main.h"
#include "IPC.h" //#include "IPC.h"
#include "Netplay.h" #include "Netplay.h"
#include "Input.h" //#include "Input.h"
#include "ROMManager.h" //#include "ROMManager.h"
#include "Config.h" #include "Config.h"
#include "Savestate.h" #include "Savestate.h"
#include "Platform.h" #include "Platform.h"
@ -170,7 +170,7 @@ printf("host mirror host connecting to %08X:%d\n", mirroraddr.host, mirroraddr.p
IsHost = true; IsHost = true;
IsMirror = false; IsMirror = false;
netplayDlg->updatePlayerList(Players, NumPlayers); //netplayDlg->updatePlayerList(Players, NumPlayers);
} }
void StartClient(const char* playername, const char* host, int port) void StartClient(const char* playername, const char* host, int port)
@ -295,6 +295,7 @@ u32 PlayerAddress(int id)
bool SpawnMirrorInstance(Player player) bool SpawnMirrorInstance(Player player)
{ {
#if 0
u16 curmask = IPC::GetInstanceBitmask(); u16 curmask = IPC::GetInstanceBitmask();
QProcess newinst; QProcess newinst;
@ -341,8 +342,9 @@ bool SpawnMirrorInstance(Player player)
//IPC::SendCommandStr(1<<newid, IPC::Cmd_LoadROM, rompath); //IPC::SendCommandStr(1<<newid, IPC::Cmd_LoadROM, rompath);
if (player.Address == 0x0100007F) player.Address = HostAddress; if (player.Address == 0x0100007F) player.Address = HostAddress;
IPC::SendCommand(1<<newid, IPC::Cmd_SetupNetplayMirror, sizeof(Player), &player); // calls Netplay::StartMirror()
//IPC::SendCommand(1<<newid, IPC::Cmd_SetupNetplayMirror, sizeof(Player), &player);
#endif
return true; return true;
} }
@ -469,7 +471,7 @@ printf("[MC] finish blob type=%d len=%d\n", type, len);
if (pkt->dataLength != 2) return; if (pkt->dataLength != 2) return;
bool res = false; bool res = false;
#if 0
// reset // reset
NDS::SetConsoleType(buf[1]); NDS::SetConsoleType(buf[1]);
NDS::EjectCart(); NDS::EjectCart();
@ -494,7 +496,7 @@ printf("[MC] finish blob type=%d len=%d\n", type, len);
//LoadCheats(); //LoadCheats();
} }
#endif
// load initial state // load initial state
// TODO: terrible hack!! // TODO: terrible hack!!
#if 0 #if 0
@ -532,7 +534,7 @@ void SyncMirrorClients()
{ {
printf("[MIRROR HOST] syncing clients\n"); printf("[MIRROR HOST] syncing clients\n");
//SendBlobToMirrorClients(Blob_CartROM, NDSCart::CartROMSize, NDSCart::CartROM); #if 0
SendBlobToMirrorClients(Blob_CartSRAM, NDSCart::GetSaveMemoryLength(), NDSCart::GetSaveMemory()); SendBlobToMirrorClients(Blob_CartSRAM, NDSCart::GetSaveMemoryLength(), NDSCart::GetSaveMemory());
// send initial state // send initial state
@ -592,6 +594,7 @@ void SyncMirrorClients()
//enet_host_flush(MirrorHost); //enet_host_flush(MirrorHost);
StartLocal(); StartLocal();
#endif
} }
void StartGame() void StartGame()
@ -641,8 +644,8 @@ void StartLocal()
InputQueue.push(frame); InputQueue.push(frame);
} }
NDS::Start(); //NDS::Start();
emuThread->emuRun(); //emuThread->emuRun();
} }
@ -725,7 +728,7 @@ void ProcessHost()
ENetPacket* pkt = enet_packet_create(cmd, 2+sizeof(Players), ENET_PACKET_FLAG_RELIABLE); ENetPacket* pkt = enet_packet_create(cmd, 2+sizeof(Players), ENET_PACKET_FLAG_RELIABLE);
enet_host_broadcast(Host, 0, pkt); enet_host_broadcast(Host, 0, pkt);
netplayDlg->updatePlayerList(Players, NumPlayers); //netplayDlg->updatePlayerList(Players, NumPlayers);
} }
break; break;
} }
@ -802,7 +805,7 @@ printf("client mirror host connecting to %08X:%d\n", mirroraddr.host, mirroraddr
Players[i].Name[31] = '\0'; Players[i].Name[31] = '\0';
} }
netplayDlg->updatePlayerList(Players, NumPlayers); //netplayDlg->updatePlayerList(Players, NumPlayers);
} }
break; break;
@ -834,7 +837,7 @@ printf("birf\n");
void ProcessMirrorHost() void ProcessMirrorHost()
{ {
if (!MirrorHost) return; if (!MirrorHost) return;
#if 0
bool block = false; bool block = false;
ENetEvent event; ENetEvent event;
while (enet_host_service(MirrorHost, &event, block ? 5000 : 0) > 0) while (enet_host_service(MirrorHost, &event, block ? 5000 : 0) > 0)
@ -920,12 +923,13 @@ void ProcessMirrorHost()
break; break;
} }
} }
#endif
} }
void ProcessMirrorClient() void ProcessMirrorClient()
{ {
if (!MirrorHost) return; if (!MirrorHost) return;
#if 0
bool block = false; bool block = false;
if (emuThread->emuIsRunning())// && NDS::NumFrames > 4) if (emuThread->emuIsRunning())// && NDS::NumFrames > 4)
{ {
@ -986,6 +990,7 @@ printf("mirror client lag notify: %d\n", lag);
if (block) break; if (block) break;
} }
#endif
} }
void ProcessFrame() void ProcessFrame()
@ -1025,7 +1030,7 @@ void ProcessInput()
// apply each input to the frame it's assigned to // apply each input to the frame it's assigned to
// before running a frame, we need to wait to have received input for it // before running a frame, we need to wait to have received input for it
// TODO: alert host if we are running too far behind // TODO: alert host if we are running too far behind
#if 0
if (!IsMirror) if (!IsMirror)
{ {
u32 lag = 4; // TODO: make configurable!! u32 lag = 4; // TODO: make configurable!!
@ -1081,6 +1086,7 @@ void ProcessInput()
else NDS::ReleaseScreen(); else NDS::ReleaseScreen();
InputQueue.pop(); InputQueue.pop();
#endif
} }
} }

View File

@ -29,10 +29,10 @@
#include "NDS.h" #include "NDS.h"
#include "NDSCart.h" #include "NDSCart.h"
#include "main.h" #include "main.h"
#include "IPC.h" //#include "IPC.h"
#include "Netplay.h" #include "NetplayDialog.h"
#include "Input.h" //#include "Input.h"
#include "ROMManager.h" //#include "ROMManager.h"
#include "Config.h" #include "Config.h"
#include "Savestate.h" #include "Savestate.h"
#include "Platform.h" #include "Platform.h"