Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rolling Dev/2.6 into master #1646

Merged
merged 45 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
890b385
Added item icon addresses to drop down token type menu. This update o…
luisbmier Jun 13, 2022
fab1d56
Update Localization.Russian.txt
alexandershalin Nov 2, 2022
4b3ccc5
Merge branch 'NPBruce:master' into master
alexandershalin Jan 17, 2023
0a9ee5f
Merge branch 'NPBruce:master' into master
luisbmier Jan 21, 2023
fe517ef
filter by type for tokens localized to spanish
luisbmier Jan 21, 2023
e2d998e
Token images added fo HJ expansion
luisbmier Jan 21, 2023
00fd3ea
Token icons for BTT, POTS, SOA and SOT expansions
luisbmier Jan 21, 2023
b080044
Merge branch 'master' into feature/item-icons-as-tokens
luisbmier Jan 21, 2023
9251468
Added asset importing from Mansions of Madness App version 1.9.3 base…
seinsinnes Jun 20, 2023
d9538e6
Fix for a handful of textures being missed during import.
seinsinnes Jun 21, 2023
a91bf1d
Fixed localisation text problem with new importing code.
seinsinnes Jun 21, 2023
11b7670
Removed Unity_Studio as its functionality has been completely replace…
seinsinnes Jun 21, 2023
e9e58fb
Changing UnityEngine.dll path back to windows default
seinsinnes Jun 22, 2023
388ac3a
Changing UnityEngine.dll path back to windows default
seinsinnes Jun 22, 2023
66c86fe
Remove accidental <
seinsinnes Jun 22, 2023
a7bf54f
Update build script to point to newer msbuild
seinsinnes Jun 24, 2023
f655e6e
Updating build script so it can find visual studio install without ha…
seinsinnes Jun 25, 2023
c712627
Adding comment on finding the path to visual studio in the build script
seinsinnes Jun 25, 2023
a9baa84
Automatically install nuget external dependencies for libraries in th…
seinsinnes Jun 27, 2023
ed71738
Changes to allow importing assets from MoM app 1.9.3 (#1622)
seinsinnes Jul 29, 2023
b506971
Fixing importing of data from offical MoM app 1.9.3 on Android. The i…
seinsinnes Aug 13, 2023
47cdb1a
Merge
seinsinnes Aug 13, 2023
9033b98
Added auxiliary data import area for android.
seinsinnes Aug 16, 2023
79d1c9c
Added new activity to ask android 11+ users for access to the MoM off…
seinsinnes Sep 22, 2023
a479a57
Merge branch 'dev/FixImportFromMoM_1.9.3onAndroid' of https://github.…
seinsinnes Sep 22, 2023
35f65ad
Moving around some of the external plugins
seinsinnes Sep 23, 2023
91f1252
Change back java path in build.bat
seinsinnes Sep 24, 2023
52e2077
Fix firebase android archives
seinsinnes Sep 24, 2023
5817a53
Merge branch 'dev/FixImportFromMoM_1.9.3onAndroid' of https://github.…
seinsinnes Sep 24, 2023
43d2abe
Expansion Andriod 11+ import code to include road to legend.
seinsinnes Oct 15, 2023
1fd8fb4
Changes to allow Valkyrie to find RtL assets in Android/Obb on Androi…
seinsinnes Oct 20, 2023
72a9b75
Extra error checking for android copy from restricted folders
seinsinnes Oct 23, 2023
1f22b42
Processing and memory optimisations for importing assets
seinsinnes Oct 26, 2023
6049fb2
Remove suppression of exporting duplicate named assets
seinsinnes Oct 28, 2023
1952a95
Correct conversion of some textures during import.
seinsinnes Oct 29, 2023
4e6401b
Merge branch 'dev/FixImportFromMoM_1.9.3onAndroid' of https://github.…
seinsinnes Oct 29, 2023
602ca9d
Not sure how these files got squashed but fixed
seinsinnes Oct 31, 2023
259a276
Adding precompiled archive of FSAF
seinsinnes Oct 31, 2023
5eb32d0
Added downloading of latest FSAF to build.bat
seinsinnes Nov 8, 2023
b88cfb7
Merge pull request #1631 from seinsinnes/dev/FixImportFromMoM_1.9.3on…
Quantumrunner Nov 10, 2023
13a034b
Version bump
seinsinnes Nov 10, 2023
e092276
Merge pull request #1597 from luisbmier/feature/item-icons-as-tokens
Quantumrunner Nov 10, 2023
a6f1440
Merge pull request #1585 from alexandershalin/master
Quantumrunner Nov 10, 2023
8c117a1
Really make sure the android official app data directories exist
seinsinnes Nov 18, 2023
2f37f93
Rolling over to release version
seinsinnes Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ echo --- ERROR --- UNITY_EDITOR_HOME path not set : please set unity editor
exit /B
)

