소스 검색

Fixed linking for macOS and Linux. Resolves #2. Resolves #4.

Added ISteamUserStats GetStats()
Brucey 5 년 전
부모
커밋
acd8d030b5
3개의 변경된 파일60개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      steamsdk.mod/common.bmx
  2. 16 0
      steamsdk.mod/glue/glue.cpp
  3. 40 2
      steamsdk.mod/steamsdk.bmx

+ 4 - 0
steamsdk.mod/common.bmx

@@ -22,6 +22,8 @@ SuperStrict
 Import "-l:steam_api64.dll"
 ?linuxx64
 Import "-lsteam_api"
+?macosx64
+Import "-lsteam_api"
 ?
 
 Import "glue/glue.cpp"
@@ -96,6 +98,8 @@ Extern
 	Function bmx_SteamAPI_ISteamUserStats_GetLeaderboardEntryCount:Int(inst:Byte Ptr, leaderboardHandle:ULong)
 	Function bmx_SteamAPI_ISteamUserStats_GetLeaderboardName:String(inst:Byte Ptr, leadboarHandle:ULong)
 	Function bmx_SteamAPI_ISteamUserStats_GetLeaderboardSortMethod:ELeaderboardSortMethod(inst:Byte Ptr, leaderboardHandle:ULong)
+	Function bmx_SteamAPI_ISteamUserStats_GetStat:Int(inst:Byte Ptr, name:String, data:Int Var)
+	Function bmx_SteamAPI_ISteamUserStats_GetStat0:Int(inst:Byte Ptr, name:String, data:Float Var)
 	Function bmx_SteamAPI_ISteamGameServerStats_GetUserAchievement:Int(inst:Byte Ptr, steamID:ULong, name:String, achieved:Int Var)
 	Function bmx_SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime:Int(inst:Byte Ptr, steamID:ULong, name:String, achieved:Int Var, unlockTime:UInt Var)
 	Function bmx_SteamAPI_ISteamGameServerStats_GetUserStat:Int(inst:Byte Ptr, steamID:ULong, name:String, data:Int Var)

+ 16 - 0
steamsdk.mod/glue/glue.cpp

