Jump to content

Android port


Guest afeder
 Share

Recommended Posts

You could configure git to ignore ".svn/*" (very easy, just dump that in a text file called .gitignore). Then you can continue to use svn to update if the official repositories get out of sync, without confusing git. in addition, because of git's hashed based versioning, if both git repositories endup with the same version separately, git should take note.

Link to comment
Share on other sites

You could configure git to ignore ".svn/*" (very easy, just dump that in a text file called .gitignore). Then you can continue to use svn to update if the official repositories get out of sync, without confusing git. in addition, because of git's hashed based versioning, if both git repositories endup with the same version separately, git should take note.

Okay, I've forked the official repo and cloned the fork repo to a directory on my local machine. How do I now pull the latest SVN revision into this directory? Doing svn co as normal fails with an error saying that the directory already exists.

Link to comment
Share on other sites

"svn up"

This fails because it doesn't know which URL to pull from.

Currently trying to do a git svn clone, but darn - is it taking a while (it's cloning the whole revision history).

Link to comment
Share on other sites

I don;t know about git svn clone, but that sounds like a git to svn converter. I would

  1. git clone your fork
  2. copy past the svn over the git,
  3. add .svn/* and .svn to .gitignore (one per line)
  4. try pushing to git hub.

Then copy in your android hacks+commit. whether you want to pop 'em all in, or make a "fake history" and commit in changes is up to you. If SVN adds anything else besides ".svn/*", I would copy that too.

Link to comment
Share on other sites

An auto-updated Git mirror would be handy so it's always in sync - it's easy to get the SVN server run a script after every commit to do whatever extra updates are needed.

I've been continuing to commit various GLES compatibility fixes, mostly trying to fix things in a permanent way (not just disabling code temporarily). The basic strategy is that any fixed-function multitexture setup code (glTexEnvi etc) should be moved to ShaderProgramFFP.cpp, and the rendering code should load it via g_Renderer.GetShaderManager().LoadEffect(...), so that we can easily add a GLSL-based implementation of the shader later. Then the rendering code should replace calls to glVertexPointer(...) etc with shader->VertexPointer(...) (which translates the fixed-function arrays into generic vertex attributes for GLES-compatible GLSL). Then replace all glBegin/glVertex3f/etc drawing with vertex arrays and glDrawArrays. Then replace the GL global matrix stuff with client-side computation of the model-view-projection matrix, and pass it to the shader with shader->Uniform("transform", m). I think the shader API provides everything that's needed for this now, so the remaining work is mostly just mechanical translation.

Link to comment
Share on other sites

Yes, that might have been a more sensible approach. I guess git-svn converts the svn revision history to git. Anyhow - in the meantime, it completed.

Well, a git checkout downloads all history too, so you probably wouldn't have saved on download times. Just make sure the conversion didn't get rid of .svn (or can git update+convert too?) and if you "push --force" to your forked repo on github it might be able to make some sense of it. Good luck!

Edited by Sonarpulse
Link to comment
Share on other sites

As of r11065, I can build and start the game with Mesa's GLESv2 implementation - there's no text on the menu screen, and it crashes when you start a match, but that should be enough to test the Android port.

I'm getting this (severely reduced) error output. The GL related errors I assume are related to NVTT and/or FCollada, so I'll #if that out. The others seem platform-specific and I'd better fix those.

Link to comment
Share on other sites

r11068 fixes some. With the GL errors: What version of the NDK are you using? I'm testing with android-ndk-r7-crystax-4 and those symbols (GL_BGRA_EXT etc) are defined in platforms/*/*/usr/include/GLES2/gl2ext.h.

After some fiddling with libraries and Premake and environment variables etc, I can get it to compile against the NDK and get far enough for the linker to complain about mostly-legitimate missing symbols. I've been writing a script to automatically build all the libraries based on the steps in the wiki, so I'll try to get that working and upload it some time tomorrow.

Link to comment
Share on other sites

r11068 fixes some. With the GL errors: What version of the NDK are you using? I'm testing with android-ndk-r7-crystax-4 and those symbols (GL_BGRA_EXT etc) are defined in platforms/*/*/usr/include/GLES2/gl2ext.h.

After some fiddling with libraries and Premake and environment variables etc, I can get it to compile against the NDK and get far enough for the linker to complain about mostly-legitimate missing symbols. I've been writing a script to automatically build all the libraries based on the steps in the wiki, so I'll try to get that working and upload it some time tomorrow.

With the latest revision it's down to this. I use android-ndk-r5-crystax-2 because I weren't able to get android-ndk-r7-crystax-4 to compile Boost. Were you?

Link to comment
Share on other sites

I patched the Boost build script with

--- MysticTreeGames-Boost-for-Android-70838fc/build-android.sh  2011-10-16 14:34:17.000000000 +0100
+++ MysticTreeGames-Boost-for-Android-70838fc/build-android.sh 2012-01-29 13:06:37.289820841 +0000
@@ -104,19 +104,19 @@
;;
windows|cygwin)
Platfrom=windows-x86
;;
*) # let's play safe here
Platfrom=linux-x86
esac

-CXXPATH=$AndroidNDKRoot/build/prebuilt/$Platfrom/arm-eabi-4.4.0/bin/arm-eabi-g++
-CXXFLAGS=-I$AndroidNDKRoot/build/platforms/android-8/arch-arm/usr/include
-TOOLSET=gcc-androidR4
+CXXPATH=$AndroidNDKRoot/bin/arm-linux-androideabi-g++
+CXXFLAGS=-I$AndroidNDKRoot/sysroot/usr/include
+TOOLSET=gcc-androidR5
if [ -n "$NDK_R5" ]; then
CXXPATH=$AndroidNDKRoot/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$Platfrom/bin/arm-linux-androideabi-g++
CXXFLAGS="-I$AndroidNDKRoot/platforms/android-8/arch-arm/usr/include \
-I$AndroidNDKRoot/sources/cxx-stl/gnu-libstdc++/include \
-I$AndroidNDKRoot/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include \
-I$AndroidNDKRoot/sources/wchar-support/include"
TOOLSET=gcc-androidR5
fi

then passed it the toolchain path instead of NDK path when running it, which seemed to be enough to get it building with the latest NDK.

Link to comment
Share on other sites

After a load of disgusting hacks, and after giving up on the emulator since it seems to complain when executing certain instructions (blx) in the Crystax NDK, I can get the code to start running on the real device. Currently the only data file is the hwdetect.js script which lets it report some hardware details like

{
"os_unix": 1,
"os_linux": 1,
"os_macosx": 0,
"os_win": 0,
"arch_ia32": 0,
"arch_amd64": 0,
"build_debug": 1,
"build_opengles": 1,
"build_datetime": "Feb 15 2012 01:13:30",
"build_revision": "custom build",
"build_msc": 0,
"build_icc": 0,
"build_gcc": 404,
"gfx_card": "ARM Mali-400 MP",
"gfx_drv_ver": "OpenGL OpenGL ES 2.0",
"gfx_mem": 0,
"snd_card": "",
"snd_drv_ver": "",
"GL_VERSION": "OpenGL ES 2.0",
"GL_VENDOR": "ARM",
"GL_RENDERER": "Mali-400 MP",
"GL_EXTENSIONS": "GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil ",
"GL_SUBPIXEL_BITS": 4,
"GL_MAX_TEXTURE_SIZE": 4096,
"GL_MAX_CUBE_MAP_TEXTURE_SIZE": 1024,
"GL_MAX_VIEWPORT_DIMS[0]": 4096,
"GL_MAX_VIEWPORT_DIMS[1]": 4096,
"GL_ALIASED_POINT_SIZE_RANGE[0]": 0.25,
"GL_ALIASED_POINT_SIZE_RANGE[1]": 100,
"GL_ALIASED_LINE_WIDTH_RANGE[0]": 0.25,
"GL_ALIASED_LINE_WIDTH_RANGE[1]": 100,
"GL_SAMPLE_BUFFERS": 0,
"GL_SAMPLES": 0,
"GL_RED_BITS": 5,
"GL_GREEN_BITS": 6,
"GL_BLUE_BITS": 5,
"GL_ALPHA_BITS": 0,
"GL_DEPTH_BITS": 0,
"GL_STENCIL_BITS": 0,
"GL_SHADING_LANGUAGE_VERSION": "OpenGL ES GLSL ES 1.00",
"GL_MAX_VERTEX_ATTRIBS": 16,
"GL_MAX_VERTEX_UNIFORM_VECTORS": 128,
"GL_MAX_VARYING_VECTORS": 12,
"GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS": 8,
"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS": 0,
"GL_MAX_FRAGMENT_UNIFORM_VECTORS": 1024,
"GL_MAX_TEXTURE_IMAGE_UNITS": 8,
"GL_MAX_RENDERBUFFER_SIZE": 4096,
"video_xres": 320,
"video_yres": 483,
"video_bpp": 32,
"video_desktop_xres": 800,
"video_desktop_yres": 480,
"video_desktop_bpp": 32,
"video_desktop_freq": 0,
"uname_sysname": "Linux",
"uname_release": "2.6.35.7-I9100XWKJ1-CL647431",
"uname_version": "#2 SMP PREEMPT Tue Oct 11 16:42:43 KST 2011",
"uname_machine": "armv7l",
"cpu_identifier": "unknown",
"cpu_frequency": -1,
"cpu_pagesize": 4096,
"cpu_largepagesize": 0,
"cpu_numprocs": 1,
"numa_numnodes": 1,
"numa_factor": 1,
"numa_interleaved": false,
"ram_total": 836,
"ram_total_os": 836,
"ram_free": 20,
"timer_resolution": 1e-9
}

