Giter VIP home page Giter VIP logo

steamworks.net's Introduction

Steamworks.NET

Steamworks.NET is a C# Wrapper for Valve's Steamworks API, it can be used either with Unity or your C# based Application.

Steamworks.NET was designed to be as close as possible to the original C++ API, as such the documentation provided from Valve largely covers usage of Steamworks.NET. Niceties and C# Idioms can be easily implemented on top of Steamworks.NET.

Steamworks.NET fully supports Windows (32 and 64 bit), OSX, and Linux. Currently building against Steamworks SDK 1.59.

Support via Paypal

Installation

You can find the installation instructions here.

Samples

Check out these sample projects to get started:

steamworks.net's People

Contributors

akarinnnnn avatar aw1534 avatar danielcrenna avatar gmman avatar jamesmcghee avatar martindevans avatar neophit avatar rlabrecque avatar sbeca avatar theace0296 avatar tilderain avatar twopoint-andychappell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steamworks.net's Issues

Unity 5.1.1f1 Error -> Failed to load 'Assets/Plugins/x86_64/CSteamworks.dll'

Hi,

I have installed Unity 5.1.1f1 and I get this error after I've reimported the project. When I was using 5.0.2 it wasn't happening. I've also updated Steamworks to 6.0.0.

The issue happens only the first time I launch the game in the editor. Launching the game a second time doesn't create the issue.

Here is the error:
Failed to load 'Assets/Plugins/x86_64/CSteamworks.dll' with error 'L’opération a réussi.
', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly.
SteamManager:Awake() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:92)
SteamManager:Awake() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:62)
UnityEngine.GameObject:AddComponent()
SteamManager:get_Instance() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:20)
SteamManager:get_Initialized() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:27)
SteamStatsAndAchievements:OnEnable() (at Assets/Scripts/Steamwork.NET/SteamStatsAndAchievements.cs:225)

Thanks for your help!

Issue with BDecryptToken() (SDK v1.31)

Hello! I found that SteamEncryptedAppTicket.BDecryptTicket() returns always false. It happens because native method has wrong signature - out pcubTicketDecrypted instead of ref pcubTicketDecrypted.
Correct method declaration resolved this issue:

public static extern bool BDecryptTicket(byte[] rgubTicketEncrypted, uint cubTicketEncrypted, byte[] rgubTicketDecrypted, ref uint pcubTicketDecrypted, [MarshalAs(UnmanagedType.LPArray, SizeConst=Constants.k_nSteamEncryptedAppTicketSymmetricKeyLen)] byte[] rgubKey, int cubKey);

SteamManager destroys itself if the game object has the component two or more times

Hey,

Just thought I'd let you know that your singleton approach for the SteamManager has an issue if the game object has more than one instance of the component.

This code:

if (s_instance != null) {
  Destroy(gameObject);
  return;
}

destroys the game object, making the s_instance null.

To prevent this, Unity has a nice class attribute you can add to the script:

[DisallowMultipleComponent]

http://docs.unity3d.com/ScriptReference/DisallowMultipleComponent.html

Of course this is just a minor thing, but I thought I'd share, especially since it's such a simple fix :)

GetCurrentGameLanguage()

Hi,

sorry if that's not the right section for such questions.

