Mesen-SX/Core/GameInformationMessage.h

55 lines
974 B
C
Raw Normal View History

2019-10-20 20:05:39 -04:00
#pragma once
#include "stdafx.h"
#include "MessageManager.h"
#include "NetMessage.h"
#include "../Utilities/FolderUtilities.h"
class GameInformationMessage : public NetMessage
{
private:
string _romFilename;
string _sha1Hash;
2019-10-20 20:05:39 -04:00
uint8_t _controllerPort = 0;
bool _paused = false;
protected:
2020-12-19 23:30:09 +03:00
void Serialize(Serializer& s) override
2019-10-20 20:05:39 -04:00
{
s.Stream(_romFilename, _sha1Hash, _controllerPort, _paused);
2019-10-20 20:05:39 -04:00
}
public:
2020-12-19 23:30:09 +03:00
GameInformationMessage(void* buffer, uint32_t length) : NetMessage(buffer, length)
{
}
2019-10-20 20:05:39 -04:00
2020-12-19 23:30:09 +03:00
GameInformationMessage(string filepath, string sha1Hash, uint8_t port, bool paused) : NetMessage(
MessageType::GameInformation)
2019-10-20 20:05:39 -04:00
{
_romFilename = FolderUtilities::GetFilename(filepath, true);
_sha1Hash = sha1Hash;
2019-10-20 20:05:39 -04:00
_controllerPort = port;
_paused = paused;
}
2020-12-19 23:30:09 +03:00
2019-10-20 20:05:39 -04:00
uint8_t GetPort()
{
return _controllerPort;
}
string GetRomFilename()
{
return _romFilename;
}
string GetSha1Hash()
{
return _sha1Hash;
2019-10-20 20:05:39 -04:00
}
bool IsPaused()
{
return _paused;
}
2020-12-19 23:30:09 +03:00
};