rem find visual studio installation path so we can find the msbuild executable. e.g. in C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\
rem this way we can find whatever year/version of vs is installed.
FOR /D %%B in ("%ProgramFiles%\Microsoft Visual Studio\*") do (SET "VSPATH=%%B")

echo using visual studio path: %VSPATH%

rem you can get NSIS from https://nsis.sourceforge.io/Main_Page
SET PATH=%PATH%;%JDK_HOME%\bin;%UNITY_EDITOR_HOME%;%ProgramFiles%\7-Zip;%WinDir%/Microsoft.NET/Framework/v4.0.30319;%ProgramFiles(x86)%\NSIS;%~dp0libraries\SetVersion\bin\Release;%ANDROID_BUILD_TOOLS%
@echo on
SET PATH=%PATH%;%JDK_HOME%\bin;%UNITY_EDITOR_HOME%;%ProgramFiles%\7-Zip;%VSPATH%\Community\MSBuild\Current\Bin\;%ProgramFiles(x86)%\NSIS;%~dp0libraries\SetVersion\bin\Release;%ANDROID_BUILD_TOOLS%;%localappdata%\NuGet;%ProgramFiles%\Git\bin

rem cleanup
rmdir /s /q build\android
Expand Down Expand Up @@ -70,9 +75,16 @@ mkdir build\macos
mkdir build\macos\Valkyrie.app
mkdir build\linux

rem download the latest version of Android Storage Access Framework library.
POWERSHELL -Command "Invoke-WebRequest -Uri https://github.com/seinsinnes/FSAF/releases/latest/download/fsaf-release.aar -OutFile .\unity\Assets\Plugins\Android\fsaf-release.aar"

rem Because reasons
set Target=

rem install any external packages required by the libraries
winget install -q Microsoft.NuGet -l "%localappdata%\NuGet" --accept-source-agreements --accept-package-agreements
nuget restore libraries/libraries.sln

rem Build libraries
msbuild libraries/libraries.sln /nologo /p:Configuration="Release" /p:NoWarn=0108

Expand All @@ -81,7 +93,7 @@ SetVersion %~dp0

rem build unity
Unity -batchmode -quit -projectPath "%~dp0unity" -buildWindowsPlayer ..\build\win\valkyrie.exe
rem copy %LOCALAPPDATA%\Unity\Editor\Editor.log %LOCALAPPDATA%\Unity\Editor\Editor_valkyrie-windows.log
rem copy %LOCALAPPDATA%\Unity\Editor\Editor.log ..\build\Editor_valkyrie-windows.log

Unity -batchmode -quit -projectPath "%~dp0unity" -buildTarget OSXUniversal -buildOSXUniversalPlayer ..\build\macos\Valkyrie.app
rem copy %LOCALAPPDATA%\Unity\Editor\Editor.log %LOCALAPPDATA%\Unity\Editor\Editor_valkyrie-macos.log
Expand All @@ -90,7 +102,7 @@ Unity -batchmode -quit -projectPath "%~dp0unity" -buildLinuxUniversalPlayer ..\b
rem copy %LOCALAPPDATA%\Unity\Editor\Editor.log %LOCALAPPDATA%\Unity\Editor\Editor_valkyrie-linux.log

Unity -batchmode -quit -projectPath "%~dp0unity" -executeMethod PerformBuild.CommandLineBuildAndroid +buildlocation "%~dp0build\android\Valkyrie-android.apk"
rem copy %LOCALAPPDATA%\Unity\Editor\Editor.log %LOCALAPPDATA%\Unity\Editor\Editor_valkyrie-android.log
rem copy %LOCALAPPDATA%\Unity\Editor\Editor.log Editor_valkyrie-android.log

rem delete the META-INF from the apk
7z -tzip d "%~dp0build\android\Valkyrie-android.apk" META-INF
Expand Down
90 changes: 73 additions & 17 deletions libraries/FFGAppImport/AssetImport/AppFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ abstract public class AppFinder
public abstract string Executable();
public abstract string RequiredFFGVersion();
public abstract string ObbPath();
public abstract string DataPath();
public abstract string AuxDataPath();
public string location = "";
public string obbRoot = "";
public string obbVersion = "";
public string exeLocation;
public string apkPath;
public abstract int ObfuscateKey();

public Platform platform;
Expand Down Expand Up @@ -140,32 +143,57 @@ internal void DeleteObb()
if (platform != Platform.Android) return;
if (!Directory.Exists(obbRoot)) return;
Directory.Delete(obbRoot, true);
}

public void ExtractObb()
}
public void ExtractApk()
{
if (platform != Platform.Android) return;

ValkyrieDebug.Log("Extracting the file " + apkPath + " to " + obbRoot);
DeleteObb();
Directory.CreateDirectory(obbRoot);
using (var zip = ZipFile.Read(apkPath))
{
zip.ExtractAll(obbRoot);
}

}