I'm currently trying to get the GetCurrentGameLanguage()-thing working. Basically, my app has other languages, which I have stored inside my app via Daikon Forge's LanguageManager (http://www.daikonforge.com/forums/threads/localization-support.418/#post-2680).

If a SteamUser has, for example, choosen German as his/her language on my app (MyAPP > Settings > Language), the app will check on startup, which language was set by the user and will then load the desired language .

My Script looks like this:

using UnityEngine;
using System.Collections;
using Steamworks;

public class SteamLocalization : MonoBehaviour {

    //Steam Localization
    void Start() {
        if (SteamManager.Initialized) {
            if (SteamApps.GetCurrentGameLanguage() == "english") {
                Debug.Log("eng");
                SetLangEN();
            }

            if (SteamApps.GetCurrentGameLanguage() == "german") {
                Debug.Log("ger");
                SetLangDE();
            }

            if (SteamApps.GetCurrentGameLanguage() == "spanish") {
                Debug.Log("esp");
                SetLangES();
            }
        }
    }

    //AVAILABLE LANGUAGES
    void SetLangEN() {
        GetComponent<dfLanguageManager>().LoadLanguage(dfLanguageCode.EN);  
    }

    void SetLangDE() {
        GetComponent<dfLanguageManager>().LoadLanguage(dfLanguageCode.DE);  
    }

    void SetLangES() {
        GetComponent<dfLanguageManager>().LoadLanguage(dfLanguageCode.ES);  
    }

    void OnGUI() {
        GUILayout.Label("SteamApps.GetAvailableGameLanguages() = " + SteamApps.GetAvailableGameLanguages());
        GUILayout.Label("SteamApps.GetCurrentGameLanguage() = " + SteamApps.GetCurrentGameLanguage());
    }
}

But it doesn't seem to be right?! I honestly don't know if "if (SteamApps.GetCurrentGameLanguage() == "english")" is even written right... I'm not really that good in programming. Atleast my console prints out the "eng"-debug log. That seems to work.

Could someone enlighten me?

Regards,
Maurice

ValidateAuthTicketResponse_t Invalid Random Steam ID and Always k_EAuthSessionResponseVACBanned

The steam IDs in the ValidateAuthTicketResponse_t callback are always random invalid Steam IDs.

[143 - ValidateAuthTicketResponse] - 532846528 -- k_EAuthSessionResponseVACBanned -- 2041564291282239631

They're always different each time it's called. Obviously my steam account is not VAC banned and I have the same issue even when the server isn't VAC protected.

I'm using Unity 5.0 beta5 64 Bit. This wasn't happening in Unity 4.6 using the exact same code.

Crash in Wrapper at SteamAPI_InitSafe()

Hey,

I am using Unity 5 64bit(pro) with Steamworks.NET (latest branch) and Steamworks SDK 1.33a
I compile my project for Linux x86 (32bit) with the SteamManager.cs attached to an object in the first scene.

When downloading and installing the game through steam onto a Linux 32bit machine (in this case I tried Ubuntu 12.04 LTS 32bit and Ubuntu 14.04 32bit) the game will crash upon launch.
The issue seems to be in the Steamworks.NativeMethods.SteamAPI_InitSafe().

When uploading a build without the SteamManager attached to anything ,the game launches fine.

Could this be fixed when not using the #define VERSION_SAFE_STEAM_API_INTERFACES ? (Steam.cs)
(there is no way to test that, I would need the recompilled dll's without this safe define.)

Log:
Stacktrace:

at (wrapper managed-to-native) Steamworks.NativeMethods.SteamAPI_InitSafe () <0x00004>
at (wrapper managed-to-native) Steamworks.NativeMethods.SteamAPI_InitSafe () <0x00004>
at Steamworks.SteamAPI.Init () [0x0001a] in C:\Projects\<game>\Code\<game>_Xbone\Assets\Plugins\Steamworks.NET\Steam.cs:58
at SteamManager.Awake () [0x0009b] in C:\Projects\<game>\Code\<game>_Xbone\Assets\<company>_Assets\Scripts\Steam\SteamManager.cs:92
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0001c, 0x0008e>

Native stacktrace:

/home/simon/.steam/steam/steamapps/common/<game>/<game>_Data/Mono/x86/libmono.so(+0x8b743) [0xb58b8743]
[0xb76ffd34]
[0xb76ffd4c]
/lib/i386-linux-gnu/libc.so.6(gsignal+0x47) [0xb72c7607]
/lib/i386-linux-gnu/libc.so.6(abort+0x143) [0xb72caa33]
/lib/i386-linux-gnu/libc.so.6(+0x68e53) [0xb7301e53]
/lib/i386-linux-gnu/libc.so.6(+0x7333a) [0xb730c33a]
/lib/i386-linux-gnu/libc.so.6(+0x73fad) [0xb730cfad]
/home/simon/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdlPv+0x1f) [0xb71f8a4f]
/home/simon/.steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1b) [0xb725d55b]
/home/simon/.steam/ubuntu12_32/libsteam.so(+0x6f6b4) [0xa59d26b4]
/home/simon/.steam/ubuntu12_32/libsteam.so(+0xd21a8) [0xa5a351a8]
/home/simon/.steam/ubuntu12_32/libsteam.so(+0x28735a) [0xa5bea35a]
/home/simon/.steam/ubuntu12_32/libsteam.so(+0x1c537) [0xa597f537]
/lib/ld-linux.so.2(+0xed37) [0xb7710d37]

Linux 64 bit: GameServer.Init crashing / LogOnAnonymous () not succeeding

Hi there,

just posting this here so it's also known for others. Still not sure where it fails but earlier when calling GameServer.Init on a 64 bit Linux Unity build the game would simply crash. That seems to have been fixed (maybe a Steam client update or Unity update) so it does no longer crash.

Current state is that GameServer.Init() returns true but after calling SteamGameServer.LogOnAnonymous() and SteamGameServer.BLoggedOn() never returns true. This does work on all other tested platforms with the same code (MacOS 32, Win32, Win64, Linux 32) and even works with using SteamAPI with a native test app.

Unity test project: http://illy.bz/tmp/LinuxCrashTest.tar.bz2
Minimum working example for native C++: http://illy.bz/tmp/LinuxNativeTest.cpp

May as well be a problem in SteamAPI / SteamClient itself but as the native code works as well as the 32 bit build I'm not completely sure on this part.

Regards,
Chris

PS: Other than that issue it's really a great piece of software, works flawlessly as long as you don't forget to actually create the callbacks you want to get called ;)

Steamworks.NET + Windows Store/ Windows Phone 8 builds

Hi there,

iam using your plugin in my cross platform project, which handles a lot of platforms, including windows store and windows phone 8.

While the windows standalone builds, android and ios builds are working as intented, troubles shows up as soon as I set the target to windows store or windows phone 8.

This is easily been reproducable by using your example project.

Assets\Plugins\Steamworks.NET\InteropHelp.cs(107,31): error CS0246: Type or namespace "ICustomMarshaler" could not been found.


