Skip to content

Commit

Permalink
Cleanup of some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
trdwll committed Dec 13, 2020
1 parent 8c2d8d0 commit 52a35a0
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 166 deletions.
13 changes: 1 addition & 12 deletions Source/SteamBridge/Private/Core/SteamApps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ bool USteamApps::BGetDLCDataByIndex(int32 DLC, int32& AppID, bool& bAvailable, F
return false;
}

uint32 Temp = 0;
TArray<char> TempStr;
bool bResult = SteamApps()->BGetDLCDataByIndex(DLC, &Temp, &bAvailable, TempStr.GetData(), MAX_int32);
AppID = Temp;
bool bResult = SteamApps()->BGetDLCDataByIndex(DLC, (uint32*)&AppID, &bAvailable, TempStr.GetData(), MAX_int32);
Name = UTF8_TO_TCHAR(TempStr.GetData());
return bResult;
}
Expand Down Expand Up @@ -57,15 +55,6 @@ bool USteamApps::GetCurrentBetaName(FString& Name)
return bResult;
}

bool USteamApps::GetDlcDownloadProgress(int32 AppID, int64& BytesDownloaded, int64& BytesTotal)
{
uint64 TempDownloaded = 0, TempTotal = 0;
bool bResult = SteamApps()->GetDlcDownloadProgress(AppID, &TempDownloaded, &TempTotal);
BytesDownloaded = TempDownloaded;
BytesTotal = TempTotal;
return bResult;
}

int32 USteamApps::GetLaunchCommandLine(FString& CommandLine)
{
TArray<char> TempStr;
Expand Down
28 changes: 0 additions & 28 deletions Source/SteamBridge/Private/Core/SteamHTTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,6 @@ USteamHTTP::~USteamHTTP()
OnHTTPRequestHeadersReceivedCallback.Unregister();
}

bool USteamHTTP::GetHTTPResponseBodySize(FHTTPRequestHandle RequestHandle, int32& BodySize)
{
uint32 Tmp = 0;
BodySize = Tmp;
return SteamHTTP()->GetHTTPResponseBodySize(RequestHandle, &Tmp);
}

bool USteamHTTP::GetHTTPResponseHeaderSize(FHTTPRequestHandle RequestHandle, const FString& HeaderName, int32& ResponseHeaderSize)
{
uint32 Tmp = 0;
ResponseHeaderSize = Tmp;
return SteamHTTP()->GetHTTPResponseHeaderSize(RequestHandle, TCHAR_TO_UTF8(*HeaderName), &Tmp);
}

bool USteamHTTP::SendHTTPRequest(FHTTPRequestHandle RequestHandle, FSteamAPICall& CallHandle)
{
SteamAPICall_t Tmp = 0;
CallHandle = Tmp;
return SteamHTTP()->SendHTTPRequest(RequestHandle, &Tmp);
}

bool USteamHTTP::SendHTTPRequestAndStreamResponse(FHTTPRequestHandle RequestHandle, FSteamAPICall& CallHandle)
{
SteamAPICall_t Tmp = 0;
CallHandle = Tmp;
return SteamHTTP()->SendHTTPRequestAndStreamResponse(RequestHandle, &Tmp);
}

void USteamHTTP::OnHTTPRequestCompleted(HTTPRequestCompleted_t* pParam)
{
m_OnHTTPRequestCompleted.Broadcast(pParam->m_hRequest, pParam->m_ulContextValue, pParam->m_bRequestSuccessful, (ESteamHTTPStatus::Type)pParam->m_eStatusCode, pParam->m_unBodySize);
Expand Down
8 changes: 0 additions & 8 deletions Source/SteamBridge/Private/Core/SteamInventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ bool USteamInventory::GetItemDefinitionIDs(TArray<FSteamItemDef>& Items) const
return false;
}

bool USteamInventory::GetItemPrice(FSteamItemDef ItemDef, int64& CurrentPrice, int64& BasePrice) const
{
uint64 TmpCurrent = 0, TmpBase = 0;
CurrentPrice = TmpCurrent;
BasePrice = TmpBase;
return SteamInventory()->GetItemPrice(ItemDef, &TmpCurrent, &TmpBase);
}

