Skip to content

Commit

Permalink
Merge litemp-sync branch
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm committed Aug 12, 2021
1 parent eb1fc85 commit 6246491
Show file tree
Hide file tree
Showing 51 changed files with 2,189 additions and 915 deletions.
10 changes: 8 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: mcr.microsoft.com/dotnet/sdk:5.0
image: mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim

stages:
- build
Expand All @@ -11,10 +11,15 @@ before_script:

build_windows:
stage: build
# run in Windows since on crossbuilding on Linux apphost customization doesn't work
tags:
- shared-windows
- windows
- windows-2004
script:
# windows 7 is EOL, win10 includes win81
#- dotnet publish -r win10-x64 -c Release -o publish/windows-Release
- dotnet publish -r win10-x64 -c Release -o publish/windows-Release -p:PublishTrimmed=true -p:PublishSingleFile=true -p:TargetFramework=net5.0
- dotnet publish -r win10-x64 -c Release -o publish/windows-Release -p:PublishSingleFile=true
artifacts:
paths:
- "gtaserver.core/publish/windows-Release"
Expand All @@ -29,6 +34,7 @@ build_linux:

build_linux_arm:
stage: build
when: manual
script:
- dotnet publish -r linux-arm -c Release -o publish/arm-Release
artifacts:
Expand Down
81 changes: 81 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
## v0.9.3.8 (2021-02-17)