Error building Player: Exception: Error: method System.String System.Text.Encoding::GetString(System.Byte[]) doesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.String Steamworks.InteropHelp::PtrToStringUTF8(System.IntPtr).
Error: method System.Void System.Runtime.InteropServices.Marshal::Copy(System.IntPtr[],System.Int32,System.IntPtr,System.Int32) doesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Void Steamworks.InteropHelp/SteamParamStringArray::.ctor(System.Collections.Generic.IList1<System.String>). Error: typeSystem.Runtime.InteropServices.ICustomMarshalerdoesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at Steamworks.UTF8Marshaler. Error: methodSystem.String System.Text.Encoding::GetString(System.Byte[])doesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Object Steamworks.UTF8Marshaler::MarshalNativeToManaged(System.IntPtr). Error: typeSystem.Runtime.InteropServices.ICustomMarshalerdoesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Runtime.InteropServices.ICustomMarshaler Steamworks.UTF8Marshaler::GetInstance(System.String). Error: typeSystem.Diagnostics.FileVersionInfodoesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean Steamworks.DllCheck::CheckSteamAPIDLL(). Error: typeSystem.Diagnostics.FileVersionInfodoesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean Steamworks.DllCheck::CheckSteamAPIDLL(). Error: methodSystem.Diagnostics.FileVersionInfo System.Diagnostics.FileVersionInfo::GetVersionInfo(System.String)doesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean Steamworks.DllCheck::CheckSteamAPIDLL(). Error: typeSystem.Diagnostics.FileVersionInfodoesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean Steamworks.DllCheck::CheckSteamAPIDLL(). Error: methodSystem.String System.Diagnostics.FileVersionInfo::get_FileVersion()` doesn't exist in target framework. It is referenced from Assembly-CSharp-firstpass.dll at System.Boolean Steamworks.DllCheck::CheckSteamAPIDLL().

I could fix those issues by appending the compiler flags to handle the builds, but maybe you have already come around this issue!? (and maybe a better way to handle those builds, beside adding UNITY_METRO & UNITY_WP8)

Using matchmaking functionality

Hello everybody
Please i wanted to know where can i find the matchmaking functionality like

Searching a lobby
SteamAPICall_t RequestLobbyList()

Creating a lobby
SteamAPICall_t CreateLobby( ELobbyType eLobbyType, int cMaxMembers );

Joining a lobby
SteamAPICall_t JoinLobby( CSteamID steamIDLobby );

on SteamAPICall_t i didn't found none of them and on Matchmaking folder there are just HServerListRequest HServerQuery but nothing about lobby

thank you

IsSteamRunning() doesn't work on Linux

I use IsSteamRunning() to check if I should execute Steamworks code when I need it (better than try catching everything :P). I was wondering if this is a correct usage, or if I should use the result of SteamAPI.Init() to determine whether to run additional Steamworks code?

Anyway, that works fine on Windows, but on Linux (Ubuntu) IsSteamRunning() seems to always return true, even if the Steam client is not running and SteamAPI.Init() returns false.

NoHasLisence problem

Hi!
I ran into strange thing.
In manual written "If the user does not own the current AppID, ValidateAuthTicketResponse_t::m_eAuthSessionResponse will be set to k_EAuthSessionResponseNoLicenseOrExpired"
BUT If I don't have license to appID I don't receive any messages after GetAuthSessionTicket. Just this
SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket) - 0 -- 0
It occurs even in example project. Maybe I do something wrong?
params: latest wrapper build. Unity 4.5.0f6. OSX 10.9.3

DllNotFoundException on OS X

I am having trouble getting Steamworks.NET working on an OS X port of a Monogame-based game. The Steamworks integration is already working on Windows.

I have downloaded the complete Steamworks.NET-Standalone_5.0.0 release and added a reference to the OSX-Linux-x86/Steamworks.NET.dll in my project.

I have then manually copied steam_appid.txt (changing the appid to our own), CSteamworks.bundle, and Steamworks.NET.dll.config files inside our Game.app/Contents/MonoBundle/ folder, right next to the Game.exe.

However, when I launch the game I get this exception from Steamworks.SteamAPI.Init():

System.DllNotFoundException: CSteamworks.bundle/Contents/MacOS/CSteamworks
at at (wrapper managed-to-native) Steamworks.NativeMethods.SteamAPI_InitSafe () <IL 0x00011, 0x0008f>
at at Steamworks.SteamAPI.Init () <IL 0x00005, 0x0002b>

What have I missed?

Any help would be highly appreciated, as this is one of the very last problems that our team has before releasing our first game on Steam. Thanks!

Issues in Steamworks.NET when targeting other platforms

Hi, first, thanks for all the time and effort you've put into this! The issue is when selecting web player as the target, this gives a compile error in InteropHelp.cs and compile errors for several of the 32/64bit dlls (libsteam_api and CSteamworks).

These can be worked around by wrapping CheckSteamAPIDLL() in a platform check and making sure the dlls are only targeting Editor/Standalone rather than all platforms.

DllNotFoundException

Hello =^)

I'm on Windows.
I can't seems to make the plugin run properly under Unity 5. I did imported the package correctly. The dll are normally in correct folders.
Yet I get the following errors:
Failed to load 'Assets/Plugins/x86_64/CSteamworks.dll' with error 'The specified module could not be found.
', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly.
SteamManager:Awake() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:92)
SteamManager:Awake() (at Assets/Scripts/Steamwork.NET/SteamManager.cs:62)
And
[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.
System.DllNotFoundException: Assets/Plugins/x86_64/CSteamworks.dll
at (wrapper managed-to-native) Steamworks.NativeMethods:SteamAPI_RestartAppIfNecessary (Steamworks.AppId_t)

But I read the documentation, and steam_api.dll is at the correct location (at the root of my project, above Assets folder)

So I don't know what to do :^(

Nanorock

Out of Memory Issues

Running into out of memory errors in the editor and builds with Steamworks.net. This happens a lot when requesting leaderboard stats, and when quitting the game:

Could not allocate memory: System out of memory! Trying to allocate 4197694132B with 4 alignment. Memory label UTF16String, Allocation Happend at: line 133 in ....TextUtil.cpp

And on exit:

Fatal error! CheckDisalowAllocation. Allocating memory when it is not allowed to allocate memory.

Tested on Windows 7/8 and Unity 4.3.7p3 with Steamworks.net "Stable, 5.0.0 unitypackage". Using Steam SDK 1.31. Build settings in Unity are set to x86_64

Steamworks SDK 1.32

Steamworks SDK 1.32 Includes the Steam Inventory API along with a few other misc things.

It unfortunately dropped the same day that I was starting my vacation, I'll be back on wth 19th and should have it completed then. Working on it over RDP is pretty difficult, but some progress has been made.

We won't be using the C# interop file provided by Valve as it seems to not even work out of the box, nor does it provide everything currently.

We won't be using the C Flat API provided by Valve for now, but it will be fun to start experimenting with that once I get back. It would be nice to get rid of CSteamworks.

Steamworks cannot find DLL

Hi there, I'm using Steamworks for my game and it's running on Mac and PC.

Mac version is running fine, but PC version cannot find steam_api.dll.
"[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details."

The error debug tells me that the file should be at the folder:
GAME_FOLDER/eus_data/Plugins/steam_api.dll

And well... it is there!

I'm running the game from within Steam.

Any help would be great! :)

Callback<Steamworks.GameOverlayActivated_t>' does not contain a definition for `Create'

