Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Spring cleaning for full release
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueCyro committed Mar 15, 2024
1 parent a75dcd6 commit 08e7f25
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Docs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions Outflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<DocumentationFile>./Docs.xml</DocumentationFile>

<Version>0.0.1.0</Version>

<Version>1.0.0</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<Authors>Cyro</Authors>
<Product>Outflow packet manager</Product>
<Description>Mitigate hitching when new users join a session in Resonite</Description>
<Copyright>Copyright (c) 2023 Riley Fields</Copyright>

<DocumentationFile>./Docs.xml</DocumentationFile>
<ReleaseBuild>./ReleaseBuild/</ReleaseBuild>
</PropertyGroup>

<!--This will test for the default Steam installation paths for Resonite on Windows and Linux.-->
Expand All @@ -40,23 +42,33 @@
</Reference>
</ItemGroup>


<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.2.2.0" />
</ItemGroup>


<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<!--Copy SourceFiles="$(OutDir)$(TargetFileName)" DestinationFolder="./" /-->
<!--Exec Command="C:\Program Files (x86)\Steam\steamapps\common\Resonite\Resonite.exe -Screen -screen-fullscreen 1 -DontAutoOpenCloudHome -CachePath C:\Resonite\Cache -DataPath C:\Resonite\Data -CTAATemporalEdgePower 1.0 -CTAASharpnessEnabled False -CTAAAdaptiveSharpness 0.4 -LoadAssembly Libraries\ResoniteModLoader.dll" /-->
</Target>


<Target Name="MoveBinary" AfterTargets="Publish">
<Copy SourceFiles="$(PublishDir)$(TargetFileName)" DestinationFolder="." />
<Copy SourceFiles="$(PublishDir)$(TargetFileName)" DestinationFolder="./$(ReleaseBuild)" />
</Target>

<Target Name="DeepClean">

<Target Name="DeepClean" AfterTargets="Clean">
<RemoveDir Directories="./bin" />
<RemoveDir Directories="./obj" />
<Delete Files="./$(TargetFileName)" />


<ItemGroup>
<FilesToDelete Include="$(ReleaseBuild)**/*" />
</ItemGroup>


<Delete Files="@(FilesToDelete)" />
<Exec Command="dotnet restore" />
</Target>
</Project>
19 changes: 16 additions & 3 deletions SessionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public static bool EnqueueStreamForTransmission(Session session, SyncMessage msg
data.streamSendEvent.Set();
}


#if DEBUG
Outflow.Debug($"Encoded StreamMessage with state #{msg.SenderStateVersion}");
#endif

return isStream;
}
Expand Down Expand Up @@ -72,7 +75,9 @@ public static void StreamLoop(Session session, AutoResetEvent ev, ConcurrentQueu
session.NetworkManager.TransmitData(result.Encode());


#if DEBUG
Outflow.Debug($"Successfully processed StreamMessage #{result.SenderStateVersion}");
#endif
}


Expand All @@ -96,33 +101,41 @@ public static void RemoveStreamQueue(this Session session)
if (SessionStreamQueue.ContainsKey(session))
{
SessionStreamQueue.TryRemove(session, out var _);


#if DEBUG
Outflow.Debug($"Removed StreamMessage queue");
#endif
}
}



/// <summary>
/// Adds a StreamMessage queue to the dictionary for use in other methods
/// Adds a StreamMessage queue to the dictionary for a given session
/// </summary>
/// <param name="session">The session to add the queue for</param>
/// <param name="ev">The event the queue processor will wait on</param>
/// <param name="queue">The queue the processor will operate with</param>
public static void AddStreamQueue(this Session session, AutoResetEvent ev, ConcurrentQueue<SyncMessage> queue)
{
SessionStreamQueue.TryAdd(session, (ev, queue));


#if DEBUG
Outflow.Debug($"Added StreamMessage queue");
#endif
}



/// <summary>
/// Only called when the Session is disposed
/// Only called when the Session is disposed, disposes of the StreamMessage processor
/// </summary>
/// <param name="session">The session to operate on</param>
public static void DisposeStreamMessageProcessor(Session session)
{
if (SessionHelpers.SessionStreamQueue.TryGetValue(session, out var data))
if (SessionStreamQueue.TryGetValue(session, out var data))
data.streamSendEvent.Set();

Outflow.Msg("Properly shut down StreamMessage processing thread");
Expand Down

0 comments on commit 08e7f25

Please sign in to comment.