diff --git a/Game.MenuSystem/SourceDllMain.cs b/Game.MenuSystem/SourceDllMain.cs index 8d52ae1c..559c349b 100644 --- a/Game.MenuSystem/SourceDllMain.cs +++ b/Game.MenuSystem/SourceDllMain.cs @@ -23,9 +23,14 @@ public static class SourceDllMain public static IGarrysMod garrysmod = null!; public static INetworkStringTableContainer? networkstringtable; + [Dependency] public static ICvar cvar { get; private set; } = null!; + [Dependency] public static IFileSystem filesystem { get; private set; } = null!; + [Dependency] public static IMaterialSystem materials { get; private set; } = null!; + [Dependency] public static ICommandLine commandLine { get; private set; } = null!; +#if !SWDS + [Dependency] public static IGameUIFuncs gameuifuncs { get; private set; } = null!; [Dependency] public static IEngineClient engine { get; private set; } = null!; [Dependency] public static IEngineVGui enginevgui { get; private set; } = null!; - [Dependency] public static IGameUIFuncs gameuifuncs { get; private set; } = null!; [Dependency] public static IGameUI gameUI { get; private set; } = null!; [Dependency] public static IMatSystemSurface surface { get; private set; } = null!; [Dependency] public static ISurface Surface { get; private set; } = null!; @@ -36,9 +41,6 @@ public static class SourceDllMain [Dependency] public static ISchemeManager vguiSchemeManager { get; private set; } = null!; [Dependency] public static ILocalize localize { get; private set; } = null!; [Dependency] public static ILocalize Localize { get; private set; } = null!; - [Dependency] public static ICvar cvar { get; private set; } = null!; - [Dependency] public static IFileSystem filesystem { get; private set; } = null!; - [Dependency] public static IMaterialSystem materials { get; private set; } = null!; - [Dependency] public static ICommandLine commandLine { get; private set; } = null!; [Dependency] public static ISystem system { get; private set; } = null!; +#endif } diff --git a/Source.Engine/EngineBuilder.cs b/Source.Engine/EngineBuilder.cs index 0e365387..2b0b452d 100644 --- a/Source.Engine/EngineBuilder.cs +++ b/Source.Engine/EngineBuilder.cs @@ -211,7 +211,6 @@ void PreBuildAllForms() { this.AddSingleton(x => x.GetRequiredService()); this.AddSingleton(); this.AddSingleton(); - this.AddSingleton(); this.AddSingleton(); this.AddSingleton(); this.AddSingleton(x => x.GetRequiredService()); @@ -326,6 +325,7 @@ public ClientLauncherAPI BuildClient() { this.AddSingleton(x => x.GetRequiredService()); // These interfaces go to client and game dll's this.AddSingleton(); + this.AddSingleton(); this.AddSingleton(); this.AddSingleton(x => x.GetRequiredService()); this.AddSingleton(x => x.GetRequiredService()); diff --git a/Source.Engine/StaticPropMgr.cs b/Source.Engine/StaticPropMgr.cs index e2d4e8eb..8f25ed11 100644 --- a/Source.Engine/StaticPropMgr.cs +++ b/Source.Engine/StaticPropMgr.cs @@ -338,6 +338,7 @@ public void ComputePropOpacity(StaticProp prop) { } public void DrawStaticProps(ref InlineArray512 props, int count, bool shadowDepth, bool drawVCollideWireframe) { +#if !SWDS if (!r_drawstaticprops.GetBool()) return; @@ -352,8 +353,10 @@ public void DrawStaticProps(ref InlineArray512 props, int cou else DrawStaticProps_Fast(ref props, count, shadowDepth); } +#endif } +#if !SWDS void DrawStaticProps_Slow(ref InlineArray512 props, int count, bool shadowDepth, bool drawVCollideWireframe) { StudioFlags flags = StudioFlags.Render; if (shadowDepth) @@ -368,7 +371,7 @@ void DrawStaticProps_Slow(ref InlineArray512 props, int count } void DrawStaticProps_Fast(ref InlineArray512 props, int count, bool shadowDepth) => throw new NotImplementedException(); - + const int MAX_OBJECTS = 2048; readonly StaticPropRenderInfo[] PropList = new StaticPropRenderInfo[MAX_OBJECTS]; @@ -392,7 +395,7 @@ void DrawStaticProps_FastPipeline(Span props, int count, bool } modelrender.DrawStaticPropArrayFast(propList, listCount, shadowDepth); } - +#endif static readonly ConVar pipeline_static_props = new("pipeline_static_props", "1"); void OutputLevelStats() => throw new NotImplementedException(); diff --git a/Source.GUI.Controls/SourceDllMain.cs b/Source.GUI.Controls/SourceDllMain.cs index bf7b4570..8b50a848 100644 --- a/Source.GUI.Controls/SourceDllMain.cs +++ b/Source.GUI.Controls/SourceDllMain.cs @@ -17,21 +17,27 @@ namespace Source.GUI.Controls; [EngineComponent] public static class SourceDllMain { - [Dependency] public static ISurface Surface { get; private set; } = null!; - [Dependency] public static ISchemeManager SchemeManager { get; private set; } = null!; - [Dependency] public static IVGui VGui { get; private set; } = null!; - [Dependency] public static IInputSystem input { get; private set; } = null!; - [Dependency] public static IVGuiInput Input { get; private set; } = null!; +#if SWDS + const bool ClientRequired = false; +#else + const bool ClientRequired = true; +#endif + + [Dependency(Required = ClientRequired)] public static ISurface Surface { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static ISchemeManager SchemeManager { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static IVGui VGui { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static IInputSystem input { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static IVGuiInput Input { get; private set; } = null!; [Dependency] public static IEngineAPI EngineAPI { get; private set; } = null!; - [Dependency] public static ILocalize Localize { get; private set; } = null!; - [Dependency] public static ILauncherManager Launcher { get; private set; } = null!; - [Dependency] public static ISystem system { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static ILocalize Localize { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static ILauncherManager Launcher { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static ISystem system { get; private set; } = null!; [Dependency] public static IMaterialSystem Materials { get; private set; } = null!; [Dependency] public static ICvar cvar { get; private set; } = null!; [Dependency] public static IFileSystem fileSystem { get; private set; } = null!; - [Dependency] public static IEngineClient engine { get; private set; } = null!; - [Dependency] public static IGameUIFuncs gameuifuncs { get; private set; } = null!; - [Dependency] public static IMatSystemSurface matSys { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static IEngineClient engine { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static IGameUIFuncs gameuifuncs { get; private set; } = null!; + [Dependency(Required = ClientRequired)] public static IMatSystemSurface matSys { get; private set; } = null!; public static void Link(IServiceCollection services) { services.AddSingleton();