Skip to content

Commit d6db22b

Browse files
authored
Merge pull request #237 from SourceDotNET/dedicated
Get dedicated building and running again
2 parents 979c0d4 + cf598a8 commit d6db22b

4 files changed

Lines changed: 30 additions & 19 deletions

File tree

‎Game.MenuSystem/SourceDllMain.cs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ public static class SourceDllMain
2323
public static IGarrysMod garrysmod = null!;
2424
public static INetworkStringTableContainer? networkstringtable;
2525

26+
[Dependency] public static ICvar cvar { get; private set; } = null!;
27+
[Dependency] public static IFileSystem filesystem { get; private set; } = null!;
28+
[Dependency] public static IMaterialSystem materials { get; private set; } = null!;
29+
[Dependency] public static ICommandLine commandLine { get; private set; } = null!;
30+
#if !SWDS
31+
[Dependency] public static IGameUIFuncs gameuifuncs { get; private set; } = null!;
2632
[Dependency] public static IEngineClient engine { get; private set; } = null!;
2733
[Dependency] public static IEngineVGui enginevgui { get; private set; } = null!;
28-
[Dependency] public static IGameUIFuncs gameuifuncs { get; private set; } = null!;
2934
[Dependency] public static IGameUI gameUI { get; private set; } = null!;
3035
[Dependency] public static IMatSystemSurface surface { get; private set; } = null!;
3136
[Dependency] public static ISurface Surface { get; private set; } = null!;
@@ -36,9 +41,6 @@ public static class SourceDllMain
3641
[Dependency] public static ISchemeManager vguiSchemeManager { get; private set; } = null!;
3742
[Dependency] public static ILocalize localize { get; private set; } = null!;
3843
[Dependency] public static ILocalize Localize { get; private set; } = null!;
39-
[Dependency] public static ICvar cvar { get; private set; } = null!;
40-
[Dependency] public static IFileSystem filesystem { get; private set; } = null!;
41-
[Dependency] public static IMaterialSystem materials { get; private set; } = null!;
42-
[Dependency] public static ICommandLine commandLine { get; private set; } = null!;
4344
[Dependency] public static ISystem system { get; private set; } = null!;
45+
#endif
4446
}

