Permalink
Browse files

Initial code.

  • Loading branch information...
gibbed committed Nov 8, 2017
1 parent 1010ccd commit b6b737f84c135f4b1ef59b1a114e959f71c49cbb
Showing with 6,804 additions and 0 deletions.
  1. +22 −0 LICENSE.txt
  2. +59 −0 SAM.API/Callback.cs
  3. +37 −0 SAM.API/Callbacks/AppDataChanged.cs
  4. +37 −0 SAM.API/Callbacks/UserStatsReceived.cs
  5. +140 −0 SAM.API/Client.cs
  6. +33 −0 SAM.API/ICallback.cs
  7. +31 −0 SAM.API/INativeWrapper.cs
  8. +33 −0 SAM.API/Interfaces/ISteamApps001.cs
  9. +40 −0 SAM.API/Interfaces/ISteamApps003.cs
  10. +54 −0 SAM.API/Interfaces/ISteamClient009.cs
  11. +48 −0 SAM.API/Interfaces/ISteamUser012.cs
  12. +62 −0 SAM.API/Interfaces/ISteamUserStats007.cs
  13. +51 −0 SAM.API/Interfaces/ISteamUtils005.cs
  14. +22 −0 SAM.API/LICENSE.txt
  15. +33 −0 SAM.API/NativeClass.cs
  16. +90 −0 SAM.API/NativeWrapper.cs
  17. BIN SAM.API/Pink.ico
  18. +61 −0 SAM.API/Properties/AssemblyInfo.cs
  19. +128 −0 SAM.API/SAM.API.csproj
  20. +2 −0 SAM.API/SAM.API.csproj.DotSettings
  21. +151 −0 SAM.API/Steam.cs
  22. +35 −0 SAM.API/Types/.svn/all-wcprops
  23. +198 −0 SAM.API/Types/.svn/entries
  24. +14 −0 SAM.API/Types/.svn/text-base/AppDataChanged.cs.svn-base
  25. +13 −0 SAM.API/Types/.svn/text-base/UserItemsReceived.cs.svn-base
  26. +17 −0 SAM.API/Types/.svn/text-base/UserStatType.cs.svn-base
  27. +14 −0 SAM.API/Types/.svn/text-base/UserStatsReceived.cs.svn-base
  28. +14 −0 SAM.API/Types/.svn/text-base/UserStatsStored.cs.svn-base
  29. +38 −0 SAM.API/Types/AccountType.cs
  30. +33 −0 SAM.API/Types/AppDataChanged.cs
  31. +36 −0 SAM.API/Types/CallbackMessage.cs
  32. +37 −0 SAM.API/Types/ItemRequestResult.cs
  33. +34 −0 SAM.API/Types/UserItemsReceived.cs
  34. +34 −0 SAM.API/Types/UserStatType.cs
  35. +33 −0 SAM.API/Types/UserStatsReceived.cs
  36. +33 −0 SAM.API/Types/UserStatsStored.cs
  37. +56 −0 SAM.API/Wrappers/SteamApps001.cs
  38. +55 −0 SAM.API/Wrappers/SteamApps003.cs
  39. +200 −0 SAM.API/Wrappers/SteamClient009.cs
  40. +55 −0 SAM.API/Wrappers/SteamUser012.cs
  41. +180 −0 SAM.API/Wrappers/SteamUserStats007.cs
  42. +85 −0 SAM.API/Wrappers/SteamUtils005.cs
  43. BIN SAM.Game/Blank.ico
  44. +34 −0 SAM.Game/DoubleBufferedListView.cs
  45. +333 −0 SAM.Game/KeyValue.cs
  46. +37 −0 SAM.Game/KeyValueType.cs
  47. +22 −0 SAM.Game/LICENSE.txt
  48. +359 −0 SAM.Game/Manager.Designer.cs
  49. +843 −0 SAM.Game/Manager.cs
  50. +149 −0 SAM.Game/Manager.resx
  51. +92 −0 SAM.Game/Program.cs
  52. +61 −0 SAM.Game/Properties/AssemblyInfo.cs
  53. +119 −0 SAM.Game/Properties/Resources.Designer.cs
  54. +145 −0 SAM.Game/Properties/Resources.resx
  55. BIN SAM.Game/Resources/arrow-circle-double.png
  56. BIN SAM.Game/Resources/bomb.png
  57. BIN SAM.Game/Resources/download-cloud.png
  58. BIN SAM.Game/Resources/lock--pencil.png
  59. BIN SAM.Game/Resources/lock-unlock.png
  60. BIN SAM.Game/Resources/lock.png
  61. BIN SAM.Game/Resources/poop-smiley-sad-enlarged.png
  62. BIN SAM.Game/Resources/poop-smiley-sad.png
  63. BIN SAM.Game/Resources/transmitter.png
  64. +155 −0 SAM.Game/SAM.Game.csproj
  65. +2 −0 SAM.Game/SAM.Game.csproj.DotSettings
  66. +35 −0 SAM.Game/Stats/AchievementDefinition.cs
  67. +47 −0 SAM.Game/Stats/AchievementInfo.cs
  68. +33 −0 SAM.Game/Stats/FloatStatDefinition.cs
  69. +52 −0 SAM.Game/Stats/FloatStatInfo.cs
  70. +52 −0 SAM.Game/Stats/IntStatInfo.cs
  71. +33 −0 SAM.Game/Stats/IntegerStatDefinition.cs
  72. +31 −0 SAM.Game/Stats/StatDefinition.cs
  73. +35 −0 SAM.Game/Stats/StatFlags.cs
  74. +46 −0 SAM.Game/Stats/StatInfo.cs
  75. +30 −0 SAM.Game/Stats/StatIsProtectedException.cs
  76. +115 −0 SAM.Game/StreamHelpers.cs
  77. +34 −0 SAM.Picker/DoubleBufferedListView.cs
  78. +68 −0 SAM.Picker/GameInfo.cs
  79. +245 −0 SAM.Picker/GamePicker.Designer.cs
  80. +368 −0 SAM.Picker/GamePicker.cs
  81. +327 −0 SAM.Picker/GamePicker.resx
  82. +22 −0 SAM.Picker/LICENSE.txt
  83. +72 −0 SAM.Picker/Program.cs
  84. +61 −0 SAM.Picker/Properties/AssemblyInfo.cs
  85. +91 −0 SAM.Picker/Properties/Resources.Designer.cs
  86. +133 −0 SAM.Picker/Properties/Resources.resx
  87. BIN SAM.Picker/Resources/arrow-circle-double.png
  88. BIN SAM.Picker/Resources/download-cloud.png
  89. BIN SAM.Picker/Resources/magnifier.png
  90. BIN SAM.Picker/Resources/television-test.png
  91. +141 −0 SAM.Picker/SAM.Picker.csproj
  92. +2 −0 SAM.Picker/SAM.Picker.csproj.DotSettings
  93. BIN SAM.Picker/SAM.ico
  94. +32 −0 SAM.sln
