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

Changes to allow importing assets from MoM app 1.9.3 #1622

Merged
merged 11 commits into from
Jul 29, 2023

Conversation

seinsinnes
Copy link
Collaborator

Valkyrie stopped being able to import assets from the latest MoM official app. This is due to the official app moving to a newer version of unity (2020.3.45f1).
This is noted in a couple of issues:
#1605
#1619

This branch replaces the Unity_Studio code with AssetStudio code allowing Valkyrie to read the newer unity files.
This is a fairly big change in the import code. I've only built and tested it on my mac so it still requires testing on other platforms.

@Quantumrunner
Copy link
Collaborator

@seinsinnes Can you please check if the Descent App also still can be imported using these changes? FFG hasn't touched this app for years therefore it was still working with the old approach.

On Steam you can find the app here:
https://store.steampowered.com/app/477200/Descent_Road_to_Legend/

@seinsinnes
Copy link
Collaborator Author

Sure.

I'm not familiar with the game unlike the many many hours I've spent on MoM but it appears import fine.
Screenshot 2023-06-21 at 8 03 38 pm

Screenshot 2023-06-21 at 8 05 51 pm

@Quantumrunner
Copy link
Collaborator

Thank you this looks all fine.

Looking promising that we can finally get rid of these issues with your change.

@seinsinnes
Copy link
Collaborator Author

seinsinnes commented Jun 23, 2023

I've just gone through the standard build on a windows vm. I was able to get to it built successfully.

A couple of things to note from that:
The target framework for ValkyrieTools needed to be updated from v3.5 to v4.6.2 and Microsoft Build Engine needed to update to one installed with recent visual studio e.g. %ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\

These changes are to accommodate the code in AssetStudio.

@seinsinnes
Copy link
Collaborator Author

@Quantumrunner
Copy link
Collaborator

@seinsinnes Is it necessary to change the build script path to the Visual Studio location? This would force the users to use Visual Studio 2022 even when a new version comes out.

@seinsinnes
Copy link
Collaborator Author

Yes, I realise it is not ideal for the build script to point to a particular version of visual studio. Though it does point to pretty specific versions of other dependencies.

The build script just needs a path to a recent version of msbuild.
So we'd need a way to find a path msbuild without referencing the visual studio version.

Apparently there is a whole powershell module just for locating visual studio components:
https://github.com/Microsoft/vssetup.powershell

I guess the other alternative would be to go through the AssetStudio code and change all the language that %WinDir%/Microsoft.NET/Framework/v4.0.3031/msbuild doesn't like to older idiom.

@seinsinnes
Copy link
Collaborator Author

@Quantumrunner I've changed the build script again so it is not dependent on visual studio of a particular year.

@Quantumrunner
Copy link
Collaborator

Thank you this looks better. Please add a comment in the script what the new line does to ensure people understand it in the future.

@Quantumrunner
Copy link
Collaborator

Thanks. Waiting for another contributor to test and approve code changes now. I hope this will not take too long for him.

@seinsinnes
Copy link
Collaborator Author

Cool, Let me know if you run into any problems.

@vidimus
Copy link
Contributor

vidimus commented Jul 7, 2023

Tried on Windows 11 and it works like a charm!

@mayjak mayjak changed the base branch from master to dev/2.6 July 29, 2023 12:29
@mayjak mayjak merged commit ed71738 into NPBruce:dev/2.6 Jul 29, 2023
vidimus added a commit to Revokee/valkyrie that referenced this pull request Jul 29, 2023
@vidimus
Copy link
Contributor

vidimus commented Jul 29, 2023

Sorry, I was on the cell phone and I accidentaly pressed on "revert". Please, ignore it

@Larrynho
Copy link

Larrynho commented Aug 12, 2023

Tried to install the APK 2.5.9a but I think it must not be properly built... You can unzip it but not install it.

2.5.9b installs and starts but it still does not find the MoM (1.9.3) app

@dhollinger
Copy link

Tried to install the APK 2.5.9a but I think it must not be properly built... You can unzip it but not install it.

2.5.9b installs and starts but it still does not find the MoM (1.9.3) app

@Larrynho Which version of Android are you on? Newer versions of Android block the ability of Valkyrie to access other apps' data directories.

@Larrynho
Copy link

@dhollinger Im on Android 12 ( MIUI 13 ). It is my understanding that these 2.5.9a and b where re designed to work with newer versions of the MOM app and Android, right? ( even if you still have to enable the install from unknowm sources for Valkyrie )

