Skip to content

Commit 20f3a2d

Browse files
skuzzissamyycXELDmentagasking1337
authored
Release v1.0.2 (#123)
Co-authored-by: samyyc <s1myyc@outlook.com> Co-authored-by: Ambr0se <eldment@qq.com> Co-authored-by: aga <rubin.samuel20@yahoo.ro>
1 parent da80921 commit 20f3a2d

File tree

2,910 files changed

+35326
-34617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,910 files changed

+35326
-34617
lines changed

generator/schema_generator/sdk.json

Lines changed: 8376 additions & 8376 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
private static readonly Lazy<nint> _$NAME$Offset = new(() => Schema.GetOffset($HASH$), LazyThreadSafetyMode.None);
1+
private static readonly nint _$NAME$Offset = Schema.GetOffset($HASH$);
22

33
public string $NAME$ {
44
get {
5-
var ptr = _Handle + _$NAME$Offset.Value;
5+
var ptr = _Handle + _$NAME$Offset;
66
return Schema.GetString(ptr);
77
}
8-
set => Schema.SetFixedString(_Handle, _$NAME$Offset.Value, value, $ELEMENT_COUNT$);
8+
set => Schema.SetFixedString(_Handle, _$NAME$Offset, value, $ELEMENT_COUNT$);
99
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
private static readonly Lazy<nint> _$NAME$Offset = new(() => Schema.GetOffset($HASH$), LazyThreadSafetyMode.None);
1+
private static readonly nint _$NAME$Offset = Schema.GetOffset($HASH$);
22

33
public $INTERFACE_TYPE$? $NAME$ {
44
get {
5-
var ptr = _Handle.Read<nint>(_$NAME$Offset.Value);
5+
var ptr = _Handle.Read<nint>(_$NAME$Offset);
66
return ptr.IsValidPtr() ? new $IMPL_TYPE$(ptr) : null;
77
}
88
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
private static readonly Lazy<nint> _$NAME$Offset = new(() => Schema.GetOffset($HASH$), LazyThreadSafetyMode.None);
1+
private static readonly nint _$NAME$Offset = Schema.GetOffset($HASH$);
22

33
public $INTERFACE_TYPE$ $NAME$ {
4-
get => new $IMPL_TYPE$(_Handle + _$NAME$Offset.Value);
4+
get => new $IMPL_TYPE$(_Handle + _$NAME$Offset);
55
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
private static readonly Lazy<nint> _$NAME$Offset = new(() => Schema.GetOffset($HASH$), LazyThreadSafetyMode.None);
1+
private static readonly nint _$NAME$Offset = Schema.GetOffset($HASH$);
22

33
public string $NAME$ {
44
get {
5-
var ptr = _Handle.Read<nint>(_$NAME$Offset.Value);
5+
var ptr = _Handle.Read<nint>(_$NAME$Offset);
66
return Schema.GetString(ptr);
77
}
8-
set => Schema.SetString(_Handle, _$NAME$Offset.Value, value);
8+
set => Schema.SetString(_Handle, _$NAME$Offset, value);
99
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
private static readonly Lazy<nint> _$NAME$Offset = new(() => Schema.GetOffset($HASH$), LazyThreadSafetyMode.None);
1+
private static readonly nint _$NAME$Offset = Schema.GetOffset($HASH$);
22

33
public ref $IMPL_TYPE$ $NAME$ {
4-
get => ref _Handle.$REF_METHOD$<$IMPL_TYPE$>(_$NAME$Offset.Value);
4+
get => ref _Handle.$REF_METHOD$<$IMPL_TYPE$>(_$NAME$Offset);
55
}

managed/src/Entrypoint.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ internal class Entrypoint
99
{
1010
[UnmanagedCallersOnly]
1111
[SecurityCritical]
12-
public unsafe static void Start( IntPtr nativeTable, int nativeTableSize, IntPtr basePath )
12+
public unsafe static void Start( IntPtr nativeTable, int nativeTableSize, IntPtr basePath, IntPtr logsPath )
1313
{
1414
try
1515
{
16-
Bootstrap.Start(nativeTable, nativeTableSize, Marshal.PtrToStringUTF8(basePath)!);
16+
Bootstrap.Start(nativeTable, nativeTableSize, Marshal.PtrToStringUTF8(basePath)!, Marshal.PtrToStringUTF8(logsPath)!);
1717
}
1818
catch (Exception e)
1919
{
Lines changed: 77 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,97 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
using Microsoft.Extensions.Logging;
4+
using Microsoft.Extensions.Hosting;
5+
using Microsoft.Extensions.Configuration;
16
using Microsoft.Extensions.DependencyInjection;
27
using Spectre.Console;
8+
using SwiftlyS2.Core.Misc;
9+
using SwiftlyS2.Core.Events;
310
using SwiftlyS2.Core.Hosting;
411
using SwiftlyS2.Core.Natives;
512
using SwiftlyS2.Core.Services;
6-
using SwiftlyS2.Shared;
7-
using SwiftlyS2.Core.Events;
8-
using Microsoft.Extensions.Logging;
9-
using Microsoft.Extensions.Hosting;
10-
using SwiftlyS2.Core.Misc;
11-
using Microsoft.Extensions.Configuration;
12-
using SwiftlyS2.Shared.Memory;
13-
using SwiftlyS2.Shared.Services;
14-
using System.Runtime.InteropServices;
1513
using SwiftlyS2.Shared.SteamAPI;
16-
using System.Reflection;
14+
1715
namespace SwiftlyS2.Core;
1816

1917
internal static class Bootstrap
2018
{
19+
// how tf i forgot services can be collected hahahahahahahhaahhahaa FUCK
20+
private static IHost? sw2Host;
2121

22-
// how tf i forgot services can be collected hahahahahahahhaahhahaa FUCK
23-
private static IHost? _host;
24-
25-
private static IntPtr SteamAPIDLLResolver( string libraryName, Assembly assembly, DllImportSearchPath? searchPath )
26-
{
27-
if (libraryName == "steam_api" || libraryName == "sdkencryptedappticket")
22+
private static IntPtr SteamAPIDLLResolver( string libraryName, Assembly assembly, DllImportSearchPath? searchPath )
2823
{
29-
if (OperatingSystem.IsWindows())
30-
{
31-
libraryName += "64";
32-
}
33-
34-
if (NativeLibrary.TryLoad(libraryName, out var handle))
35-
{
36-
return handle;
37-
}
38-
}
24+
if (libraryName == "steam_api" || libraryName == "sdkencryptedappticket")
25+
{
26+
if (OperatingSystem.IsWindows())
27+
{
28+
libraryName += "64";
29+
}
3930

40-
return IntPtr.Zero;
41-
}
31+
if (NativeLibrary.TryLoad(libraryName, out var handle))
32+
{
33+
return handle;
34+
}
35+
}
4236

43-
public static void Start( IntPtr nativeTable, int nativeTableSize, string basePath )
44-
{
45-
Environment.SetEnvironmentVariable("SWIFTLY_MANAGED_ROOT", basePath);
46-
47-
NativeBinding.BindNatives(nativeTable, nativeTableSize);
48-
49-
NativeLibrary.SetDllImportResolver(typeof(NativeMethods).Assembly, SteamAPIDLLResolver);
50-
51-
EventPublisher.Register();
52-
GameFunctions.Initialize();
53-
FileLogger.Initialize(basePath);
37+
return IntPtr.Zero;
38+
}
5439

55-
AnsiConsole.Write(new FigletText("SwiftlyS2").LeftJustified().Color(Spectre.Console.Color.LightSteelBlue1));
40+
public static void Start( IntPtr nativeTable, int nativeTableSize, string basePath, string logPath )
41+
{
42+
Environment.SetEnvironmentVariable("SWIFTLY_MANAGED_ROOT", basePath);
43+
NativeBinding.BindNatives(nativeTable, nativeTableSize);
44+
NativeLibrary.SetDllImportResolver(typeof(NativeMethods).Assembly, SteamAPIDLLResolver);
5645

57-
_host = Host.CreateDefaultBuilder()
58-
.UseConsoleLifetime(options =>
59-
{
60-
options.SuppressStatusMessages = true;
61-
})
62-
.ConfigureServices(( context, services ) =>
63-
{
64-
services.AddHostedService<StartupService>();
65-
})
66-
.ConfigureLogging(( context, logging ) =>
67-
{
68-
logging.ClearProviders();
69-
logging.AddProvider(new SwiftlyLoggerProvider("SwiftlyS2"));
70-
})
71-
.ConfigureAppConfiguration(( context, config ) =>
72-
{
73-
config.SetBasePath(Path.Combine(Environment.GetEnvironmentVariable("SWIFTLY_MANAGED_ROOT")!, "configs"));
74-
config.AddJsonFile("permissions.jsonc", optional: false, reloadOnChange: true);
75-
})
76-
.ConfigureServices(( context, services ) =>
77-
{
78-
services
79-
.AddProfileService()
80-
.AddConfigurationService()
81-
.AddTestService()
82-
.AddRootDirService()
83-
.AddDataDirectoryService()
84-
.AddPlayerManagerService()
85-
.AddPluginManager()
86-
.AddHookManager()
87-
.AddTraceManagerService()
88-
.AddPermissionManager()
89-
.AddCoreHookService()
90-
.AddCoreCommandService()
91-
.AddCommandTrackerManager()
92-
.AddCommandTrackerService()
93-
.AddSwiftlyCore(basePath);
94-
})
95-
.Build();
46+
EventPublisher.Register();
47+
GameFunctions.Initialize();
48+
FileLogger.Initialize(logPath);
9649

97-
_host.Start();
50+
AnsiConsole.Write(new FigletText("SwiftlyS2").LeftJustified().Color(Color.LightSteelBlue1));
9851

99-
// provider.UseTestService();
52+
sw2Host = Host.CreateDefaultBuilder()
53+
.UseConsoleLifetime(options =>
54+
{
55+
options.SuppressStatusMessages = true;
56+
})
57+
.ConfigureServices(( context, services ) =>
58+
{
59+
_ = services.AddHostedService<StartupService>();
60+
})
61+
.ConfigureLogging(( context, logging ) =>
62+
{
63+
_ = logging.ClearProviders();
64+
_ = logging.AddProvider(new SwiftlyLoggerProvider("SwiftlyS2"));
65+
})
66+
.ConfigureAppConfiguration(( context, config ) =>
67+
{
68+
_ = config.SetBasePath(Path.Combine(Environment.GetEnvironmentVariable("SWIFTLY_MANAGED_ROOT")!, "configs"));
69+
_ = config.AddJsonFile("permissions.jsonc", optional: false, reloadOnChange: true);
70+
})
71+
.ConfigureServices(( context, services ) =>
72+
{
73+
_ = services
74+
.AddProfileService()
75+
.AddConfigurationService()
76+
.AddTestService()
77+
.AddRootDirService()
78+
.AddDataDirectoryService()
79+
.AddPlayerManagerService()
80+
.AddPluginManager()
81+
.AddHookManager()
82+
.AddTraceManagerService()
83+
.AddPermissionManager()
84+
.AddCoreHookService()
85+
.AddCoreCommandService()
86+
.AddCommandTrackerManager()
87+
.AddCommandTrackerService()
88+
.AddMenuManagerAPI()
89+
.AddMenuManagerAPIService()
90+
.AddSwiftlyCore(basePath);
91+
})
92+
.Build();
10093

101-
}
94+
sw2Host.Start();
95+
// provider.UseTestService();
96+
}
10297
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using SwiftlyS2.Core.Menus;
3+
4+
namespace SwiftlyS2.Core.Hosting;
5+
6+
internal static class MenuManagerAPIInjection
7+
{
8+
public static IServiceCollection AddMenuManagerAPI( this IServiceCollection self )
9+
{
10+
return self.AddSingleton<MenuManagerAPI>();
11+
}
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using SwiftlyS2.Core.Services;
3+
4+
namespace SwiftlyS2.Core.Hosting;
5+
6+
internal static class MenuManagerAPIServiceInjection
7+
{
8+
public static IServiceCollection AddMenuManagerAPIService( this IServiceCollection self )
9+
{
10+
return self.AddSingleton<MenuManagerAPIService>();
11+
}
12+
13+
public static void UseMenuManagerAPIService( this IServiceProvider self )
14+
{
15+
self.GetRequiredService<MenuManagerAPIService>();
16+
}
17+
}

0 commit comments

Comments
 (0)