add il2cpp file (binary, metadata) export to advanced tab
This commit is contained in:
@@ -37,4 +37,8 @@ export class SignalRServerApi {
|
|||||||
"GetPotentialUnityVersions",
|
"GetPotentialUnityVersions",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async exportIl2CppFiles(targetDirectory: string) {
|
||||||
|
return await this.connection.send("ExportIl2CppFiles", targetDirectory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from "$lib/components/ui/button/button.svelte";
|
import Button from "$lib/components/ui/button/button.svelte";
|
||||||
|
import { signalRState } from "$lib/signalr/api.svelte";
|
||||||
|
import { open } from "@tauri-apps/plugin-dialog";
|
||||||
|
|
||||||
|
async function exportIl2CppFiles(e: Event) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const exportDirectory = await open({
|
||||||
|
title: "Select the output folder",
|
||||||
|
directory: true,
|
||||||
|
multiple: false,
|
||||||
|
recursive: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (exportDirectory === null) return;
|
||||||
|
|
||||||
|
await signalRState.api?.server.exportIl2CppFiles(exportDirectory);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex w-screen flex-col">
|
<div class="flex w-screen flex-col">
|
||||||
@@ -7,8 +24,17 @@
|
|||||||
<h1
|
<h1
|
||||||
class="ml-10 scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl"
|
class="ml-10 scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl"
|
||||||
>
|
>
|
||||||
Advanced information
|
Advanced
|
||||||
</h1>
|
</h1>
|
||||||
|
<div class="mx-5 mt-10 grid h-full grid-cols-2 gap-4 sm:gap-6">
|
||||||
|
<Button
|
||||||
|
class="sm:p-10"
|
||||||
|
variant="outline"
|
||||||
|
onclick={exportIl2CppFiles}
|
||||||
|
>
|
||||||
|
Export IL2CPP files
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mx-5 mb-3 flex flex-row-reverse justify-between">
|
<div class="mx-5 mb-3 flex flex-row-reverse justify-between">
|
||||||
<Button onclick={() => history.back()} variant="outline">Go back</Button
|
<Button onclick={() => history.back()} variant="outline">Go back</Button
|
||||||
|
|||||||
@@ -44,4 +44,9 @@ internal class Il2CppHub : Hub
|
|||||||
{
|
{
|
||||||
return await State.GetPotentialUnityVersions();
|
return await State.GetPotentialUnityVersions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task ExportIl2CppFiles(string outputDirectory)
|
||||||
|
{
|
||||||
|
await State.ExportIl2CppFiles(Client, outputDirectory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ public class UiContext
|
|||||||
{
|
{
|
||||||
if (await TryLoadMetadataFromStream(client, stream))
|
if (await TryLoadMetadataFromStream(client, stream))
|
||||||
{
|
{
|
||||||
await client.ShowSuccessToast($"Loaded metadata from {inputFile}", cancellationToken);
|
await client.ShowSuccessToast($"Loaded metadata (v{_metadata!.Version}) from {inputFile}", cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_binary == null && PathHeuristics.IsBinaryPath(inputFile))
|
else if (_binary == null && PathHeuristics.IsBinaryPath(inputFile))
|
||||||
@@ -175,7 +175,7 @@ public class UiContext
|
|||||||
{
|
{
|
||||||
if (await TryInitializeInspector(client))
|
if (await TryInitializeInspector(client))
|
||||||
{
|
{
|
||||||
await client.ShowSuccessToast("Successfully loaded IL2CPP data!", cancellationToken);
|
await client.ShowSuccessToast($"Successfully loaded IL2CPP (v{_appModels[0].Package.Version}) data!", cancellationToken);
|
||||||
await client.OnImportCompleted(cancellationToken);
|
await client.OnImportCompleted(cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,4 +222,26 @@ public class UiContext
|
|||||||
{
|
{
|
||||||
return Task.FromResult(_potentialUnityVersions.Select(x => x.VersionRange.Min.ToString()).ToList());
|
return Task.FromResult(_potentialUnityVersions.Select(x => x.VersionRange.Min.ToString()).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task ExportIl2CppFiles(UiClient client, string outputDirectory, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
Debug.Assert(_appModels.Count > 0);
|
||||||
|
var pkg = _appModels[0].Package;
|
||||||
|
|
||||||
|
await using (await LoadingSession.Start(client))
|
||||||
|
{
|
||||||
|
await Task.Run(async () =>
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(outputDirectory);
|
||||||
|
|
||||||
|
await client.ShowLogMessage("Extracting IL2CPP binary", cancellationToken);
|
||||||
|
pkg.SaveBinaryToFile(Path.Join(outputDirectory, pkg.BinaryImage.DefaultFilename));
|
||||||
|
|
||||||
|
await client.ShowLogMessage("Extracting IL2CPP metadata", cancellationToken);
|
||||||
|
pkg.SaveMetadataToFile(Path.Join(outputDirectory, "global-metadata.dat"));
|
||||||
|
|
||||||
|
await client.ShowSuccessToast("Successfully extracted IL2CPP files.", cancellationToken);
|
||||||
|
}, cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user