Hi Guys,

Sorry for asking this question (it's probably something really simple to fix), but I can't figure it out.

I have implemented your SteamScript like on your page, but when I add the Callbacks I get this error:
Assets/Scripts/Steamwork.NET/SteamScript.cs(12,83): error CS0117: Callback<Steamworks.GameOverlayActivated_t>' does not contain a definition forCreate'

Did I miss something?
Thanks.

PS: Obviously I have imported the unity package 6.0.0 and followed the tutorials.
I can run the game with steam (the shift - tab menu works), etc.

Installation instructions are confusing

I find the instructions on https://steamworks.github.io/installation/ confusing:

"Download the .unitypackage Stable (6.0.0) or Clone from Github
Extract and copy Steamworks.NET’s Plugins/ and Editor/ folders into your Assets/ folder.
Launch your Unity project. The included editor scripts will copy steam_appid.txt (and steam_api.dll if your on windows) into the root of your project.
Open steam_appid.txt which now resides in the root of your Unity project and replace 480 with your own AppId."

"Extracting" a Unity package is unclear. Does it mean opening it with Unity? Does it mean renaming it to ZIP and extracting it that way?
"copy Steamworks.NET’s Plugins/ and Editor/ folders into your Assets/ folder" suggests manual file copying (which makes the previous line more ambiguous). The most logical step seemed to be to open the package with Unity and just import the Plugins and Editor folders. But that didn't work at all.

When I watched the video here https://www.youtube.com/watch?v=3FJzehQrqJE it became clear what I had to do.

Is it possible this was written before there was Unity bundle?

May I suggest: "Open the package with Unity and import everything"?

Crash in RunCallbacks() in Standalone 6.0.0

Using Steamworks.NET 6.0 standalone Steam API 3.2, I get a System.AccessViolationException after a callback is requested in RunCallbacks(). It happens in native code so there's very little I can tell about this.

A friend using 3.0.0 and API 2.29 didn't have the error, so I switched that version, where there is no crash. If there isn't any advantage to using 6.0 I can just use 3.0 for the time being.

Here is what I'm doing:

//Condensed for brevity/clarity
if (Steamworks.SteamAPI.Init())
{
    mSteamID = new Steamworks.CGameID(Steamworks.SteamUtils.GetAppID());

    m_UserStatsReceived = Steamworks.Callback<Steamworks.UserStatsReceived_t>.Create(OnUserStatsReceived);
    mTrophiesRequested = Steamworks.SteamUserStats.RequestCurrentStats();
}

And then, in the main loop,

    Steamworks.SteamAPI.RunCallbacks();  //Exception.

If I do not request current stats, I don't have the crash.

Standalone - callbacks never return :(

Hi there

Trying to get a non unity project working and getting errors in many ways I tried, the most obvious one is this one.

Given this code

            _steamInited = SteamAPI.Init();

            Thread.Sleep(100);

            if(!_steamInited)
            {
                Console.WriteLine("SteamAPI.Init() failed!");
                return;
            }
            Console.WriteLine("Packsize.Test() returned: {0}", Packsize.Test());


             Callback<UserStatsReceived_t>.Create(OnUserStatsReceived);

            //    Callback<LeaderboardScoresDownloaded_t>.Create(OnLeaderboardDataReceived);


            while (!Console.KeyAvailable)
            {
                SteamAPI.RunCallbacks();
                Console.Write("+");
                Thread.Sleep(100);
            }

            SteamAPI.Shutdown();

I never get a result back. Any ideas?

Thanks :)

What callback for InviteUserToGame?

I use InviteUserToGame to invite others to join my game. I don't use Steam game lobbies for matchmaking so I want to be able to send a string with a match ID from my own system. My setup works for when the other player hasn't opened the game yet. InviteUserToGame makes your friend get a match request in his steam chat, which he can accept and that prompts him if he wants to open the game with the matchId as a command line argument. And that's great :)

But I want this to work when your friend already has the game opened. I'm guessing there's a callback that gets called and I tried using the GameLobbyJoinRequested_t, but it won't trigger. I was wondering what callback I should register to receive a InviteUserToGame message.

Switch folder structure to have Steamworks files in one place

Hi Riley,

not sure if you even want to do this as it would break compatibility with older Unity versions ... but with Unity 5 we finally could have everything regarding Steamworks(.NET) in one place, e.g.

  • Assets/Steamworks.NET
    • Editor (Editor only scripts)
    • Scripts (Normal scripts that are currently in Plugins/Steamworks.NET)
    • Plugins
      • x86
      • x64

At least according to the docs this should work fine and would make management a bit easier IMHO. Maybe the only thing left open would be the native Windows Steam libraries that seem to still have to go to the project root in standalone builds but that could be a postbuild script.

Regards,
Chris

steam init fails on unity4.3 mac osx

I'm using the Steamworks.NET -Test-master in Unity 4.3.4 on OS X10.8.5 and I always get the
SteamAPI_Init() failed in the console. I've tried using my app id from the
store page and the default one 480 from the steam_appid.txt file but it
never connects. What have I missed? Do i need to copy dlls to root folder?
if so, where are the instructions for doing that?

Any tips very appreciated.

SteamServersConnected callback not being called

SteamServersConnected is never being called, even though the steam calls match exactly with the C++ example.

GameServer.Init(0, 8766, 27015, 27016, EServerMode.eServerModeAuthenticationAndSecure, "1.0.0.0");

SteamGameServer.SetModDir("spacewar");
SteamGameServer.SetProduct("SteamworksExample");
SteamGameServer.SetGameDescription("Steamworks Example");
SteamGameServer.LogOnAnonymous();
SteamGameServer.EnableHeartbeats(true);

Latest version not working on OSX

I get the error "SteamAPI_Init failed" when trying to initialize steamworks. I have tried rebuilding the .bundle on a mac, which gives the same error.

I tried using the .bundle from your example project which works fine (it is an older version), so I guess something has happened with the latest build.

Unity plugin - Build and Run works, build (and then run the .exe) doesn't!

UPDATE: It seems that the 'strange behaviour' is that you get the overlay when building and running, NOT that you don't get it when running the .exe.

I've tried other steam games, and all of them fail to show the overlay unless you run them via the steam client. Kind of bizarre that Unity manages to get it to happen...

Please disregard this issue, as it isn't one :)

Having a VERY strange problem here:

If I run in the editor, all is well and Shift+Tab brings up the overlay.

If I hit 'build and run', all is well and Shift+Tab brings up the overlay.

If I then double click the exact same .exe, Shift+Tab does nothing! The API still seems to be working as the messages on-screen are correct, but it's impossible to bring up the overlay.

I'm at a complete loss as to why "build and run" should be different from double clicking the exe. Any ideas?

NB: This also happens with the spacewar-based example I got from here, not just my project.

64bit Editor issues - RequestInternetServerList

NOTHISPTR is always defined in editor - even if the editor is 64bit. This was causing the callbacks to return junk in Unity5.

After fixing this, I'm finding that querying servers isn't working as I'd expect. It seems like the filters don't get applied properly?

        filterArray = new Steamworks.MatchMakingKeyValuePair_t[3];
        filterArray[0].m_szKey = "gamedir";
        filterArray[0].m_szValue = "rust";

        filterArray[1].m_szKey = "secure";
        filterArray[1].m_szValue = "1";

        filterArray[2].m_szKey = "gametagsand";
        filterArray[2].m_szValue = "official";

        request = Steamworks.SteamMatchmakingServers.RequestInternetServerList( SteamSystem.STEAM_APPID, filterArray, (uint)filterArray.Length, serverResponder );

Fallback handler could not load library

I followed the instructions to add the package to Unity, and then setup some simple scripts with the excellent documentation. Everything works great in the editor, I could debug my Steam user name and see that I was in game when loaded in editor. I updated steam_appid.txt with my app id and confirmed dll locations. I then uploaded to steam on a private alpha channel. App crashes as soon as I try to load SteamManager (before any custom scripts). Odd thing is I looked and confirmed the files it says could not load are indeed in the locations its looking for them in. I was originally using Unity 5.0.1f, but I tried updating to 5.1.1 (latest version), same error.

Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.
System.DllNotFoundException: C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll

at (wrapper managed-to-native) Steamworks.NativeMethods:SteamAPI_RestartAppIfNecessary (Steamworks.AppId_t)

at Steamworks.SteamAPI.RestartAppIfNecessary (AppId_t unOwnAppID) [0x00000] in :0

at SteamManager.Awake () [0x00000] in :0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)

Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/.\libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll
Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Mono/libC:/Program Files (x86)/Steam/steamapps/common/Quadrant/quadrant_Data/Plugins/CSteamworks.dll

