<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Android progress, some problems remain</title>
		<link>http://www.allegro.cc/forums/view/616904</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 25 May 2017 14:45:00 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>First the good news, <a href="https://www.allegro.cc/forums/thread/616889">with elias&#39; help</a> I got one of my games running on the android emulator. Yay!</p><p><span class="remote-thumbnail"><span class="json">{"name":"610903","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/9\/6961d9a901e4bb9f0a81936bf50bee57.png","w":1053,"h":731,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/9\/6961d9a901e4bb9f0a81936bf50bee57"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/6/9/6961d9a901e4bb9f0a81936bf50bee57-240.jpg" alt="610903" width="240" height="166" /></span></p><p>The bad news is that I had to disable some functionality to get it going. Here is what I discovered:</p><ul><li><p>al_open_directory() fails reading the APK file system. I can&#39;t load all files from the assets directory like I usually do, I had to manually list each file in the code.
</p></li><li><p>al_load_font() fails to load a ttf font that&#39;s in my APK.
</p></li><li><p>al_load_audio_stream() fails to load a .xm file that&#39;s in my APK.</p></li></ul><p>The latter two make me think perhaps FreeType and Dumb were not included in the build. But then again, it could be a problem with the APK file system.</p><p>Trying to debug these issues, I discovered that I can step through my C++ code using the androidStudio debugger, but I can&#39;t step into allegro functions. I discovered that the allegro debug libraries don&#39;t contain source listings, as in:</p><div class="source-code snippet"><div class="inner"><pre>allegro5-debug-5.2.3.0.aar<span class="k3">/</span>jni<span class="k3">/</span>x86$ gdb liballegro_ttf-debug.so
<span class="k2">(</span>gdb<span class="k2">)</span> l <a href="http://www.allegro.cc/manual/al_load_ttf_font_f"><span class="a">al_load_ttf_font_f</span></a>
<span class="n">820</span>  in <span class="k3">/</span>home<span class="k3">/</span>allefant<span class="k3">/</span>allegro<span class="k3">/</span>git<span class="k3">/</span>addons<span class="k3">/</span>ttf<span class="k3">/</span>ttf.c
</pre></div></div><p>
So the debug library just refers to files on elias&#39; harddrive. Is that how it&#39;s supposed to be?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Wed, 24 May 2017 15:48:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>al_open_directory is broken for me as well. But so easy to work around I never bothered to try and fix it.</p><p>al_load_font works for me, loading a .ttf from the .apk. So yes, will be good to debug that.</p><p>I never used dumb (and my Android builds do not include dumb), but al_load_audio_stream with an .ogg file does work for me, loading from the .apk. I can rather easily add dumb to my script creating the .aar file <span class="ref"><sup>[<a href="#">1</a>]</sup></span>, all I need is a link to the source code of dumb, and instructions how to compile it for Android, and I&#39;d make the script download and compile it.</p><p>I have no idea about the debug settings of those .so files, they are created by Allegro&#39;s CMakeLists.txt <span class="ref"><sup>[<a href="#">2</a>]</sup></span></p><p>This is the complete commands I used to create the debug libraries:</p><p>cmake /home/allefant/allegro/git -DCMAKE_TOOLCHAIN_FILE=/home/allefant/allegro/git/cmake/Toolchain-android.cmake -DARM_TARGETS=armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_TARGET=android-24 -DWANT_DEMO=off -DWANT_EXAMPLES=off -DWANT_TESTS=off -DWANT_DOCS=off -DPKG_CONFIG_EXECUTABLE=/usr/bin/pkg-config -DOGG_LIBRARY=/home/allefant/android/toolchain-armeabi-v7a/lib/libogg.a -DOGG_INCLUDE_DIR=/home/allefant/android/toolchain-armeabi-v7a/include -DVORBIS_LIBRARY=/home/allefant/android/toolchain-armeabi-v7a/lib/libvorbis.a -DVORBISFILE_LIBRARY=/home/allefant/android/toolchain-armeabi-v7a/lib/libvorbisfile.a -DVORBIS_INCLUDE_DIR=/home/allefant/android/toolchain-armeabi-v7a/include -DSUPPORT_VORBIS=true -DFREETYPE_LIBRARY=/home/allefant/android/toolchain-armeabi-v7a/lib/libfreetype.a -DFREETYPE_INCLUDE_DIRS=/home/allefant/android/toolchain-armeabi-v7a/include;/home/allefant/android/toolchain-armeabi-v7a/include/freetype2<br />make -j4<br />make install</p><p>Reading though that CMakeLists.txt there is no Android specific settings. But it might be cmake messing things up once again, adding special flags when it detects Android. Alternatively, maybe that&#39;s how a debugger works on all platforms? I don&#39;t think I ever used the debug library of something I did not compile myself (and therefore had the path to the sources). Can you see if you maybe can tell your debugger the location of the source code?</p><p>Otherwise another option is to compile Allegro yourself (using the above commands), then it should hardcode the correct paths to your local sources.</p><p>[Edit:] This <span class="ref"><sup>[<a href="#">3</a>]</sup></span> has a section called &quot;Symbol Directories&quot;, maybe you can try that?
</p><div class="ref-block"><h2>References</h2><ol><li><a href="https://github.com/liballeg/android/blob/master/install_android.py">https://github.com/liballeg/android/blob/master/install_android.py</a></li><li><a href="https://github.com/liballeg/allegro5/blob/master/CMakeLists.txt">https://github.com/liballeg/allegro5/blob/master/CMakeLists.txt</a></li><li><a href="https://developer.android.com/studio/run/rundebugconfig.html#android-application">https://developer.android.com/studio/run/rundebugconfig.html#android-application</a></li></ol></div></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 24 May 2017 19:17:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616904/1030550#target">amarillion</a> said:</div><div class="quote"><p>al_load_font() fails to load a ttf font that&#39;s in my APK. </p></div></div><p>