and then it dies because it can't find the rest of the data files. Need to make the hacks less disgusting, then I'll try uploading my changes, and then need to get it to load all the other data files to display the GUI screen, and see what else breaks.

Link to comment
Share on other sites

I've made it to the linker stage with android-ndk-r7-crystax-4:


/home/afeder/android/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
make[1]: *** [../../../binaries/system/pyrogenesis_dbg] Error 1
make[1]: Target `all' not remade because of errors.
make: *** [pyrogenesis] Error 2

Edited by afeder
Link to comment
Share on other sites

I think I've committed the right code now. It's not at all elegant or robust, but seems to be enough to start testing and iterating.

Rough usage instructions:

"hg clone http://hg.libsdl.org/SDL" into build/android/sdl-project/jni/ (or clone elsewhere and symlink it there, or whatever). Until this bug is fixed, apply the patch from there.

In build/android/sdl-project/, run "make". That should compile SDL and the .apk file. (Dependency checking is probably broken, so run "make clean" if you need to rebuild after changing stuff.)

In build/android/, run "./setup-libs.sh". The script hardcodes the expected locations of NDK and SDK, so put them there or adjust the script, and it will output to ~/android/toolchain-0ad. That should download and compile loads of stuff.

Build the game like


./update-workspaces.sh --gles --android --without-fam --without-audio --disable-atlas --with-system-mozjs185 --with-system-enet --with-system-nvtt --without-nvtt

and


TOOLCHAIN=${HOME}/android/toolchain-0ad PKG_CONFIG_LIBDIR=${TOOLCHAIN}/sysroot/usr/local/lib/pkgconfig LDFLAGS="-lSDL2 -L=/usr/local/lib -L../../android/sdl-project/libs/armeabi" INCLUDES="--sysroot=${TOOLCHAIN}/sysroot -I${TOOLCHAIN}/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi/armv7-a/ -I../../android/files/SDL/include -isystem=/usr/local/include/boost-1_45" CXX=${TOOLCHAIN}/bin/arm-linux-androideabi-g++ make pyrogenesis -j3 config=debug

Then attach a device, and in build/android/sdl-project/ run "make push-apk" and "make push-so". Run /sdcard/0ad.apk on the device to install. Then you need to build a public.zip containing all the data files, kind of like what source/tools/dist/build.sh does, and preferably unzip+zip it so that it's compressed properly (to save bandwidth and space), and push to /sdcard/0ad/data/mods/public/public.zip, then run the app.

(The .apk is basically just the standard SDL android-project, and it loads /data/local/libpyrogenesis_dbg.so which contains all the engine code. That means you can recompile and then upload the engine code (via "make push-so") on the host PC, and don't have to manually reinstall the app after each change.)

Link to comment
Share on other sites

Found a better camera (and fixed text rendering and landscape mode etc):

android2.jpg

(You can get to the match setup screen by touching buttons, but the GUI isn't designed for such a low screen resolution so you can't click the button to start the game, which wouldn't work anyway because it's missing shaders and doesn't have the Collada importer.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...