Unable to upload on Mac Appstore due to incorect code signing (SDK 1.31)

Hello !

I'm using Steamwork for my game on PC / Mac / Linux / iPad / Android.
Your package works great and did the job. Thanks for that.

The game will be also available on the Mac AppStore. There is my problem.
I can't code sign the bundle of your package.

This is the error : CSteamworks.bundle: main executable failed strict validation
In subcomponent: /CSteamworks.bundle/Contents/MacOS/libsteam_api.dylib

Have you an idea on what's going on ?

Maybe I need to directly sign the bundle with my own certificates in xcode.

Thanks a lot for the wrapper again.

System.AccessViolationException when requesting current user stats

On my machine, running the following code produces an AccessViolationException in the RunCallbacks method:

    Environment.SetEnvironmentVariable("SteamAppId", NW.STEAMAPPID.ToString());
    SteamAPI.Init();
    var cb = Callback<UserStatsReceived_t>.Create((UserStatsReceived_t pCallback) => {
      Console.WriteLine(pCallback.m_eResult);
    });
    bool bSuccess = SteamUserStats.RequestCurrentStats();
    SteamAPI.RunCallbacks();
    System.Threading.Thread.Sleep(1000);
    SteamAPI.RunCallbacks();

This also happens when I run with the Spacewar AppID.