* Fix kick command crash, and who/help formatting 2f632dc (Indra)
* Make linux_arm build manual 5ccbc85 (Indra)
* User-friendly help and commands d0ab142 (Indra)
* Follow msdn guidelines 92f1913 (Indra)
* Tiny WASM patches 95b6712 (Indra)
* This is not C++ you know, objects needs initialization 3be50eb (Indra)
* Change CI image since Microsoft fucked up 790340e (Indra)
* Use new Windows Terminal OSC 9;4 to show progress 0560ffa (Indra)
* Add players query and anonymous telemetry 9418676 (Indra)
* Fix console exception for empty input 7289e75 (Indra)
* Resolved merge conflict 44c203b (Indra)
* Update SyncPed.cs f833572 (Cassio Davi Emer)
* Update Main.cs 068afba (Cassio Davi Emer)
* Change command parsing to allow in quotes arguments b71c002 (Indra)
* Fix plugins not loading with PublishTrimmed MSbuild option 7078662 (Indra)
* Merge branch 'master' of https://gitlab.com/cgmp/gta 60d5ff1 (Indra)
* tweak (sync): cycle pedalling and steering sync 8292770 (Indra)
* Remove PublishReadyToRunsince since Linux fuckery 1799954 (Indra)
* Fix CI build 1a6c608 (Indra)
* experiment (windows only): trimmed, singlefile and .NET 5 server builds f3f49c4 (Indra)
* security: Block certain natives from RPC calls 24ecd96 (Indra)
* Change playerlist to orginal GTA Online scaleform 01a42b8 (Indra)
* Possibly fix chat on ultrawide 3fe95f7 (Indra)
* Add basic NetGraph and update Lidgren.Network 5cd9403 (Indra)
* Fix client not building, update NativeUI to latest upstream 009d96d (Indra)
* Add status command and metrics OOB command ee09cf6 (Indra)
* Revert "Attempt to implement plugin reloading" f8b5384 (Indra)
* Attempt to implement plugin reloading fc3206b (Indra)
* Rename DefaultLogger to support future other log providers e104e4e (Indra)
* Update master announcing and minor changes 3d60820 (Indra)
* Fix some commands not returning any response 299f7f0 (Indra)
* Fix dependency loading for plugins 8347c1f (Indra)
* Change logging provider c2d3b29 (Indra)
* Don't write minidump on tick exception 2060025 (Indra)
* Update deps 78c3836 (Indra)
* Update Lidgren.Network 5a88c13 (Indra)
* Include Microsoft.SourceLink 8858bf1 (Indra)
* Don't throw on unknown packet type 0b7f118 (Indra)
* Make chat key use game keybind c0a3847 (Indra)
* Repo cleanup 580b3c2 (Indra)
* Remove useless project 3de69ee (Indra)
* Fix reading empty data messages 513e955 (Indra)
* Merge branch 'develop-branch' into 'master' 276c3c2 (Indra)
* Merge branch 'develop' into 'master' f8a2789 (Indra)
* Updated Copyright to reflect latest (2018) 6858f05 (JedDevs)
* Add minidump file to sentry event 42f67e3 (Indra)
* Implement Q3 like RCON 1966d14 (Indra)
* Fix CI not recognizing nuget bfd786a (Indra)
* Change Lidgren.Network fork 0f38080 (Indra)
* Minor refactor 8a4cf1e (Indra)
* feature: add local discord user to sentry events 53a293d (Indra)
* feature: server write minidumps to "Crashes" folder 9a1cb93 (Indra)
* Change ConsoleCommandSender access modifiers 9a03742 (Indra)
* Refactor main thread cd1247c (Indra)
* Fix nullreference 85d065e (Indra)
* Lock 'GameServer' while executing command, add NoConsole config option f4e8b5e (Indra)
* Lock 'GameServer.Command' in ConsoleThread 50820b3 (Indra)
* Revert bc2a8e1 partly ad241a4 (Indra)
* Don't zip CI builds 163273f (Indra)
* Add jetbrains profiler to profile main server tick bc2a8e1 (Indra)
* Redo CI configuration, add linux-arm 58c4f05 (Indra)
* Don't approve connection on duplicate name 1f91433 (Indra)
* Add experimental UPnP port forward 94d8701 (Indra)
* Rewrite console/command system 9ddecc3 (Indra)
* Add CI_PIPELINE_ID to assembly version 0648e4c (Indra)
* Remove unused sentry code; update dependencies b50e757 (Indra)
* Update CI image to sdk:3.1 8bbad0d (Indra)
* Merge branch 'develop' into 'master' f94be20 (Indra)
* Upgrade to .NET Core 3.1 ba52347 (Indra)
* Add exception message to 'failed to announce' 802180e (Indra)
* Add help command for console 0da0ad0 (Indra)
* Attempt to use SDK 2.2 docker image 4df8493 (Indra)
* Use Path.Combine for paths 7bb63df (Indra)
* Implement "Error" message type fba42d8 (Indra)
* Remove unused imports bd32a7a (Indra)
* Fix GTASERVERCORE-8, fix GTASERVERCORE-16 0a8f8a5 (Indra)
* Refactor announce system, fix GTASERVERCORE-18 9141d43 (Indra)
* Remove 'divide by zero' 74684fc (Indra)
* Progress on race gamemode c6d4c72 (Indra)
45 changes: 18 additions & 27 deletions Client/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ public bool IsFocused
get { return _isFocused; }
set
{
if (value)
IsHidden = false;

if (value && !_isFocused)
{
_mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL");
Expand All @@ -56,6 +53,9 @@ public bool IsFocused
}

_isFocused = value;

if (value && _isHidden)
_isHidden = false;
}
}

Expand All @@ -66,44 +66,35 @@ public bool IsFocused
private int _switch = 1;
private Keys _lastKey;
private bool _isFocused;
private int _lastMessageTime;
private bool _isHidden;
private bool IsHidden
{
get { return _isHidden; }
set
{
if (value && !_isHidden)
{
_mainScaleform.CallFunction("hide");
}
else if (!value && _isHidden)
{
_mainScaleform.CallFunction("showFeed");
}

_isHidden = value;
}
}
private DateTime _lastMessageTime = DateTime.UtcNow;
private bool _isHidden = false;

public void Tick()
{
if (!Main.IsOnServer()) return;

if (Environment.TickCount >= _lastMessageTime + 15000 && !IsFocused && !IsHidden)
IsHidden = true;
if (_lastMessageTime.AddSeconds(15) < DateTime.UtcNow && !IsFocused && !_isHidden)
{
_mainScaleform.CallFunction("hide");
_isHidden = true;
}

if (!IsHidden)
if (!_isHidden)
_mainScaleform.Render2D();


if (!IsFocused) return;
Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 0);
}

