From e055d8d121395ba67978840bccb3163ad114a4d3 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Wed, 11 Mar 2026 07:16:54 +1100 Subject: [PATCH] Use standard types in stats state --- Minecraft.Client/GameState/StatsCounter.cpp | 16 ++++++++-------- Minecraft.Client/GameState/StatsCounter.h | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Minecraft.Client/GameState/StatsCounter.cpp b/Minecraft.Client/GameState/StatsCounter.cpp index ab4895a2b..a68e2a46c 100644 --- a/Minecraft.Client/GameState/StatsCounter.cpp +++ b/Minecraft.Client/GameState/StatsCounter.cpp @@ -142,9 +142,9 @@ void StatsCounter::parse(void* data) assert( stats.size() == 0 ); //Pointer to current position in stat array - PBYTE pbData=(PBYTE)data; - pbData+=sizeof(GAME_SETTINGS); - unsigned short* statData = (unsigned short*)pbData;//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); + std::uint8_t* pbData = reinterpret_cast(data); + pbData += sizeof(GAME_SETTINGS); + unsigned short* statData = reinterpret_cast(pbData);//data + (STAT_DATA_OFFSET/sizeof(unsigned short)); //Value being read StatContainer newVal; @@ -215,15 +215,15 @@ void StatsCounter::save(int player, bool force) //Retrieve the data pointer from the profile #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ ) - PBYTE pbData = (PBYTE)StorageManager.GetGameDefinedProfileData(player); + std::uint8_t* pbData = reinterpret_cast(StorageManager.GetGameDefinedProfileData(player)); #else - PBYTE pbData = (PBYTE)ProfileManager.GetGameDefinedProfileData(player); + std::uint8_t* pbData = reinterpret_cast(ProfileManager.GetGameDefinedProfileData(player)); #endif - pbData+=sizeof(GAME_SETTINGS); + pbData += sizeof(GAME_SETTINGS); //Pointer to current position in stat array //unsigned short* statData = (unsigned short*)data + (STAT_DATA_OFFSET/sizeof(unsigned short)); - unsigned short* statData = (unsigned short*)pbData; + unsigned short* statData = reinterpret_cast(pbData); //Reset all the data to 0 (we're going to replace it with the map data) memset(statData, 0, CConsoleMinecraftApp::GAME_DEFINED_PROFILE_DATA_BYTES-sizeof(GAME_SETTINGS)); @@ -283,7 +283,7 @@ void StatsCounter::save(int player, bool force) } #ifdef _XBOX -void StatsCounter::setLeaderboardProperty(XUSER_PROPERTY* prop, DWORD id, unsigned int value) +void StatsCounter::setLeaderboardProperty(XUSER_PROPERTY* prop, std::uint32_t id, unsigned int value) { app.DebugPrintf("Setting property id: %d to value %d\n", id, value); prop->dwPropertyId = id; diff --git a/Minecraft.Client/GameState/StatsCounter.h b/Minecraft.Client/GameState/StatsCounter.h index 4963d3ab8..55298ae01 100644 --- a/Minecraft.Client/GameState/StatsCounter.h +++ b/Minecraft.Client/GameState/StatsCounter.h @@ -1,4 +1,5 @@ #pragma once +#include class Stat; class Achievement; class StatsSyncher; @@ -95,7 +96,7 @@ private: void dumpStatsToTTY(); #ifdef _XBOX - static void setLeaderboardProperty(XUSER_PROPERTY* prop, DWORD id, unsigned int value); + static void setLeaderboardProperty(XUSER_PROPERTY* prop, std::uint32_t id, unsigned int value); static void setLeaderboardRating(XUSER_PROPERTY* prop, LONGLONG value); #endif