This sounds familiar.  I had a similar problem with my game on the PC, loading a TTF with Physfs from a ZIP.  I don&#39;t know if that&#39;s similar on the Android.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Thu, 25 May 2017 07:26:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I got a little bit further. I discovered that in android studio, in the Debug panel there is an LLDB tab where you can send commands to LLDB. </p><p>For example, this will make it possible to step into libraries even if there are no debug symbols:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k2">(</span>lldb<span class="k2">)</span> settings show target.process.thread.step-in-avoid-nodebug
target.process.thread.step-in-avoid-nodebug <span class="k2">(</span>boolean<span class="k2">)</span> <span class="k3">=</span> <span class="k1">true</span>
<span class="k2">(</span>lldb<span class="k2">)</span> settings set target.process.thread.step-in-avoid-nodebug <span class="k1">false</span>
</pre></div></div><p>

With that I can actually step into al_load_font, even though it doesn&#39;t show source code. Using the &#39;dis&#39; command in LLDB I can see the disassembly. That&#39;s not much, but it&#39;s something.</p><p>I tried this to make it find source code:</p><div class="source-code snippet"><div class="inner"><pre><span class="k2">(</span>lldb<span class="k2">)</span> settings show target.source-map
target.source-map <span class="k2">(</span>path-map<span class="k2">)</span> <span class="k3">=</span>
<span class="k2">(</span>lldb<span class="k2">)</span> settings set target.source-map <span class="k3">/</span>home<span class="k3">/</span>allefant<span class="k3">/</span>allegro<span class="k3">/</span>git<span class="k3">/</span> <span class="k3">/</span>home<span class="k3">/</span>martijn<span class="k3">/</span>prg<span class="k3">/</span>alleg<span class="k3">/</span>allegro5-git<span class="k3">/</span>
</pre></div></div><p>

But that doesn&#39;t work as of yet. LLDB doesn&#39;t give me any indication of even trying to open the allegro sources.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Thu, 25 May 2017 14:45:00 +0000</pubDate>
	</item>
</rss>