@@ -165,6 +165,8 @@ extern "C" {
 	int bmx_SteamAPI_ISteamUserStats_GetLeaderboardEntryCount(intptr_t instancePtr, uint64 leaderboardHandle);
 	BBString * bmx_SteamAPI_ISteamUserStats_GetLeaderboardName(intptr_t instancePtr, uint64 leaderboardHandle);
 	ELeaderboardSortMethod bmx_SteamAPI_ISteamUserStats_GetLeaderboardSortMethod(intptr_t instancePtr, uint64 leaderboardHandle);
+	int bmx_SteamAPI_ISteamUserStats_GetStat(intptr_t instancePtr, BBString * name, int * data);
+	int bmx_SteamAPI_ISteamUserStats_GetStat0(intptr_t instancePtr, BBString * name, float * data);
 	int bmx_SteamAPI_ISteamGameServerStats_GetUserAchievement(intptr_t instancePtr, uint64 steamID, BBString * name, int * achieved);
 	int bmx_SteamAPI_ISteamUserStats_GetUserAchievementAndUnlockTime(intptr_t instancePtr, uint64 steamID, BBString * name, int * achieved, uint32 * unlockTime);
 	int bmx_SteamAPI_ISteamGameServerStats_GetUserStat(intptr_t instancePtr, uint64 steamID, BBString * name, int * data);
@@ -925,6 +927,20 @@ ELeaderboardSortMethod bmx_SteamAPI_ISteamUserStats_GetLeaderboardSortMethod(int
 	return SteamAPI_ISteamUserStats_GetLeaderboardSortMethod(instancePtr, leaderboardHandle);
 }
 
+int bmx_SteamAPI_ISteamUserStats_GetStat(intptr_t instancePtr, BBString * name, int * data) {
+	char * n = bbStringToUTF8String(name);
+	int res = SteamAPI_ISteamUserStats_GetStat(instancePtr, n, data);
+	bbMemFree(n);
+	return res;
+}
+
+int bmx_SteamAPI_ISteamUserStats_GetStat0(intptr_t instancePtr, BBString * name, float * data) {
+	char * n = bbStringToUTF8String(name);
+	int res = SteamAPI_ISteamUserStats_GetStat0(instancePtr, n, data);
+	bbMemFree(n);
+	return res;
+}
+
 int bmx_SteamAPI_ISteamGameServerStats_GetUserAchievement(intptr_t instancePtr, uint64 steamID, BBString * name, int * achieved) {
 	char * n = bbStringToUTF8String(name);
 	bool ach;

+ 40 - 2
steamsdk.mod/steamsdk.bmx

@@ -23,11 +23,14 @@ bbdoc: Steam SDK
 End Rem
 Module Steam.SteamSDK
 
-ModuleInfo "Version: 1.03"
+ModuleInfo "Version: 1.04"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Steam SDK - Valve Corporation"
 ModuleInfo "Copyright: Wrapper - 2019-2020 Bruce A Henderson"
 
+ModuleInfo "History: 1.04"
+ModuleInfo "History: Added ISteamUserStats GetStats()."
+ModuleInfo "History: Fixed linking for macOS and Linux."
 ModuleInfo "History: 1.03"
 ModuleInfo "History: Fixed thread registration."
 ModuleInfo "History: 1.02"
@@ -42,6 +45,7 @@ ModuleInfo "CPP_OPTS: -std=c++11"
 ModuleInfo "LD_OPTS: -L%PWD%/sdk/redistributable_bin/win64"
 ?linuxx64
 ModuleInfo "LD_OPTS: -L%PWD%/sdk/redistributable_bin/linux64"
+ModuleInfo "LD_OPTS: -Wl,-rpath,'$ORIGIN'"
 ?macosx64
 ModuleInfo "LD_OPTS: -L%PWD%/sdk/redistributable_bin/osx32"
 ?
@@ -872,7 +876,41 @@ Type TSteamUserStats Extends TSteamAPI
 	Method GetNumberOfCurrentPlayers()
 		bmx_SteamAPI_ISteamUserStats_GetNumberOfCurrentPlayers(callbackPtr)
 	End Method
-	
+
+	Rem
+	bbdoc: Gets the current value of the a stat for the current user.
+	about: You must have called #RequestCurrentStats and it needs to return successfully via its callback prior to calling this.
+
+	To receive stats for other users use #GetUserStat.
+
+	This method returns #True upon success if all of the following conditions are met; otherwise, #False.
+	* The specified stat exists in App Admin on the Steamworks website, and the changes are published.
+	* #RequestCurrentStats has completed and successfully returned its callback.
+	* The type passed to this function must match the type listed in the App Admin panel of the Steamworks website.
+
+	See Also: #RequestCurrentStats, #SetStat, #UpdateAvgRateStat, #StoreStats, #ResetAllStats
+	End Rem
+	Method GetStat:Int(name:String, data:Int Var)
+		Return bmx_SteamAPI_ISteamUserStats_GetStat(instancePtr, name, data)
+	End Method
+
+	Rem
+	bbdoc: Gets the current value of the a stat for the current user.
+	about: You must have called #RequestCurrentStats and it needs to return successfully via its callback prior to calling this.
+
+	To receive stats for other users use #GetUserStat.
+
+	This method returns #True upon success if all of the following conditions are met; otherwise, #False.
+	* The specified stat exists in App Admin on the Steamworks website, and the changes are published.
+	* #RequestCurrentStats has completed and successfully returned its callback.
+	* The type passed to this function must match the type listed in the App Admin panel of the Steamworks website.
+
+	See Also: #RequestCurrentStats, #SetStat, #UpdateAvgRateStat, #StoreStats, #ResetAllStats
+	End Rem
+	Method GetStat:Int(name:String, data:Float Var)
+		Return bmx_SteamAPI_ISteamUserStats_GetStat0(instancePtr, name, data)
+	End Method
+
 	Rem
 	bbdoc: Gets the unlock status of the Achievement.
 	about: The equivalent function for the local user is #GetAchievement.