View
@@ -0,0 +1,22 @@
zlib License
Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
View
@@ -0,0 +1,59 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System;
using System.Runtime.InteropServices;
namespace SAM.API
{
public abstract class Callback : ICallback
{
public delegate void CallbackFunction(IntPtr param);
public event CallbackFunction OnRun;
public abstract int Id { get; }
public abstract bool IsServer { get; }
public void Run(IntPtr param)
{
this.OnRun(param);
}
}
public abstract class Callback<TParameter> : ICallback
where TParameter : struct
{
public delegate void CallbackFunction(TParameter arg);
public event CallbackFunction OnRun;
public abstract int Id { get; }
public abstract bool IsServer { get; }
public void Run(IntPtr pvParam)
{
var data = (TParameter)Marshal.PtrToStructure(pvParam, typeof(TParameter));
this.OnRun(data);
}
}
}
@@ -0,0 +1,37 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.API.Callbacks
{
public class AppDataChanged : Callback<Types.AppDataChanged>
{
public override int Id
{
get { return 1001; }
}
public override bool IsServer
{
get { return false; }
}
}
}
@@ -0,0 +1,37 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
namespace SAM.API.Callbacks
{
public class UserStatsReceived : Callback<Types.UserStatsReceived>
{
public override int Id
{
get { return 1101; }
}
public override bool IsServer
{
get { return false; }
}
}
}
View
@@ -0,0 +1,140 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace SAM.API
{
public class Client
{
public Wrappers.SteamClient009 SteamClient;
public Wrappers.SteamUser012 SteamUser;
public Wrappers.SteamUserStats007 SteamUserStats;
public Wrappers.SteamUtils005 SteamUtils;
public Wrappers.SteamApps001 SteamApps001;
public Wrappers.SteamApps003 SteamApps003;
private int _Pipe;
private int _User;
private readonly List<ICallback> _Callbacks = new List<ICallback>();
public bool Initialize(long appId)
{
if (appId != 0)
{
Environment.SetEnvironmentVariable("SteamAppId", appId.ToString(CultureInfo.InvariantCulture));
}
if (Steam.GetInstallPath() == null)
{
return false;
}
if (Steam.Load() == false)
{
return false;
}
this.SteamClient = Steam.CreateInterface<Wrappers.SteamClient009>("SteamClient009");
if (this.SteamClient == null)
{
return false;
}
this._Pipe = this.SteamClient.CreateSteamPipe();
if (this._Pipe == 0)
{
return false;
}
this._User = this.SteamClient.ConnectToGlobalUser(this._Pipe);
if (this._User == 0)
{
return false;
}
this.SteamUtils = this.SteamClient.GetSteamUtils004(this._Pipe);
if (appId > 0 && this.SteamUtils.GetAppId() != (uint)appId)
{
return false;
}
this.SteamUser = this.SteamClient.GetSteamUser012(this._User, this._Pipe);
this.SteamUserStats = this.SteamClient.GetSteamUserStats006(this._User, this._Pipe);
this.SteamApps001 = this.SteamClient.GetSteamApps001(this._User, this._Pipe);
this.SteamApps003 = this.SteamClient.GetSteamApps003(this._User, this._Pipe);
return true;
}
~Client()
{
if (this.SteamClient != null)
{
this.SteamClient.ReleaseUser(this._Pipe, this._User);
this._User = 0;
this.SteamClient.ReleaseSteamPipe(this._Pipe);
this._Pipe = 0;
}
}
public TCallback CreateAndRegisterCallback<TCallback>()
where TCallback : ICallback, new()
{
var callback = new TCallback();
this._Callbacks.Add(callback);
return callback;
}
private bool _RunningCallbacks;
public void RunCallbacks(bool server)
{
if (this._RunningCallbacks == true)
{
return;
}
this._RunningCallbacks = true;
Types.CallbackMessage message;
int call;
while (Steam.GetCallback(this._Pipe, out message, out call) == true)
{
var callbackId = message.Id;
foreach (ICallback callback in this._Callbacks.Where(
candidate => candidate.Id == callbackId &&
candidate.IsServer == server))
{
callback.Run(message.ParamPointer);
}
Steam.FreeLastCallback(this._Pipe);
}
this._RunningCallbacks = false;
}
}
}
View
@@ -0,0 +1,33 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System;
namespace SAM.API
{
public interface ICallback
{
int Id { get; }
bool IsServer { get; }
void Run(IntPtr param);
}
}
View
@@ -0,0 +1,31 @@
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System;
namespace SAM.API
{
public interface INativeWrapper
{
void SetupFunctions(IntPtr objectAddress);
}
}
Oops, something went wrong.

0 comments on commit b6b737f

Please sign in to comment.