Compiling Android version with a .pak

O Ilusionista

Captain 100K
Its possible to complie the Android version with a .pak inside, so the user doesn't needs to copy the file to the specific folder?

Plus, can I change the default icon?
 
To answer that question, utunnels made this comment in Rev 3954:
Android port now uses relative directory instead. It can also carry a default pak if it is placed properly in assets folder (experimental).

There is a way to do this though:
According to the Android Developers site:
main/assets/
This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.

Utunnels placed code called CopyPak in the android build. You can find this in SDLActivity.java (located in engine\android\src\org\libsdl\app\). This code will copy the pack to the OpenBOR SDCard folder, but this requires that your APK is compiled there. Here's how you would do it.

On your Android build, make an assets folder. Place your mod in the assets, remember the name of the pak, this will matter when you will use CopyPak.

After that, open your SDLActivity.java and under OnCreate, there is a CopyPak sandwiched there with the default:
Code:
CopyPak("BOR");
Replace "BOR" with your pak name. Example:
Code:
CopyPak("Avengers")
(for your Avengers mod).

Then you can now compile the app using the build.bat provided. For compilation instructions, please consult the updated readthis.txt.

For the icons, there is a folder called res, the icons are placed in the "drawable-*" folders. All are PNG files that can be edited.

That's all I can say.  ;)
 
That depends if you named your app differently and made a different folder. Although it sounds easy and looks easy, editing the Android manifest and such, but this takes more time though as you would need to find some strings and edit the source code of OpenBOR itself. That's my opinion though, I'll try to delve to that once I'm finished my job here.

One side note though, the method will definitely bloat your APK. It's not going to compress it or anything, just add it over to the rest of the thing. I know though that an APK is a zip file, since pak is just code, it may not reduce it to the size that you would like it to be.
 
i created copypak.apk for android, you could just unrar it and place pak file in assets folder , i would move this pak file to openbor/paks on android device.
I just remember that i had problem if pak was above 50mb or 100mb not sure which one.It didnt work if it was too large.

CRxTRDude can you create something similar that would work without this size limit  and wouildnt require to compile all over agbain?? So we could just unrar apk and replace pak file in assets .

https://drive.google.com/file/d/0B8RnYSep1u_YdXJhUlh3a1E0eWc/view?usp=sharing
 
I got what you mean, you open the apk and place the file in the assets folder, place the asset over the pak and stuff, since you really can't place too big stuff in the assets folder by compile (needs to be 1MB according to here).

The limit you're talking about btw is this:

Google Play currently requires that your APK file be no more than 50MB. For most applications, this is plenty of space for all the application's code and assets.

Unfortunately the OS itself also locks the APK to no more than 50MB.

There is a way to circumvent that though, through the use of OBBs or expansion files. But we need to register the app to Google Play though, that's another problem there. LVL(License Verification Library) is needed to run expansion files.

EDIT: Lots of edits, because I want to clarify things.  :)
 
You have to be programmer moron to lock OS like that for 50MB :) im sure one person is responsible for that kind of stupid decision and im sure he's proud. ::)
Anyway so only way is to download it from server to device ?
 
bWWd said:
You have to be programmer moron to lock OS like that for 50MB :) im sure one person is responsible for that kind of stupid decision and im sure he's proud. ::)

I think that was because it was that time before when the internet technology was still at boom and download sppeds and mobile device storage capacities were not that great.

When the time came that the storage space was catching up, with quad core processors and higher ram, at the same time, they were pinning against Apple with the App Store and Play, Google decided instead of reinventing the wheel, they added things to it instead, like the expansion file, not only is that the answer to the age old problem of 50 meg lock in, but also their DRM for their Play service.

The rest is history, one thing to blame, blame Google's devs for not thinking that nothing changes in the APK if you just increase their storage capacity and opted to f*** us up with expansion files for the dough. :)

Long story short, the only way is for manual downloading and install. An automation process is great, but we need a private server to store the pak, or even dropbox, make a text file that informs what version is latest, download it first before running so that it detcts if it's the latest version, downloading the latest version if available and play.

We don't diss of the expansion files though, if you want to put your mod in Google Play, that method can be used.
 
