Skip to content

Commit

Permalink
Brio 0.2 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
AsgardXIV committed Dec 31, 2023
1 parent 0f5574b commit d226dd3
Show file tree
Hide file tree
Showing 244 changed files with 23,624 additions and 3,671 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Brio - Dalamud Release

on:
push:
branches: '*'
tags-ignore: '*'
pull_request:

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x

- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev"
- name: Restore Dependencies
run: dotnet restore Brio.sln

- name: Build Brio
run: dotnet build --no-restore Brio.sln /p:Configuration=Release /p:DebugType=None /p:DebugSymbols=false /p:Version=0.0.0.1

- name: Zip Release
uses: TheDoctor0/zip-release@0.6.0
with:
filename: '../../../../Brio.zip'
directory: './Brio/bin/x64/Release/'

- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.1
with:
path: |
./Brio.zip
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Brio
name: Build Brio - Dalamud Staging

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ jobs:

- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev"
- name: Restore Dependencies
run: dotnet restore Brio.sln

- name: Build Brio
run: dotnet build Brio.sln --no-restore /p:Configuration=Release /p:DebugType=None /p:DebugSymbols=false /p:Version=${{ github.event.inputs.version }}
run: dotnet build Brio.sln --no-restore /p:Configuration=Release /p:Version=${{ github.event.inputs.version }}

- name: Zip Release
uses: TheDoctor0/zip-release@0.6.0
with:
filename: '../../../../Brio.zip'
directory: './Brio/bin/x64/Release/'
exclusions: '*.pdb* *.xml*'
exclusions: 'Brio Brio/*'

- name: Upload Release
uses: ncipollo/release-action@v1
Expand Down
2,309 changes: 2,309 additions & 0 deletions Acknowledgements.md

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Brio.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
VisualStudioVersion = 17.8.34316.72
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Brio", "Brio\Brio.csproj", "{E88698DB-603B-4D99-8A46-72BD91094BED}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Brio", "Brio\Brio.csproj", "{6E14631E-8223-427D-8A03-550EEE66B842}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E88698DB-603B-4D99-8A46-72BD91094BED}.Debug|Any CPU.ActiveCfg = Debug|x64
{E88698DB-603B-4D99-8A46-72BD91094BED}.Debug|Any CPU.Build.0 = Debug|x64
{E88698DB-603B-4D99-8A46-72BD91094BED}.Release|Any CPU.ActiveCfg = Release|x64
{E88698DB-603B-4D99-8A46-72BD91094BED}.Release|Any CPU.Build.0 = Release|x64
{6E14631E-8223-427D-8A03-550EEE66B842}.Debug|x64.ActiveCfg = Debug|x64
{6E14631E-8223-427D-8A03-550EEE66B842}.Debug|x64.Build.0 = Debug|x64
{6E14631E-8223-427D-8A03-550EEE66B842}.Release|x64.ActiveCfg = Release|x64
{6E14631E-8223-427D-8A03-550EEE66B842}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {54ABBAF7-84C3-49B8-A395-FA332263885E}
SolutionGuid = {5E2A0464-B31C-449B-B345-80D9E0F949A6}
EndGlobalSection
EndGlobal
169 changes: 125 additions & 44 deletions Brio/Brio.cs
Original file line number Diff line number Diff line change
@@ -1,71 +1,152 @@
using Brio.Config;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Brio.Config;
using Brio.Core;
using Brio.Entities;
using Brio.Game.Actor;
using Brio.Game.Chat;
using Brio.Game.GPose;
using Brio.Game.Render;
using Brio.Game.Posing;
using Brio.Game.World;
using Brio.IPC;
using Brio.Resources;
using Brio.UI;
using Brio.UI.Windows;
using Brio.Web;
using Dalamud.Plugin.Services;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics;
using Brio.Game.Camera;
using Brio.UI.Windows.Specialized;
using Brio.Game.Core;
using System;

namespace Brio;

