diff options
| author | Matthew Collins <[email protected]> | 2020-02-22 20:50:46 +0000 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2020-02-22 20:50:46 +0000 |
| commit | 0b4f68b1f4fac5c7e608861274eadeb5186688b3 (patch) | |
| tree | 9d69e5fd94e4d6cd8c7a535f4a0236e2d55c7d35 /src/app.rs | |
| parent | Bump version to 0.6.1 (diff) | |
| download | steamworks-rs-0b4f68b1f4fac5c7e608861274eadeb5186688b3.tar.xz steamworks-rs-0b4f68b1f4fac5c7e608861274eadeb5186688b3.zip | |
Rework to use the new flat steam api
Diffstat (limited to 'src/app.rs')
| -rw-r--r-- | src/app.rs | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -19,7 +19,7 @@ impl <Manager> Apps<Manager> { /// This does not mean the user owns the game. pub fn is_app_installed(&self, app_id: AppId) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsAppInstalled(self.apps, sys::AppId_t(app_id.0)) != 0 + sys::SteamAPI_ISteamApps_BIsAppInstalled(self.apps, app_id.0) } } @@ -27,7 +27,7 @@ impl <Manager> Apps<Manager> { /// installed. pub fn is_dlc_installed(&self, app_id: AppId) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsDlcInstalled(self.apps, sys::AppId_t(app_id.0)) != 0 + sys::SteamAPI_ISteamApps_BIsDlcInstalled(self.apps, app_id.0) } } @@ -38,21 +38,21 @@ impl <Manager> Apps<Manager> { /// yours (e.g. demo). pub fn is_subscribed_app(&self, app_id: AppId) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsSubscribedApp(self.apps, sys::AppId_t(app_id.0)) != 0 + sys::SteamAPI_ISteamApps_BIsSubscribedApp(self.apps, app_id.0) } } /// Returns whether the user is subscribed via a free weekend pub fn is_subscribed_from_free_weekend(&self) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend(self.apps) != 0 + sys::SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend(self.apps) } } /// Returns whether the user has a VAC ban on their account. pub fn is_vac_banned(&self) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsVACBanned(self.apps) != 0 + sys::SteamAPI_ISteamApps_BIsVACBanned(self.apps) } } @@ -60,7 +60,7 @@ impl <Manager> Apps<Manager> { /// is for cyber cafes. pub fn is_cybercafe(&self) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsCybercafe(self.apps) != 0 + sys::SteamAPI_ISteamApps_BIsCybercafe(self.apps) } } @@ -68,14 +68,14 @@ impl <Manager> Apps<Manager> { /// provides low violence depots. pub fn is_low_violence(&self) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsLowViolence(self.apps) != 0 + sys::SteamAPI_ISteamApps_BIsLowViolence(self.apps) } } /// Returns whether the user is subscribed to the current app ID pub fn is_subscribed(&self) -> bool { unsafe { - sys::SteamAPI_ISteamApps_BIsSubscribed(self.apps) != 0 + sys::SteamAPI_ISteamApps_BIsSubscribed(self.apps) } } @@ -92,8 +92,8 @@ impl <Manager> Apps<Manager> { /// would be installed in the default location. pub fn app_install_dir(&self, app_id: AppId) -> String { unsafe { - let buffer = vec![0; 2048]; - sys::SteamAPI_ISteamApps_GetAppInstallDir(self.apps, sys::AppId_t(app_id.0), buffer.as_ptr(), buffer.len() as u32); + let mut buffer = vec![0; 2048]; + sys::SteamAPI_ISteamApps_GetAppInstallDir(self.apps, app_id.0, buffer.as_mut_ptr(), buffer.len() as u32); let path = CStr::from_ptr(buffer.as_ptr()); path.to_string_lossy().into_owned() } @@ -104,7 +104,7 @@ impl <Manager> Apps<Manager> { /// Differs from the current user if the app is borrowed. pub fn app_owner(&self) -> SteamId { unsafe { - SteamId(sys::SteamAPI_ISteamApps_GetAppOwner(self.apps).0) + SteamId(sys::SteamAPI_ISteamApps_GetAppOwner(self.apps)) } } @@ -138,8 +138,8 @@ impl <Manager> Apps<Manager> { /// returns `None` pub fn current_beta_name(&self) -> Option<String> { unsafe { - let buffer = vec![0; 256]; - if sys::SteamAPI_ISteamApps_GetCurrentBetaName(self.apps, buffer.as_ptr(), buffer.len() as _) != 0 { + let mut buffer = vec![0; 256]; + if sys::SteamAPI_ISteamApps_GetCurrentBetaName(self.apps, buffer.as_mut_ptr(), buffer.len() as _) { let path = CStr::from_ptr(buffer.as_ptr()); Some(path.to_string_lossy().into_owned()) } else { |