Author Topic: Yabause On Android OS?  (Read 86583 times)

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Yabause On Android OS?
« Reply #15 on: January 21, 2012, 11:13:29 PM »
You need to set cdcoretype too:

yinit.cdcoretype = CDCORE_ISO;

Just tried it, but it doesn't boot the game... can't debug it now, will take a look tomorrow...

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Yabause On Android OS?
« Reply #16 on: January 21, 2012, 11:38:05 PM »
ermhh... in fact, it does works after setting the correct cd core.
But on both the emulator and a real device, game freezes after the sega logo :/

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #17 on: January 21, 2012, 11:51:28 PM »
Thanks, I had actually tried yinit.cdcoretype = CDCORE_ISO; and got an error window pop-up with error messages:
Code: [Select]
Master SH2 invalid opcode
R0 = EFCAECAC  R12 = FFFFFFF8
R1 = 06033FF0  R13 = 00000000
R2 = 00000000  R14 = 0601C5EC
R3 = 25890008  R15 = 06001F74
R4 = 00000800  SR = 000000F0
R5 = 25FE00A0  GBR = 06003400
R6 = 06036000  VBR = 06000000
R7 = 25F00000  MACH = 00000000
R9 = FFFFFF00  PR = 06029D60
R10 = 25F80114  PC = EFCAECAC
R11 = FFFFFF01

So I thought that was the wrong setting to use (that's why I didn't mention it in my post, sorry about that).  Is "yinit.cdcoretype = CDCORE_ISO;" what you mean by setting the correct cd core (or is there another setting somewhere I'd need to change as well)?  Thanks for looking into it.

BTW, when you built it originally, did you test it with a game (if so, which format?), or was the proof of concept just to get it to boot up?  Either way, I'll continue adding in a basic GUI/ front-end in anticipation for when it is working.  I'll also redo the rendering stuff and add audio linkage (probably through SLES, but could potentially use OpenAL Soft or SDL or directly through Android API)

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Yabause On Android OS?
« Reply #18 on: January 22, 2012, 01:56:59 PM »
Yeah, by correct cd core, I mean the CDCORE_ISO. The CDCORE_DUMMY will always send you to the bios cd screen.

I guess there's some problem when loading the game to memory; that would explain both the problem you have (the invalid opcode) and those I have (freeze).

Trev186

  • Scoobies
  • Newbie
  • *****
  • Posts: 37
    • View Profile
Re: Yabause On Android OS?
« Reply #19 on: January 27, 2012, 01:03:08 AM »
Hey Paul,

I saw it was mentioned a couple posts back that some games are able to be booted but freeze at the Sega logo.

I don't know the state of the app's interface on a phone but I have a rather extensive collection of Sega Saturn games. I could take a stab at the games on my OCed S2 and see if I can't get them to boot any further. I will take Logcats I can supply you with. Perhaps that can help identify the problem?

I have done a decent amount of beta testing on Android for several types of emulators and have had success at booting into several games that were supposedly not playable at the time.

By opening trying to boot the game under a variety of settings I may get in.

I also use Yabause on my PC quite a bit so I am familiar with the settings.

All up to you but if you want someone who is willing to bang his head against the wall for hours just hoping for a miracle let me know:)

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #20 on: January 27, 2012, 02:26:39 AM »
It might be worthwhile to try a bunch of games to see if any of them at all will boot without freezing or crashing with invalid opcode messages (I'm not familiar enough with how the program works to know how likely it is that the problem is with game compatibility or something else).  It might also be worthwhile to try ripping as ISO instead of CUE/ BIN (assuming that's possible with CDs that have mixed data/ audio tracks).  I only own a couple Saturn games myself so not a lot to work with.  Let me put in a quick-and-ugly GUI interface for picking the bios and CD image, plus a couple settings.  I'll post a link to it for you tomorrow.

Trev186

  • Scoobies
  • Newbie
  • *****
  • Posts: 37
    • View Profile