Also, bSuccess == true, and the callback never gets called. The exception occurs on the second RunCallbacks() call.

If I don't set the callback, the exception does not get thrown.

Unity 5: Some Callbacks never getting called (eg LobbyCreated_t, LobbyChatMsg_t)

Steamworks SDK 1.31 64-bit
Steamworks.NET 5.0.0

I've verified the SteamAPI DLL is absolutely the correct version and size. I'm using the SpaceWar app ID.

When I run the example Steamworks.NET and create a lobby, the LobbyCreated_t Callresult is never called. However if I change it to a Callback it does get called, but the data in the structure seems invalid or uninitialised. It still creates and enters the lobby however.

Similarly if I create and enter a lobby, then use SendLobbyMsg the Callback LobbyChatMsg_t is never received.

A lot of the callbacks are working, but why are a few never getting called? I browsed through the Steam SDK and the headers don't indicate any change to the API that has slipped by.

Small nit pick at the FAQ

On the item "Does the Steam DRM wrapper work with Unity or XNA/Monogame?", the FAQ says Unity games can't be wrapped. This is not true; I've seen a number of Unity games wrapped with Steam DRM. Steam DRM can't wrap .NET assemblies because newer Windows versions (XP and above) never executes the native code stub and directly starts up the .NET runtime. Unity, however, is a pure native code program with embedded support for Mono, and is thus wrappable. It is still true XNA/MonoGame executables can't be wrapped, unless the developer writes a native code loader for the assemblies first.

Recursive Leaderboard callbacks do not work.

Calling SteamUserStats.DownloadLeaderboardEntries() from within the callresult function of an earlier call does not work (the new call is never callresulted).

This works with C Steamworks (at least, I did it with the Ludosity plugin, so I'd blame the wrapper not Steamworks).

I was using this to incrementally get scores first from around the player, then the top 20, then their friends, and merge them as they arrive. Workaround was to just fire off all 3 calls from the start, which seems to give better results anyway (less lag).

Unity 5.1 support

In CallbackDispacher.cs and Packsize.cs it needs to check UNITY_5_1

Ideally it checks...

UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_5_7 || UNITY_5_8 || UNITY_5_9

Thanks for an awesome package :-)

Documentation

Even though this is suppose to be 1:1 with Steams C++ SDK, compiling documentation or multiple examples for the following:

  • Achievements (done)
  • Stats (done)
  • Steam Controller
  • Multiplayer
    • Connecting / Disconnecting
    • Lobbies

This will make it 100 times better then Ludosity's SDK.

Callback hack

Hello,

I'm having trouble to make achievements working, even while using the example provided :^/
When I'm getting the callback from OnUserStatsReceived, the m_GameID is different than the pCallback.m_nGameID, I never get one with my correct game id :^( (And by passing this test, of course none of my achievements are loaded)

And I stumbled upon this:
// This is a temporary hack to preserve backwards compatability with the old CallbackDispatcher.
// If this is still here in 5.0.0 yell at me.
;^) I won't yell at you, would be silly from me, but I figured out I could remind you that + ask if you encountered such problem, or have any idea why I don't get my achievements ^^'

Nanorock

[OSX] Standalone Test doesn't run on mono 3.2.7 and higher

After running into problems with our game on OSX, I have tried running the standalone test on OSX. This also does not work. Something goes wrong in the native library while running the callbacks. The full application output is as follows.

