mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Struct name fixes
This commit is contained in:
parent
0b02bf2331
commit
b1280eb65c
@ -87,13 +87,13 @@ public void Refresh()
|
||||
ServerLobbyId = 0;
|
||||
|
||||
var gameInfo = new SteamNative.FriendGameInfo_t();
|
||||
if ( Client.native.friends.GetFriendGamePlayed( Id, ref gameInfo ) && gameInfo.m_gameID > 0 )
|
||||
if ( Client.native.friends.GetFriendGamePlayed( Id, ref gameInfo ) && gameInfo.GameID > 0 )
|
||||
{
|
||||
CurrentAppId = gameInfo.m_gameID;
|
||||
ServerIp = gameInfo.m_unGameIP;
|
||||
ServerGamePort = gameInfo.m_usGamePort;
|
||||
ServerQueryPort = gameInfo.m_usQueryPort;
|
||||
ServerLobbyId = gameInfo.m_steamIDLobby;
|
||||
CurrentAppId = gameInfo.GameID;
|
||||
ServerIp = gameInfo.GameIP;
|
||||
ServerGamePort = gameInfo.GamePort;
|
||||
ServerQueryPort = gameInfo.QueryPort;
|
||||
ServerLobbyId = gameInfo.SteamIDLobby;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ internal bool Update( SteamNative.SteamMatchmakingServers servers, Action<SteamN
|
||||
WatchList.RemoveAll( x =>
|
||||
{
|
||||
var info = servers.GetServerDetails( Request, x );
|
||||
if ( info.m_bHadSuccessfulResponse )
|
||||
if ( info.HadSuccessfulResponse )
|
||||
{
|
||||
OnServer( info );
|
||||
changes = true;
|
||||
@ -179,7 +179,7 @@ private void Update()
|
||||
|
||||
private void OnServer( SteamNative.gameserveritem_t info )
|
||||
{
|
||||
if ( info.m_bHadSuccessfulResponse )
|
||||
if ( info.HadSuccessfulResponse )
|
||||
{
|
||||
Responded.Add( Server.FromSteam( client, info ) );
|
||||
}
|
||||
|
@ -51,24 +51,24 @@ internal static Server FromSteam( Client client, SteamNative.gameserveritem_t it
|
||||
return new Server()
|
||||
{
|
||||
Client = client,
|
||||
Address = item.m_NetAdr.m_unIP,
|
||||
ConnectionPort = item.m_NetAdr.m_usConnectionPort,
|
||||
QueryPort = item.m_NetAdr.m_usQueryPort,
|
||||
Name = item.m_szServerName,
|
||||
Ping = item.m_nPing,
|
||||
GameDir = item.m_szGameDir,
|
||||
Map = item.m_szMap,
|
||||
Description = item.m_szGameDescription,
|
||||
AppId = item.m_nAppID,
|
||||
Players = item.m_nPlayers,
|
||||
MaxPlayers = item.m_nMaxPlayers,
|
||||
BotPlayers = item.m_nBotPlayers,
|
||||
Passworded = item.m_bPassword,
|
||||
Secure = item.m_bSecure,
|
||||
LastTimePlayed = item.m_ulTimeLastPlayed,
|
||||
Version = item.m_nServerVersion,
|
||||
Tags = item.m_szGameTags == null ? null : item.m_szGameTags.Split( ',' ),
|
||||
SteamId = item.m_steamID
|
||||
Address = item.NetAdr.IP,
|
||||
ConnectionPort = item.NetAdr.ConnectionPort,
|
||||
QueryPort = item.NetAdr.QueryPort,
|
||||
Name = item.ServerName,
|
||||
Ping = item.Ping,
|
||||
GameDir = item.GameDir,
|
||||
Map = item.Map,
|
||||
Description = item.GameDescription,
|
||||
AppId = item.AppID,
|
||||
Players = item.Players,
|
||||
MaxPlayers = item.MaxPlayers,
|
||||
BotPlayers = item.BotPlayers,
|
||||
Passworded = item.Password,
|
||||
Secure = item.Secure,
|
||||
LastTimePlayed = item.TimeLastPlayed,
|
||||
Version = item.ServerVersion,
|
||||
Tags = item.GameTags == null ? null : item.GameTags.Split( ',' ),
|
||||
SteamId = item.SteamID
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ internal void Start()
|
||||
{
|
||||
return new SteamNative.MatchMakingKeyValuePair_t()
|
||||
{
|
||||
m_szKey = x.Key,
|
||||
m_szValue = x.Value
|
||||
Key = x.Key,
|
||||
Value = x.Value
|
||||
};
|
||||
|
||||
} ).ToArray();
|
||||
|
@ -82,11 +82,11 @@ internal void TryFill()
|
||||
{
|
||||
return new Inventory.Item()
|
||||
{
|
||||
Quantity = x.m_unQuantity,
|
||||
Id = x.m_itemId,
|
||||
DefinitionId = x.m_iDefinition,
|
||||
TradeLocked = ( (int)x.m_unFlags & (int)SteamNative.SteamItemFlags.NoTrade ) != 0,
|
||||
Definition = inventory.FindDefinition( x.m_iDefinition )
|
||||
Quantity = x.Quantity,
|
||||
Id = x.ItemId,
|
||||
DefinitionId = x.Definition,
|
||||
TradeLocked = ( (int)x.Flags & (int)SteamNative.SteamItemFlags.NoTrade ) != 0,
|
||||
Definition = inventory.FindDefinition( x.Definition )
|
||||
};
|
||||
} ).ToArray();
|
||||
}
|
||||
|
@ -34,17 +34,17 @@ public Item( ulong Id, Workshop workshop )
|
||||
|
||||
internal static Item From( SteamNative.SteamUGCDetails_t details, Workshop workshop )
|
||||
{
|
||||
var item = new Item( details.m_nPublishedFileId, workshop);
|
||||
var item = new Item( details.PublishedFileId, workshop);
|
||||
|
||||
item.Title = details.m_rgchTitle;
|
||||
item.Description = details.m_rgchDescription;
|
||||
item.OwnerId = details.m_ulSteamIDOwner;
|
||||
item.Tags = details.m_rgchTags.Split( ',' );
|
||||
item.Score = details.m_flScore;
|
||||
item.VotesUp = details.m_unVotesUp;
|
||||
item.VotesDown = details.m_unVotesDown;
|
||||
item.Modified = new DateTime( details.m_rtimeUpdated );
|
||||
item.Created = new DateTime( details.m_rtimeCreated );
|
||||
item.Title = details.Title;
|
||||
item.Description = details.Description;
|
||||
item.OwnerId = details.SteamIDOwner;
|
||||
item.Tags = details.Tags.Split( ',' );
|
||||
item.Score = details.Score;
|
||||
item.VotesUp = details.VotesUp;
|
||||
item.VotesDown = details.VotesDown;
|
||||
item.Modified = new DateTime( details.TimeUpdated );
|
||||
item.Created = new DateTime( details.TimeCreated );
|
||||
item.UpdateState();
|
||||
|
||||
return item;
|
||||
|
@ -134,7 +134,7 @@ void OnResult( QueryCompleted.Data data )
|
||||
continue;
|
||||
|
||||
// We already have this file, so skip it
|
||||
if ( _results.Any( x => x.Id == details.m_nPublishedFileId ) )
|
||||
if ( _results.Any( x => x.Id == details.PublishedFileId ) )
|
||||
continue;
|
||||
|
||||
var item = Item.From( details, workshop );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
|
||||
namespace Generator
|
||||
{
|
||||
public partial class CSharpGenerator
|
||||
public partial class CodeWriter
|
||||
{
|
||||
private void Enums()
|
||||
{
|
||||
|
@ -6,24 +6,9 @@
|
||||
|
||||
namespace Generator
|
||||
{
|
||||
public partial class CSharpGenerator
|
||||
public partial class CodeWriter
|
||||
{
|
||||
void PlatformInterface()
|
||||
{
|
||||
StartBlock( $"internal static partial class Platform" );
|
||||
StartBlock( $"public interface Interface" );
|
||||
|
||||
WriteLine( "bool IsValid { get; } " );
|
||||
WriteLine();
|
||||
|
||||
foreach ( var c in def.methods.GroupBy( x => x.ClassName ) )
|
||||
{
|
||||
PlatformInterface( c.Key, c.ToArray() );
|
||||
}
|
||||
|
||||
EndBlock();
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
|
||||
bool LargePack;
|
||||
@ -80,51 +65,9 @@ private void PlatformClass( string className, SteamApiDefinition.MethodDef[] met
|
||||
WriteLine();
|
||||
}
|
||||
|
||||
private void PlatformInterface( string className, SteamApiDefinition.MethodDef[] methodDef )
|
||||
{
|
||||
if ( className == "ISteamMatchmakingPingResponse" ) return;
|
||||
if ( className == "ISteamMatchmakingServerListResponse" ) return;
|
||||
if ( className == "ISteamMatchmakingPlayersResponse" ) return;
|
||||
if ( className == "ISteamMatchmakingRulesResponse" ) return;
|
||||
if ( className == "ISteamMatchmakingPingResponse" ) return;
|
||||
|
||||
LastMethodName = "";
|
||||
foreach ( var m in methodDef )
|
||||
{
|
||||
PlatformInterfaceMethod( className, m );
|
||||
}
|
||||
|
||||
WriteLine();
|
||||
}
|
||||
|
||||
private void PlatformInterfaceMethod( string classname, SteamApiDefinition.MethodDef methodDef )
|
||||
{
|
||||
var arguments = BuildArguments( methodDef.Params );
|
||||
|
||||
var ret = new Argument()
|
||||
{
|
||||
Name = "return",
|
||||
NativeType = methodDef.ReturnType
|
||||
};
|
||||
|
||||
ret.Build( null, TypeDefs );
|
||||
|
||||
var methodName = methodDef.Name;
|
||||
|
||||
if ( LastMethodName == methodName )
|
||||
methodName = methodName + "0";
|
||||
|
||||
var flatName = $"SteamAPI_{classname}_{methodName}";
|
||||
|
||||
if ( classname == "SteamApi" )
|
||||
flatName = methodName;
|
||||
|
||||
var argstring = string.Join( ", ", arguments.Select( x => x.InteropParameter( true ) ) );
|
||||
if ( argstring != "" ) argstring = $" {argstring} ";
|
||||
|
||||
WriteLine( $"{ret.Return()} {classname}_{methodName}({argstring});" );
|
||||
LastMethodName = methodDef.Name;
|
||||
}
|
||||
|
||||
private void PlatformClassMethod( string classname, SteamApiDefinition.MethodDef methodDef )
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace Generator
|
||||
{
|
||||
public partial class CSharpGenerator
|
||||
public partial class CodeWriter
|
||||
{
|
||||
void Structs()
|
||||
{
|
||||
@ -131,6 +131,8 @@ string CleanMemberName( string m )
|
||||
{
|
||||
if ( m == "m_pubParam" ) return "ParamPtr";
|
||||
if ( m == "m_cubParam" ) return "ParamCount";
|
||||
if ( m == "m_itemId" ) return "ItemId";
|
||||
|
||||
|
||||
var cleanName = m.Replace( "m_un", "" )
|
||||
.Replace( "m_us", "" )
|
||||
@ -139,11 +141,15 @@ string CleanMemberName( string m )
|
||||
.Replace( "m_e", "" )
|
||||
.Replace( "m_un", "" )
|
||||
.Replace( "m_ul", "" )
|
||||
.Replace( "m_fl", "" )
|
||||
.Replace( "m_u", "" )
|
||||
.Replace( "m_b", "" )
|
||||
.Replace( "m_i", "" )
|
||||
.Replace( "m_pub", "" )
|
||||
.Replace( "m_cub", "" )
|
||||
.Replace( "m_n", "" )
|
||||
.Replace( "m_rgch", "" )
|
||||
.Replace( "m_r", "" )
|
||||
.Replace( "m_", "" );
|
||||
|
||||
return cleanName.Substring( 0, 1 ).ToUpper() + cleanName.Substring( 1 );
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace Generator
|
||||
{
|
||||
public partial class CSharpGenerator
|
||||
public partial class CodeWriter
|
||||
{
|
||||
private void Types()
|
||||
{
|
||||
|
@ -8,14 +8,14 @@
|
||||
|
||||
namespace Generator
|
||||
{
|
||||
public partial class CSharpGenerator
|
||||
public partial class CodeWriter
|
||||
{
|
||||
private StringBuilder sb = new StringBuilder();
|
||||
private SteamApiDefinition def;
|
||||
|
||||
private Dictionary<string, TypeDef> TypeDefs = new Dictionary<string, TypeDef>();
|
||||
|
||||
public CSharpGenerator( SteamApiDefinition def )
|
||||
public CodeWriter( SteamApiDefinition def )
|
||||
{
|
||||
this.def = def;
|
||||
|
||||
|
@ -14,7 +14,7 @@ static void Main( string[] args )
|
||||
var content = System.IO.File.ReadAllText( "steam_api.json" );
|
||||
var def = Newtonsoft.Json.JsonConvert.DeserializeObject<SteamApiDefinition>( content );
|
||||
|
||||
var generator = new CSharpGenerator( def );
|
||||
var generator = new CodeWriter( def );
|
||||
|
||||
generator.ToFolder( "../Facepunch.Steamworks/SteamNative/" );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user