Re: Yabause On Android OS?
« Reply #21 on: January 27, 2012, 09:31:18 PM »
It might be worthwhile to try a bunch of games to see if any of them at all will boot without freezing or crashing with invalid opcode messages (I'm not familiar enough with how the program works to know how likely it is that the problem is with game compatibility or something else).  It might also be worthwhile to try ripping as ISO instead of CUE/ BIN (assuming that's possible with CDs that have mixed data/ audio tracks).  I only own a couple Saturn games myself so not a lot to work with.  Let me put in a quick-and-ugly GUI interface for picking the bios and CD image, plus a couple settings.  I'll post a link to it for you tomorrow.

Looking forward. To it

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #22 on: January 27, 2012, 11:42:30 PM »
I probably won't have the test app ready until tomorrow (I got side-track debugging my other emulator project, haha)

Trev186

  • Scoobies
  • Newbie
  • *****
  • Posts: 37
    • View Profile
Re: Yabause On Android OS?
« Reply #23 on: January 28, 2012, 01:10:18 AM »
Curious is dynarec working in this emulator ? I'm sure that and open GL will be needed to get it to full speed

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #24 on: January 28, 2012, 02:46:57 AM »
Hmm.. it actually seems like the dynarec is not in use, based on the make output (I don't see any reference to linkage_arm.s in the files built into the libyabause.a static library):

Code: [Select]
paul@ASUS:~/workspace/yabause-android/build$ make
-- Could NOT find Doxygen  (missing:  DOXYGEN_EXECUTABLE)
-- Could NOT find Threads  (missing:  Threads_FOUND)
-- CMAKE_SYSTEM_NAME Linux
-- CMAKE_SYSTEM_PROCESSOR
-- AndroidManifest.xml
-- project.properties
-- jni/yui.c
-- src/org/yabause/android/Yabause.java
-- src/org/yabause/android/YabauseView.java
-- res/drawable/pad.png
-- res/drawable-hdpi/icon.png
-- res/drawable-ldpi/icon.png
-- res/drawable-mdpi/icon.png
-- res/layout/main.xml
-- res/menu/emulation.xml
-- res/values/strings.xml
-- Configuring done
-- Generating done
-- Build files have been written to: /home/paul/workspace/yabause-android/build
Scanning dependencies of target c68kinc
[  0%] Creating directories for 'c68kinc'
[  0%] No download step for 'c68kinc'
[  0%] No patch step for 'c68kinc'
[  0%] No update step for 'c68kinc'
[  0%] Performing configure step for 'c68kinc'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/paul/workspace/yabause-android/build/src/c68k
[  0%] Performing build step for 'c68kinc'
[ 75%] Built target gen68k
[100%] Built target c68kinc
[  0%] No install step for 'c68kinc'
[  0%] Completed 'c68kinc'
[ 12%] Built target c68kinc
Scanning dependencies of target yabause
[ 14%] Building C object src/CMakeFiles/yabause.dir/bios.c.o
[ 15%] Building C object src/CMakeFiles/yabause.dir/cdbase.c.o
[ 17%] Building C object src/CMakeFiles/yabause.dir/cheat.c.o
[ 18%] Building C object src/CMakeFiles/yabause.dir/coffelf.c.o
[ 20%] Building C object src/CMakeFiles/yabause.dir/cs0.c.o
[ 21%] Building C object src/CMakeFiles/yabause.dir/cs1.c.o
[ 23%] Building C object src/CMakeFiles/yabause.dir/cs2.c.o
[ 25%] Building C object src/CMakeFiles/yabause.dir/debug.c.o
[ 26%] Building C object src/CMakeFiles/yabause.dir/error.c.o
[ 28%] Building C object src/CMakeFiles/yabause.dir/m68kcore.c.o
[ 29%] Building C object src/CMakeFiles/yabause.dir/m68kd.c.o
[ 31%] Building C object src/CMakeFiles/yabause.dir/memory.c.o
[ 32%] Building C object src/CMakeFiles/yabause.dir/movie.c.o
[ 34%] Building C object src/CMakeFiles/yabause.dir/netlink.c.o
[ 35%] Building C object src/CMakeFiles/yabause.dir/peripheral.c.o
[ 37%] Building C object src/CMakeFiles/yabause.dir/profile.c.o
[ 39%] Building C object src/CMakeFiles/yabause.dir/scu.c.o
[ 40%] Building C object src/CMakeFiles/yabause.dir/sh2core.c.o
[ 42%] Building C object src/CMakeFiles/yabause.dir/sh2d.c.o
[ 43%] Building C object src/CMakeFiles/yabause.dir/sh2idle.c.o
[ 45%] Building C object src/CMakeFiles/yabause.dir/sh2int.c.o
/home/paul/workspace/yabause-android/yabause/src/sh2int.c:64: warning: initialization from incompatible pointer type
/home/paul/workspace/yabause-android/yabause/src/sh2int.c:100: warning: initialization from incompatible pointer type
[ 46%] Building C object src/CMakeFiles/yabause.dir/sh2trace.c.o
[ 48%] Building C object src/CMakeFiles/yabause.dir/smpc.c.o
[ 50%] Building C object src/CMakeFiles/yabause.dir/snddummy.c.o
[ 51%] Building C object src/CMakeFiles/yabause.dir/vdp1.c.o
[ 53%] Building C object src/CMakeFiles/yabause.dir/vdp2.c.o
[ 54%] Building C object src/CMakeFiles/yabause.dir/vdp2debug.c.o
[ 56%] Building C object src/CMakeFiles/yabause.dir/vidogl.c.o
[ 57%] Building C object src/CMakeFiles/yabause.dir/vidshared.c.o
[ 59%] Building C object src/CMakeFiles/yabause.dir/vidsoft.c.o
[ 60%] Building C object src/CMakeFiles/yabause.dir/yabause.c.o
[ 62%] Building C object src/CMakeFiles/yabause.dir/ygl.c.o
[ 64%] Building C object src/CMakeFiles/yabause.dir/yglshader.c.o
[ 65%] Building C object src/CMakeFiles/yabause.dir/scsp.c.o
[ 67%] Building C object src/CMakeFiles/yabause.dir/c68k/c68kexec.c.o
[ 68%] Building C object src/CMakeFiles/yabause.dir/c68k/c68k.c.o
[ 70%] Building C object src/CMakeFiles/yabause.dir/c68k/gen68k.c.o
[ 71%] Building C object src/CMakeFiles/yabause.dir/m68kc68k.c.o
[ 73%] Building C object src/CMakeFiles/yabause.dir/thr-linux.c.o
[ 75%] Building C object src/CMakeFiles/yabause.dir/cd-linux.c.o
Linking C static library libyabause.a
[ 75%] Built target yabause
...etc

Guillaume, how would I tell cmake to build Ari64's ARM dynarec?
« Last Edit: January 28, 2012, 03:27:41 AM by paulscode »

Trev186

  • Scoobies
  • Newbie
  • *****
  • Posts: 37
    • View Profile
Re: Yabause On Android OS?
« Reply #25 on: January 29, 2012, 02:51:13 AM »
So I found the beta you have hosted on your paulscode website but from the conversation here and there it seems like the hosted version can only boot to bios.

Once you have the time to post another update I will load up my 64 gb sd card with as many saturn games it can hold :)