public class Brio : IDisposable
public class Brio : IDalamudPlugin
{
public const string PluginName = "Brio";
public static readonly string PluginVersion = typeof(Brio).Assembly.GetName().Version?.ToString() ?? "(Unknown Version)";
public const string Name = "Brio";

private readonly ServiceProvider _services;

private static ServiceManager _serviceManager { get; set; } = null!;
public static IPluginLog Log { get; private set; } = null!;

public Brio()
public Brio(DalamudPluginInterface pluginInterface)
{
_serviceManager = new ServiceManager();

// Services
_serviceManager.Add<ConfigService>();
_serviceManager.Add<CommandHandlerService>();
_serviceManager.Add<GPoseService>();
_serviceManager.Add<RenderHookService>();
_serviceManager.Add<ActorService>();
_serviceManager.Add<ActorRedrawService>();
_serviceManager.Add<ActorSpawnService>();
_serviceManager.Add<ActionTimelineService>();
_serviceManager.Add<TimeService>();
_serviceManager.Add<WeatherService>();
_serviceManager.Add<FestivalService>();
_serviceManager.Add<PenumbraIPCService>();
_serviceManager.Add<PenumbraCollectionService>();
_serviceManager.Add<BrioIPCService>();

// Presentation
_serviceManager.Add<UIService>();
_serviceManager.Add<WebService>();
_serviceManager.Add<WelcomeService>();

Dalamud.Framework.RunOnFrameworkThread(() =>
// Setup dalamud services
var dalamudServices = new DalamudServices(pluginInterface);
Log = dalamudServices.Log;

var stopwatch = new Stopwatch();
stopwatch.Start();
Log.Info($"Starting {Name}...");

// Setup plugin services
var serviceCollection = SetupServices(dalamudServices);
_services = serviceCollection.BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true });

dalamudServices.Framework.RunOnFrameworkThread(() =>
{
_serviceManager.Start();
Dalamud.Framework.Update += Framework_Update;
try
{
// Initialize the singletons
foreach (var service in serviceCollection)
{
if (service.Lifetime == ServiceLifetime.Singleton)
_services.GetRequiredService(service.ServiceType);
}

// Setup default entities
_services.GetRequiredService<EntityManager>().SetupDefaultEntities();
_services.GetRequiredService<EntityActorManager>().AttachContainer();

// Trigger GPose events to ensure the plugin is in the correct state
_services.GetRequiredService<GPoseService>().TriggerGPoseChange();

Log.Info($"Started {Name} in {stopwatch.ElapsedMilliseconds}ms");
}
catch (Exception e)
{
Log.Error(e, $"Failed to start {Name} in {stopwatch.ElapsedMilliseconds}ms");
_services.Dispose();
throw;
}
});
}

private void Framework_Update(IFramework framework)
private IServiceCollection SetupServices(DalamudServices dalamudServices)
{
_serviceManager.Tick();
ServiceCollection serviceCollection = new();

// Dalamud
serviceCollection.AddSingleton(dalamudServices.PluginInterface);
serviceCollection.AddSingleton(dalamudServices.Framework);
serviceCollection.AddSingleton(dalamudServices.GameInteropProvider);
serviceCollection.AddSingleton(dalamudServices.ClientState);
serviceCollection.AddSingleton(dalamudServices.SigScanner);
serviceCollection.AddSingleton(dalamudServices.ObjectTable);
serviceCollection.AddSingleton(dalamudServices.DataManager);
serviceCollection.AddSingleton(dalamudServices.CommandManager);
serviceCollection.AddSingleton(dalamudServices.ToastGui);
serviceCollection.AddSingleton(dalamudServices.TargetManager);
serviceCollection.AddSingleton(dalamudServices.TextureProvider);
serviceCollection.AddSingleton(dalamudServices.Log);
serviceCollection.AddSingleton(dalamudServices.ChatGui);

// Core / Misc
serviceCollection.AddSingleton<EventBus>();
serviceCollection.AddSingleton<ConfigurationService>();
serviceCollection.AddSingleton<ResourceProvider>();
serviceCollection.AddSingleton<GameDataProvider>();
serviceCollection.AddSingleton<WelcomeService>();

// IPC
serviceCollection.AddSingleton<PenumbraService>();
serviceCollection.AddSingleton<GlamourerService>();

// Web
serviceCollection.AddSingleton<WebService>();

// Entity
serviceCollection.AddSingleton<EntityManager>();
serviceCollection.AddSingleton<EntityActorManager>();

// Game
serviceCollection.AddSingleton<TargetService>();
serviceCollection.AddSingleton<ActorSpawnService>();
serviceCollection.AddSingleton<ActorRedrawService>();
serviceCollection.AddSingleton<ActorAppearanceService>();
serviceCollection.AddSingleton<ActionTimelineService>();
serviceCollection.AddSingleton<GPoseService>();
serviceCollection.AddSingleton<CommandHandlerService>();
serviceCollection.AddSingleton<ModelTransformService>();
serviceCollection.AddSingleton<TimeService>();
serviceCollection.AddSingleton<WeatherService>();
serviceCollection.AddSingleton<FestivalService>();
serviceCollection.AddSingleton<SkeletonService>();
serviceCollection.AddSingleton<PosingService>();
serviceCollection.AddSingleton<CameraService>();
serviceCollection.AddSingleton<ObjectMonitorService>();


// UI
serviceCollection.AddSingleton<UIManager>();
serviceCollection.AddSingleton<MainWindow>();
serviceCollection.AddSingleton<SettingsWindow>();
serviceCollection.AddSingleton<InfoWindow>();
serviceCollection.AddSingleton<ActorAppearanceWindow>();
serviceCollection.AddSingleton<ActionTimelineWindow>();
serviceCollection.AddSingleton<PosingOverlayWindow>();
serviceCollection.AddSingleton<PosingOverlayToolbarWindow>();
serviceCollection.AddSingleton<PosingTransformWindow>();
serviceCollection.AddSingleton<CameraWindow>();
serviceCollection.AddSingleton<PosingGraphicalWindow>();


return serviceCollection;
}

public void Dispose()
{
Dalamud.Framework.Update -= Framework_Update;
_serviceManager.Dispose();
_services.Dispose();
}

#if DEBUG
public static bool IsDebug => true;
#else
public static bool IsDebug => _serviceManager.IsStarted && ConfigService.Configuration.ForceDebug;
#endif
}
Loading

0 comments on commit d226dd3

Please sign in to comment.