@seinsinnes
Copy link
Collaborator Author

Yes, Valkyrie-android-2.5.9b.apk
should work to import from MoM official app 1.9.3.

The problem is that the import fails on Android 11, 12, 13. I can't figure out a good fix for that.
Access to the data of the MoM official app is blocked by the Android operating system.

@dhollinger
Copy link

@seinsinnes @Larrynho there are a few different potential problems here:

  1. Android 13+ has sandboxing and security features that prevent apps from accessing data of another app on the device. There was a workaround via a bug in Android 12 (maybe 11, too) that allowed Valkyrie to bypass that.

  2. This is more a future concern, but Android 14+ will no longer support 32-bit apps and as of now, FFG has not updated Road to Legend to be 64-bit and it will no longer function

@seinsinnes
Copy link
Collaborator Author

@dhollinger With regards to 1: Can you elaborate on the bug for Android 12 because my changes for MoM 1.9.3 don't work with Android 11 due to being denied access to Android/Data/com.fantasyflightgames.mom/?

As for 2 the only way I see around that (if FFG doesn't update RtL) is to stop relying on the official app for assets and just have a downloadable/shareable blob of importable assets (but this might have IP implications)

@dhollinger
Copy link

dhollinger commented Aug 15, 2023

@seinsinnes Have you made sure that Android isn't blocking any permissions for the Valkyrie app? Sometimes Android itself will block certain permissions if those permissions haven't been used in a while.

It's also possible that the loophole/bugfix that was pushed in Android 13 (details) was backported by certain Android distributions, such as Samsung, LG, OnePlus, etc and thus no longer allowing Valkyrie to access the files of MoM.

In fact, it's likely that some workaround was going to be needed anyway since the Android developer docs specifically state that an App's app-specific files are not supposed to be accessible from by other apps - (details)[https://developer.android.com/training/data-storage]

That's the best answer I can give you. I'm not an android dev, I work more on backend code running on linux-based systems, so my knowledge is limited.

@Larrynho
Copy link

Larrynho commented Aug 15, 2023

A guy in discord passed me the IMPORT folder from his phone, as a "workaround", and by copying it on my phone on the proper route, the app starts but once you load an scenario everything is meesed up, badly positioned, tiles iver other tiles, markers on incorrect positions etc...

Is there any way that I do tgis import step manually from my MoM app installation to my Valkyrie installation??

Edit: tested with an IMPORT folder from another phone and now works flawlessly. It seems that the first import folder I tried was from a PC version

@seinsinnes
Copy link
Collaborator Author

@Larrynho Glad to hear it was resolved.

I've added in the possibly of manually moving the data:
Valkyrie-android-2.5.9c.apk

If you use that apk and can copy the folder Android/data/com.fantasyflightgames.mom to Valkyrie/com.fantasyflightgames.mom then the import will run successfully.

This works on my Android 13 device. To do the copy just requires a file browser with enough access to the storage.
I used https://play.google.com/store/apps/details?id=com.cxinventor.file.explorer&hl=en&gl=US
For some reason I've been unable to reproduce the same access to the app data in Valkyrie.

Anyway, you found a workaround so you don't need this.

@seinsinnes
Copy link
Collaborator Author

@dhollinger Yes, I spent some time fiddling with permissions and requesting various permissions with nothing much to show for it.
I'm not generally an android dev either.

@seinsinnes
Copy link
Collaborator Author

After looking at the Proof of Concept:
https://github.com/folderv/androidDataWithoutRootAPI33
I've been able to get access to import the MoM official app data on Android 11 and Android 13 in Valkyrie.
By asking the user for permission to access specific folders, like so:

This is a build with this permission fix: Valkyrie-android-2.5.9d.apk

@riwarek
Copy link

riwarek commented Nov 5, 2023

The generated binaries from the build: Valkyrie-android-2.5.9a.apk valkyrie-linux-2.5.9a.tar.gz valkyrie-macos-2.5.9a.tar.gz valkyrie-windows-2.5.9a.7z valkyrie-windows-2.5.9a.exe valkyrie-windows-2.5.9a.zip

Theese links are dead. Can you update them? I see official app update period is extremely long.

@vidimus
Copy link
Contributor

vidimus commented Nov 5, 2023

@riwarek
The lastest beta version is 2.5.9e. Here are the links:
https://github.com/seinsinnes/valkyrie/releases/tag/release%2F2.5%2F2.5.9e_r2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants