-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #11, reshuffled some UI and added a button to the main menu/lobby
- Loading branch information
Showing
12 changed files
with
396 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using Dalamud.Plugin; | ||
using Reloaded.Hooks.Definitions.X64; | ||
|
||
namespace Penumbra.Game | ||
{ | ||
public class GameUtils | ||
{ | ||
private readonly DalamudPluginInterface _pluginInterface; | ||
|
||
[Function( CallingConventions.Microsoft )] | ||
public unsafe delegate void* LoadPlayerResourcesPrototype( IntPtr pResourceManager ); | ||
|
||
[Function( CallingConventions.Microsoft )] | ||
public unsafe delegate void* UnloadPlayerResourcesPrototype( IntPtr pResourceManager ); | ||
|
||
|
||
public LoadPlayerResourcesPrototype LoadPlayerResources { get; private set; } | ||
public UnloadPlayerResourcesPrototype UnloadPlayerResources { get; private set; } | ||
|
||
// Object addresses | ||
private IntPtr _playerResourceManagerAddress; | ||
public IntPtr PlayerResourceManagerPtr => Marshal.ReadIntPtr( _playerResourceManagerAddress ); | ||
|
||
public GameUtils( DalamudPluginInterface pluginInterface ) | ||
{ | ||
_pluginInterface = pluginInterface; | ||
|
||
var scanner = _pluginInterface.TargetModuleScanner; | ||
|
||
var loadPlayerResourcesAddress = | ||
scanner.ScanText( | ||
"E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? BA ?? ?? ?? ?? 41 B8 ?? ?? ?? ?? 48 8B 48 30 48 8B 01 FF 50 10 48 85 C0 74 0A " ); | ||
var unloadPlayerResourcesAddress = | ||
scanner.ScanText( "41 55 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 4C 8B E9 48 83 C1 08" ); | ||
|
||
_playerResourceManagerAddress = scanner.GetStaticAddressFromSig( "0F 44 FE 48 8B 0D ?? ?? ?? ?? 48 85 C9 74 05" ); | ||
|
||
LoadPlayerResources = Marshal.GetDelegateForFunctionPointer< LoadPlayerResourcesPrototype >( loadPlayerResourcesAddress ); | ||
UnloadPlayerResources = Marshal.GetDelegateForFunctionPointer< UnloadPlayerResourcesPrototype >( unloadPlayerResourcesAddress ); | ||
} | ||
|
||
public unsafe void ReloadPlayerResources() | ||
{ | ||
UnloadPlayerResources( PlayerResourceManagerPtr ); | ||
LoadPlayerResources( PlayerResourceManagerPtr ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Penumbra.Importer | ||
{ | ||
public enum ImporterState | ||
{ | ||
None, | ||
WritingPackToDisk, | ||
ExtractingModFiles, | ||
Done | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Penumbra/Importer/MagicTempFileStreamManagerAndDeleterFuckery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.IO; | ||
using Lumina.Data; | ||
|
||
namespace Penumbra.Importer | ||
{ | ||
public class MagicTempFileStreamManagerAndDeleterFuckery : SqPackStream, IDisposable | ||
{ | ||
private readonly FileStream _fileStream; | ||
|
||
public MagicTempFileStreamManagerAndDeleterFuckery( FileStream stream ) : base( stream ) | ||
{ | ||
_fileStream = stream; | ||
} | ||
|
||
public new void Dispose() | ||
{ | ||
var filePath = _fileStream.Name; | ||
|
||
base.Dispose(); | ||
_fileStream.Dispose(); | ||
|
||
File.Delete( filePath ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.