noxime / steamworks-rs Goto Github PK
View Code? Open in Web Editor NEWRust bindings to the SteamWorks SDK
License: Apache License 2.0
Rust bindings to the SteamWorks SDK
License: Apache License 2.0
This crate doesn't have bindings for all the Steam SDK operations, right? At least, I can not find SteamEncryptedAppTicket_BDecryptTicket.
Are the methods added on demand by needs or are some well-defined boundaries that should be supported?
I need support for querying workshop content, which is currently missing.
I could try working on this.
Many of the new ISteamUtils functions appear to be missing bindings, especially ones related to the Steam Deck. Some of these are required to get a game to run on the Steam Deck well. Can they be added? I think the most important are:
I don't think we should have comments likes this:
steamworks-rs/examples/chat-example/src/main.rs
Lines 58 to 62 in 30904eb
As a proposal to the API, I think the callback should only be dropped when explicite requested, so we don't have unexpected cases where our callbacks stop working from nothing.
Related: ceifa/steamworks.js#77
Hello! @Noxime
I'm trying to build Rust in Windows and macOS, but when compiling steamworks-sys
, I get this:
error: failed to run custom build command for `steamworks-sys v0.7.0`
Caused by:
process didn't exit successfully: `/Library/WebServer/Documents/hello_world/target/debug/build/steamworks-sys-76cbcb8d9f2d24c2/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-search=/sdk/redistributable_bin/osx
cargo:rustc-link-lib=dylib=steam_api
--- stderr
error: header '/sdk/public/steam/steam_gameserver.h' does not exist.
thread 'main' panicked at 'Unable to generate bindings: ()', /Users/podrivo/.cargo/registry/src/github.com-1ecc6299db9ec823/steamworks-sys-0.7.0/build.rs:49:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Testing on:
I'm running this command to build (without the SDK STEAM_SDK_LOCATION env var
in Windows):
STEAM_SDK_LOCATION=/sdk/ cargo build
This is my Cargo.toml
:
[package]
name = "hello_world"
version = "0.1.0"
[dependencies]
steamworks = "0.7.0"
And this is my folder structure:
hello_world
├── sdk
├── src
│ └── main.rs
├── Cargo.toml
└── steam_appid.txt
Thoughts on why this is happening?
Thank you!
I'm not familiar with rust. but I do some test like this
and i found the code not work ,maybe some package should upgrade ,maybe other reason.
#[test]
fn it_works() {
let value = Some("test");
let a = value
.and_then(|v| CString::new(v).ok())
.map(|s| s.as_ptr() as *const _)
.unwrap_or(std::ptr::null());
let c: &CStr = unsafe { CStr::from_ptr(a) };
println!("........{:#?}", c);
// it will print only .......
}
#[test]
fn t_t() {
let a = CString::new("tttt").unwrap_or_default();
println!("........{:#?}", a);
let b = a.as_ptr() as * const c_char;
println!("........{:#?}", b);
let c: &CStr = unsafe { CStr::from_ptr(b) };
println!("........{:#?}", c);
//it will print ......"test"
}
Hello @Noxime!
I was able to build steamworks-rs
in macOS 10.15.7 and Windows 10, but when I try to run with cargo run
I get an error message, in both systems:
Windows:
cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `target\debug\hello_world.exe`
error: process didn't exit successfully: `target\debug\hello_world.exe` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)
macOS
cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target/debug/hello_world`
dyld: Library not loaded: @loader_path/libsteam_api.dylib
Referenced from: /Users/pedroivo/Desktop/hello_world/target/debug/hello_world
Reason: image not found
I've tried multiple things, from setting $PATH to creating new profile files, but can't make it work in either systems.
Thoughts on what should I try to make it work?
Thank you!
Okay so this is a weird issue and I will try and look further into it, but the gist of it is the following:
I'm using steamworks-rs to create and upload workshop items. In general, this works alright, except for a glaring issue: If you create a workshop item with ugc.create_item
, it will return the wrong ID for the created workshop item.
Example:
I created an item, I get the following from my callback handler:
Okay, looks sane, even though the ID is a little bit... high, but whatever. Now, checking out the newly created workshop item in Steam shows the following ID:
I have no idea if this only happens on my machine or if something else is going on. I will run some tests on other machines and add some logging...
Maybe someone already encountered this and can tell me what's going on.
Am I missing something stupid?
I was looking through the Step-by-Step guide for stats, and I couldn't find SteamUserStats()->SetStat(name, value) anywhere...
A more Rust native version of the API using async/await instead of using callbacks would be super useful for easier game engine integration, particularly with callback handlers that have non-static lifetimes.
This will be a breaking change, so it may be best to put all of this under a top level module that is gated by a feature.
A (very) small portion of the existing API has already been done: https://github.com/Seeker14491/steamworks-rs
In rust, panicking across an FFI function is undefined behavior. It looks like the unwind checking in register_call_result
is gated by #[cfg(debug_assertions)]
. If it's not enabled, the callback is called with no panic checking.
This technically violates Rust's safety guarantees, since, in a release build, it's now possible with purely-safe code to cause this undefined behavior.
Hi,
when I try to build with v0.7 as a dependency on my m1 Mac, I get errors about undeclared identifier 'nullptr':
[dependencies]
...
steamworks = "0.7.0"
robertpyke@Roberts-Mac-mini RustyTower % STEAM_SDK_LOCATION=~/Documents/dev/git/RustyTower/sdk/151 cargo build
Compiling rusty-tower v0.1.0 (/Users/robertpyke/Documents/dev/git/RustyTower)
Compiling steamworks-sys v0.7.0
error: failed to run custom build command for `steamworks-sys v0.7.0`
Caused by:
process didn't exit successfully: `/Users/robertpyke/Documents/dev/git/RustyTower/target/debug/build/steamworks-sys-039c9649e303658a/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-search=/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/redistributable_bin/osx
cargo:rustc-link-lib=dylib=steam_api
--- stderr
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_common.h:227:54: error: use of undeclared identifier 'nullptr'
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_common.h:227:63: error: use of undeclared identifier 'nullptr'
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:87:11: error: use of undeclared identifier 'nullptr'
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:88:11: error: use of undeclared identifier 'nullptr'
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:147:12: error: use of undeclared identifier 'nullptr'
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:147:31: error: use of undeclared identifier 'nullptr'
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_common.h:227:54: error: use of undeclared identifier 'nullptr', err: true
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_common.h:227:63: error: use of undeclared identifier 'nullptr', err: true
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:87:11: error: use of undeclared identifier 'nullptr', err: true
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:88:11: error: use of undeclared identifier 'nullptr', err: true
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:147:12: error: use of undeclared identifier 'nullptr', err: true
/Users/robertpyke/Documents/dev/git/RustyTower/sdk/151/public/steam/steam_api_internal.h:147:31: error: use of undeclared identifier 'nullptr', err: true
thread 'main' panicked at 'Unable to generate bindings: ()', /Users/robertpyke/.cargo/registry/src/github.com-1ecc6299db9ec823/steamworks-sys-0.7.0/build.rs:49:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
If I then change that to use the git repo directly:
[dependencies]
...
steamworks = {git = "https://github.com/Noxime/steamworks-rs"}
the build passes without issue.
I also tried cloning this repo directly onto my machine and running the chat-example. That worked when referencing the git repo code, but hit the same issue when building against latest cargo release.
I just wanted to check if I'm missing something, or if the published cargo release just needs to be updated?
I'd like to use steamworks-rs in one of my projects but I'm lost as to where to even begin. Is there any documentation or example code that can help give an idea of how to get started?
I have followed the instructions for the requirements. I'm not sure what i'm doing wrong.
Is it possible to add support for that?
There doesn't appear to a callback a client can register to be made aware of server disconnect. The server listen socket can definitely detect disconnected clients but not the other way around. After pulling down this crate and adding some println statements, I do see NetConnectionStatusChanged
events being published to a default NetworkingSocketsData.connection_callback
handler but I don't see a way to register for this outside the library.
NetConnectionStatusChanged { connection: 791123397, connection_info: NetConnectionInfo { identity_remote: Some(steamid:765xxx..), user_data: -1, listen_socket: None, state: Ok(ProblemDetectedLocally), end_reason: Some(MiscTimeout) }, old_state: Connected }
Whether the client is connected via p2p or ip doesn't matter. Am I missing something?
When building a project depending on this library using cargo cross for the x86_64-pc-windows-gnu target the build fails and a very long error is printed.
The solution for this is to remove the type definitions under after #if defined( _WIN32 )
in steamtypes.h
. As I don't have any Windows PC I do not know whether the resulting binary works yet, but I wanted to open this issue in case anybody else has the same problem.
Edit: the binary works
It's been a year since version 0.9.0 was released; dozens of commits have been merged since then.
Please tag and release a new version of this library.
I think this is more of a problem with the debuggers, but I had the same problem in VS Code and CLion, both on Windows and Linux.
It's easily fixed by copying the .dll and .lib files to the root folder of the project, I'm assuming it's the same with the .so file in Linux. I fixed the problem there by copying the libsteam_api.so to /usr/lib.
Maybe I'm missing something and there's a less messy solution, but hopefully, this can help somebody else with the same problem.
If I'm not missing something there is no way to set the meta data for a lobby and it can only be read.
Hello, since the start of the year I have been conscripted into the Finnish army and I will be serving my duty until September/October. This means my free time to maintain steamworks-rs has been effectively cut completely from the already low standard. While the crate is maintained quite passively, with features landing through (greatly appreciated) external PRs, I have no time to review and merge them anymore.
To fix this issue, we should either nominate a new maintainer or add acting co-maintainers to the project. I can return to maintainership when I move to the reserves, but until then we should find new people. If anyone is willing to step up, it'd be great for the Rust gamedev community!
I've noticed at least @james7132 and @Nonakesh have been quite active on steamworks-rs, would either or both of you wish to take the mantle? No pressure, of course
I've just updated the Steamworks SDK. Version 1.48 includes a pretty big overhaul to the flat interface, and a new windows-event-like manual callback dispatch mechanism. The goal is to make binding layers like this easier to write. Less manual maintenance, and less gross hackery under the hood.
When you get a sec, please take a look at it, and if you have any questions or complaints, email me.
In Linux, flatpak is quickly gaining popularity and many people are using flatpak to install steam. I am trying to write a tool to display network statistics of connected players in lobby using steamworks.
When I am trying to initiate Client
, I am getting the following error:
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
dlopen failed trying to load:
/home/u1/.steam/sdk64/steamclient.so
with error:
/home/u1/.steam/sdk64/steamclient.so: cannot open shared object file: No such file or directory
[S_API] SteamAPI_Init(): Sys_LoadModule failed to load: /home/u1/.steam/sdk64/steamclient.so
thread 'main' panicked at 'Failed to initialize Steamworks API: InitFailed', src/main.rs:5:33
stack backtrace:
0: rust_begin_unwind
at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:64:14
2: core::result::unwrap_failed
at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/result.rs:1790:5
3: core::result::Result<T,E>::expect
at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/result.rs:1069:23
4: rust_playground::main
at ./src/main.rs:5:18
5: core::ops::function::FnOnce::call_once
at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The sdk64
is located at $HOME/.var/app/com.valvesoftware.Steam/.steam/sdk64
and there is a steamclient.so
in there. There's also an sdk32
in the same directory as sdk64
Note that I have installed steam flatpak as a user which is why it is at $HOME
. Destination might be simply /var
if a user installs steam flatpak systemwide.
I have tried using LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=$HOME/.var/app/com.valvesoftware.Steam/.steam/sdk64:$LD_LIBRARY_PATH
To find the same issue.
Same with LD_PRELOAD:
$ LD_PRELOAD=$HOME/.var/app/com.valvesoftware.Steam/.steam/sdk64/steamclient.so cargo run -q
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
dlopen failed trying to load:
/home/u1/.steam/sdk64/steamclient.so
with error:
/home/u1/.steam/sdk64/steamclient.so: cannot open shared object file: No such file or directory
[S_API] SteamAPI_Init(): Sys_LoadModule failed to load: /home/u1/.steam/sdk64/steamclient.so
thread 'main' panicked at 'Failed to initialize Steamworks API: InitFailed', src/main.rs:5:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Hi,
I'm trying to run your example and when compiling I get this error
$ cargo run
Compiling steamworks-sys v0.6.1
error: failed to run custom build command for `steamworks-sys v0.6.1`
Caused by:
process didn't exit successfully: `D:\Repositories\rust_fps\game\target\debug\build\steamworks-sys-eb43cd0edde91b0b\build-script-build` (exit code: 1)
--- stdout
cargo:rustc-link-search=C:\SDKs\SteamworksSDK\redistributable_bin\win64
cargo:rustc-link-lib=dylib=steam_api64
TARGET = Some("x86_64-pc-windows-msvc")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-msvc")
CXX_x86_64-pc-windows-msvc = None
CXX_x86_64_pc_windows_msvc = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-pc-windows-msvc = None
CXXFLAGS_x86_64_pc_windows_msvc = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
DEBUG = Some("true")
running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "C:\\SDKs\\SteamworksSDK\\public/steam" "-W4" "-FoD:\\Repositories\\rust_fps\\game\\target\\debug\\build\\steamworks-sys-f499b415b8b3742f\\out\\src/lib.o" "-c" "src/lib.cpp"
lib.cpp
C:\SDKs\SteamworksSDK\public\steam\matchmakingtypes.h(45): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\SDKs\SteamworksSDK\public\steam\matchmakingtypes.h(47): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\SDKs\SteamworksSDK\public\steam\matchmakingtypes.h(161): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
C:\SDKs\SteamworksSDK\public\steam\matchmakingtypes.h(246): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
src/lib.cpp(52): error C2660: 'SteamGameServer_Init': function does not take 6 arguments
C:\SDKs\SteamworksSDK\public\steam\steam_gameserver.h(102): note: see declaration of 'SteamGameServer_Init'
exit code: 2
--- stderr
error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "C:\\SDKs\\SteamworksSDK\\public/steam" "-W4" "-FoD:\\Repositories\\rust_fps\\game\\target\\debug\\build\\steamworks-sys-f499b415b8b3742f\\out\\src/lib.o" "-c" "src/lib.cpp" with args "cl.exe" did not execute successfully (status code exit code: 2).
I've got a weird problem. When I launch my app through steam on OSX it works totally fine as expected.
When I launch it through steam on windows I get some Fossilize Error about failing to parse Application Info I'm guessing I'm missing some manifest file?
Launching the game through the executable directly works fine.
Anyone have any ideas on what could be causing this?
Actual Error:
Error: Failed to parse ApplicationInfoFilter, letting recording go through
INFO: Overriding serialization path : "E:/SteamLibray/steamapps/shadercache/2248000/fozpipelinesv6/steamapprun_pipeline_cache".
I'm unable to find any resources on the web for this except for the ErrorMessage in the Fossilize Repository, and no one seems to know what the cause is
I'm running on an NVIDIA 3070 with a Vulkan backend
I'm new guy for rust, the query function not work, can some on explain it ,very thanks.
@Thinkofname @james7132 @ColonelThirtyTwo
#[test]
fn query_item() {
let (client, single) = Client::init().unwrap();
let a = client.ugc().subscribed_items();
println!("{:#?}",a[0]);
let test = client.ugc().query_item(a[0]);
let mut f = match test {
Ok(file) => file,
Err(error) => panic!("Problem opening the file: {:?}", error),
};
f.fetch(|x| match x {
Ok(_) => {println!("a")} //not print
Err(_) => {println!("b")} //not print
})
}
If not, do you have an idea of an existing crate that does that?
I have the correct env var pointing to my sdk, and I have verified that libsteam_api.so is in the sdk at the right place, but the following error still shows -
target/debug/crate-name: error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory
When I run the test at the bottom of server.rs I get these errors:
[S_API FAIL] SteamAPI_ManualDispatch_RunFrame() Cannot be used, must call SteamAPI_ManualDispatch_Init first.
[S_API FAIL] SteamAPI_ManualDispatch_GetNextCallback() Cannot be used, must call SteamAPI_ManualDispatch_Init first.
Hi, Im trying to add set rich presence SteamAPI_ISteamFriends_SetRichPresence
C header from SDK virtual bool SetRichPresence( const char *pchKey, const char *pchValue ) = 0;
My implementation:
pub fn SteamAPI_ISteamFriends_SetRichPresence(instance: *mut ISteamFriends, key: *const c_char, value: *const c_char) -> bool;
/// Set rich presence of current game.
pub fn set_rp(&self, key: &str, value: &str ) -> Result<(), ()> {
let key_rp = CString::new(key).unwrap();
let val_rp = CString::new(value).unwrap();
let success = unsafe {
sys::SteamAPI_ISteamFriends_SetRichPresence(self.friends, key_rp.as_ptr(), val_rp.as_ptr())
};
if success { Ok(()) } else { Err(()) }
}
The question is, should key_rp.as_ptr()
also cast using as *const _
? I saw some of your implementation using as *const _
. If you dont mind to explain what as *const _
do.
I tried using as *const _
and not using it, no compiler error.
With a fresh update of the master branch, I ran cargo test
to make sure everything downloaded properly:
✔ ~/projects/steamworks-rs [master|✔ ]
09:28 $ git rev-parse HEAD
ffd355e58fbbe43d0dc617004b17441ffac91ee7
✔ ~/projects/steamworks-rs [master|✔ ]
09:28 $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
✔ ~/projects/steamworks-rs [master|✔ ]
09:28 $ cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.05s
Running unittests src/lib.rs (target/debug/deps/steamworks-3e33e261a815adfd)
running 15 tests
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 480
SteamInternal_SetMinidumpSteamID: Caching Steam ID: 76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID: Caching Steam ID: 76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID: Caching Steam ID: 76561197984333817 [API loaded no]
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully: `/home/flaise/projects/steamworks-rs/target/debug/deps/steamworks-3e33e261a815adfd` (signal: 11, SIGSEGV: invalid memory reference)
✘ ~/projects/steamworks-rs [master|✔ ]
09:28 $ cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.06s
Running unittests src/lib.rs (target/debug/deps/steamworks-3e33e261a815adfd)
running 15 tests
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
Setting breakpad minidump AppID = 480
SteamInternal_SetMinidumpSteamID: Caching Steam ID: 76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID: Caching Steam ID: 76561197984333817 [API loaded no]
SteamInternal_SetMinidumpSteamID: Caching Steam ID: 76561197984333817 [API loaded no]
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
Installing breakpad exception handler for appid(steamworks-3e33e261a815adfd)/version(1.0)/tid(13681)
test networking_types::tests::test_allocate_and_free_message ... ok
test networking_types::tests::test_network_identity_ip ... ok
test networking_types::tests::test_network_identity_steam_id ... ok
test networking_types::tests::test_new_ip ... ok
test networking_types::tests::test_set_ipv4 ... ok
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
assert_20230325093111_3.dmp[13692]: Uploading dump (out-of-process)
/tmp/dumps/assert_20230325093111_3.dmp
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
src/clientdll/steamclient.cpp (855) : IsValidHSteamUserPipe( hUser, hSteamPipe )
test networking_sockets::tests::test_create_listen_socket_ip ... ok
test networking_sockets::tests::test_socket_connection ... FAILED
[S_API] SteamAPI_Init(): Loaded '/home/flaise/.local/share/Steam/linux64/steamclient.so' OK.
assert_20230325093111_3.dmp[13692]: Finished uploading minidump (out-of-process): success = no
assert_20230325093111_3.dmp[13692]: error: libcurl.so: cannot open shared object file: No such file or directory
assert_20230325093111_3.dmp[13692]: file ''/tmp/dumps/assert_20230325093111_3.dmp'', upload no: ''libcurl.so: cannot open shared object file: No such file or directory''
CreateFn failed for SteamUser021 User
CreateFn failed for SteamUser021 User
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully: `/home/flaise/projects/steamworks-rs/target/debug/deps/steamworks-3e33e261a815adfd` (signal: 11, SIGSEGV: invalid memory reference)
Notice that I ran the same command twice with different results, which makes it look like the tests may be interfering with each other. But that's weird because you're already using serial_test::serial
. Also weird is that the actual game I'm making that uses steamworks-rs still works even when I updated to 0.10.0, the same commit I'm getting failing tests on.
Do you know what went wrong here?
When I init app and client, it run game. I only want to get game install path but after that game is still running due to init process, how I could close game or stop init ?
I want to use the Steam Leaderboards API to retrieve leaderboards for a game. It seems it isn't implemented in the steamworks
crate, and there doesn't appear to be bindings for these functions in steamworks-sys
either.
I suppose the first step in resolving this would be generating bindings for these functions; is there a reason bindings for these functions aren't being generated?
I tried to compile the create with Steam SDK 151 but it gives me this
error[E0425]: cannot find function, tuple struct or tuple variant `SteamAPI_SteamUGC_v015` in crate `sys`
--> C:\Users\fflea\.cargo\registry\src\github.com-1ecc6299db9ec823\steamworks-0.7.0\src\ugc.rs:666:36
|
666 | let ugc = sys::SteamAPI_SteamUGC_v015();
| ^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `SteamAPI_SteamUGC_v014`
|
::: C:\Users\fflea\CLionProjects\rust_test\target\debug\build\steamworks-sys-1244e4b6e1e8ec01\out/bindings.rs:26893:5
|
26893 | pub fn SteamAPI_SteamUGC_v014() -> *mut ISteamUGC;
| -------------------------------------------------- similarly named function `SteamAPI_SteamUGC_v014` defined here
Does seem to be an updated function name issue. What should I do? Thank you.
https://steamcommunity.com/groups/steamworks/announcements/detail/1791775741704351698
May also want to wrap it in a way that the open source version ( https://github.com/ValveSoftware/GameNetworkingSockets ) can be used as well?
ld returned exit code zero
This might be a user issue because I have zero clue what's going on
This might require some design, but requiring callbacks to be 'static requires all state passed into them to be owned. This interacts poorly with the way a lot of Rust game engines (like Bevy) work, where a subsection of the global game state is only borrowed temporarily. In it's current form, this almost always forces the use of Arc<Mutex<T>>
or something else to hold the state, and locking a mutex on each callback can be quite expensive to do, especially when there is a high callback volume.
What other APIs tend to do is use a scope
API. For example:
let (client, single) = Client::init();
let mut game_state = GameState::new();
single.run_scoped_callbacks(|event| {
match event {
SteamEvent::P2PSessionRequest(request) => {
// game_state is borrowed mutably and is not moved into the event handler.
game_state.handle_session_request(request);
},
...
}
});
This may end up being a cleaner interface than requiring users to register callbacks and funnel game state in and out via mutexes or channels, and may also resolve the issues seen in #124.
steamworks-rs is missing these Activate Overlay features from ISteamFriends:
At the moment we have no way to find out if the NetConnection
of a Client who connects with P2P is still valid.
SteamNetConnectionStatusChangedCallback_t
is currently only at a crate public level. I don't really understand why its not possible to add a callback for this public, if any has a idea why thats not possible in this rust implementation i would be grateful :)!
Also its missing the method to have a other chance to get the current state of a NetConnection
GetConnectionInfo.
Hello, I recently started to use this API and I would like upload workshop item but I don't get what is &self arg and cb arg. If you could send me full example... Thanks!
The publicly available Steamworks v153 is available from Steamworks now and currently building against it fails:
error[E0425]: cannot find function, tuple struct or tuple variant `SteamAPI_SteamGameServer_v013` in crate `sys`
--> C:\Users\conta\.cargo\registry\src\github.com-1ecc6299db9ec823\steamworks-0.7.0\src\server.rs:78:35
|
78 | let server_raw = sys::SteamAPI_SteamGameServer_v013();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `SteamAPI_SteamGameServer_v014`
|
::: C:\Users\conta\Git\bevy-steamworks\target\debug\build\steamworks-sys-6bd566e14e720d9e\out/bindings.rs:29667:5
|
29667 | pub fn SteamAPI_SteamGameServer_v014() -> *mut ISteamGameServer;
| ---------------------------------------------------------------- similarly named function `SteamAPI_SteamGameServer_v014` defined here
error[E0425]: cannot find function, tuple struct or tuple variant `SteamAPI_ISteamGameServer_EnableHeartbeats` in crate `sys`
--> C:\Users\conta\.cargo\registry\src\github.com-1ecc6299db9ec823\steamworks-0.7.0\src\server.rs:228:18
|
228 | sys::SteamAPI_ISteamGameServer_EnableHeartbeats(self.server, active);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `SteamAPI_ISteamGameServer_GetGameplayStats`
|
::: C:\Users\conta\Git\bevy-steamworks\target\debug\build\steamworks-sys-6bd566e14e720d9e\out/bindings.rs:29836:5
|
29836 | pub fn SteamAPI_ISteamGameServer_GetGameplayStats(self_: *mut ISteamGameServer);
| -------------------------------------------------------------------------------- similarly named function `SteamAPI_ISteamGameServer_GetGameplayStats` defined here
error[E0425]: cannot find function, tuple struct or tuple variant `SteamAPI_SteamUGC_v015` in crate `sys`
--> C:\Users\conta\.cargo\registry\src\github.com-1ecc6299db9ec823\steamworks-0.7.0\src\ugc.rs:666:36
|
666 | let ugc = sys::SteamAPI_SteamUGC_v015();
| ^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `SteamAPI_SteamUGC_v016`
|
::: C:\Users\conta\Git\bevy-steamworks\target\debug\build\steamworks-sys-6bd566e14e720d9e\out/bindings.rs:27662:5
|
27662 | pub fn SteamAPI_SteamUGC_v016() -> *mut ISteamUGC;
| -------------------------------------------------- similarly named function `SteamAPI_SteamUGC_v016` defined here
error[E0425]: cannot find function, tuple struct or tuple variant `SteamAPI_SteamRemoteStorage_v014` in crate `sys`
--> C:\Users\conta\.cargo\registry\src\github.com-1ecc6299db9ec823\steamworks-0.7.0\src\lib.rs:294:27
|
294 | let rs = sys::SteamAPI_SteamRemoteStorage_v014();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `SteamAPI_SteamRemoteStorage_v016`
|
::: C:\Users\conta\Git\bevy-steamworks\target\debug\build\steamworks-sys-6bd566e14e720d9e\out/bindings.rs:25621:5
|
25621 | pub fn SteamAPI_SteamRemoteStorage_v016() -> *mut ISteamRemoteStorage;
| ---------------------------------------------------------------------- similarly named function `SteamAPI_SteamRemoteStorage_v016` defined here
error[E0425]: cannot find function, tuple struct or tuple variant `SteamAPI_SteamUGC_v015` in crate `sys`
--> C:\Users\conta\.cargo\registry\src\github.com-1ecc6299db9ec823\steamworks-0.7.0\src\lib.rs:309:28
|
309 | let ugc = sys::SteamAPI_SteamUGC_v015();
| ^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `SteamAPI_SteamUGC_v016`
|
::: C:\Users\conta\Git\bevy-steamworks\target\debug\build\steamworks-sys-6bd566e14e720d9e\out/bindings.rs:27662:5
|
27662 | pub fn SteamAPI_SteamUGC_v016() -> *mut ISteamUGC;
| -------------------------------------------------- similarly named function `SteamAPI_SteamUGC_v016` defined here
Is it possible now with -Z configurable-env stablized to vendor the specific version of the Steamworks SDK alongside the crate itself?
Great library first of all! This actually makes working with steamworks quite pleasant. However, I'm facing some problems with the callback functions.
I would like to call e.g. UGC#create_item and then wait for the result. Since I will also need to poll for the results, it seems that using async future would be the best approach. However, if my knowledge of Rust guarantees is correct, the type of the callback function FnMut
makes this quite difficult.
I'm getting cannot move out of 'sender', a captured variable in an 'FnMut' closure
with the code below. Since the Sender type should implement Copy, I don't think simple Arc Mutex tricks work here either. Would you have some quick tips whether this approach would be feasible?
use futures::Future;
use futures::channel::oneshot;
use futures::channel::oneshot::Canceled;
use std::pin::Pin;
use steamworks::{PublishedFileId, AppId, SteamError};
use futures::lock::Mutex;
type CreateResult = Result<(PublishedFileId, bool), SteamError>;
fn create<M>(ugc: &steamworks::UGC<M>, app_id: AppId) -> Pin<Box<dyn Future<Output = Result<CreateResult, Canceled>>>> {
let (sender, receiver) = oneshot::channel::<CreateResult>();
ugc.create_item(app_id, steamworks::FileType::Community, move|res| {
sender.send(res).unwrap();
});
// TODO poll for receiver here
return Box::pin(receiver);
}
The documentation over on docs.rs fails to build.
The build log can be found at https://docs.rs/crate/steamworks/0.5.1/builds/164438 .
Here is a copy of the log output for your convenience:
$ rustc --version
rustc 1.37.0-nightly (37d001e4d 2019-05-29)
$ cratesfyi --version
cratesfyi 0.6.0 (254ceae 2019-06-04)
$ cratesfyi ...
Updating crates.io index
Downloading crates ...
Downloaded steamworks v0.5.1
Fresh unicode-xid v0.1.0
Fresh cc v1.0.37
Fresh itoa v0.4.4
Fresh autocfg v0.1.4
Fresh cfg-if v0.1.9
Fresh rustc-demangle v0.1.15
Fresh proc-macro2 v0.4.30
Fresh ryu v0.2.8
Fresh serde v1.0.92
Fresh libc v0.2.58
Fresh quote v0.6.12
Fresh bitflags v1.1.0
Fresh serde_json v1.0.39
Fresh backtrace-sys v0.1.28
Fresh syn v0.15.34
Fresh serde_derive v1.0.92
Fresh synstructure v0.10.2
Fresh backtrace v0.3.30
Compiling steamworks-sys v0.5.0
Fresh failure_derive v0.1.5
Fresh failure v0.1.5
Running `rustc --crate-name build_script_build /home/cratesfyi/.cargo/registry/src/github.com-1ecc6299db9ec823/steamworks-sys-0.5.0/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="docs-only"' -C metadata=a7ee3993ad721cac -C extra-filename=-a7ee3993ad721cac --out-dir /home/cratesfyi/cratesfyi/debug/build/steamworks-sys-a7ee3993ad721cac -L dependency=/home/cratesfyi/cratesfyi/debug/deps --extern cc=/home/cratesfyi/cratesfyi/debug/deps/libcc-53722e16c2fefd30.rlib --extern serde=/home/cratesfyi/cratesfyi/debug/deps/libserde-85f2515f5407ea2e.rlib --extern serde_derive=/home/cratesfyi/cratesfyi/debug/deps/libserde_derive-b1fc60a07632edde.so --extern serde_json=/home/cratesfyi/cratesfyi/debug/deps/libserde_json-b8a8a800ef5d0c87.rlib --cap-lints allow`
Running `/home/cratesfyi/cratesfyi/debug/build/steamworks-sys-a7ee3993ad721cac/build-script-build`
Running `rustc --crate-name steamworks_sys /home/cratesfyi/.cargo/registry/src/github.com-1ecc6299db9ec823/steamworks-sys-0.5.0/src/lib.rs --color never --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="docs-only"' -C metadata=a2a14fa14951002c -C extra-filename=-a2a14fa14951002c --out-dir /home/cratesfyi/cratesfyi/debug/deps -L dependency=/home/cratesfyi/cratesfyi/debug/deps --extern libc=/home/cratesfyi/cratesfyi/debug/deps/liblibc-3340795a62eaaed9.rmeta --cap-lints allow`
error: couldn't read /home/cratesfyi/cratesfyi/debug/build/steamworks-sys-2b7afdf3e2f467b2/out/bindings.rs: No such file or directory (os error 2)
--> /home/cratesfyi/.cargo/registry/src/github.com-1ecc6299db9ec823/steamworks-sys-0.5.0/src/lib.rs:7:1
|
7 | include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
thread 'main' panicked at 'ProcessError { desc: "process didn\'t exit successfully: `rustc --crate-name steamworks_sys /home/cratesfyi/.cargo/registry/src/github.com-1ecc6299db9ec823/steamworks-sys-0.5.0/src/lib.rs --color never --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg \'feature=\"default\"\' --cfg \'feature=\"docs-only\"\' -C metadata=a2a14fa14951002c -C extra-filename=-a2a14fa14951002c --out-dir /home/cratesfyi/cratesfyi/debug/deps -L dependency=/home/cratesfyi/cratesfyi/debug/deps --extern libc=/home/cratesfyi/cratesfyi/debug/deps/liblibc-3340795a62eaaed9.rmeta --cap-lints allow` (exit code: 1)", exit: Some(ExitStatus(ExitStatus(256))), output: None }
Could not compile `steamworks-sys`.', src/bin/cratesfyi.rs:160:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Due to the use of packed structures its current only safe to access the fields on structures via helper methods for -sys
related code.
Once rust-lang/rust#33158 is stable this should be fixable.
A DllNotFound error on Windows is fired if cargo run
is used when STEAM_SDK_LOCATION is set to a location outside the target folder.
According to the cargo docs:
Search paths included from any build script with the rustc-link-search instruction. **Paths outside of the target directory are removed.** It is the responsibility of the user running Cargo to properly set the environment if additional libraries on the system are needed in the search path.
steamworks-sys
already copies the required DLL to the OUT_DIR location. This can be easily fixed by copying the dynamic library first then using OUT_DIR as the link search path instead.
Its kind of hard to start using this library, as one has to poke around in the build scripts to figure out how to get this library to recognize the Steamworks SDK and build correctly. A readme with a general project overview, possibly a basic example, and some build instructions would be helpful for new users.
I'm getting this error
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InitFailed', src\main.rs:14:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Code
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use steamworks::AppId;
use steamworks::Client;
use steamworks::FriendFlags;
use steamworks::PersonaStateChange;
fn main() {
println!("test");
let (client, _single) = Client::init().unwrap();
println!("test");
}
Did I forget something?
Build script is failing with a bunch of errors like
.../public/steam/steam_api_common.h:227:54: error: use of undeclared identifier 'nullptr'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.