joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.53k stars 369 forks source link

Android (APK) build target #959

Open joncampbell123 opened 5 years ago

joncampbell123 commented 5 years ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Steps listed to setup, compile, and generate an APK for DOSBox-X for Android OS. Help is wanted for this. ARM support for dynrec would be useful on Android since most are ARM based.

Additional context My Android devices (cell phone and tablet) are Android 4.x (maybe 5.x) as a baseline. I expect the port to use SDL2 because SDL2 provides touchscreen input where SDL1 does not.

joncampbell123 commented 5 years ago

If possible the Android UI portion should run in a separate thread so that DOSBox-X hanging does not prevent the UI from responding.

joncampbell123 commented 5 years ago

Another reminder: Android applications can take input from a keyboard. Not just the onscreen keyboard, but also from a bluetooth keyboard paired with the Android device.

sikthehedgehog commented 5 years ago

Keyboard can come from USB too I believe (no idea if it's a separate API or not, just making sure to get bases covered). Not every phone will recognize a keyboard over USB (or some other devices), however.

joncampbell123 commented 5 years ago

@sikthehedgehog I'm sure if it comes in through USB that it probably comes in through the same API as well. Otherwise you wouldn't be able to use a USB keyboard with most of your favorite Android apps.

cnnn commented 5 years ago

I have a port to iOS with the 0.82.12 build, using https://github.com/litchie/dospad as a base project. If there’s an interest I can submit a PR. For Android I came across this repo that could be helpful https://github.com/meesokim/dosbox.

joncampbell123 commented 5 years ago

Pull requests for iOS support are welcome, as long as they are in small incremental segments that aren't disruptive to this main project.

I'll look at the Android port.

strikersix23 commented 5 years ago

Any updates on this?

joncampbell123 commented 5 years ago

Any takers on this? I lack the experience required to compile DOSBox-X for Android.

strikersix23 commented 5 years ago

i know terminal emulation with termux is possible with that but other than that i dont know

strikersix23 commented 5 years ago

I created crude source code but I cant work on it any further without gradle

strikersix23 commented 5 years ago

Repo https://github.com/strikersix23/dosbox-x-ae.git

strikersix23 commented 5 years ago

Its in a zip no garrentees it will work it uses vary old wrapper

joncampbell123 commented 5 years ago

How do you build it?

Merging changes is easier if the source code is in the repository, not in a zip file in a repository.

git can't diff the contents of ZIP files.

strikersix23 commented 5 years ago

Its based off dosbox turbo source with updated sdl I dobt have enough experience to convert it to gradle

12101111 commented 4 years ago

I can run dosbox-x in Termux 图片

strikersix23 commented 4 years ago

How did you compile it on termux

xTMODx commented 3 years ago

Phones nowadays are really powerfull, I hope this will get a port to android.

ElTentakel commented 2 years ago

How did you compile it on termux

I'm not as far, but here is my first try:

apt install git build-essential
git clone https://github.com/joncampbell123/dosbox-x.git 
cd dosbox-x
find . -name 'config.sub' -exec chmod u+w '{}' \; -exec cp -f "${PREFIX}/share/libtool/build-aux/config.sub" '{}' \;
find . -name 'config.guess' -exec chmod u+w '{}' \; -exec cp -f "${PREFIX}/share/libtool/build-aux/config.guess" '{}' \;
./build

The issue I encountered was:

./core_dynrec/../../fpu/fpu_instructions_longdouble.h:29:12: fatal error: 'fpu_control.h' file not found

So I assume the glib headers are missing:

https://www.gnu.org/software/gnulib/manual/html_node/fpu_005fcontrol_002eh.html

I have no time now to look up a solution, but maybe it helps someone

strikersix23 commented 2 years ago

Im running into this non-stop i disabled fpu but this happens

- Screenshot_20210708-140358_Termux

strikersix23 commented 2 years ago

More info Screenshot_20210708-140619_Termux Env flags LDFLAGS= -landroid-shmem -llog -lm CC=clang CXX=clang++ configure flags

./configure --disable-fpu --disable-fpu-x86 --disable-fpu-x64 --disable-dynamic-core --disable-dynamic-x86

strikersix23 commented 2 years ago

@ElTentakel Android 9+ doesnt support fpu do to incompatable with boinic, @joncampbell123 how do i compile to arm instead of x86 instructions, Disable x86-64,x86 cores exclusive

strikersix23 commented 2 years ago

There is a possiblity to build target inside of termux using buildapk or take example from https://github.com/VDavid003/sm64-port-android/blob/master/Makefile this makefile produces sdl2 build using termuxs native tools compiles it then inputs it into a package signs it, then its ready to use You would probally need to create an in app file picker or a custom lib to read/write internal storage libslirp would be highly ideal but it would need defaults as android is pretty picky, for ui i would recommend something like magicdosbox's or idosboxs, Idosboxes is in dosbox-staging repo in a branch, libpcap would need to be disabled fluidsynth lite is recomended as its striped down and used in deltatouch for quick processing

joncampbell123 commented 2 years ago

@strikersix23 I've never cross-compiled DOSBox-X before, it's based on your host at this time as well as #defines provided by your compiler. So you would need to compile for Android from an ARM device (like the Raspberry Pi) to target ARM. A good start is to try compiling with dynamic core disabled at ./configure time.

strikersix23 commented 2 years ago

I am compiling native termux uses clang from the ndk if you want to know more here https://github.com/termux/termux-app https://termux.com/

strikersix23 commented 2 years ago

They also have a builder docker image and cross-toolchain setup for ubuntu

strikersix23 commented 2 years ago

So the error is fpu.h i disabled all cores include dynamic and enabled them one at a time every time its fpu.h with an 'MMX_reg' In core_normal_8086.cpp core_normal_286.cpp core_normal.cpp Do i comment that or how do disable it

joncampbell123 commented 2 years ago

Try adding an #include "mmx.h"

MMX_reg is defined in include/mmx.h

strikersix23 commented 2 years ago

AArch32, AArch64 does not have mmx instructions So they doe not have mmx however im going to apply sse2neon and see what happens

joncampbell123 commented 2 years ago

include/mmx.h is for MMX emulation for the guest, not host MMX instruction support.

strikersix23 commented 2 years ago

Ok then ill add it In fpu.h it references mmx right. What is where you call the host simd sse2neon can convert mmx up to sse4.1 it would seem it doesnt understand it reads it but doesnt understand it im going to more i need to what exact includes its calling

strikersix23 commented 2 years ago

Okay i got past the fpu.h error i added sse2neon.h then called ./configure --disable-dynamic-x86 --disable-fpu-x86 --disable-opengl --disable-dynrec

But i run into the issue ive had for over a month

) dos_programs.cpp:6452:7: error: no member named 'isfinite' in namespace 'std'; did you mean 'finite'? if (std::isfinite(user_value))

