Add UpdateDatabase Button
This commit is contained in:
@@ -1682,13 +1682,14 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 844924682}
|
||||
- {fileID: 2073237536}
|
||||
m_Father: {fileID: 1704906816}
|
||||
m_RootOrder: 17
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 141.5, y: -410}
|
||||
m_SizeDelta: {x: 283, y: 50}
|
||||
m_AnchoredPosition: {x: 141.5, y: -1071.7834}
|
||||
m_SizeDelta: {x: 283, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &93905315
|
||||
MonoBehaviour:
|
||||
@@ -17114,7 +17115,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 283, y: -75}
|
||||
m_AnchoredPosition: {x: 283, y: -25}
|
||||
m_SizeDelta: {x: 283, y: 50}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!114 &844924683
|
||||
@@ -29470,6 +29471,139 @@ MonoBehaviour:
|
||||
m_isRichTextEditingAllowed: 0
|
||||
m_LineLimit: 0
|
||||
m_InputValidator: {fileID: 0}
|
||||
--- !u!1 &1516377149
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1516377150}
|
||||
- component: {fileID: 1516377153}
|
||||
- component: {fileID: 1516377152}
|
||||
- component: {fileID: 1516377151}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1516377150
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1516377149}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1618706696}
|
||||
m_Father: {fileID: 2073237536}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1516377151
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1516377149}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1516377152}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1564959567}
|
||||
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
||||
m_MethodName: UpdateGameDB
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 1
|
||||
m_CallState: 2
|
||||
--- !u!114 &1516377152
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1516377149}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1516377153
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1516377149}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!224 &1525688469 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 22448498, guid: 916ee089a0d7b63419075f91e1c657ec,
|
||||
@@ -31082,6 +31216,85 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1618706695
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1618706696}
|
||||
- component: {fileID: 1618706698}
|
||||
- component: {fileID: 1618706697}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1618706696
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1618706695}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1516377150}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1618706697
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1618706695}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 25
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Update Database
|
||||
--- !u!222 &1618706698
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1618706695}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1622519936
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -39893,6 +40106,82 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2062531603}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &2073237535
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2073237536}
|
||||
- component: {fileID: 2073237538}
|
||||
- component: {fileID: 2073237537}
|
||||
m_Layer: 5
|
||||
m_Name: UpdateDatabase
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2073237536
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2073237535}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1516377150}
|
||||
m_Father: {fileID: 93905314}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 283, y: -75}
|
||||
m_SizeDelta: {x: 283, y: 50}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!114 &2073237537
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2073237535}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.19607843}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &2073237538
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2073237535}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &2073676005
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using K4os.Compression.LZ4.Streams;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -107,19 +106,7 @@ public class BSVReader
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] input;
|
||||
if (isCompressed)
|
||||
{
|
||||
var source = new MemoryStream(File.ReadAllBytes(path));
|
||||
var decoder = LZ4Stream.Decode(source);
|
||||
var target = new MemoryStream();
|
||||
decoder.CopyTo(target);
|
||||
input = target.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
input = File.ReadAllBytes(path);
|
||||
}
|
||||
byte[] input = isCompressed? LZ4Util.DecompressFromFile(path): File.ReadAllBytes(path);
|
||||
|
||||
if (mode == ReadMode.Stream)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using K4os.Compression.LZ4;
|
||||
using K4os.Compression.LZ4.Streams;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
public static class LZ4Util
|
||||
{
|
||||
[DllImport("libnative.dll")]
|
||||
public static extern int LZ4_decompress_safe_ext(IntPtr src, IntPtr dst, int compressedSize, int dstCapacity);
|
||||
|
||||
public static byte[] DecompressFromFile(string path)
|
||||
{
|
||||
var decoder = LZ4Stream.Decode(File.OpenRead(path));
|
||||
var target = new MemoryStream();
|
||||
decoder.CopyTo(target);
|
||||
return target.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] DecompressFromBytesSafe(byte[] bytes)//WIP
|
||||
{
|
||||
IntPtr data = Marshal.AllocHGlobal(bytes.Length);
|
||||
Marshal.Copy(bytes, 0, data, bytes.Length);
|
||||
|
||||
int dataLength = 0;
|
||||
dataLength = ((dataLength| bytes[3])<<8);
|
||||
dataLength = ((dataLength| bytes[2])<<8);
|
||||
dataLength = ((dataLength| bytes[1])<<8);
|
||||
dataLength = (dataLength| bytes[0]);
|
||||
|
||||
IntPtr result = Marshal.AllocHGlobal(bytes.Length+ dataLength);
|
||||
|
||||
var output = new byte[bytes.Length + dataLength];
|
||||
var outlength = LZ4_decompress_safe_ext(data, result, bytes.Length, output.Length);
|
||||
|
||||
Marshal.Copy(result, output, 0,outlength);
|
||||
|
||||
Array.Resize(ref output, outlength);
|
||||
Marshal.FreeHGlobal(data);
|
||||
Marshal.FreeHGlobal(result);
|
||||
return output;
|
||||
}
|
||||
|
||||
public static byte[] CompressFromBytes(byte[] bytes)
|
||||
{
|
||||
var source = new MemoryStream(bytes);
|
||||
var decoder = LZ4Stream.Encode(source);
|
||||
var target = new MemoryStream();
|
||||
decoder.CopyTo(target);
|
||||
return target.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad28139c90f43ce4eba7c018a861ca37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,5 @@
|
||||
using Mono.Data.Sqlite;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
@@ -11,11 +12,12 @@ using static ManifestCategory;
|
||||
public class ManifestDB
|
||||
{
|
||||
public SqliteConnection MetaDB;
|
||||
public string DBPath;
|
||||
public static string MANIFEST_ROOT_URL = "https://prd-storage-app-umamusume.akamaized.net/dl/resources/Manifest";
|
||||
public ManifestDB(string DBPath)
|
||||
public static string DBPath;
|
||||
public const string DefaultDBPath = "umamusume/meta";
|
||||
public Action<string> callback;
|
||||
public ManifestDB(string DBPath = DefaultDBPath)
|
||||
{
|
||||
this.DBPath = DBPath;
|
||||
ManifestDB.DBPath = DBPath;
|
||||
if (File.Exists(DBPath))
|
||||
{
|
||||
MetaDB = new SqliteConnection($@"Data Source={DBPath}");
|
||||
@@ -43,31 +45,68 @@ public class ManifestDB
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator UpdateResourceVersion(Action<string> callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
callback?.Invoke("Checking Resource Version");
|
||||
yield return UpdateMetaDB();
|
||||
yield return UpdateMasterDB();
|
||||
callback?.Invoke($"Done");
|
||||
}
|
||||
|
||||
//umamusume uses the manifest file to generate meta database.
|
||||
//it needs to get the root manifest file first
|
||||
//then read the root manifest to get other manifest file information
|
||||
//recursively read the manifest file to obtain all resource files information
|
||||
//finally, insert all data into the meta database
|
||||
public IEnumerator GenerateMetaDB(ulong rootSize, ulong rootCheckSum)
|
||||
public IEnumerator UpdateMetaDB()
|
||||
{
|
||||
if (MetaDB == null || MetaDB.State == System.Data.ConnectionState.Closed) {
|
||||
string rootHash = null;
|
||||
callback?.Invoke("Getting resource version");
|
||||
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/MetaC/root", txt =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(txt)) return;
|
||||
var item = JObject.Parse(txt);
|
||||
if ((string)item["n"] == "//root")
|
||||
{
|
||||
rootHash = (string)item["h"];
|
||||
}
|
||||
});
|
||||
|
||||
if (rootHash == null)
|
||||
{
|
||||
Debug.LogError("Get RootHash Error");
|
||||
yield break;
|
||||
}
|
||||
|
||||
ManifestEntry rootEntry = new ManifestEntry(Encoding.UTF8.GetBytes("root"), null, 0, 0, 0, 0, "", 3);
|
||||
rootEntry.hname = rootHash;
|
||||
yield return UpdateMetaDB(rootEntry);
|
||||
}
|
||||
|
||||
public IEnumerator UpdateMetaDB(ulong size, ulong checksum)
|
||||
{
|
||||
ManifestEntry rootEntry = new ManifestEntry(Encoding.UTF8.GetBytes("root"), null, 0, 0, size, checksum, "", 3);
|
||||
rootEntry.hname = rootEntry.CalHameString();
|
||||
yield return UpdateMetaDB(rootEntry);
|
||||
}
|
||||
|
||||
public IEnumerator UpdateMetaDB(ManifestEntry rootEntry)
|
||||
{
|
||||
if (MetaDB == null || MetaDB.State == System.Data.ConnectionState.Closed)
|
||||
{
|
||||
Debug.LogError("Open Meta Database Error");
|
||||
yield break;
|
||||
}
|
||||
|
||||
//Insert root
|
||||
ManifestEntry rootEntry = new ManifestEntry(Encoding.UTF8.GetBytes("root"), null, 0, 0, rootSize, rootCheckSum, "", 3);
|
||||
rootEntry.hname = rootEntry.CalHameString();
|
||||
|
||||
SqliteCommand command = new SqliteCommand(MetaDB);
|
||||
command.CommandText = "DELETE FROM a";
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
//Insert root
|
||||
int index = 1;
|
||||
UpdateManifestEntry(index, "manifest3", rootEntry, ref command);
|
||||
|
||||
//Insert platform
|
||||
callback?.Invoke("Reading Platform Manifest");
|
||||
ManifestEntry[] platformEntrys = null;
|
||||
yield return GetManifest(rootEntry.hname, Kind.PlatformManifest, entrys => { platformEntrys = entrys; });
|
||||
if (platformEntrys == null)
|
||||
@@ -91,14 +130,15 @@ public class ManifestDB
|
||||
}
|
||||
using (SqliteTransaction tran = MetaDB.BeginTransaction())
|
||||
{
|
||||
foreach (var entry in assetEntrys)
|
||||
for (int i = 0; i < assetEntrys.Length; i++)
|
||||
{
|
||||
index++;
|
||||
UpdateManifestEntry(index, "manifest", entry, ref command);
|
||||
callback?.Invoke($"Reading Assets Manifest : {assetEntrys[i].tname} ({i + 1}/{assetEntrys.Length})");
|
||||
UpdateManifestEntry(index, "manifest", assetEntrys[i], ref command);
|
||||
}
|
||||
tran.Commit();
|
||||
}
|
||||
|
||||
|
||||
//Insert Asset
|
||||
foreach (var assetEntry in assetEntrys)
|
||||
{
|
||||
@@ -109,17 +149,54 @@ public class ManifestDB
|
||||
Debug.LogError("Read AssetManifest Error");
|
||||
continue;
|
||||
}
|
||||
using (SqliteTransaction tran = MetaDB.BeginTransaction())
|
||||
using SqliteTransaction tran = MetaDB.BeginTransaction();
|
||||
for (int i = 0; i < assets.Length; i++)
|
||||
{
|
||||
foreach (var entry in assets)
|
||||
{
|
||||
index++;
|
||||
UpdateManifestEntry(index, assetEntry.tname, entry, ref command);
|
||||
}
|
||||
tran.Commit();
|
||||
index++;
|
||||
callback?.Invoke($"Reading AssetBundles Manifest : {assetEntry.tname} ({i + 1}/{assets.Length})");
|
||||
UpdateManifestEntry(index, assetEntry.tname, assets[i], ref command);
|
||||
}
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator UpdateMasterDB()
|
||||
{
|
||||
if (MetaDB == null || MetaDB.State == System.Data.ConnectionState.Closed)
|
||||
{
|
||||
Debug.LogError("Open Meta Database Error");
|
||||
yield break;
|
||||
}
|
||||
|
||||
callback?.Invoke($"Checking master.mdb");
|
||||
SqliteCommand command = new SqliteCommand("SELECT h FROM a WHERE n LIKE 'master.mdb.lz4'", MetaDB);
|
||||
var reader = command.ExecuteReader();
|
||||
|
||||
if (reader.Read())
|
||||
{
|
||||
var hash = reader.GetString(0);
|
||||
var path = GetManifestPath(hash);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
callback?.Invoke($"Downloading master.mdb");
|
||||
UnityWebRequest www = UnityWebRequest.Get(UmaViewerDownload.GetGenericRequestUrl(hash));
|
||||
yield return www.SendWebRequest();
|
||||
if (www.result == UnityWebRequest.Result.Success)
|
||||
{
|
||||
File.WriteAllBytes(path, www.downloadHandler.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Download Master.mdb Failed :" + www.error);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
callback?.Invoke($"Decompress master.mdb");
|
||||
var masterPath = $"{Path.GetDirectoryName(DBPath)}/master/master.mdb";
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(masterPath));
|
||||
File.WriteAllBytes(masterPath, LZ4Util.DecompressFromFile(path));
|
||||
}
|
||||
MetaDB.Close();
|
||||
}
|
||||
|
||||
private void UpdateManifestEntry(int index, string type, ManifestEntry entry, ref SqliteCommand command)
|
||||
@@ -180,6 +257,7 @@ public class ManifestDB
|
||||
var path = GetManifestPath(hash);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
this.callback?.Invoke($"Downloading Manifest :{hash}");
|
||||
yield return DownloadManifest(hash);
|
||||
}
|
||||
if (File.Exists(path))
|
||||
@@ -190,7 +268,7 @@ public class ManifestDB
|
||||
|
||||
public IEnumerator DownloadManifest(string hash)
|
||||
{
|
||||
UnityWebRequest www = UnityWebRequest.Get(GetManifestRequestUrl(hash));
|
||||
UnityWebRequest www = UnityWebRequest.Get(UmaViewerDownload.GetManifestRequestUrl(hash));
|
||||
www.timeout = 15;
|
||||
yield return www.SendWebRequest();
|
||||
if (www.result == UnityWebRequest.Result.Success)
|
||||
@@ -206,18 +284,13 @@ public class ManifestDB
|
||||
public string GetManifestPath(string hash, bool createPath = true)
|
||||
{
|
||||
string path = $"{Path.GetDirectoryName(DBPath)}/dat/{hash.Substring(0, 2)}";
|
||||
if (createPath && !Directory.Exists(path))
|
||||
if (createPath)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
return path + $"/{hash}";
|
||||
}
|
||||
|
||||
public static string GetManifestRequestUrl(string hash)
|
||||
{
|
||||
return $"{MANIFEST_ROOT_URL}/{hash.Substring(0, 2)}/{hash}";
|
||||
}
|
||||
|
||||
public static ManifestEntry GetLocalPlatformEntry(ManifestEntry[] platformEntrys)
|
||||
{
|
||||
foreach (var entry in platformEntrys)
|
||||
|
||||
@@ -58,8 +58,7 @@ public struct ManifestEntry
|
||||
public static string CalHNameString(ulong checksum, ulong size, byte[] name)
|
||||
{
|
||||
var bytes = CalHName(checksum, size, name);
|
||||
Base32 base32 = new Base32();
|
||||
return base32.Encode(bytes);
|
||||
return new Base32().Encode(bytes);
|
||||
}
|
||||
|
||||
public static string CalHameString(ulong checksum, ulong size, string name)
|
||||
|
||||
@@ -53,16 +53,9 @@ public class UmaDatabaseController
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source={GetGameRootPath()}/meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={GetGameRootPath()}/master/master.mdb;");
|
||||
}
|
||||
else
|
||||
{
|
||||
metaDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\master\master.mdb;");
|
||||
}
|
||||
metaDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\meta;");
|
||||
masterDb = new SqliteConnection($@"Data Source={Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume\master\master.mdb;");
|
||||
|
||||
metaDb.Open();
|
||||
MetaEntries = ReadMeta(metaDb);
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@ using UnityEngine.Networking;
|
||||
|
||||
public class UmaViewerDownload : MonoBehaviour
|
||||
{
|
||||
public static string MANIFEST_ROOT_URL = "https://prd-storage-app-umamusume.akamaized.net/dl/resources/Manifest";
|
||||
public static string GENERIC_BASE_URL = "https://prd-storage-umamusume.akamaized.net/dl/resources/Generic";
|
||||
public static string ASSET_BASE_URL = "https://prd-storage-umamusume.akamaized.net/dl/resources/Windows/assetbundles/";
|
||||
|
||||
public static IEnumerator DownloadText(string url, System.Action<string> callback)
|
||||
{
|
||||
UnityWebRequest www = UnityWebRequest.Get(url);
|
||||
@@ -21,4 +25,19 @@ public class UmaViewerDownload : MonoBehaviour
|
||||
callback(www.downloadHandler.text);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetManifestRequestUrl(string hash)
|
||||
{
|
||||
return $"{MANIFEST_ROOT_URL}/{hash.Substring(0, 2)}/{hash}";
|
||||
}
|
||||
|
||||
public static string GetGenericRequestUrl(string hash)
|
||||
{
|
||||
return $"{GENERIC_BASE_URL}/{hash.Substring(0, 2)}/{hash}";
|
||||
}
|
||||
|
||||
public static string GetAssetRequestUrl(string hash)
|
||||
{
|
||||
return $"{ASSET_BASE_URL}/{hash.Substring(0, 2)}/{hash}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ using System;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using static ManifestCategory;
|
||||
using BaseNcoding;
|
||||
using System.Text;
|
||||
|
||||
public class UmaViewerMain : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -88,6 +88,8 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
|
||||
|
||||
private IEnumerator UpdateResVerCoroutine;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
@@ -713,8 +715,6 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void AudioPause()
|
||||
{
|
||||
if (Builder.CurrentAudioSources.Count>0)
|
||||
@@ -919,4 +919,12 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateGameDB() {
|
||||
if (UpdateResVerCoroutine != null) return;
|
||||
ManifestDB dB = new ManifestDB();
|
||||
UpdateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg) { LyricsText.text = msg; });
|
||||
StartCoroutine(UpdateResVerCoroutine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user