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;
|
ServerLobbyId = 0;
|
||||||
|
|
||||||
var gameInfo = new SteamNative.FriendGameInfo_t();
|
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;
|
CurrentAppId = gameInfo.GameID;
|
||||||
ServerIp = gameInfo.m_unGameIP;
|
ServerIp = gameInfo.GameIP;
|
||||||
ServerGamePort = gameInfo.m_usGamePort;
|
ServerGamePort = gameInfo.GamePort;
|
||||||
ServerQueryPort = gameInfo.m_usQueryPort;
|
ServerQueryPort = gameInfo.QueryPort;
|
||||||
ServerLobbyId = gameInfo.m_steamIDLobby;
|
ServerLobbyId = gameInfo.SteamIDLobby;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ internal bool Update( SteamNative.SteamMatchmakingServers servers, Action<SteamN
|
|||||||
WatchList.RemoveAll( x =>
|
WatchList.RemoveAll( x =>
|
||||||
{
|
{
|
||||||
var info = servers.GetServerDetails( Request, x );
|
var info = servers.GetServerDetails( Request, x );
|
||||||
if ( info.m_bHadSuccessfulResponse )
|
if ( info.HadSuccessfulResponse )
|
||||||
{
|
{
|
||||||
OnServer( info );
|
OnServer( info );
|
||||||
changes = true;
|
changes = true;
|
||||||
@ -179,7 +179,7 @@ private void Update()
|
|||||||
|
|
||||||
private void OnServer( SteamNative.gameserveritem_t info )
|
private void OnServer( SteamNative.gameserveritem_t info )
|
||||||
{
|
{
|
||||||
if ( info.m_bHadSuccessfulResponse )
|
if ( info.HadSuccessfulResponse )
|
||||||
{
|
{
|
||||||
Responded.Add( Server.FromSteam( client, info ) );
|
Responded.Add( Server.FromSteam( client, info ) );
|
||||||
}
|
}
|
||||||
|
@ -51,24 +51,24 @@ internal static Server FromSteam( Client client, SteamNative.gameserveritem_t it
|
|||||||
return new Server()
|
return new Server()
|
||||||
{
|
{
|
||||||
Client = client,
|
Client = client,
|
||||||
Address = item.m_NetAdr.m_unIP,
|
Address = item.NetAdr.IP,
|
||||||
ConnectionPort = item.m_NetAdr.m_usConnectionPort,
|
ConnectionPort = item.NetAdr.ConnectionPort,
|
||||||
QueryPort = item.m_NetAdr.m_usQueryPort,
|
QueryPort = item.NetAdr.QueryPort,
|
||||||
Name = item.m_szServerName,
|
Name = item.ServerName,
|
||||||
Ping = item.m_nPing,
|
Ping = item.Ping,
|
||||||
GameDir = item.m_szGameDir,
|
GameDir = item.GameDir,
|
||||||
Map = item.m_szMap,
|
Map = item.Map,
|
||||||
Description = item.m_szGameDescription,
|
Description = item.GameDescription,
|
||||||
AppId = item.m_nAppID,
|
AppId = item.AppID,
|
||||||
Players = item.m_nPlayers,
|
Players = item.Players,
|
||||||
MaxPlayers = item.m_nMaxPlayers,
|
MaxPlayers = item.MaxPlayers,
|
||||||
BotPlayers = item.m_nBotPlayers,
|
BotPlayers = item.BotPlayers,
|
||||||
Passworded = item.m_bPassword,
|
Passworded = item.Password,
|
||||||
Secure = item.m_bSecure,
|
Secure = item.Secure,
|
||||||
LastTimePlayed = item.m_ulTimeLastPlayed,
|
LastTimePlayed = item.TimeLastPlayed,
|
||||||
Version = item.m_nServerVersion,
|
Version = item.ServerVersion,
|
||||||
Tags = item.m_szGameTags == null ? null : item.m_szGameTags.Split( ',' ),
|
Tags = item.GameTags == null ? null : item.GameTags.Split( ',' ),
|
||||||
SteamId = item.m_steamID
|
SteamId = item.SteamID
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ internal void Start()
|
|||||||
{
|
{
|
||||||
return new SteamNative.MatchMakingKeyValuePair_t()
|
return new SteamNative.MatchMakingKeyValuePair_t()
|
||||||
{
|
{
|
||||||
m_szKey = x.Key,
|
Key = x.Key,
|
||||||
m_szValue = x.Value
|
Value = x.Value
|
||||||
};
|
};
|
||||||
|
|
||||||
} ).ToArray();
|
} ).ToArray();
|
||||||
|
@ -82,11 +82,11 @@ internal void TryFill()
|
|||||||
{
|
{
|
||||||
return new Inventory.Item()
|
return new Inventory.Item()
|
||||||
{
|
{
|
||||||
Quantity = x.m_unQuantity,
|
Quantity = x.Quantity,
|
||||||
Id = x.m_itemId,
|
Id = x.ItemId,
|
||||||
DefinitionId = x.m_iDefinition,
|
DefinitionId = x.Definition,
|
||||||
TradeLocked = ( (int)x.m_unFlags & (int)SteamNative.SteamItemFlags.NoTrade ) != 0,
|
TradeLocked = ( (int)x.Flags & (int)SteamNative.SteamItemFlags.NoTrade ) != 0,
|
||||||
Definition = inventory.FindDefinition( x.m_iDefinition )
|
Definition = inventory.FindDefinition( x.Definition )
|
||||||
};
|
};
|
||||||
} ).ToArray();
|
} ).ToArray();
|
||||||
}
|
}
|
||||||
|
@ -34,17 +34,17 @@ public Item( ulong Id, Workshop workshop )
|
|||||||
|
|
||||||
internal static Item From( SteamNative.SteamUGCDetails_t details, 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.Title = details.Title;
|
||||||
item.Description = details.m_rgchDescription;
|
item.Description = details.Description;
|
||||||
item.OwnerId = details.m_ulSteamIDOwner;
|
item.OwnerId = details.SteamIDOwner;
|
||||||
item.Tags = details.m_rgchTags.Split( ',' );
|
item.Tags = details.Tags.Split( ',' );
|
||||||
item.Score = details.m_flScore;
|
item.Score = details.Score;
|
||||||
item.VotesUp = details.m_unVotesUp;
|
item.VotesUp = details.VotesUp;
|
||||||
item.VotesDown = details.m_unVotesDown;
|
item.VotesDown = details.VotesDown;
|
||||||
item.Modified = new DateTime( details.m_rtimeUpdated );
|
item.Modified = new DateTime( details.TimeUpdated );
|
||||||
item.Created = new DateTime( details.m_rtimeCreated );
|
item.Created = new DateTime( details.TimeCreated );
|
||||||
item.UpdateState();
|
item.UpdateState();
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -134,7 +134,7 @@ void OnResult( QueryCompleted.Data data )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// We already have this file, so skip it
|
// 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;
|
continue;
|
||||||
|
|
||||||
var item = Item.From( details, workshop );
|
var item = Item.From( details, workshop );
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
{
|
{
|
||||||
public partial class CSharpGenerator
|
public partial class CodeWriter
|
||||||
{
|
{
|
||||||
private void Enums()
|
private void Enums()
|
||||||
{
|
{
|
||||||
|
@ -6,24 +6,9 @@
|
|||||||
|
|
||||||
namespace Generator
|
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;
|
bool LargePack;
|
||||||
@ -80,51 +65,9 @@ private void PlatformClass( string className, SteamApiDefinition.MethodDef[] met
|
|||||||
WriteLine();
|
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 )
|
private void PlatformClassMethod( string classname, SteamApiDefinition.MethodDef methodDef )
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
{
|
{
|
||||||
public partial class CSharpGenerator
|
public partial class CodeWriter
|
||||||
{
|
{
|
||||||
void Structs()
|
void Structs()
|
||||||
{
|
{
|
||||||
@ -131,6 +131,8 @@ string CleanMemberName( string m )
|
|||||||
{
|
{
|
||||||
if ( m == "m_pubParam" ) return "ParamPtr";
|
if ( m == "m_pubParam" ) return "ParamPtr";
|
||||||
if ( m == "m_cubParam" ) return "ParamCount";
|
if ( m == "m_cubParam" ) return "ParamCount";
|
||||||
|
if ( m == "m_itemId" ) return "ItemId";
|
||||||
|
|
||||||
|
|
||||||
var cleanName = m.Replace( "m_un", "" )
|
var cleanName = m.Replace( "m_un", "" )
|
||||||
.Replace( "m_us", "" )
|
.Replace( "m_us", "" )
|
||||||
@ -139,11 +141,15 @@ string CleanMemberName( string m )
|
|||||||
.Replace( "m_e", "" )
|
.Replace( "m_e", "" )
|
||||||
.Replace( "m_un", "" )
|
.Replace( "m_un", "" )
|
||||||
.Replace( "m_ul", "" )
|
.Replace( "m_ul", "" )
|
||||||
|
.Replace( "m_fl", "" )
|
||||||
.Replace( "m_u", "" )
|
.Replace( "m_u", "" )
|
||||||
.Replace( "m_b", "" )
|
.Replace( "m_b", "" )
|
||||||
.Replace( "m_i", "" )
|
.Replace( "m_i", "" )
|
||||||
.Replace( "m_pub", "" )
|
.Replace( "m_pub", "" )
|
||||||
.Replace( "m_cub", "" )
|
.Replace( "m_cub", "" )
|
||||||
|
.Replace( "m_n", "" )
|
||||||
|
.Replace( "m_rgch", "" )
|
||||||
|
.Replace( "m_r", "" )
|
||||||
.Replace( "m_", "" );
|
.Replace( "m_", "" );
|
||||||
|
|
||||||
return cleanName.Substring( 0, 1 ).ToUpper() + cleanName.Substring( 1 );
|
return cleanName.Substring( 0, 1 ).ToUpper() + cleanName.Substring( 1 );
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
{
|
{
|
||||||
public partial class CSharpGenerator
|
public partial class CodeWriter
|
||||||
{
|
{
|
||||||
private void Types()
|
private void Types()
|
||||||
{
|
{
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
namespace Generator
|
namespace Generator
|
||||||
{
|
{
|
||||||
public partial class CSharpGenerator
|
public partial class CodeWriter
|
||||||
{
|
{
|
||||||
private StringBuilder sb = new StringBuilder();
|
private StringBuilder sb = new StringBuilder();
|
||||||
private SteamApiDefinition def;
|
private SteamApiDefinition def;
|
||||||
|
|
||||||
private Dictionary<string, TypeDef> TypeDefs = new Dictionary<string, TypeDef>();
|
private Dictionary<string, TypeDef> TypeDefs = new Dictionary<string, TypeDef>();
|
||||||
|
|
||||||
public CSharpGenerator( SteamApiDefinition def )
|
public CodeWriter( SteamApiDefinition def )
|
||||||
{
|
{
|
||||||
this.def = def;
|
this.def = def;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ static void Main( string[] args )
|
|||||||
var content = System.IO.File.ReadAllText( "steam_api.json" );
|
var content = System.IO.File.ReadAllText( "steam_api.json" );
|
||||||
var def = Newtonsoft.Json.JsonConvert.DeserializeObject<SteamApiDefinition>( content );
|
var def = Newtonsoft.Json.JsonConvert.DeserializeObject<SteamApiDefinition>( content );
|
||||||
|
|
||||||
var generator = new CSharpGenerator( def );
|
var generator = new CodeWriter( def );
|
||||||
|
|
||||||
generator.ToFolder( "../Facepunch.Steamworks/SteamNative/" );
|
generator.ToFolder( "../Facepunch.Steamworks/SteamNative/" );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user