‎Source.Engine/EngineBuilder.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ void PreBuildAllForms() {
211211
this.AddSingleton<IServerPluginHelpers, ServerPlugin>(x => x.GetRequiredService<ServerPlugin>());
212212
this.AddSingleton<IUniformRandomStream, UniformRandomStream>();
213213
this.AddSingleton<ISoundServices, EngineSoundServices>();
214-
this.AddSingleton<IGameUIFuncs, GameUIFuncs>();
215214
this.AddSingleton<DtCommonEng>();
216215
this.AddSingleton<EngineToolImpl>();
217216
this.AddSingleton<IEngineToolInternal>(x => x.GetRequiredService<EngineToolImpl>());
@@ -326,6 +325,7 @@ public ClientLauncherAPI BuildClient() {
326325
this.AddSingleton<IEngineVGui, EngineVGui>(x => x.GetRequiredService<EngineVGui>());
327326
// These interfaces go to client and game dll's
328327
this.AddSingleton<IEngineClient, EngineClient>();
328+
this.AddSingleton<IGameUIFuncs, GameUIFuncs>();
329329
this.AddSingleton<ClientLauncherAPI>();
330330
this.AddSingleton<IEngineAPI, ClientLauncherAPI>(x => x.GetRequiredService<ClientLauncherAPI>());
331331
this.AddSingleton<IClientLauncherAPI, ClientLauncherAPI>(x => x.GetRequiredService<ClientLauncherAPI>());

‎Source.Engine/StaticPropMgr.cs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ public void ComputePropOpacity(StaticProp prop) {
338338
}
339339

340340
public void DrawStaticProps(ref InlineArray512<IClientRenderable> props, int count, bool shadowDepth, bool drawVCollideWireframe) {
341+
#if !SWDS
341342
if (!r_drawstaticprops.GetBool())
342343
return;
343344

@@ -352,8 +353,10 @@ public void DrawStaticProps(ref InlineArray512<IClientRenderable> props, int cou
352353
else
353354
DrawStaticProps_Fast(ref props, count, shadowDepth);
354355
}
356+
#endif
355357
}
356358

359+
#if !SWDS
357360
void DrawStaticProps_Slow(ref InlineArray512<IClientRenderable> props, int count, bool shadowDepth, bool drawVCollideWireframe) {
358361
StudioFlags flags = StudioFlags.Render;
359362
if (shadowDepth)
@@ -368,7 +371,7 @@ void DrawStaticProps_Slow(ref InlineArray512<IClientRenderable> props, int count
368371
}
369372

370373
void DrawStaticProps_Fast(ref InlineArray512<IClientRenderable> props, int count, bool shadowDepth) => throw new NotImplementedException();
371-
374+
372375
const int MAX_OBJECTS = 2048;
373376
readonly StaticPropRenderInfo[] PropList = new StaticPropRenderInfo[MAX_OBJECTS];
374377

@@ -392,7 +395,7 @@ void DrawStaticProps_FastPipeline(Span<IClientRenderable> props, int count, bool
392395
}
393396
modelrender.DrawStaticPropArrayFast(propList, listCount, shadowDepth);
394397
}
395-
398+
#endif
396399
static readonly ConVar pipeline_static_props = new("pipeline_static_props", "1");
397400

398401
void OutputLevelStats() => throw new NotImplementedException();

‎Source.GUI.Controls/SourceDllMain.cs‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,27 @@ namespace Source.GUI.Controls;
1717
[EngineComponent]
1818
public static class SourceDllMain
1919
{
20-
[Dependency] public static ISurface Surface { get; private set; } = null!;
21-
[Dependency] public static ISchemeManager SchemeManager { get; private set; } = null!;
22-
[Dependency] public static IVGui VGui { get; private set; } = null!;
23-
[Dependency] public static IInputSystem input { get; private set; } = null!;
24-
[Dependency] public static IVGuiInput Input { get; private set; } = null!;
20+
#if SWDS
21+
const bool ClientRequired = false;
22+
#else
23+
const bool ClientRequired = true;
24+
#endif
25+
26+
[Dependency(Required = ClientRequired)] public static ISurface Surface { get; private set; } = null!;
27+
[Dependency(Required = ClientRequired)] public static ISchemeManager SchemeManager { get; private set; } = null!;
28+
[Dependency(Required = ClientRequired)] public static IVGui VGui { get; private set; } = null!;
29+
[Dependency(Required = ClientRequired)] public static IInputSystem input { get; private set; } = null!;
30+
[Dependency(Required = ClientRequired)] public static IVGuiInput Input { get; private set; } = null!;
2531
[Dependency] public static IEngineAPI EngineAPI { get; private set; } = null!;
26-
[Dependency] public static ILocalize Localize { get; private set; } = null!;
27-
[Dependency] public static ILauncherManager Launcher { get; private set; } = null!;
28-
[Dependency] public static ISystem system { get; private set; } = null!;
32+
[Dependency(Required = ClientRequired)] public static ILocalize Localize { get; private set; } = null!;
33+
[Dependency(Required = ClientRequired)] public static ILauncherManager Launcher { get; private set; } = null!;
34+
[Dependency(Required = ClientRequired)] public static ISystem system { get; private set; } = null!;
2935
[Dependency] public static IMaterialSystem Materials { get; private set; } = null!;
3036
[Dependency] public static ICvar cvar { get; private set; } = null!;
3137
[Dependency] public static IFileSystem fileSystem { get; private set; } = null!;
32-
[Dependency] public static IEngineClient engine { get; private set; } = null!;
33-
[Dependency] public static IGameUIFuncs gameuifuncs { get; private set; } = null!;
34-
[Dependency] public static IMatSystemSurface matSys { get; private set; } = null!;
38+
[Dependency(Required = ClientRequired)] public static IEngineClient engine { get; private set; } = null!;
39+
[Dependency(Required = ClientRequired)] public static IGameUIFuncs gameuifuncs { get; private set; } = null!;
40+
[Dependency(Required = ClientRequired)] public static IMatSystemSurface matSys { get; private set; } = null!;
3541

3642
public static void Link(IServiceCollection services) {
3743
services.AddSingleton<AnimationController>();

0 commit comments

Comments
 (0)