Skip to content

Commit

Permalink
ACZ fixes (OpenDreamProject#1573)
Browse files Browse the repository at this point in the history
* Fix packaging

* Fix ACZ root path being wrong if using relative JSON path

The JSON path is relative to the original working directory of the file. However the server switches working directory during initialization of DreamResourceManager, which invalidates the old path. This old path was still passed to ACZ, so using a relative JSON path would make ACZ unable to find rsc files.

The path is now turned absolute before the working directory switch occurs.

* Add Full Hybrid ACZ provider.

This permits rsc resources to be combined with the Content.Client.zip Hybrid ACZ.

Also update RT

* Update OpenDreamPackaging/DreamPackaging.cs

---------

Co-authored-by: wixoa <[email protected]>
  • Loading branch information
PJB3005 and wixoaGit authored Dec 28, 2023
1 parent 3ccb916 commit 173ca01
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 40 deletions.
17 changes: 12 additions & 5 deletions OpenDreamPackaging/DreamPackaging.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Robust.Packaging;
using Robust.Packaging.AssetProcessing;
using Robust.Packaging.AssetProcessing.Passes;

namespace OpenDreamPackaging;

Expand All @@ -19,13 +20,21 @@ public static async Task WriteResources(

var inputPass = graph.Input;

await RobustClientPackaging.WriteClientResources(
contentDir,
await RobustSharedPackaging.WriteContentAssemblies(
inputPass,
cancel);
contentDir,
"Content.Client",
new[] { "OpenDreamClient", "OpenDreamShared" },
cancel: cancel);

await RobustClientPackaging.WriteClientResources(contentDir, inputPass, cancel);

WriteRscResources(dreamRootDir, resources, inputPass);

inputPass.InjectFinished();
}

public static void WriteRscResources(string dreamRootDir, string[] resources, AssetPassPipe inputPass) {
for (var i = 0; i < resources.Length; i++) {
var resource = resources[i].Replace('\\', Path.DirectorySeparatorChar);
// The game client only knows a resource ID, so that's what we name the files.
Expand All @@ -35,7 +44,5 @@ await RobustClientPackaging.WriteClientResources(

inputPass.InjectFileFromDisk(path, diskPath);
}

inputPass.InjectFinished();
}
}
43 changes: 43 additions & 0 deletions OpenDreamRuntime/DreamAczProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using OpenDreamPackaging;
using Robust.Packaging;
using Robust.Packaging.AssetProcessing;
using Robust.Server.ServerStatus;

namespace OpenDreamRuntime;

public sealed class DreamAczProvider : IMagicAczProvider, IFullHybridAczProvider {
private readonly IDependencyCollection _dependencies;
private readonly string _rootPath;
private readonly string[] _resources;

public DreamAczProvider(IDependencyCollection dependencies, string rootPath, string[] resources) {
_dependencies = dependencies;
_rootPath = rootPath;
_resources = resources;
}

public async Task Package(AssetPass pass, IPackageLogger logger, CancellationToken cancel) {
var contentDir = DefaultMagicAczProvider.FindContentRootPath(_dependencies);

await DreamPackaging.WriteResources(contentDir, _rootPath, _resources, pass, logger, cancel);
}

public Task Package(AssetPass hybridPackageInput, AssetPass output, IPackageLogger logger, CancellationToken cancel) {
var clientAssetGraph = new RobustClientAssetGraph();
var resourceInput = clientAssetGraph.Input;
output.AddDependency(clientAssetGraph.Output);
output.AddDependency(hybridPackageInput);

AssetGraph.CalculateGraph(
clientAssetGraph.AllPasses.Concat(new[] { hybridPackageInput, output }).ToArray(),
logger);

DreamPackaging.WriteRscResources(_rootPath, _resources, resourceInput);
resourceInput.InjectFinished();

return Task.CompletedTask;
}
}
26 changes: 0 additions & 26 deletions OpenDreamRuntime/DreamMagicAczProvider.cs

This file was deleted.

8 changes: 4 additions & 4 deletions OpenDreamRuntime/DreamManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public bool LoadJson(string? jsonPath) {
}

_compiledJson = json;
var rootPath = Path.GetDirectoryName(jsonPath)!;
var rootPath = Path.GetFullPath(Path.GetDirectoryName(jsonPath)!);
var resources = _compiledJson.Resources ?? Array.Empty<string>();
_dreamResourceManager.Initialize(rootPath, resources);
if(!string.IsNullOrEmpty(_compiledJson.Interface) && !_dreamResourceManager.DoesFileExist(_compiledJson.Interface))
Expand Down Expand Up @@ -146,9 +146,9 @@ public bool LoadJson(string? jsonPath) {

_dreamMapManager.LoadMaps(_compiledJson.Maps);

_statusHost.SetMagicAczProvider(new DreamMagicAczProvider(
_dependencyCollection, rootPath, resources
));
var aczProvider = new DreamAczProvider(_dependencyCollection, rootPath, resources);
_statusHost.SetMagicAczProvider(aczProvider);
_statusHost.SetFullHybridAczProvider(aczProvider);

return true;
}
Expand Down
4 changes: 0 additions & 4 deletions OpenDreamRuntime/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public sealed class EntryPoint : GameServer {
private DreamCommandSystem? _commandSystem;

public override void Init() {
IoCManager.Resolve<IStatusHost>().SetMagicAczProvider(new DefaultMagicAczProvider(
new DefaultMagicAczInfo("Content.Client", new[] {"OpenDreamClient", "OpenDreamShared"}),
IoCManager.Resolve<IDependencyCollection>()));

IComponentFactory componentFactory = IoCManager.Resolve<IComponentFactory>();
componentFactory.DoAutoRegistrations();

Expand Down
2 changes: 1 addition & 1 deletion RobustToolbox
Submodule RobustToolbox updated 91 files
+1 −1 MSBuild/Robust.Engine.Version.props
+61 −1 RELEASE-NOTES.md
+155 −74 Robust.Benchmarks/Transform/RecursiveMoveBenchmark.cs
+44 −0 Robust.Client.WebView/Cef/Program.cs
+5 −0 Robust.Client.WebView/Cef/WebViewManagerCef.cs
+20 −7 Robust.Client/GameObjects/ClientEntityManager.cs
+54 −5 Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs
+2 −6 Robust.Client/GameObjects/EntitySystems/ClientOccluderSystem.cs
+8 −9 Robust.Client/GameObjects/EntitySystems/PointLightSystem.cs
+1 −1 Robust.Client/GameStates/ClientDirtySystem.cs
+55 −15 Robust.Client/UserInterface/Controls/SpriteView.cs
+2 −2 Robust.Server/Audio/AudioSystem.Effects.cs
+1 −2 Robust.Server/Audio/AudioSystem.cs
+26 −9 Robust.Server/Console/ServerConsoleHost.cs
+2 −2 Robust.Server/GameObjects/EntitySystems/InputSystem.cs
+7 −0 Robust.Server/GameObjects/EntitySystems/MapSystem.cs
+15 −0 Robust.Server/GameObjects/EntitySystems/PointLightSystem.cs
+23 −0 Robust.Server/GameObjects/EntitySystems/ServerOccluderSystem.cs
+46 −20 Robust.Server/GameObjects/EntitySystems/VisibilitySystem.cs
+2 −8 Robust.Server/GameObjects/ServerEntityManager.cs
+0 −91 Robust.Server/GameStates/PVSData.cs
+277 −0 Robust.Server/GameStates/PvsChunk.cs
+0 −673 Robust.Server/GameStates/PvsCollection.cs
+192 −0 Robust.Server/GameStates/PvsData.cs
+171 −34 Robust.Server/GameStates/PvsOverrideSystem.cs
+39 −11 Robust.Server/GameStates/PvsSystem.Ack.cs
+338 −0 Robust.Server/GameStates/PvsSystem.Chunks.cs
+3 −15 Robust.Server/GameStates/PvsSystem.Dirty.cs
+114 −0 Robust.Server/GameStates/PvsSystem.Entity.cs
+15 −71 Robust.Server/GameStates/PvsSystem.GetStates.cs
+190 −0 Robust.Server/GameStates/PvsSystem.Overrides.cs
+39 −0 Robust.Server/GameStates/PvsSystem.Pooling.cs
+125 −0 Robust.Server/GameStates/PvsSystem.Session.cs
+149 −214 Robust.Server/GameStates/PvsSystem.ToSendSet.cs
+154 −758 Robust.Server/GameStates/PvsSystem.cs
+0 −197 Robust.Server/GameStates/RobustTree.cs
+25 −242 Robust.Server/GameStates/ServerGameStateManager.cs
+7 −10 Robust.Server/Replays/ReplayRecordingManager.cs
+30 −0 Robust.Server/ServerStatus/IFullHybridAczProvider.cs
+25 −0 Robust.Server/ServerStatus/IStatusHost.cs
+31 −11 Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs
+17 −9 Robust.Server/ServerStatus/StatusHost.Acz.cs
+2 −0 Robust.Shared.Scripting/ScriptGlobalsShared.cs
+16 −2 Robust.Shared/CVars.cs
+5 −0 Robust.Shared/Console/ConsoleHost.cs
+1 −1 Robust.Shared/Containers/SharedContainerSystem.Insert.cs
+0 −2 Robust.Shared/Containers/SharedContainerSystem.Remove.cs
+0 −3 Robust.Shared/Containers/SharedContainerSystem.Validation.cs
+5 −0 Robust.Shared/GameObjects/Components/Eye/EyeComponent.cs
+23 −0 Robust.Shared/GameObjects/Components/MetaDataComponent.cs
+2 −0 Robust.Shared/GameObjects/Components/Renderable/SpriteLayerData.cs
+23 −25 Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs
+2 −0 Robust.Shared/GameObjects/Entity.cs
+87 −9 Robust.Shared/GameObjects/EntityManager.cs
+2 −2 Robust.Shared/GameObjects/EntityStringRepresentation.cs
+30 −15 Robust.Shared/GameObjects/EntitySystem.Proxy.cs
+2 −7 Robust.Shared/GameObjects/EntitySystemMessages/EntityTerminatingEvent.cs
+2 −2 Robust.Shared/GameObjects/IComponent.cs
+21 −1 Robust.Shared/GameObjects/IEntityManager.cs
+3 −0 Robust.Shared/GameObjects/NetEntity.cs
+4 −1 Robust.Shared/GameObjects/Systems/EntityLookupSystem.cs
+10 −3 Robust.Shared/GameObjects/Systems/MetaDataSystem.cs
+2 −2 Robust.Shared/GameObjects/Systems/OccluderSystem.cs
+34 −14 Robust.Shared/GameObjects/Systems/SharedGridTraversalSystem.cs
+15 −15 Robust.Shared/GameObjects/Systems/SharedMapSystem.Grid.cs
+20 −6 Robust.Shared/GameObjects/Systems/SharedPointLightSystem.cs
+7 −7 Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs
+20 −0 Robust.Shared/GameStates/GameState.cs
+29 −1 Robust.Shared/Localization/ILocalizationManager.cs
+189 −52 Robust.Shared/Localization/LocalizationManager.cs
+1 −0 Robust.Shared/Map/IMapManager.cs
+75 −21 Robust.Shared/Map/MapManager.Queries.cs
+1 −3 Robust.Shared/Network/Messages/MsgState.cs
+1 −1 Robust.Shared/Physics/Systems/SharedBroadphaseSystem.cs
+1 −2 Robust.Shared/Player/ISharedPlayerManager.cs
+6 −21 Robust.Shared/Player/SharedPlayerManager.State.cs
+2 −2 Robust.Shared/Replays/SharedReplayRecordingManager.cs
+1 −1 Robust.Shared/Toolshed/Commands/Entities/DoCommand.cs
+3 −0 Robust.Shared/Toolshed/Commands/Generic/EmplaceCommand.cs
+3 −0 Robust.Shared/Toolshed/Commands/Generic/ReduceCommand.cs
+7 −1 Robust.Shared/Toolshed/IInvocationContext.cs
+10 −5 Robust.Shared/Toolshed/Invocation/OldShellInvocationContext.cs
+34 −13 Robust.Shared/Toolshed/ToolshedManager.cs
+10 −1 Robust.UnitTesting/RobustIntegrationTest.NetManager.cs
+5 −1 Robust.UnitTesting/RobustUnitTest.cs
+153 −0 Robust.UnitTesting/Server/GameStates/PvsChunkTest.cs
+7 −2 Robust.UnitTesting/Server/RobustServerSimulation.cs
+6 −6 Robust.UnitTesting/Shared/GameObjects/ContainerTests.cs
+6 −6 Robust.UnitTesting/Shared/Map/EntityCoordinates_Tests.cs
+3 −0 Robust.UnitTesting/Shared/Toolshed/ToolshedTest.cs
+5 −1 Robust.UnitTesting/TestingParallelManager.cs

0 comments on commit 173ca01

Please sign in to comment.