strikersix23 commented 2 years ago

fixed it turnes out it was clang, @joncampbell123 If i can get this to compile can i create a patch and send it to you. I cant do a wrapper but this may help start it

strikersix23 commented 2 years ago

Requirements would be the user would have to compile it on device until a buildbot could be setup and it could be tested

strikersix23 commented 2 years ago

I cant get past fpu.h

strikersix23 commented 2 years ago

@Wengier do you know how from which files to comment mmx_reg from fpu.h

strikersix23 commented 2 years ago

Im going to create a new issue as this feels semi off topic if that is ok

strikersix23 commented 2 years ago

@ElTentakel do you remember the version or commit

ElTentakel commented 2 years ago

I checked out the Tag |dosbox-x-v0.83.9"

Suppachok2527 commented 1 year ago

Hopefully the virtual keyboard will be able to type in languages ​​other than English, especially Thai.

I can't install windows 1.01 😭

turboboy215 commented 1 year ago

Will there be any progress on this?

rderooy commented 1 year ago

As mentioned elsewhere. Depends on developer interest.

strikersix23 commented 1 year ago

Dosbox-x is already in turmux that's the closest you can get for now

Yogi-baer commented 5 months ago

I know that my comment is slightly delayed ... https://github.com/joncampbell123/dosbox-x/issues/959#issuecomment-877329631 ... but I built the current Main successfully on Debian GNU/Linux 12 (bookworm) Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 Linux 6.1.0-rpi7-rpi-v8 Does this help in some way?

Yogi-baer commented 5 months ago