public bool ExtractObb()
{
if (platform != Platform.Android) return true;
//string obbFile = "C:/Users/Bruce/Desktop/Mansions of Madness_v1.3.5_apkpure.com/Android/obb/com.fantasyflightgames.mom/main.598.com.fantasyflightgames.mom.obb";
//string obbFile = "C:/Users/Bruce/Desktop/Road to Legend_v1.3.1_apkpure.com/Android/obb/com.fantasyflightgames.rtl/main.319.com.fantasyflightgames.rtl.obb";
string obbPath = ObbPath();
if (obbPath == "") return false;
ValkyrieDebug.Log("Extracting the file " + obbPath + " to " + obbRoot);
DeleteObb();
Directory.CreateDirectory(obbRoot);
using (var zip = ZipFile.Read(obbPath))
try
{
zip.ExtractAll(obbRoot);
}
Directory.CreateDirectory(obbRoot);
using (var zip = ZipFile.Read(obbPath))
{
zip.ExtractAll(obbRoot);
}

ConvertObbStreamingAssets();
ConvertObbAssets();
ConvertObbStreamingAssets();
ConvertObbAssets();
return true;
}
catch (System.Exception e)
{
ValkyrieDebug.Log(e.ToString());
return false;
}
}

internal string ExtractObbVersion()
{
if (platform != Platform.Android) return "";

if (!string.IsNullOrEmpty(obbVersion)) return obbVersion; // lookup version only once
string obbPath = ObbPath();
if (obbPath == "") return "";
ValkyrieDebug.Log("Extracting the version from " + obbPath + ".");
using (var zip = ZipFile.Read(obbPath))
{
Expand Down Expand Up @@ -287,18 +315,46 @@ private void ConvertObbStreamingAssets()
Directory.Move(dirAssetBundles, dirAssetBundlesWin);
}

protected string GetObbPath(string prefix, string suffix)
public string GetDataPath(string packageName)
{

return Android.GetStorage() + "/Android/data/" + packageName;
}

public string GetAuxDataPath(string packageName)
{

return Android.GetStorage() + "/Valkyrie/" + packageName;
}

protected string GetObbPath(string prefix, string suffix, string altprefix = null)
{
if (prefix == null) throw new ArgumentNullException("prefix");
if (suffix == null) throw new ArgumentNullException("suffix");
if (suffix == null) throw new ArgumentNullException("suffix");
try
{
string location = Path.Combine(Android.GetStorage(), prefix);

string location = Path.Combine(Android.GetStorage(), prefix);
if (!Directory.Exists(location))
{
return "";
if (!Directory.Exists(location))
{
return "";
}
var file = Directory.GetFiles(location).ToList().Find(x => x.EndsWith(suffix));
return file ?? "";
}
catch (Exception ex)
{
ValkyrieDebug.Log("GetObbPath caused " + ex.GetType().Name + ": " + ex.Message + " " + ex.StackTrace);
if(altprefix == null)
{
return "";
}
else
{
return GetObbPath(altprefix, suffix);
}
}
var file = Directory.GetFiles(location).ToList().Find(x => x.EndsWith(suffix));
return file ?? "";

}
}
}
55 changes: 55 additions & 0 deletions libraries/FFGAppImport/AssetImport/AssetStudio/7zip/Common/CRC.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Common/CRC.cs

namespace SevenZip
{
public class CRC
{
public static readonly uint[] Table;

static CRC()
{
Table = new uint[256];
const uint kPoly = 0xEDB88320;
for (uint i = 0; i < 256; i++)
{
uint r = i;
for (int j = 0; j < 8; j++)
if ((r & 1) != 0)
r = (r >> 1) ^ kPoly;
else
r >>= 1;
Table[i] = r;
}
}

uint _value = 0xFFFFFFFF;

public void Init() { _value = 0xFFFFFFFF; }

public void UpdateByte(byte b)
{
_value = Table[(((byte)(_value)) ^ b)] ^ (_value >> 8);
}

public void Update(byte[] data, uint offset, uint size)
{
for (uint i = 0; i < size; i++)
_value = Table[(((byte)(_value)) ^ data[offset + i])] ^ (_value >> 8);
}

public uint GetDigest() { return _value ^ 0xFFFFFFFF; }

static uint CalculateDigest(byte[] data, uint offset, uint size)
{
CRC crc = new CRC();
// crc.Init();
crc.Update(data, offset, size);
return crc.GetDigest();
}

static bool VerifyDigest(uint digest, byte[] data, uint offset, uint size)
{
return (CalculateDigest(data, offset, size) == digest);
}
}
}
Loading