aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorMatthew Collins <[email protected]>2020-02-22 20:50:46 +0000
committerMatthew Collins <[email protected]>2020-02-22 20:50:46 +0000
commit0b4f68b1f4fac5c7e608861274eadeb5186688b3 (patch)
tree9d69e5fd94e4d6cd8c7a535f4a0236e2d55c7d35 /src/app.rs
parentBump version to 0.6.1 (diff)
downloadsteamworks-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.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/app.rs b/src/app.rs
index 9df5820..3127459 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -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 {