bool USteamInventory::GetResultItemProperty(FSteamInventoryResult ResultHandle, int32 ItemIndex, const FString& PropertyName, FString& Value) const
{
TArray<char> TmpStr;
Expand Down
19 changes: 3 additions & 16 deletions Source/SteamBridge/Private/Core/SteamMatchmaking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,10 @@ int32 USteamMatchmaking::AddFavoriteGame(int32 AppID, const FString& IP, int32 C

bool USteamMatchmaking::GetFavoriteGame(int32 GameIndex, int32& AppID, FString& IP, int32& ConnPort, int32& QueryPort, TArray<ESteamFavoriteFlags>& Flags, int32& TimeLastPlayedOnServer) const
{
uint32 TmpAppID = 0, TmpIP = 0, TmpFlags = 0, TmpTime = 0;
uint16 TmpConnPort = 0, TmpQueryPort = 0;
uint32 TmpIP = 0, TmpFlags = 0;

bool bResult = SteamMatchmaking()->GetFavoriteGame(GameIndex, &TmpAppID, &TmpIP, &TmpConnPort, &TmpQueryPort, &TmpFlags, &TmpTime);

AppID = TmpAppID;
bool bResult = SteamMatchmaking()->GetFavoriteGame(GameIndex, (uint32*)&AppID, &TmpIP, (uint16*)&ConnPort, (uint16*)&QueryPort, &TmpFlags, (uint32*)&TimeLastPlayedOnServer);
IP = USteamBridgeUtils::ConvertIPToString(TmpIP);
ConnPort = TmpConnPort;
QueryPort = TmpQueryPort;
TimeLastPlayedOnServer = TmpTime;

for (int32 i = 0; i < 32; i++)
{
Expand Down Expand Up @@ -108,15 +102,8 @@ bool USteamMatchmaking::GetLobbyDataByIndex(FSteamID SteamIDLobby, int32 LobbyDa
bool USteamMatchmaking::GetLobbyGameServer(FSteamID SteamIDLobby, FString& GameServerIP, int32& GameServerPort, FSteamID& SteamIDGameServer) const
{
uint32 TmpIP = 0;
uint16 TmpPort = 0;
CSteamID TmpSteamID;

bool bResult = SteamMatchmaking()->GetLobbyGameServer(SteamIDLobby, &TmpIP, &TmpPort, &TmpSteamID);

bool bResult = SteamMatchmaking()->GetLobbyGameServer(SteamIDLobby, &TmpIP, (uint16*)&GameServerPort, (CSteamID*)&SteamIDGameServer);
GameServerIP = USteamBridgeUtils::ConvertIPToString(TmpIP);
GameServerPort = TmpPort;
SteamIDGameServer = TmpSteamID.ConvertToUint64();

return bResult;
}

Expand Down
8 changes: 0 additions & 8 deletions Source/SteamBridge/Private/Core/SteamParties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ USteamParties::~USteamParties()
OnActiveBeaconsUpdatedCallback.Unregister();
}

bool USteamParties::GetNumAvailableBeaconLocations(int32& NumLocations) const
{
uint32 TmpNum = 0;
bool bResult = SteamParties()->GetNumAvailableBeaconLocations(&TmpNum);
NumLocations = TmpNum;
return bResult;
}

bool USteamParties::GetAvailableBeaconLocations(TArray<FSteamPartyBeaconLocation>& LocationList) const
{
TArray<SteamPartyBeaconLocation_t> TmpArray;
Expand Down
10 changes: 5 additions & 5 deletions Source/SteamBridge/Private/Core/SteamUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ bool USteamUser::GetEncryptedAppTicket(TArray<uint8>& Ticket)

ESteamVoiceResult USteamUser::GetVoice(TArray<uint8>& VoiceData)
{
int32 tmpData = 0;
ESteamVoiceResult result = GetAvailableVoice(tmpData);
int32 TmpData = 0;
ESteamVoiceResult result = GetAvailableVoice(TmpData);
if (result == ESteamVoiceResult::OK)
{
VoiceData.SetNum(tmpData);
result = (ESteamVoiceResult)SteamUser()->GetVoice(true, VoiceData.GetData(), VoiceData.Num(), (uint32*)&tmpData);
VoiceData.SetNum(tmpData);
VoiceData.SetNum(TmpData);
result = (ESteamVoiceResult)SteamUser()->GetVoice(true, VoiceData.GetData(), VoiceData.Num(), (uint32*)&TmpData);
VoiceData.SetNum(TmpData);
}
return result;
}
Expand Down
32 changes: 0 additions & 32 deletions Source/SteamBridge/Private/Core/SteamUserStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,6 @@ FSteamAPICall USteamUserStats::FindOrCreateLeaderboard(const FString& Leaderboar
return SteamUserStats()->FindOrCreateLeaderboard(TCHAR_TO_UTF8(*LeaderboardName), (ELeaderboardSortMethod)LeaderboardSortMethod, (ELeaderboardDisplayType)LeaderboardDisplayType);
}

bool USteamUserStats::GetAchievementAndUnlockTime(const FString& Name, bool& bAchieved, int32& UnlockTime) const
{
uint32 TmpTime = 0;
bool bResult = SteamUserStats()->GetAchievementAndUnlockTime(TCHAR_TO_UTF8(*Name), &bAchieved, &TmpTime);
UnlockTime = TmpTime;
return bResult;
}

bool USteamUserStats::GetGlobalStatFloat(const FString& StatName, float& Data) const
{
double TmpData = 0;
bool bResult = SteamUserStats()->GetGlobalStat(TCHAR_TO_UTF8(*StatName), &TmpData);
Data = TmpData;
return bResult;
}

int32 USteamUserStats::GetGlobalStatHistoryInt64(const FString& StatName, TArray<int64>& Data, int32 Size) const
{
TArray<int64> TmpData;
int32 result = SteamUserStats()->GetGlobalStatHistory(TCHAR_TO_UTF8(*StatName), TmpData.GetData(), Size);
Data = TmpData;
return result;
}

int32 USteamUserStats::GetGlobalStatHistoryFloat(const FString& StatName, TArray<float>& Data, int32 Size) const
{
TArray<double> TmpData;
Expand All @@ -81,14 +57,6 @@ int32 USteamUserStats::GetGlobalStatHistoryFloat(const FString& StatName, TArray
return result;
}

bool USteamUserStats::GetUserAchievementAndUnlockTime(FSteamID SteamIDUser, const FString& Name, bool& bAchieved, int32& UnlockTime) const
{
uint32 TmpUnlockTime;
bool bResult = SteamUserStats()->GetUserAchievementAndUnlockTime(SteamIDUser, TCHAR_TO_UTF8(*Name), &bAchieved, &TmpUnlockTime);
UnlockTime = TmpUnlockTime;
return bResult;
}

FSteamAPICall USteamUserStats::UploadLeaderboardScore(FSteamLeaderboard SteamLeaderboard, ESteamLeaderboardUploadScoreMethod LeaderboardUploadScoreMethod, int32 Score, const TArray<int32>& ScoreDetails) const
{
return SteamUserStats()->UploadLeaderboardScore(SteamLeaderboard, (ELeaderboardUploadScoreMethod)LeaderboardUploadScoreMethod, Score, ScoreDetails.GetData(), ScoreDetails.Num());
Expand Down
2 changes: 1 addition & 1 deletion Source/SteamBridge/Public/Core/SteamApps.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class STEAMBRIDGE_API USteamApps final : public UObject
* @return bool - true if the specified DLC exists and is currently downloading; otherwise, false.
*/
UFUNCTION(BlueprintPure, Category = "SteamBridgeCore|Apps")
bool GetDlcDownloadProgress(int32 AppID, int64& BytesDownloaded, int64& BytesTotal);
bool GetDlcDownloadProgress(int32 AppID, int64& BytesDownloaded, int64& BytesTotal) const { return SteamApps()->GetDlcDownloadProgress(AppID, (uint64*)&BytesDownloaded, (uint64*)&BytesTotal); }

/**
* Gets the time of purchase of the specified app in Unix epoch format (time since Jan 1st, 1970).
Expand Down
Loading

0 comments on commit 52a35a0

Please sign in to comment.