Game Dev Contest
Join in on the Game Development contest with over $300 in prizes!
Banner Creation Contest!
Help the community out by creating your own version of the banner, and potentially having that as the main banner!
Resources
Check out our resources :D
Upgrade your account
Help out the community, and keep the website running and fully up to date by donating! :D

Pointing the Android MV client to load from internal storage.

GO TO ADMIN PANEL > ADD-ONS AND INSTALL ABSTRACT SIDEBAR TO SEE FORUMS AND SIDEBAR

Isaac The Red

Towns Guard
Joined
Dec 24, 2015
Messages
148
Points
95
RM Skill
Designer
OK so Xilefians Android Client is kinda the go to, for porting you games to android, now I asked in the main thread for the client on the rpgmakerweb forum about loading the game project from local storage rather than from within the apk. Now I've managed to get that to work, it's hacky, not the best way to do it by any means, but seems to work nonetheless. I figured I would share it, and ask for additional input or ideas on this whole thing since no one has really opened the gates on using apk expansion files for android releases.

Now let me preface this with some information, the way I got this to work was very simple, and simple solutions while they work, can have gaping holes in security or other consequences. I take no responsibility for damages caused to your hardware from following in my footsteps blindly. I caution anyone who does this to only use it with your own personal projects, and do not use this method to load other's projects onto your device. Simply because you do not know where those files have been, or if they have been modified in a way that could be harmful to your device. I am not an experienced java or android platform developer in any way shape and or form. This is just my digging and general understanding of computers and operating systems that has let me stumble down this path.

With that out of the way, let me dive in to what it is that I sniffed out. In the MV Client project files, since I was trying to figure out how to do this, I thumbed through the webplayeractivity.java file, one of the core componants of the Android client that loads up your game. This file on line 203 references a variable mv_project_index. chasing that variable I found in the file values_internal.xml that variable is given it's value. "//android_asset/www/index.html" So there it is, the place in the project that defines where the thing is looking for our deployed project.

So this next part was basically me guessing, I made an educated guess that it was looking into its internal asset folder using //android_asset/ as a binding to a virtual filesystem of some sort. At least that's how I'm looking at it. so I figure, what if I instead tell it to look at a folder in the device storage. Thankfully I have a filebrowser for android that shows me how android looks at its filesystem. in this case I pointed the mv_project_index variable to the location "/storage/emulated/0/www/index.html" basically the root of your internal storage into a folder named www and at the file index.html.

I compiled and launched it and error. Because of course its not that easy. But the error I got I almost missed because black text on black background is not easy to notice. The error was a permissions error. I looked up how to add permissions to an android application, to do that I added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to the file AndroidManifest.xml on line 19 just before "<application" where it starts defining things such as the program lable, icon etc.

Compiled and launched again. Same error. However since I added the permission into the manifest, This time I could go into android settings, to apps, to the MV client, and turn on filesystem access. Relaunch and OMFG it worked. My sample project started loading up like nothing was wrong, audio worked, menus worked, transitions worked. It just did the thing it was supposed to!

So I am super stoked that this all worked out, but I'm not knowledgeable on this kind of stuff I have decent intuition, and can figure things out quite well, but if I can stumble my way into getting it to read the game off the internal storage, it can't be THAT hard to make it read the game out of an obb file, can it?

In the end, this method I've managed to cobjob together was because I wanted to be able to just push my game files to my phone to test how it runs, without needing to rebuild the apk every... single... time... and for every... single... project. So that way I can save time, and only build an apk for more finalized games/demos that I plan on actually distributing. On top of this, the MV client is essentially a container with a mini webserver and whatnot in it, so you can build your own index.html with a "game select" menu, for if you want to have multiple projects in testing at once. rather than constantly changing and renaming folders to put one project in the spotlight at a time. Though I don't think it will handle save files properly when doing something like that, anyway if you read through all of this, thanks! I hope what I have here can help someone else even if just a bit, and I hope someone who reads this can help further us along the path of getting obb files in motion for actual releases!
 
Top