Closed oleg-derevenetz closed 1 month ago
Hi @oleg-derevenetz , I tested the build and I found several issues:
Hi @ihhub
No mentioning that maps must be in a zip format. Since we export them in a zip format then the same format is used for import.
The logic is currently absolutely the same as for importing/exporting save files. They are also imported & exported as ZIP archives and you cannot import a save file as is. As far as I understand, users do not encounter difficulties with this.
Some zip files are not detected (I assume it is a Java package issue):
This file selection window is a system Activity that is called by our app. It's hard to say what it doesn't like about these archives. Can they be opened by the Save File Manager or using the assets extraction button?
@oleg-derevenetz , something is strange as I used full-set.zip file to install a full version of the game. After that I am not able to even select this file anymore. I was downloading them from my own Google Drive.
One thing we definitely need to do is to disable save and map related buttons if we cannot start the game.
@ihhub
something is strange as I used full-set.zip file to install a full version of the game. After that I am not able to even select this file anymore.
So you cannot select this file anymore even using the "Extract HoMM2 Assets" button? It looks like your Android goes slightly mad :) It looks like it doesn't allow you to choose files that are NOT created by this app, but this is nonsense, since this system Activity is designed to provide the application with access to arbitrary files (and, as I understand, this initially worked).
One thing we definitely need to do is to disable save and map related buttons if we cannot start the game.
Are there any specific reasons for this? Because these things are totally unrelated: you can import save files and FH2M maps even if no game assets are extracted yet. Technically, nothing prevents you from doing this.
@oleg-derevenetz , thank you very much for this feature!
Hi @ihhub
Cannot import native .fh2m files:
I tried to add such an opportunity for the sake of interest, but it doesn't work so far. The problem is that, when calling the file chooser activity (or, more precisely, just the "chooser activity", because not just files can be selected in general), you need to pass not a template(s) for file names, but a set of MIME types (like application/zip
). That's a problem, because there is, obviously, no standard, well-known MIME type for our fh2m files. I tried to somehow "register" it in various ways (mostly utilizing the intent-filter
in the app manifest), but none of the methods worked properly so far, those custom MIME types are not recognized by the system chooser activity (probably because it's a system one and it doesn't care about MIME types registered by the 3-rd party apps, like fheroes2).
P.S. What's interesting, the ContentResolver
also doesn't work properly with those "custom" MIME types, fh2m files are always reported as application/octet-stream
despite my attempts to "register" them somehow (while ZIP files are reported as application/zip
, because they have "standard" MIME type).
Hi @oleg-derevenetz , thank you so much for this comprehensive research.
We can come up with another solution in the future. At the moment I don't have any good solution except the one to somehow make zip files within the Editor but this seems odd to have.
Hi @ihhub
We can come up with another solution in the future. At the moment I don't have any good solution except the one to somehow make zip files within the Editor but this seems odd to have.
In general, importing/exporting something as a ZIP file is commonly used on Android (mostly because of all this pain with MIME types, as well as, I believe, various difficulties with getting "real" file names when using choosers, because URIs issued by choosers may have nothing to do with the original file names, as well as DISPLAY_NAME
s returned by ContentResolver
for these URIs), so it shouldn't be something non-ordinary for a regular user. At least AFAIK no one complained about a similar mechanism with save files. I think creating a ZIP archive, if necessary, does not pose a problem for the user, widespread OS have built-in tools for this, there is no point in embedding this functionality into the editor.
close #8730
Nothing particularly complicated, Save File Manager-like UI. Only FH2M files are supported - maps in other formats could not be created by our Editor, they are "import-only", the "Extract HoMM2 assets" button in the Toolset itself successfully copes with this.