Setting breakpad minidump AppID = 480
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198005606492 [API loaded no]
CurrentGameLanguage: 
PersonaName: Cireon
AppInstallDir: 71 /Users/Tom/Library/Application Support/Steam/steamapps/common/Spacewar
Reqesting Current Stats
GetNumberOfCurrentPlayers() - 330780208267574
[304 - PersonaStateChange] - 6331461952 -- k_EPersonaChangeGamePlayed, k_EPersonaChangeGameServer, k_EPersonaChangeLeftSource
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Steamworks.NativeMethods.SteamAPI_RunCallbacks () <IL 0x00022, 0xffffffff>
  at Steamworks.SteamAPI.RunCallbacks () <IL 0x00005, 0x0002b>
  at SteamworksNET_StandaloneTest.Program.Main (string[]) [0x00125] in /Users/Tom/Projects/SteamStats/SteamStats/Program.cs:46
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:


Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.TXPbWj'
Executing commands in '/private/tmp/mono-gdb-commands.TXPbWj'.
(lldb) process attach --pid 1605
Process 1605 stopped
Executable module set to "/Library/Frameworks/Mono.framework/Versions/3.10.0/bin/mono".
Architecture set to: i386-apple-macosx.
(lldb) thread list
Process 1605 stopped
* thread #1: tid = 0x1f725, 0x98eaae1a libsystem_kernel.dylib`__wait4 + 10, name = 'MainThrd', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x1f727, 0x98ea4a6a libsystem_kernel.dylib`semaphore_wait_trap + 10
  thread #3: tid = 0x1f728, 0x98eab8d2 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
  thread #4: tid = 0x1f729, 0x98eaa772 libsystem_kernel.dylib`__recvfrom + 10
  thread #5: tid = 0x1f72c, 0x98eab8b6 libsystem_kernel.dylib`kevent + 10, name = 'IOPollingHelperThread'
  thread #6: tid = 0x1f72d, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0x1f72e, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread backtrace all
* thread #1: tid = 0x1f725, 0x98eaae1a libsystem_kernel.dylib`__wait4 + 10, name = 'MainThrd', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x98eaae1a libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x95ce4b25 libsystem_c.dylib`waitpid$UNIX2003 + 48
    frame #2: 0x0015540d mono`mono_handle_native_sigsegv(signal=11, ctx=0x00787fe0) + 541 at mini-exceptions.c:2323
    frame #3: 0x001a595b mono`mono_arch_handle_altstack_exception(sigctx=<unavailable>, fault_addr=<unavailable>, stack_ovf=0) + 155 at exceptions-x86.c:1159
    frame #4: 0x000a658d mono`mono_sigsegv_signal_handler(_dummy=<unavailable>, info=<unavailable>, context=<unavailable>) + 445 at mini.c:6861
    frame #5: 0x94e5503b libsystem_platform.dylib`_sigtramp + 43

  thread #2: tid = 0x1f727, 0x98ea4a6a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x98ea4a6a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x002fbc9a mono`mono_sem_wait(sem=0x00401658, alertable=1) + 26 at mono-semaphore.c:103
    frame #2: 0x00267c3e mono`finalizer_thread(unused=0x00000000) + 142 at gc.c:1077
    frame #3: 0x00244c42 mono`start_wrapper [inlined] start_wrapper_internal + 485 at threads.c:660
    frame #4: 0x00244a5d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:707
    frame #5: 0x00301060 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:88
    frame #6: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #3: tid = 0x1f728, 0x98eab8d2 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x98eab8d2 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x9304073f libdispatch.dylib`_dispatch_mgr_invoke + 245
    frame #2: 0x930403a2 libdispatch.dylib`_dispatch_mgr_thread + 52

  thread #4: tid = 0x1f729, 0x98eaa772 libsystem_kernel.dylib`__recvfrom + 10
    frame #0: 0x98eaa772 libsystem_kernel.dylib`__recvfrom + 10
    frame #1: 0x95ce4d32 libsystem_c.dylib`recv$UNIX2003 + 55
    frame #2: 0x0018d3e8 mono`socket_transport_recv(buf=<unavailable>, len=<unavailable>) + 168 at debugger-agent.c:1131
    frame #3: 0x0017f4a7 mono`debugger_thread [inlined] transport_recv(len=<unavailable>) + 31 at debugger-agent.c:1557
    frame #4: 0x0017f488 mono`debugger_thread(arg=0x00000000) + 1560 at debugger-agent.c:9565
    frame #5: 0x00301060 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:88
    frame #6: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #5: tid = 0x1f72c, 0x98eab8b6 libsystem_kernel.dylib`kevent + 10, name = 'IOPollingHelperThread'
    frame #0: 0x98eab8b6 libsystem_kernel.dylib`kevent + 10
    frame #1: 0x01f5127e steamclient.dylib`OSXHelpers::CIOPollingHelper::RealRun() + 286
    frame #2: 0x03020a9d libtier0_s.dylib`CatchAndWriteContext_t::Invoke() + 159
    frame #3: 0x0302049f libtier0_s.dylib`CatchAndWriteMiniDump_Impl(CatchAndWriteContext_t&) + 214
    frame #4: 0x03020586 libtier0_s.dylib`CatchAndWriteMiniDumpExForVoidPtrFn + 87
    frame #5: 0x030205af libtier0_s.dylib`CatchAndWriteMiniDumpForVoidPtrFn + 35
    frame #6: 0x01f5114f steamclient.dylib`OSXHelpers::CIOPollingHelper::Run() + 41
    frame #7: 0x03025030 libtier0_s.dylib`SteamThreadTools::CThread::ThreadExceptionWrapper(void*) + 16
    frame #8: 0x03020a9d libtier0_s.dylib`CatchAndWriteContext_t::Invoke() + 159
    frame #9: 0x0302049f libtier0_s.dylib`CatchAndWriteMiniDump_Impl(CatchAndWriteContext_t&) + 214
    frame #10: 0x03020586 libtier0_s.dylib`CatchAndWriteMiniDumpExForVoidPtrFn + 87
    frame #11: 0x030205af libtier0_s.dylib`CatchAndWriteMiniDumpForVoidPtrFn + 35
    frame #12: 0x03024fa4 libtier0_s.dylib`SteamThreadTools::CThread::ThreadProc(void*) + 238
    frame #13: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #14: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #15: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #6: tid = 0x1f72d, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30

  thread #7: tid = 0x1f72e, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30