termux: pkg install x11-repo (successfull) pkg install dosbox-x (successfull) But where is the DOSBox-X window? LOG: Early LOG Init complete LOG: DOSBox-X's working directory: /data/data/com.termux/files/home LOG: Logging init: beginning logging proper. This is the end of the early init logging LOG: Logging: No logfile was given. All further logging will be discarded. LOG: DOSBox-X version 2022.09.0 (Linux SDL2) LOG: Host keyboard layout is now us (US English) LOG: Mapper keyboard layout is now us (US English) LOG: SDL2 reports desktop display mode 1024 x 768 LOG: The default output for the video system: opengl LOG: Configured windowposition: - LOG: SDL: Current window pixel format: SDL_PIXELFORMAT_RGB888 LOG: SDL: You are running in 24 bpp mode, this will slow down things! LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI) LOG: ISA BCLK: 8333333.333Hz (25000000/3) LOG: monopal: green, LOG: Active save slot: 1 [Empty] LOG: USING AVI+ZMBV LOG: Max 3670016 sz 16384 LOG: Final 16384 LOG: SDLNet_TCP_Open: Couldn't connect to remote host LOG: TiMidity: can't open control connection (host=127.0.0.1, port=7777) LOG: MIDI:fluidsynth: SoundFont not specified, and no system SoundFont found LOG: MIDI:synth: Specify .SF2 sound font file with midiconfig= LOG: MIDI:Opened device:none LOG: Pentium CMPXCHG8B emulation is enabled LOG: VOODOO LFB now at d0000000 LOG: Serial1: BASE 3f8h LOG: Serial2: BASE 2f8h LOG: Parallel1: BASE 378h LOG: MPU-401 Registering I/O ports as if IBM PC MPU-401 at base 330h LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI) LOG: Allocated APM BIOS pm entry point at f000:ce20 LOG: Writing code to fce20 LOG: Writing code to fce40 LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI) LOG: ISA Plug & Play BIOS enabled LOG: VGA ROM BIOS init callback LOG: pixratio 1.000, dw false, dh false LOG: Aspect ratio: 640 x 480 xToY=1.333 yToX=0.750 LOG: menuScale=1 LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI) LOG: font texture id=2 will make 128 x 256 LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI) LOG: WARNING: No translation support (to host) for code page 0 LOG: 2144710 ERROR BIOS:Keyboard layout file auto not found LOG: 2144710 ERROR BIOS:Keyboard layout file auto not found LOG: XMS: 50 handles allocated for use by the DOS environment LOG: EMS page frame at 0xe000-0xefff LOG: COMMAND.COM env size: 720 bytes LOG: COMMAND.COM environment block: 0x0701 sz=0x002d LOG: COMMAND.COM main body (PSP): 0x072f sz=0x009a LOG: COMMAND.COM stack: 0x0749 LOG: pixratio 1.350, dw false, dh false LOG: Aspect ratio: 720 x 540 xToY=1.333 yToX=0.750 LOG: menuScale=1 LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI) LOG: font texture id=2 will make 128 x 256 LOG: Screen report: Method 'None' (-1.000 x -1.000 pixels) at (0.000 x 0.000) (-1.000 x -1.000 mm) (-0.039 x -0.039 in) (-1.000 x -1.000 DPI)

strikersix23 commented 5 months ago

You need to install termux-x11 app From here https://github.com/termux/termux-x11

Yogi-baer commented 5 months ago

@strikersix23 Thx for your hint. For today it is too late for me to understand that. I come back when I was able to try that out.

Yogi-baer commented 5 months ago

@strikersix23 Today I managed to test it. I walked this line:

Bump com.android.tools.build:gradle from 8.2.0 to 8.2.1 #534 https://github.com/termux/termux-x11/actions/runs/7404127299

termux-companion packages https://github.com/termux/termux-x11/actions/runs/7404127299/artifacts/1146569209 termux-companion packages.zip

Path = .../Downloads/termux-companion packages.zip Type = zip Physical Size = 13861

Everything is Ok

shell-loader-nightly.apk 4.057 Bytes Do 04 Jan 2024 00∶55∶16 CET

Screenshot_20240107_015843_Package installer Translation: The App was not installed because the package is invalid

Android 14 One UI-Version 6.0 Kernel-Version 5.15.94-android13-8... #1 Wed Nov 29 23:12:53 UTC 2023 [Samsung Galaxy S23]

Well, what went wrong?

strikersix23 commented 5 months ago

type this

termux-info

And post the output

strikersix23 commented 5 months ago

You need the debug build from github as well

Yogi-baer commented 5 months ago

~ $ termux-info Termux Variables: TERMUX_API_VERSION=0.50.1 TERMUX_APK_RELEASE=F_DROID TERMUX_APP_PACKAGE_MANAGER=apt TERMUX_APP_PID=31732 TERMUX_IS_DEBUGGABLE_BUILD=0 TERMUX_MAIN_PACKAGE_FORMAT=debian TERMUX_VERSION=0.118.0 TERMUX__USER_ID=0 Packages CPU architecture: aarch64 Subscribed repositories:

sources.list

deb https://termux.cdn.lumito.net/termux-main stable main

x11-repo (sources.list.d/x11.list)

deb https://packages-cf.termux.dev/apt/termux-x11/ x11 main Updatable packages: command-not-found/stable 2.4.0-6 aarch64 [upgradable from: 2.4.0-5] termux-tools/stable 1.40.5 all [upgradable from: 1.40.4] termux-tools version: 1.40.4 Android version: 14 Kernel build information: Linux localhost 5.15.94-android13-8-27763874-abS911BXXS3BWKC #1 SMP PREEMPT Wed Nov 29 23:12:53 UTC 2023 aarch64 Android Device manufacturer: samsung Device model: SM-S911B LD Variables: LD_LIBRARY_PATH= LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so Installed termux plugins: com.termux.api versionCode:51