Have. Good weekend

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #26 on: January 29, 2012, 12:48:47 PM »
Sorry for the delay, I'll try and get that built today.  I was hoping to figure out how to enable the dynarec first, but didn't have any luck (I'm still new to cmake, and I'm having a little trouble figuring out what setting to add to which file so it adds the extra source files under sh2_dynarec to the project be built).

Ari64

  • Administrator
  • Newbie
  • *****
  • Posts: 21
    • View Profile
Re: Yabause On Android OS?
« Reply #27 on: January 30, 2012, 04:30:59 PM »
Sorry for the delay, I'll try and get that built today.  I was hoping to figure out how to enable the dynarec first, but didn't have any luck (I'm still new to cmake, and I'm having a little trouble figuring out what setting to add to which file so it adds the extra source files under sh2_dynarec to the project be built).

Look in src/CMakelists.txt.  It adds sh2_dynarec/sh2_dynarec.c, sh2_dynarec/linkage_arm.s, and -DSH2_DYNAREC=1.  You'll also need -DANDROID=1 to work around the __clear_cache() problem.

The bin/cue support is a bit broken currently.  Try using iso files for games that don't have any audio tracks.

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #28 on: January 30, 2012, 04:41:19 PM »
Thanks, Ari64!  I'll give it a shot when I get home this evening.