public void AddMessage(string sender, string msg)
{
_lastMessageTime = Environment.TickCount;
IsHidden = false;
_lastMessageTime = DateTime.UtcNow;
if (_isHidden)
{
_mainScaleform.CallFunction("showFeed");
_isHidden = false;
}

if (string.IsNullOrEmpty(sender))
{
Expand Down
52 changes: 52 additions & 0 deletions Client/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Drawing;
using Lidgren.Network;
using GTA.Native;
using System.IO;

namespace GTACoOp
{
Expand Down Expand Up @@ -73,4 +74,55 @@ public long GetGameTimer()
return Function.Call<long>(Hash.GET_GAME_TIMER);
}
}

// very basic logger
public class Logger : IDisposable
{
private StreamWriter _handle;

public Logger()
{
// %localappdata%\cgmp\gtacoop\error.log
// C:\Program Files\ can not always be written
// documents might be easier to find for the user?
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "cgmp", "gtacoop");

if(!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}

// TODO this might fail and then entire client is fucked, try to catch
_handle = new StreamWriter(path + @"\error.log");

// yay
WriteLine("GTA Coop version " + Main.ReadableScriptVersion());
}

public void Dispose()
{
_handle.Close();

GC.SuppressFinalize(this);
}

public void Write(string text)
{
_handle.Write(text);
_handle.Flush();
}

public void WriteLine(string text = "")
{
_handle.WriteLine(text);
_handle.Flush();
}

public void WriteException(string description, Exception e)
{
_handle.WriteLine(description + ": " + e.Message + "\n"
+ e.StackTrace);
_handle.Flush();
}
}
}
1 change: 0 additions & 1 deletion Client/DebugWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public void Draw()
output += "IsInVehicle: " + player.Value.IsInVehicle + "\n";
output += "Position: " + player.Value.Position + "\n";
output += "VehiclePosition: " + player.Value.VehiclePosition + "\n";
output += "Steering: " + player.Value.Steering + "\n";
output += "VehModel: " + player.Value.VehicleHash + "\n";
output += "Last Updated: " + player.Value.LastUpdateReceived + "\n";
output += "Latency: " + player.Value.Latency + "\n";
Expand Down
23 changes: 14 additions & 9 deletions Client/GTACoOp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
Expand All @@ -36,7 +36,6 @@
<FileAlignment>8192</FileAlignment>
<DebugSymbols>true</DebugSymbols>
<NoWarn>1591</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<StartupObject>
Expand All @@ -49,8 +48,20 @@
<Reference Include="Lidgren.Network.MultiTarget, Version=2012.1.7.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Lidgren.Network.MultiTarget.2012.1.7.6\lib\net462\Lidgren.Network.MultiTarget.dll</HintPath>
</Reference>
<Reference Include="MaxMind.Db, Version=2.0.0.0, Culture=neutral, PublicKeyToken=66afa4cc5ae853ac, processorArchitecture=MSIL">
<HintPath>..\packages\MaxMind.Db.3.0.0\lib\net461\MaxMind.Db.dll</HintPath>
</Reference>
<Reference Include="MaxMind.GeoIP2, Version=2.6.0.0, Culture=neutral, PublicKeyToken=66afa4cc5ae853ac, processorArchitecture=MSIL">
<HintPath>..\packages\MaxMind.GeoIP2.2.7.1\lib\net45\MaxMind.GeoIP2.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="NativeUI">
<HintPath>D:\Grand Theft Auto V\Scripts\NativeUI.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="protobuf-net, Version=2.4.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
<HintPath>..\packages\protobuf-net.2.4.6\lib\net40\protobuf-net.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -94,15 +105,9 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NativeUI\NativeUI\NativeUI.csproj">
<Project>{f3e16ed9-dbf7-4e7b-b04b-9b24b11891d3}</Project>
<Name>NativeUI</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>COPY "$(TargetPath)" "D:\Grand Theft Auto V\Scripts"</PostBuildEvent>
<PostBuildEvent>COPY "$(TargetPath)" "D:\Grand Theft Auto V\scripts"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Loading

0 comments on commit 6246491

Please sign in to comment.