mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Merge remote-tracking branch 'origin/master' into luna
This commit is contained in:
commit
2943890959
4 changed files with 56 additions and 12 deletions
|
|
@ -4,6 +4,7 @@ using EmbedIO.Routing;
|
||||||
using EmbedIO.WebApi;
|
using EmbedIO.WebApi;
|
||||||
using Penumbra.Api.Api;
|
using Penumbra.Api.Api;
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
|
using Penumbra.Mods.Settings;
|
||||||
|
|
||||||
namespace Penumbra.Api;
|
namespace Penumbra.Api;
|
||||||
|
|
||||||
|
|
@ -12,6 +13,7 @@ public class HttpApi : IDisposable, Luna.IApiService
|
||||||
private partial class Controller : WebApiController
|
private partial class Controller : WebApiController
|
||||||
{
|
{
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
|
[Route( HttpVerbs.Get, "/moddirectory" )] public partial string GetModDirectory();
|
||||||
[Route( HttpVerbs.Get, "/mods" )] public partial object? GetMods();
|
[Route( HttpVerbs.Get, "/mods" )] public partial object? GetMods();
|
||||||
[Route( HttpVerbs.Post, "/redraw" )] public partial Task Redraw();
|
[Route( HttpVerbs.Post, "/redraw" )] public partial Task Redraw();
|
||||||
[Route( HttpVerbs.Post, "/redrawAll" )] public partial Task RedrawAll();
|
[Route( HttpVerbs.Post, "/redrawAll" )] public partial Task RedrawAll();
|
||||||
|
|
@ -19,6 +21,7 @@ public class HttpApi : IDisposable, Luna.IApiService
|
||||||
[Route( HttpVerbs.Post, "/installmod" )] public partial Task InstallMod();
|
[Route( HttpVerbs.Post, "/installmod" )] public partial Task InstallMod();
|
||||||
[Route( HttpVerbs.Post, "/openwindow" )] public partial void OpenWindow();
|
[Route( HttpVerbs.Post, "/openwindow" )] public partial void OpenWindow();
|
||||||
[Route( HttpVerbs.Post, "/focusmod" )] public partial Task FocusMod();
|
[Route( HttpVerbs.Post, "/focusmod" )] public partial Task FocusMod();
|
||||||
|
[Route( HttpVerbs.Post, "/setmodsettings")] public partial Task SetModSettings();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,6 +67,12 @@ public class HttpApi : IDisposable, Luna.IApiService
|
||||||
|
|
||||||
private partial class Controller(IPenumbraApi api, IFramework framework)
|
private partial class Controller(IPenumbraApi api, IFramework framework)
|
||||||
{
|
{
|
||||||
|
public partial string GetModDirectory()
|
||||||
|
{
|
||||||
|
Penumbra.Log.Debug($"[HTTP] {nameof(GetModDirectory)} triggered.");
|
||||||
|
return api.PluginState.GetModDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
public partial object? GetMods()
|
public partial object? GetMods()
|
||||||
{
|
{
|
||||||
Penumbra.Log.Debug($"[HTTP] {nameof(GetMods)} triggered.");
|
Penumbra.Log.Debug($"[HTTP] {nameof(GetMods)} triggered.");
|
||||||
|
|
@ -115,6 +124,7 @@ public class HttpApi : IDisposable, Luna.IApiService
|
||||||
Penumbra.Log.Debug($"[HTTP] {nameof(OpenWindow)} triggered.");
|
Penumbra.Log.Debug($"[HTTP] {nameof(OpenWindow)} triggered.");
|
||||||
api.Ui.OpenMainWindow(TabType.Mods, string.Empty, string.Empty);
|
api.Ui.OpenMainWindow(TabType.Mods, string.Empty, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async partial Task FocusMod()
|
public async partial Task FocusMod()
|
||||||
{
|
{
|
||||||
var data = await HttpContext.GetRequestDataAsync<ModFocusData>().ConfigureAwait(false);
|
var data = await HttpContext.GetRequestDataAsync<ModFocusData>().ConfigureAwait(false);
|
||||||
|
|
@ -123,6 +133,30 @@ public class HttpApi : IDisposable, Luna.IApiService
|
||||||
api.Ui.OpenMainWindow(TabType.Mods, data.Path, data.Name);
|
api.Ui.OpenMainWindow(TabType.Mods, data.Path, data.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async partial Task SetModSettings()
|
||||||
|
{
|
||||||
|
var data = await HttpContext.GetRequestDataAsync<SetModSettingsData>().ConfigureAwait(false);
|
||||||
|
Penumbra.Log.Debug($"[HTTP] {nameof(SetModSettings)} triggered.");
|
||||||
|
await framework.RunOnFrameworkThread(() =>
|
||||||
|
{
|
||||||
|
var collection = data.CollectionId ?? api.Collection.GetCollection(ApiCollectionType.Current)!.Value.Id;
|
||||||
|
if (data.Inherit.HasValue)
|
||||||
|
{
|
||||||
|
api.ModSettings.TryInheritMod(collection, data.ModPath, data.ModName, data.Inherit.Value);
|
||||||
|
if (data.Inherit.Value)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.State.HasValue)
|
||||||
|
api.ModSettings.TrySetMod(collection, data.ModPath, data.ModName, data.State.Value);
|
||||||
|
if (data.Priority.HasValue)
|
||||||
|
api.ModSettings.TrySetModPriority(collection, data.ModPath, data.ModName, data.Priority.Value.Value);
|
||||||
|
foreach (var (group, settings) in data.Settings ?? [])
|
||||||
|
api.ModSettings.TrySetModSettings(collection, data.ModPath, data.ModName, group, settings);
|
||||||
|
}
|
||||||
|
).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
private record ModReloadData(string Path, string Name)
|
private record ModReloadData(string Path, string Name)
|
||||||
{
|
{
|
||||||
public ModReloadData()
|
public ModReloadData()
|
||||||
|
|
@ -150,5 +184,15 @@ public class HttpApi : IDisposable, Luna.IApiService
|
||||||
: this(string.Empty, RedrawType.Redraw, -1)
|
: this(string.Empty, RedrawType.Redraw, -1)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private record SetModSettingsData(
|
||||||
|
Guid? CollectionId,
|
||||||
|
string ModPath,
|
||||||
|
string ModName,
|
||||||
|
bool? Inherit,
|
||||||
|
bool? State,
|
||||||
|
ModPriority? Priority,
|
||||||
|
Dictionary<string, List<string>>? Settings)
|
||||||
|
{ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -420,9 +420,9 @@ public sealed unsafe partial class RedrawService : IDisposable
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
foreach (ref var f in currentTerritory->Furniture)
|
foreach (ref var f in currentTerritory->FurnitureManager.FurnitureMemory)
|
||||||
{
|
{
|
||||||
var gameObject = f.Index >= 0 ? currentTerritory->HousingObjectManager.Objects[f.Index].Value : null;
|
var gameObject = f.Index >= 0 ? currentTerritory->FurnitureManager.ObjectManager.ObjectArray.Objects[f.Index].Value : null;
|
||||||
if (gameObject == null)
|
if (gameObject == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ public sealed partial class MtrlTab : IWritable, IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Valid
|
public bool Valid
|
||||||
=> _shadersKnown && Mtrl.Valid;
|
=> Mtrl.Valid; // FIXME This should be _shadersKnown && Mtrl.Valid but the algorithm for _shadersKnown is flawed as of 7.2.
|
||||||
|
|
||||||
public byte[] Write()
|
public byte[] Write()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"Description": "Runtime mod loader and manager.",
|
"Description": "Runtime mod loader and manager.",
|
||||||
"InternalName": "Penumbra",
|
"InternalName": "Penumbra",
|
||||||
"AssemblyVersion": "1.5.1.2",
|
"AssemblyVersion": "1.5.1.2",
|
||||||
"TestingAssemblyVersion": "1.5.1.2",
|
"TestingAssemblyVersion": "1.5.1.3",
|
||||||
"RepoUrl": "https://github.com/xivdev/Penumbra",
|
"RepoUrl": "https://github.com/xivdev/Penumbra",
|
||||||
"ApplicableVersion": "any",
|
"ApplicableVersion": "any",
|
||||||
"DalamudApiLevel": 13,
|
"DalamudApiLevel": 13,
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
"LoadRequiredState": 2,
|
"LoadRequiredState": 2,
|
||||||
"LoadSync": true,
|
"LoadSync": true,
|
||||||
"DownloadLinkInstall": "https://github.com/xivdev/Penumbra/releases/download/1.5.1.2/Penumbra.zip",
|
"DownloadLinkInstall": "https://github.com/xivdev/Penumbra/releases/download/1.5.1.2/Penumbra.zip",
|
||||||
"DownloadLinkTesting": "https://github.com/xivdev/Penumbra/releases/download/1.5.1.2/Penumbra.zip",
|
"DownloadLinkTesting": "https://github.com/xivdev/Penumbra/releases/download/testing_1.5.1.3/Penumbra.zip",
|
||||||
"DownloadLinkUpdate": "https://github.com/xivdev/Penumbra/releases/download/1.5.1.2/Penumbra.zip",
|
"DownloadLinkUpdate": "https://github.com/xivdev/Penumbra/releases/download/1.5.1.2/Penumbra.zip",
|
||||||
"IconUrl": "https://raw.githubusercontent.com/xivdev/Penumbra/master/images/icon.png"
|
"IconUrl": "https://raw.githubusercontent.com/xivdev/Penumbra/master/images/icon.png"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue