Android Custom APK

I have been moving home I should have my PC setup tonight I will update the tutorial as soon as I get a chance.
 
Good luck ! Ive been moving home about 11 times  ;D each time its more stuff but it gets easier emotionally for sure.
 
Just a update I am working to migrate from the old Ant build to Gradle I have been looking at other SDL2 android projects to try to understand how the process works.  The reason for migration is to make the build process a bit future proof and enable newer services that we need to enable adverts.  My end goal is to have a simple process to compile the android build with options to sign and release the APK and have adverts fired directly from openbor script so the developer has full control when a advert is shown.  I am holding off updating the tutorial until I have this all working sorry but it might take some time please be patient.
 
Great! If thats not gonna motivate newcomers to start making games then i dont know what will  ;D
I just wish we would have securepak or something that would lock our mods from modifications in the future.
 
nsw25 said:
bWWd said:

nsw25 That's cool man. May I message you to ask about the way you secure the pak file? I have original IP in the work for PC & android (I can let you know in the msg), although android version will be much later in the future, It'd be great to cover the base and know about the solutions.
 
nsw25 just be aware that there isn't a 100% secure tool for it and there are several tools to bypass it. For example, if you use molebox to secure it...its a piece of cake to crack it open.
 
Add your pak file in the folder "res/raw/bor.pak" if the raw folder is not there then make it and be sure to rename your mod to bor.pak i will update it to accept any filename but for now it has to be that one.

Now compile then test it.
 
Worked great ! now i have custom working game for android !Im currently making custom touch.txt files
This one is without special button, only direction and attack jump start, no escape.
Code:
button attack 0.15 0.1 0.08 2
 button jump 0.35 0.1 0.08 2
 button special -99 -99 0.08 0
 button attack2 -99 -99 0.08 0
 button attack3 -99 -99 0.08 0
 button attack4 -99 -99 0.08 0
 button esc -99 -99 0.08 0
 button start 0.1 0.1 0.08 1
this one is with special
Code:
button attack 0.15 0.1 0.08 2
 button jump 0.35 0.1 0.08 2
 button special 0.55 0.1 0.08 2 
 button attack2 -99 -99 0.08 0
 button attack3 -99 -99 0.08 0
 button attack4 -99 -99 0.08 0
 button esc -99 -99 0.08 0
 button start 0.1 0.1 0.08 1
Can someone upload touch.zip file with button png graphics ?
 
Tuch.txt goes to data filder, where models.txt is and all that, button png file looks like this , you use it by having texture command and path in touch.txt
http://www.chronocrash.com/forum/index.php?topic=277.msg1659#msg1659
406e651d.png

Just in case i copied it and its here:
The title says it all. Apparently, uTunnels implemented a configuration text file for use of his Android build called 'touch.txt'. Like the text files we modders commonly edit, touch.txt can also be commented for ease of navigation and stuff.

You can place the touch.txt on either your save folder (/mnt/sdcard/OpenBOR/saves) or if you plan on including it on your pak, you can place it on your data folder of your mod prior to pak-ing it.

Here's the three syntax that touch.txt can detect:

    buttons {x} {y} {size} {placement}
This is what we usually modify in touch.txt. This controls the placement of the on screen touch buttons.
Firstly, placement defines what corner do we place the button. For a diagram, here's what uTunnels created in the source code:
          0                  1

          3                  2
The reason why I explain placement first is because {x} and {y} are relative to {placement}. For example, if placement is defined 2, then {x} goes from right to left and {y} goes from down to up.
X's range is 0.0 to 1.80 while Y's range is 0.0 to 1.0 (since the screen size is 9:5)
You can adjust size of the button by using {size}. Default is 0.08, which is the comfortable size. I tested using 1.0 and it's gigantic.  ;)

    surface {path}
You can define your button's appearance using this. The path is relative to the OpenBOR folder path. If you plan to include it to your mod, you should point your touch.txt to point at the data folder. Example:
    surface data\yourbutton.png
The button should be in PNG and you need to follow the button template included in the tutorial zip.

    screendocking {value}
Screendocking, according to uTunnels' source, is "[changing] screen position to avoid buttons". This is optional since the buttons are already transparent, but you can place it anyway.
Accepted values are left, right, top and bottom

Tip:
If you want to hide a button, you can make the x and y go -99. Not placing graphics on the respective button might hide it, but it can still be detected when pressed.
If you want to center a button, say the screenshot button, you can use x=0.90 and y=0.5

That's all there is to it for touch.txt.

For now I have a zip file template for android porting:

touch.zip - 10.25 KB

The zip file contains the old buttons that was used by uTunnels from his previous commit from the source code. This can be used as a template for your buttons. The zip also has a touch.txt set on a configuration similar to what bWWd had but includes the screenshot and directional buttons configured as well the attack button enlarged a bit.

Thanks for bWWd for pointing this out!
This one says its "texture" command that should be used, strange
Android touch button layout can be customized now using touch.txt, which can be placed in 3 different locations:

1) /mnt/sdcard/OpenBOR/Saves/pakname/touch.txt
2) data/touch.txt
3) /mnt/sdcard/OpenBOR/Saves/touch.txt

1) overrides 2), 2) overrides 3), so 3) can be used as a global setting if you don't want the default layout. The commands:

button {name} {x} {y} {radius} {corner}

{name} is same as its counterpart in menu.txt.

{x} {y} {radius}, coordinations and radius. They should be decimal values, and the actual size is sizexwidthx0.6, see below.

{corner} defines one of the 4 corners your coordinations start from.

0    1

3    2

An example:

button attack 0.6 0.25 0.08 2

Assume your screen resolution is 800x480, the button (center of it) is at (0.6x800x0.6, 0.25x800x0.6)=(288, 120), radius is 38. Because corner is 2(see above), actual position is at (800-288, 480-120)=(512, 360). There is no direct way to center a button though.

To hide a button, just move it out of the screen.

Usually you don't need to change the picture, if you really want to, use texture command:

texture {path}
-------


Ok i tested texture and surface, texture definitely is the one that works, surface wasnt working for me, i can see my new buttons but at first old green buttons are shown onscreen along with openbor logo, can we somehow hide the original non customized buttons at the beginning , wheres the graphics for them in the source ?
--
Ok foud it , button file but uts in h format, what should i do to replace it with png ?
Its here : C:\openbor.git\branches\Malik-Updates\engine\android\app\jni\openbor
Heres the file :
https://github.com/sega-dreamcast/openbor/blob/master/engine/android/jni/openbor/button_png_800x480.h
---
Ok i managed to hide default buttons at the beginning (custom ones show up ok) I changed button_png .h file in notepad++ to that and compiled again :
Code:
char buttonpng[99078] = {
	0x89,	0x50,	0x4E,	0x47,	0xD,	0xA,	0x1A,	0xA,
	0x4E,	0x44,	0xAE,	0x42,	0x60,	0x82 
};
ITs dirty way but works, still intereted how to use my own png and use it as header (h) file.
---
published
https://play.google.com/store/apps/details?id=org.bearz.game
 
I also want to mention that before you upload to playstore you have to go through their menus so you have gray circle icons highlighted to green, you have to describe violence level and theme of the game etc.
I kinda hogged this topic but id prefere if people knew what has to be done to get it right.
msmalik681 great job !
 
I wanted to include he-man pak file in the apk , its about 170mb, i cant do it tho, i have this error.
Other smaller paks work fine, is there any way to fix this ?
From what i know raw folder doesnt have any limit so why it happens ?
f6c02059.jpg
 
I cant even get small paks to work in your branch, im getting this:
Game shuts down because resolution cant be set, but i used this pak previously with your branch and it worked, how come now it doesnt ?
Code:
DL video Renderer: opengles2 
error: Surface doesn't have a colorkey
OpenBoR v3.0 Build , Compile Date: Sep 29 2019

Game Selected: /storage/emulated/0/Android/data/org.bearzz.game/files/Paks/1.0.0.pak

FileCaching System Init......	Enabled
Initializing video............
Reading video settings from 'data/video.txt'.

Colordepth is depreciated. All modules are displayed with a 32bit color screen.


Using debug video mode: 640 x 360
Initialized video.............	640x360 (Mode: 255)

SDL video Renderer: opengles2 
error: Surface doesn't have a colorkey

******** An Error Occurred ********
*            Shutting Down            *

Unable to set video mode: 640 x 360!
Total Ram:  1930194944 Bytes (  1840 MB )
 Free Ram:   136179712 Bytes (   129 MB )
 Used Ram:   128552448 Bytes (   122 MB )

Release level data...........
Done!

Release graphics data........	Done!
Release game data............


Release game data............	Done!
Release timer................	Done!
Release input hardware.......	Done!
Release sound system.........	Done!
Release FileCaching System...	Done!

************** Done ***************

Unable to set video mode: 640 x 360!
Is there any way i can revert files to older changes ?
--
I see that in my app paks folder (org.heman.app/paks/) i have 1.0.0.pak file , when i try to delete that file and then place heman.pak in there then after running app it automatically replaces heman.pak with 1.0.0.pak file that it was installed with... wow this is trange, is there a way to disable that ? I want to create he-man apk with icon and all but
still be able to move pak file by myself there, i cant do it now because its being replaced.
 
Part of the android code is to copy the bor.pak file from your res folder to the paks folder using the game version number as the file name.  On the next run if the file name of the pak file does not match the version number it will empty the paks folder and do the whole process again.  In retrospect this was probably not the best plan as save data would not carry over updates.

Again I will look over it today and see what has gone wrong.
 
Where i can find lines for the code responsible for this ?
---
OK figured something important out !!!
If pak file is without touch.txt and touch.png then it will not run with this method of installing.I compared paks that works and doesnt work, even if you put bor.pak in res/raw  folder before compliling and it doesnt have these 2 files then after install game will not run, could you disable that so it runs fine with any pak ? OR maybe its because there was only touch.txt without touch.png, not sure as im testing at the moment.

So now i can replace 1.0.0.pak file with any pak that i like, i wish it was possible to create separate installer for bigger pak files and it would place them in respective folders of the game.
 
it seems lager pak files get currupt or something goes wrong with the headder information (just gessing).  When I use a big "bor.pak" file it get the error  "invalid stored block lengths" but if I zip that file then rename it to bor.pak it works fine so something happens when the data is being packed up.

There are 2 options fix the packing process this is something Plombo could do but it is beyond me.  Or second option is to upload the file as a zip and I remake the copy code to a extracting code instead.  I would like to see what Plombo thinks as this might be a easy fix for him.
 
Your workaround would help a lot, can i help You with this in any way ? I really would love to have ability to pack large pak files.
I tried to zip it and compile but it failed again.
Tried to pack 70mb game and it failed.
 
Bad news I successfully zipped a 63mb pak file into zip and it compiled and I successfully made a code to extract it but bad news is it takes literally forever to unzip maybe because it is extracting a zip file from a zip file. So this is not a good fix need to work out what the issue is with large pak files.

Plombo haxpor do you guys have any idea about the "invalid stored block lengths" error when compiling large pak files ?
 
Back
Top Bottom