paulscode

  • Scoobies
  • Newbie
  • *****
  • Posts: 34
    • View Profile
Re: Yabause On Android OS?
« Reply #29 on: January 30, 2012, 10:27:45 PM »
Ok, that almost worked.  I added the following to yabause/src/CMakeLists.txt (there's probably a better way to do this, but it seems to do the job for now):
Code: [Select]
# paulscode: Android (TODO: is there a better place for this?)
set(CMAKE_SYSTEM_PROCESSOR "armv7l")
add_definitions(-DANDROID=1)
# end Android

# SH2 dynamic recompiler
...etc

However, it seems to get snagged at the end of the build process after it finishes building the static library libyabause.a and gets to Android.mk (which simply builds yui.c into a shared library and includes the prebuilt static library).  Here is the last bit of output from the build:

Code: [Select]
Linking C static library libyabause.a
[ 75%] Built target yabause
Scanning dependencies of target yabause-android
[ 75%] Generating res/values/strings.xml
[ 75%] Generating jni/yui.c
[ 75%] Generating AndroidManifest.xml
[ 75%] Generating project.properties
[ 75%] Generating local.properties
Updated local.properties
No project name specified, using Activity name 'Yabause'.
If you wish to change it, edit the first line of build.xml.
Added file /home/paul/workspace/yabause-android/build/src/android/build.xml
Added file /home/paul/workspace/yabause-android/build/src/android/proguard.cfg
[ 75%] Generating jni/libyabause.a
[ 75%] Generating libs/armeabi/libyabause.so
Compile thumb  : yabause <= yui.c
Prebuilt       : libyabause.a <= jni/
SharedLibrary  : libyabause.so
/home/paul/bin/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libyabause.a(linkage_arm.s.o): relocation R_ARM_MOVW_ABS_NC against `decilinestop_p' can not be used when making a shared object; recompile with -fPIC
./obj/local/armeabi/libyabause.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[3]: *** [obj/local/armeabi/libyabause.so] Error 1
make[2]: *** [src/android/libs/armeabi/libyabause.so] Error 2
make[1]: *** [src/android/CMakeFiles/yabause-android.dir/all] Error 2
make: *** [all] Error 2

I take this to mean linkage_arm.s is not designed to be used by a shared object?  I see where decilinestop_p is at in the code:
Code: [Select]
newline:
movw r0, #:lower16:decilinestop_p
movt r0, #:upper16:decilinestop_p
movw r1, #:lower16:yabsys_timing_bits
movt r1, #:upper16:yabsys_timing_bits
movw r2, #:lower16:SH2CycleFrac_p
ldr r0, [r0] /* pointer to decilinestop */
...etc

I tried adding -fPIC into yabause/src/CMakeLists.txt (no effect):
Code: [Select]
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
set(CMAKE_C_FLAGS "-O3 -mcpu=cortex-a8 -mfpu=vfp -mfloat-abi=softfp -fPIC")
endif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")

I'm not sure what the next course of action should be, or if there is a way around the problem.  Any ideas?
« Last Edit: January 30, 2012, 11:08:55 PM by paulscode »