start writing steam transport. smash head against wall

This commit is contained in:
JohnCorby 2025-02-21 03:07:22 -08:00
parent 5d09c9bb87
commit 0f9b0015bf
6 changed files with 164 additions and 0 deletions

View File

@ -38,6 +38,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSBPatcher", "QSBPatcher\QS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QSB-NH", "QSB-NH\QSB-NH.csproj", "{74F84A39-1C9D-4EF7-889A-485D33B7B324}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamTransport", "SteamTransport\SteamTransport.csproj", "{83E8A790-CD63-4642-81D1-E406FC9F8EED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -72,6 +74,10 @@ Global
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74F84A39-1C9D-4EF7-889A-485D33B7B324}.Release|Any CPU.Build.0 = Release|Any CPU
{83E8A790-CD63-4642-81D1-E406FC9F8EED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83E8A790-CD63-4642-81D1-E406FC9F8EED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83E8A790-CD63-4642-81D1-E406FC9F8EED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83E8A790-CD63-4642-81D1-E406FC9F8EED}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -75,6 +75,7 @@
<PackageReference Include="OWML" Version="2.15.1" IncludeAssets="compile" />
<Reference Include="..\Lib\*.dll" />
<ProjectReference Include="..\FizzySteamworks\FizzySteamworks.csproj" />
<ProjectReference Include="..\SteamTransport\SteamTransport.csproj" />
<ProjectReference Include="..\SteamRerouter\SteamRerouter.csproj" />
<ProjectReference Include="..\QSBPatcher\QSBPatcher.csproj" />
<ProjectReference Include="..\MirrorWeaver\MirrorWeaver.csproj" ReferenceOutputAssembly="false" />

76
SteamTransport/Program.cs Normal file
View File

@ -0,0 +1,76 @@
using Steamworks;
using System;
namespace SteamTransport;
/// <summary>
/// entry point for testing.
/// should probably make this a separate project since it copies over steam api. idc rn
/// </summary>
public static class Program
{
public static void Main(string[] args)
{
Console.WriteLine("This is the test mode for the steam transport");
try
{
// stupid copied init code
{
if (!Packsize.Test())
{
Console.Error.WriteLine("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.");
}
if (!DllCheck.Test())
{
Console.Error.WriteLine("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.");
}
// qsbcore
Environment.SetEnvironmentVariable("SteamAppId", "480");
Environment.SetEnvironmentVariable("SteamGameId", "480");
var m_bInitialized = SteamAPI.Init();
if (!m_bInitialized)
{
Console.Error.WriteLine("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.");
return;
}
}
switch (Console.ReadKey().KeyChar)
{
case '1':
DoServer();
break;
case '2':
DoClient();
break;
}
}
finally
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
private static void DoServer()
{
var address = new SteamNetworkingIPAddr();
address.SetIPv6LocalHost();
var socket = SteamNetworkingSockets.CreateListenSocketIP(ref address, 0, new SteamNetworkingConfigValue_t[0]);
}
private static void DoClient()
{
var address = new SteamNetworkingIPAddr();
address.SetIPv6LocalHost();
var conn = SteamNetworkingSockets.ConnectByIPAddress(ref address, 0, new SteamNetworkingConfigValue_t[0]);
}
}

View File

@ -0,0 +1,59 @@
using Mirror;
using System;
namespace SteamTransport;
public class SteamTransport : Transport
{
public override bool Available() => throw new NotImplementedException();
public override bool ClientConnected() => throw new NotImplementedException();
public override void ClientConnect(string address)
{
throw new NotImplementedException();
}
public override void ClientSend(ArraySegment<byte> segment, int channelId = 0)
{
throw new NotImplementedException();
}
public override void ClientDisconnect()
{
throw new NotImplementedException();
}
public override Uri ServerUri() => throw new NotImplementedException();
public override bool ServerActive() => throw new NotImplementedException();
public override void ServerStart()
{
throw new NotImplementedException();
}
public override void ServerSend(int connectionId, ArraySegment<byte> segment, int channelId = 0)
{
throw new NotImplementedException();
}
public override void ServerDisconnect(int connectionId)
{
throw new NotImplementedException();
}
public override string ServerGetClientAddress(int connectionId) => throw new NotImplementedException();
public override void ServerStop()
{
throw new NotImplementedException();
}
public override int GetMaxPacketSize(int channelId = 0) => throw new NotImplementedException();
public override void Shutdown()
{
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyTitle>Steam Transport</AssemblyTitle>
<Product>Steam Transport</Product>
<Title>Steam Transport</Title>
<Description>A custom Mirror transport based on FizzySteamworks</Description>
<Authors>William Corby, Henry Pointer</Authors>
<Company>William Corby, Henry Pointer</Company>
<Copyright>Copyright © William Corby, Henry Pointer 2022-2025</Copyright>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OuterWildsGameLibs" Version="1.1.14.768" IncludeAssets="compile" />
<PackageReference Include="OWML" Version="2.11.1" IncludeAssets="compile" />
<Reference Include="..\Lib\*.dll" />
</ItemGroup>
<ItemGroup>
<None Include="steam_api64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.