mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Code cleanup - Removed old unused feature
This commit is contained in:
parent
e17aeb36ad
commit
aa14eb5981
13 changed files with 16 additions and 87 deletions
|
@ -9,26 +9,15 @@ public:
|
|||
uint16_t Port;
|
||||
|
||||
string PlayerName;
|
||||
uint8_t* AvatarData;
|
||||
uint32_t AvatarSize;
|
||||
|
||||
bool Spectator;
|
||||
|
||||
ClientConnectionData(string host, uint16_t port, string playerName, uint8_t* avatarData, uint32_t avatarSize, bool spectator) :
|
||||
Host(host), Port(port), PlayerName(playerName), AvatarSize(avatarSize), Spectator(spectator)
|
||||
ClientConnectionData(string host, uint16_t port, string playerName, bool spectator) :
|
||||
Host(host), Port(port), PlayerName(playerName), Spectator(spectator)
|
||||
{
|
||||
if(avatarSize > 0) {
|
||||
AvatarData = new uint8_t[avatarSize];
|
||||
memcpy(AvatarData, avatarData, avatarSize);
|
||||
} else {
|
||||
AvatarData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
~ClientConnectionData()
|
||||
{
|
||||
if(AvatarData) {
|
||||
delete[] AvatarData;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -33,7 +33,7 @@ GameClientConnection::~GameClientConnection()
|
|||
|
||||
void GameClientConnection::SendHandshake()
|
||||
{
|
||||
HandShakeMessage message(_connectionData->PlayerName, _connectionData->AvatarData, _connectionData->AvatarSize, _connectionData->Spectator);
|
||||
HandShakeMessage message(_connectionData->PlayerName, _connectionData->Spectator);
|
||||
SendNetMessage(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ GameServerConnection::GameServerConnection(shared_ptr<Socket> socket) : GameConn
|
|||
GameServerConnection::~GameServerConnection()
|
||||
{
|
||||
if(_connectionData) {
|
||||
MessageManager::DisplayToast("Net Play", _connectionData->PlayerName + " (Player " + std::to_string(_controllerPort + 1) + ") disconnected.", _connectionData->AvatarData, _connectionData->AvatarSize);
|
||||
MessageManager::DisplayMessage("NetPlay", _connectionData->PlayerName + " (Player " + std::to_string(_controllerPort + 1) + ") disconnected.");
|
||||
}
|
||||
|
||||
UnregisterNetPlayDevice(this);
|
||||
|
@ -88,11 +88,11 @@ void GameServerConnection::ProcessHandshakeResponse(HandShakeMessage* message)
|
|||
Console::Pause();
|
||||
|
||||
_controllerPort = message->IsSpectator() ? GameConnection::SpectatorPort : GetFirstFreeControllerPort();
|
||||
_connectionData.reset(new ClientConnectionData("", 0, message->GetPlayerName(), message->GetAvatarData(), message->GetAvatarSize(), false));
|
||||
_connectionData.reset(new ClientConnectionData("", 0, message->GetPlayerName(), false));
|
||||
|
||||
string playerPortMessage = _controllerPort == GameConnection::SpectatorPort ? "Spectator" : "Player " + std::to_string(_controllerPort + 1);
|
||||
|
||||
MessageManager::DisplayToast("Net Play", _connectionData->PlayerName + " (" + playerPortMessage + ") connected.", _connectionData->AvatarData, _connectionData->AvatarSize);
|
||||
MessageManager::DisplayMessage("NetPlay", _connectionData->PlayerName + " (" + playerPortMessage + ") connected.");
|
||||
|
||||
if(Console::GetRomName().size() > 0) {
|
||||
SendGameInformation();
|
||||
|
|
|
@ -11,8 +11,6 @@ private:
|
|||
uint32_t _protocolVersion = CurrentVersion;
|
||||
char* _playerName = nullptr;
|
||||
uint32_t _playerNameLength = 0;
|
||||
void* _avatarData = nullptr;
|
||||
uint32_t _avatarSize = 0;
|
||||
bool _spectator = false;
|
||||
|
||||
protected:
|
||||
|
@ -21,19 +19,16 @@ protected:
|
|||
Stream<uint32_t>(_mesenVersion);
|
||||
Stream<uint32_t>(_protocolVersion);
|
||||
StreamArray((void**)&_playerName, _playerNameLength);
|
||||
StreamArray(&_avatarData, _avatarSize);
|
||||
Stream<bool>(_spectator);
|
||||
}
|
||||
|
||||
public:
|
||||
HandShakeMessage(void* buffer, uint32_t length) : NetMessage(buffer, length) { }
|
||||
HandShakeMessage(string playerName, uint8_t* avatarData, uint32_t avatarSize, bool spectator) : NetMessage(MessageType::HandShake)
|
||||
HandShakeMessage(string playerName, bool spectator) : NetMessage(MessageType::HandShake)
|
||||
{
|
||||
_mesenVersion = EmulationSettings::GetMesenVersion();
|
||||
_protocolVersion = HandShakeMessage::CurrentVersion;
|
||||
CopyString(&_playerName, _playerNameLength, playerName);
|
||||
_avatarSize = avatarSize;
|
||||
_avatarData = avatarData;
|
||||
_spectator = spectator;
|
||||
}
|
||||
|
||||
|
@ -42,16 +37,6 @@ public:
|
|||
return string(_playerName);
|
||||
}
|
||||
|
||||
uint8_t* GetAvatarData()
|
||||
{
|
||||
return (uint8_t*)_avatarData;
|
||||
}
|
||||
|
||||
uint32_t GetAvatarSize()
|
||||
{
|
||||
return _avatarSize;
|
||||
}
|
||||
|
||||
bool IsValid()
|
||||
{
|
||||
return _protocolVersion == CurrentVersion && _mesenVersion == EmulationSettings::GetMesenVersion();
|
||||
|
|
|
@ -9,7 +9,6 @@ class IMessageManager
|
|||
{
|
||||
public:
|
||||
virtual void DisplayMessage(string title, string message) = 0;
|
||||
virtual void DisplayToast(shared_ptr<ToastInfo> toast) = 0;
|
||||
};
|
||||
|
||||
class ToastInfo
|
||||
|
|
|
@ -441,13 +441,6 @@ void MessageManager::DisplayMessage(string title, string message, string param1,
|
|||
}
|
||||
}
|
||||
|
||||
void MessageManager::DisplayToast(string title, string message, uint8_t* iconData, uint32_t iconSize)
|
||||
{
|
||||
if(MessageManager::_messageManager) {
|
||||
MessageManager::_messageManager->DisplayToast(shared_ptr<ToastInfo>(new ToastInfo(title, message, 4000, iconData, iconSize)));
|
||||
}
|
||||
}
|
||||
|
||||
void MessageManager::Log(string message)
|
||||
{
|
||||
auto lock = _logLock.AcquireSafe();
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
|
||||
static void RegisterMessageManager(IMessageManager* messageManager);
|
||||
static void DisplayMessage(string title, string message, string param1 = "", string param2 = "");
|
||||
static void DisplayToast(string title, string message, uint8_t* iconData, uint32_t iconSize);
|
||||
|
||||
static void Log(string message = "");
|
||||
static string GetLog();
|
||||
|
|
39
GUI.NET/Forms/NetPlay/frmPlayerProfile.Designer.cs
generated
39
GUI.NET/Forms/NetPlay/frmPlayerProfile.Designer.cs
generated
|
@ -29,16 +29,13 @@
|
|||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblName = new System.Windows.Forms.Label();
|
||||
this.lblAvatar = new System.Windows.Forms.Label();
|
||||
this.txtPlayerName = new System.Windows.Forms.TextBox();
|
||||
this.picAvatar = new System.Windows.Forms.PictureBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picAvatar)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// baseConfigPanel
|
||||
//
|
||||
this.baseConfigPanel.Location = new System.Drawing.Point(0, 59);
|
||||
this.baseConfigPanel.Location = new System.Drawing.Point(0, 55);
|
||||
this.baseConfigPanel.Size = new System.Drawing.Size(302, 29);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
|
@ -47,18 +44,16 @@
|
|||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.lblName, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.lblAvatar, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtPlayerName, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.picAvatar, 1, 1);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(302, 59);
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(302, 55);
|
||||
this.tableLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// lblName
|
||||
|
@ -71,17 +66,6 @@
|
|||
this.lblName.TabIndex = 3;
|
||||
this.lblName.Text = "Player name:";
|
||||
//
|
||||
// lblAvatar
|
||||
//
|
||||
this.lblAvatar.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.lblAvatar.AutoSize = true;
|
||||
this.lblAvatar.Location = new System.Drawing.Point(3, 55);
|
||||
this.lblAvatar.Name = "lblAvatar";
|
||||
this.lblAvatar.Size = new System.Drawing.Size(41, 13);
|
||||
this.lblAvatar.TabIndex = 4;
|
||||
this.lblAvatar.Text = "Avatar:";
|
||||
this.lblAvatar.Visible = false;
|
||||
//
|
||||
// txtPlayerName
|
||||
//
|
||||
this.txtPlayerName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
|
@ -91,21 +75,11 @@
|
|||
this.txtPlayerName.TabIndex = 5;
|
||||
this.txtPlayerName.Text = "DefaultPlayer";
|
||||
//
|
||||
// picAvatar
|
||||
//
|
||||
this.picAvatar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.picAvatar.Location = new System.Drawing.Point(77, 29);
|
||||
this.picAvatar.Name = "picAvatar";
|
||||
this.picAvatar.Size = new System.Drawing.Size(66, 66);
|
||||
this.picAvatar.TabIndex = 8;
|
||||
this.picAvatar.TabStop = false;
|
||||
this.picAvatar.Visible = false;
|
||||
//
|
||||
// frmPlayerProfile
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(302, 88);
|
||||
this.ClientSize = new System.Drawing.Size(302, 84);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
|
@ -117,7 +91,6 @@
|
|||
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picAvatar)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -126,8 +99,6 @@
|
|||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label lblName;
|
||||
private System.Windows.Forms.Label lblAvatar;
|
||||
private System.Windows.Forms.TextBox txtPlayerName;
|
||||
private System.Windows.Forms.PictureBox picAvatar;
|
||||
}
|
||||
}
|
|
@ -839,7 +839,7 @@ namespace Mesen.GUI.Forms
|
|||
frmClientConfig frm = new frmClientConfig();
|
||||
if(frm.ShowDialog(sender) == System.Windows.Forms.DialogResult.OK) {
|
||||
Task.Run(() => {
|
||||
InteropEmu.Connect(ConfigManager.Config.ClientConnectionInfo.Host, ConfigManager.Config.ClientConnectionInfo.Port, ConfigManager.Config.Profile.PlayerName, null, 0, ConfigManager.Config.ClientConnectionInfo.Spectator);
|
||||
InteropEmu.Connect(ConfigManager.Config.ClientConnectionInfo.Host, ConfigManager.Config.ClientConnectionInfo.Port, ConfigManager.Config.Profile.PlayerName, ConfigManager.Config.ClientConnectionInfo.Spectator);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Mesen.GUI
|
|||
[DllImport(DLLPath)] public static extern void StartServer(UInt16 port, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string hostPlayerName);
|
||||
[DllImport(DLLPath)] public static extern void StopServer();
|
||||
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool IsServerRunning();
|
||||
[DllImport(DLLPath)] public static extern void Connect([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string host, UInt16 port, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string playerName, byte[] avatarData, UInt32 avatarSize, [MarshalAs(UnmanagedType.I1)]bool spectator);
|
||||
[DllImport(DLLPath)] public static extern void Connect([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string host, UInt16 port, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(UTF8Marshaler))]string playerName, [MarshalAs(UnmanagedType.I1)]bool spectator);
|
||||
[DllImport(DLLPath)] public static extern void Disconnect();
|
||||
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool IsConnected();
|
||||
|
||||
|
@ -724,6 +724,7 @@ namespace Mesen.GUI
|
|||
|
||||
public UInt32 InsertCoin1;
|
||||
public UInt32 InsertCoin2;
|
||||
public UInt32 VsServiceButton;
|
||||
|
||||
public UInt32 TakeScreenshot;
|
||||
}
|
||||
|
|
|
@ -180,14 +180,12 @@ namespace InteropEmu {
|
|||
DllExport void __stdcall StopServer() { GameServer::StopServer(); }
|
||||
DllExport bool __stdcall IsServerRunning() { return GameServer::Started(); }
|
||||
|
||||
DllExport void __stdcall Connect(char* host, uint16_t port, char* playerName, uint8_t* avatarData, uint32_t avatarSize, bool spectator)
|
||||
DllExport void __stdcall Connect(char* host, uint16_t port, char* playerName, bool spectator)
|
||||
{
|
||||
shared_ptr<ClientConnectionData> connectionData(new ClientConnectionData(
|
||||
host,
|
||||
port,
|
||||
playerName,
|
||||
avatarData,
|
||||
avatarSize,
|
||||
spectator
|
||||
));
|
||||
|
||||
|
|
|
@ -359,11 +359,6 @@ namespace NES
|
|||
void Renderer::DisplayMessage(string title, string message)
|
||||
{
|
||||
shared_ptr<ToastInfo> toast(new ToastInfo(title, message, 4000, ""));
|
||||
DisplayToast(toast);
|
||||
}
|
||||
|
||||
void Renderer::DisplayToast(shared_ptr<ToastInfo> toast)
|
||||
{
|
||||
_toasts.push_front(toast);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ namespace NES {
|
|||
void Reset();
|
||||
void Render();
|
||||
void DisplayMessage(string title, string message);
|
||||
void DisplayToast(shared_ptr<ToastInfo> toast);
|
||||
|
||||
void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue