State/Movie: Use char instead of u8 for game ID

Gets rid of casts.
This commit is contained in:
JosJuice 2015-11-28 09:36:48 +01:00
parent 2b0bdc361f
commit 0d3c763126
4 changed files with 6 additions and 6 deletions

View File

@ -185,7 +185,7 @@ void Init()
ReadHeader();
std::thread md5thread(CheckMD5);
md5thread.detach();
if (strncmp((char *)tmpHeader.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6))
if (strncmp(tmpHeader.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6))
{
PanicAlertT("The recorded game (%s) is not the same as the selected game (%s)", tmpHeader.gameID, SConfig::GetInstance().GetUniqueID().c_str());
EndPlayInput(false);
@ -1205,7 +1205,7 @@ void SaveRecording(const std::string& filename)
memset(&header, 0, sizeof(DTMHeader));
header.filetype[0] = 'D'; header.filetype[1] = 'T'; header.filetype[2] = 'M'; header.filetype[3] = 0x1A;
strncpy((char *)header.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6);
strncpy(header.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6);
header.bWii = SConfig::GetInstance().bWii;
header.numControllers = s_numPads & (SConfig::GetInstance().bWii ? 0xFF : 0x0F);

View File

@ -63,7 +63,7 @@ struct DTMHeader
{
u8 filetype[4]; // Unique Identifier (always "DTM"0x1A)
u8 gameID[6]; // The Game ID
char gameID[6]; // The Game ID
bool bWii; // Wii game
u8 numControllers; // The number of connected controllers (1-4)

View File

@ -343,7 +343,7 @@ static void CompressAndDumpState(CompressAndDumpState_args save_args)
// Setting up the header
StateHeader header;
strncpy((char*)header.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6);
strncpy(header.gameID, SConfig::GetInstance().GetUniqueID().c_str(), 6);
header.size = g_use_compression ? (u32)buffer_size : 0;
header.time = Common::Timer::GetDoubleTime();
@ -474,7 +474,7 @@ static void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_
StateHeader header;
f.ReadArray(&header, 1);
if (strncmp(SConfig::GetInstance().GetUniqueID().c_str(), (char*)header.gameID, 6))
if (strncmp(SConfig::GetInstance().GetUniqueID().c_str(), header.gameID, 6))
{
Core::DisplayMessage(StringFromFormat("State belongs to a different game (ID %.*s)",
6, header.gameID), 2000);

View File

@ -20,7 +20,7 @@ static const u32 NUM_STATES = 10;
struct StateHeader
{
u8 gameID[6];
char gameID[6];
u32 size;
double time;
};