I dont believe it was good reason to introduce something that stupid, games on CD already had hundreds of MB in early 90's.ITs just some idiot and they didnt bother to fix this to this day.If android phone had smal amount of memory then it should take care of storage space itself, If apk was too large then just dont install, PC programs do that check very often, doesnt need to have hardcoded limits of 50mb like if this was 1985 year.
How hard could it be to remove single line or 2 of code and get rid of it, whats the use of such crippling ?
Its similar thig on consoles , amount of ram cripples complexity of games which would be more complex if ps3 xbox360 had more ram.
50mb limits a lot of people who now have to use expansion filesand are forced to register and pay google for license.Monopoly at its best.
 
Indeed.  ;)

Actually LVL is free, it's just that you need to acknowledge to Google Play via a private key (which you have to register for free for a dev license) that this is the file to dload/patch. That's if we use Play, but there are ways like I said, but that's just one way to kill a bird.  :) :)

I'll try to put this along as part of a to-do list and if I can implement something, something on the lines of using a patch file to download latest APKs and using a downloader within android before loading the engine itself, I might be able to do so, but that's just something of a long term goal than an immediate thing.
 
hi
started to test compile my android version of war of the gems with the pak file inside the .apk

i think i compile and merged the pak correctly
but in my bin folder i recieve more files than the .apk file
Captura%20de%20tela%202015-08-22%2000.03.39.png


is that normal or i did many things wrong to recieve those extra files?

[attachment deleted by admin]
 
Yeah, that's normal. Just get the one with '*-debug.apk'.

In your case wargems-debug.apk.

It's okay that it says 'debug' in it, since you didn't use a private key for it. (You only use a private key for Google Play) The other ones are just products of the compiling process, so it can be safely removed.
 
now is time for the test results:

the wargems.apk installed as expected in the wargems folder

the
Code:
CopyPak("wargems");
part of the source with
Code:
String fileRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + ctx.getApplicationInfo().loadLabel(ctx.getPackageManager());

not worked as i expected and the wargems.pak was not copied on directory wargems/Paks/wargems.pak

so i didi it manually and place the wargems.pak in the
wargems/Paks/wargems.pak

run the game and it closes when start to read wargems.pak

then i create a openbor folder and inserted in openbor/paks/wargems.pak

and tried to run the game by wargems.apk installation and it works

but if i delete wargems.pak from Wargems directory it not found the pak file to work

so long story short i need to have wargems.pak in openbor and in wargems paks directory to make it work for now

the changes that i made on the android build was:

app name from openbor to wargems
project name from openbor to wargems
package name on manifest.xml org.openbor.engine to org.wargems.rafhot

copypak from BOR to wargems

added a assets folder and place wargems.pak inside


i did not change the openbor display name on video.c
ans also the touch.txt locations that point to openbor folder



i did not changed also the original openbor code




 
On second thought, did you remove the private void CopyPak?

Also if you got something like ES File Explorer and your phone is rooted, try to find where the pak was placed after installation.

It is expected to be in /Android/data/org.openbor.engine/files as it was commented in the code.

If it's there, then it should be fine.

Also try to remove the .pak in your pak file. Just wargems. I saw it in the code that it would just copy the name appended with .pak to be copied over to OpenBOR's folder.

Sorry if it's convoluted, but you get the idea.
 
Can someone help me configure the Android NKD for windows 10 I have extracted it but not sure what to do from there (is there a set location I have to copy it to maybe ?). I have the SDK and ANT working !

Never mind I fixed it now I can build openbor for android  ;D
 
Just a progress report I have managed to get openbor to compile for android with a custom name and folder but the problems are:

  • the custom made engine will not accept .pak files but it does work with a fake pak file and a data folder.
  • the engine still logs all files (saves,screenshots,logs . . .ect) to the default "/mnt/sdcard/Openbor" directory.
Once I get these issues resolved copying a pak file should be no problem. Here is a list of file that I have found that have reference to directories:

engine\sdl\sdlport.c
engine\android\jni\openbor\video.c
engine\android\src\org\libsdl\app\SDLActivity.java

I have not found any other files I will keep digging but if anyone can help me look I would appreciate it.  Also the file "engine\android\jni\openbor\include\sdl\SDL_filesystem.h" might be useful I am still looking into this one.

 
at the moment I have logs writing to the correct folder but still a issue with loading pak files and saving settings.  In the source code both pak files and savedata are referenced using "getBasePath" right now I am trying to figure out how to modify this variable with no luck I have tried:


engine\android\jni\openbor\include\sdl\SDL_filesystem.h
Code:
extern DECLSPEC char *SDLCALL SDL_GetBasePath("/mnt/sdcard/Android/Obb/org.tekken.malik/");


This caused a problem when compiling if someone knows what I am doing wrong please help.
 
Back
Top Bottom