diff --git a/Penumbra/API/ModsController.cs b/Penumbra/API/ModsController.cs index 3c9b953e..1c38b37f 100644 --- a/Penumbra/API/ModsController.cs +++ b/Penumbra/API/ModsController.cs @@ -27,8 +27,14 @@ namespace Penumbra.API } ); } - [Route( HttpVerbs.Get, "/files" )] + [Route( HttpVerbs.Post, "/mods" )] public object CreateMod() + { + return new { }; + } + + [Route( HttpVerbs.Get, "/files" )] + public object GetFiles() { var modManager = Service< ModManager >.Get(); return modManager.ResolvedFiles.ToDictionary( diff --git a/Penumbra/ResourceLoader.cs b/Penumbra/Hooks/ResourceLoader.cs similarity index 99% rename from Penumbra/ResourceLoader.cs rename to Penumbra/Hooks/ResourceLoader.cs index 60ab97f3..747df092 100644 --- a/Penumbra/ResourceLoader.cs +++ b/Penumbra/Hooks/ResourceLoader.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Text; @@ -12,7 +11,7 @@ using Reloaded.Hooks.Definitions; using Reloaded.Hooks.Definitions.X64; using FileMode = Penumbra.Structs.FileMode; -namespace Penumbra +namespace Penumbra.Hooks { public class ResourceLoader : IDisposable { diff --git a/Penumbra/Hooks/SoundShit.cs b/Penumbra/Hooks/SoundShit.cs new file mode 100644 index 00000000..4455ab01 --- /dev/null +++ b/Penumbra/Hooks/SoundShit.cs @@ -0,0 +1,40 @@ +using System; +using System.Runtime.InteropServices; +using Dalamud.Plugin; +using Reloaded.Hooks; +using Reloaded.Hooks.Definitions; +using Reloaded.Hooks.Definitions.X64; + +namespace Penumbra.Hooks +{ + public unsafe class SoundShit + { + private readonly IntPtr _musicManager; + + public SoundShit( Plugin plugin ) + { + var scanner = plugin.PluginInterface.TargetModuleScanner; + + var fw = plugin.PluginInterface.Framework.Address.BaseAddress; + + // the wildcard is basically the framework offset we want (lol) + // .text:000000000009051A 48 8B 8E 18 2A 00 00 mov rcx, [rsi+2A18h] + // .text:0000000000090521 39 78 20 cmp [rax+20h], edi + // .text:0000000000090524 0F 94 C2 setz dl + // .text:0000000000090527 45 33 C0 xor r8d, r8d + // .text:000000000009052A E8 41 1C 15 00 call musicInit + var shit = scanner.ScanText( "48 8B 8E ?? ?? ?? ?? 39 78 20 0F 94 C2 45 33 C0" ); + var fuckkk = *( int* )( shit + 3 ); + _musicManager = *( IntPtr* )( fw + fuckkk ); + StreamingEnabled = false; + + PluginLog.Information("disabled streaming: {addr}", _musicManager); + } + + public bool StreamingEnabled + { + get => *( bool* )( _musicManager + 50 ); + set => *( bool* )( _musicManager + 50 ) = value; + } + } +} \ No newline at end of file diff --git a/Penumbra/Plugin.cs b/Penumbra/Plugin.cs index 626faf25..2fd71c91 100644 --- a/Penumbra/Plugin.cs +++ b/Penumbra/Plugin.cs @@ -5,6 +5,7 @@ using EmbedIO; using EmbedIO.WebApi; using Penumbra.API; using Penumbra.Game; +using Penumbra.Hooks; using Penumbra.Mods; using Penumbra.UI; @@ -25,6 +26,7 @@ namespace Penumbra public SettingsInterface SettingsInterface { get; set; } public GameUtils GameUtils { get; set; } + public SoundShit SoundShit { get; set; } public string PluginDebugTitleStr { get; private set; } @@ -37,6 +39,7 @@ namespace Penumbra Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); Configuration.Initialize( PluginInterface ); + SoundShit = new SoundShit( this ); GameUtils = new GameUtils( PluginInterface ); var modManager = Service< ModManager >.Set( this ); diff --git a/Penumbra/UI/ImGuiFramedGroup.cs b/Penumbra/UI/Custom/ImGuiFramedGroup.cs similarity index 100% rename from Penumbra/UI/ImGuiFramedGroup.cs rename to Penumbra/UI/Custom/ImGuiFramedGroup.cs diff --git a/Penumbra/UI/ImGuiRenameableCombo.cs b/Penumbra/UI/Custom/ImGuiRenameableCombo.cs similarity index 100% rename from Penumbra/UI/ImGuiRenameableCombo.cs rename to Penumbra/UI/Custom/ImGuiRenameableCombo.cs diff --git a/Penumbra/UI/ImGuiResizingTextInput.cs b/Penumbra/UI/Custom/ImGuiResizingTextInput.cs similarity index 100% rename from Penumbra/UI/ImGuiResizingTextInput.cs rename to Penumbra/UI/Custom/ImGuiResizingTextInput.cs diff --git a/Penumbra/UI/ImGuiUtil.cs b/Penumbra/UI/Custom/ImGuiUtil.cs similarity index 100% rename from Penumbra/UI/ImGuiUtil.cs rename to Penumbra/UI/Custom/ImGuiUtil.cs diff --git a/Penumbra/UI/LaunchButton.cs b/Penumbra/UI/LaunchButton.cs index a14a0427..72ad85b3 100644 --- a/Penumbra/UI/LaunchButton.cs +++ b/Penumbra/UI/LaunchButton.cs @@ -5,7 +5,7 @@ namespace Penumbra.UI { public partial class SettingsInterface { - private class LaunchButton + private class ManageModsButton { // magic numbers private const int Padding = 50; @@ -29,7 +29,7 @@ namespace Penumbra.UI private readonly SettingsInterface _base; private readonly Dalamud.Game.ClientState.Condition _condition; - public LaunchButton( SettingsInterface ui ) + public ManageModsButton( SettingsInterface ui ) { _base = ui; _condition = ui._plugin.PluginInterface.ClientState.Condition; diff --git a/Penumbra/UI/SettingsInterface.cs b/Penumbra/UI/SettingsInterface.cs index 709729e7..19b5c884 100644 --- a/Penumbra/UI/SettingsInterface.cs +++ b/Penumbra/UI/SettingsInterface.cs @@ -13,14 +13,14 @@ namespace Penumbra.UI private readonly Plugin _plugin; - private readonly LaunchButton _launchButton; + private readonly ManageModsButton _manageModsButton; private readonly MenuBar _menuBar; private readonly SettingsMenu _menu; public SettingsInterface( Plugin plugin ) { _plugin = plugin; - _launchButton = new LaunchButton( this ); + _manageModsButton = new ManageModsButton( this ); _menuBar = new MenuBar( this ); _menu = new SettingsMenu( this ); } @@ -30,7 +30,7 @@ namespace Penumbra.UI public void Draw() { _menuBar.Draw(); - _launchButton.Draw(); + _manageModsButton.Draw(); _menu.Draw(); }