(lldb) detach

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Process 1605 detached
(lldb) quit
(lldb) Abort trap: 6

The code from the StandAlone test was copied into an empty C# Console Project made through Xamarin. The OSX/Linux dll was added as reference and the CSteamworks.bundle, steam_appid.txt and Steamworks.NET.dll.config were added to the build folder.

Oddly enough, Steamworks.NET seems to just run fine through Unity, but my knowledge of Unity is too limited to be aware of the differences that could cause his.

Upgraded to Steamworks.NET 6.0.0, and SteamAPI.Init() doesn't work on a Mac anymore

Trying to init SteamAPI on mac results in the following error:

[S_API FAIL] SteamAPI_Init() failed; ipcserver GetSteamPath failed.
[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.dylib.
[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.

The game was started from Steam, so Steam was definitely running. This used to work properly on version 4.0.0. I checked the documentation and didn't see anything pertaining to this specific problem.

RunCallbacks throws AccessViolationException

When calling CreateLobby and setting the handle of the CallResult of LobbyCreated_t then RunCallbacks throws AccessViolationException.

CallResult<LobbyCreated_t> m_LobbyCreated;

SteamAPI.Init();
m_LobbyCreated = CallResult<LobbyCreated_t>.Create((LobbyCreated_t t, bool failure) =>
{
    Console.WriteLine("callresult");
});
SteamAPICall_t t1 = SteamMatchmaking.CreateLobby(ELobbyType.k_ELobbyTypePublic, 2);
m_LobbyCreated.Set(t1);

SteamAPI.RunCallbacks();

This applies to the standalone version.

SteamUGC.GetSubscribedItems doesn't work

As I noted in this discussion thread, SteamUGC.GetSubscribedItems doesn't work - it never populates any items into the passed array. I was able to get it to work on my end by applying the [Out] attribute to the p/invoke call:
public static extern uint ISteamUGC_GetSubscribedItems([Out] PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries);

I'm filing an issue rather than a pull request because I'm not too familiar with p/invoke and I'm not sure this is completely the right thing to do, but it fixed this issue for me.

Thanks for your wrapper, it's be very easy to implement in general!

GetSubscribedItems bug

ISteamUGC's GetSubscribedItems() isn't filling the array with the items. The number of items returned is correct, but the array isn't populated.

Looking at the 5.0.0, NativeMethods.cs, the call looked like this:

public static extern uint ISteamUGC_GetSubscribedItems(PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries);

The 'pvecPublishedFileID' should be [In, Out], like so:

public static extern uint ISteamUGC_GetSubscribedItems([In, Out] PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries);

Great product by the way. Keep up the good work. :)

CSteamID has incorrect visibility for some methods

Firstly: This may be a CSteamworks issue, I'm not sure.

While porting my code over from using my own steam wrapper to using Steamworks.NET I've encountered a few problems with CSteamID missing some utility methods. In steamclientpublic.h there are methods such as:

Line 671: bool IsLobby()
Line 681: bool BIndividualAccount()
Line 721: bool IsValid()

These are just the particular methods I've needed. Quite a few others have the same problem.

These methods are not actually "missing", the implementation in CSteamID has these methods there but they all have private visibility.

Trouble with const char * values in SteamHTMLSurface callbacks

isteamhtmlsurface.c has a bunch of callbacks that use const char * in the struct. In SteamCallbacks.cs, these show up as string types. But they're not getting marshalled correctly. There's probably a better way to do it, but I was able to work around the problem by changing the string type in SteamCallbacks.cs to IntPtr, then using Marshal.ReadByte() to read out the data. For example:

    public struct HTML_NeedsPaint_t {
        public const int k_iCallback = Constants.k_iSteamHTMLSurfaceCallbacks + 2;
        public HHTMLBrowser unBrowserHandle; // the browser that needs the paint
        public IntPtr pBGRA; // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
        ...
    }

Then to read the data:

    if (param.pBGRA != null) {
        int totalBytes = (int)param.unTall * (int)param.unWide * 4;
        byte[] bytes = new byte[totalBytes];
        for (int i=0; i<totalBytes; ++i) {
            bytes[i] = Marshal.ReadByte(param.pBGRA, i);
        }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.