big brain (read: shit) fix for scd streaming, should be update proof...

This commit is contained in:
Adam 2021-02-21 20:28:44 +11:00
parent eb0301f964
commit 4a55119feb
10 changed files with 56 additions and 8 deletions

View file

@ -27,8 +27,14 @@ namespace Penumbra.API
} ); } );
} }
[Route( HttpVerbs.Get, "/files" )] [Route( HttpVerbs.Post, "/mods" )]
public object CreateMod() public object CreateMod()
{
return new { };
}
[Route( HttpVerbs.Get, "/files" )]
public object GetFiles()
{ {
var modManager = Service< ModManager >.Get(); var modManager = Service< ModManager >.Get();
return modManager.ResolvedFiles.ToDictionary( return modManager.ResolvedFiles.ToDictionary(

View file

@ -1,5 +1,4 @@
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
@ -12,7 +11,7 @@ using Reloaded.Hooks.Definitions;
using Reloaded.Hooks.Definitions.X64; using Reloaded.Hooks.Definitions.X64;
using FileMode = Penumbra.Structs.FileMode; using FileMode = Penumbra.Structs.FileMode;
namespace Penumbra namespace Penumbra.Hooks
{ {
public class ResourceLoader : IDisposable public class ResourceLoader : IDisposable
{ {

View file

@ -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;
}
}
}

View file

@ -5,6 +5,7 @@ using EmbedIO;
using EmbedIO.WebApi; using EmbedIO.WebApi;
using Penumbra.API; using Penumbra.API;
using Penumbra.Game; using Penumbra.Game;
using Penumbra.Hooks;
using Penumbra.Mods; using Penumbra.Mods;
using Penumbra.UI; using Penumbra.UI;
@ -25,6 +26,7 @@ namespace Penumbra
public SettingsInterface SettingsInterface { get; set; } public SettingsInterface SettingsInterface { get; set; }
public GameUtils GameUtils { get; set; } public GameUtils GameUtils { get; set; }
public SoundShit SoundShit { get; set; }
public string PluginDebugTitleStr { get; private set; } public string PluginDebugTitleStr { get; private set; }
@ -37,6 +39,7 @@ namespace Penumbra
Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
Configuration.Initialize( PluginInterface ); Configuration.Initialize( PluginInterface );
SoundShit = new SoundShit( this );
GameUtils = new GameUtils( PluginInterface ); GameUtils = new GameUtils( PluginInterface );
var modManager = Service< ModManager >.Set( this ); var modManager = Service< ModManager >.Set( this );

View file

@ -5,7 +5,7 @@ namespace Penumbra.UI
{ {
public partial class SettingsInterface public partial class SettingsInterface
{ {
private class LaunchButton private class ManageModsButton
{ {
// magic numbers // magic numbers
private const int Padding = 50; private const int Padding = 50;
@ -29,7 +29,7 @@ namespace Penumbra.UI
private readonly SettingsInterface _base; private readonly SettingsInterface _base;
private readonly Dalamud.Game.ClientState.Condition _condition; private readonly Dalamud.Game.ClientState.Condition _condition;
public LaunchButton( SettingsInterface ui ) public ManageModsButton( SettingsInterface ui )
{ {
_base = ui; _base = ui;
_condition = ui._plugin.PluginInterface.ClientState.Condition; _condition = ui._plugin.PluginInterface.ClientState.Condition;

View file

@ -13,14 +13,14 @@ namespace Penumbra.UI
private readonly Plugin _plugin; private readonly Plugin _plugin;
private readonly LaunchButton _launchButton; private readonly ManageModsButton _manageModsButton;
private readonly MenuBar _menuBar; private readonly MenuBar _menuBar;
private readonly SettingsMenu _menu; private readonly SettingsMenu _menu;
public SettingsInterface( Plugin plugin ) public SettingsInterface( Plugin plugin )
{ {
_plugin = plugin; _plugin = plugin;
_launchButton = new LaunchButton( this ); _manageModsButton = new ManageModsButton( this );
_menuBar = new MenuBar( this ); _menuBar = new MenuBar( this );
_menu = new SettingsMenu( this ); _menu = new SettingsMenu( this );
} }
@ -30,7 +30,7 @@ namespace Penumbra.UI
public void Draw() public void Draw()
{ {
_menuBar.Draw(); _menuBar.Draw();
_launchButton.Draw(); _manageModsButton.Draw();
_menu.Draw(); _menu.Draw();
} }