Author Topic: NXEngine AE  (Read 47803 times)

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
NXEngine AE
« on: April 29, 2012, 02:13:44 PM »
I am working on porting NXEngine to android (aka Cave Story)
It is unplayable yet as it doesn't want to recognize the data files or even start in landscape mode.
So far, I have gotten this:
http://www.paulscode.com/forum/index.php?action=dlattach;topic=443.0;attach=474;image



Current download links:
App:
http://db.tt/KYl38Rs5
Data:
http://db.tt/6nKdu9Za
extract nxengine folder to /sdcard/data so you have /sdcard/data/nxengine/<a lot of data files>
not /sdcard/data/nxengine/nxengine

If you want to make a video, please upload it to youtube as a video response to http://youtu.be/NwMQKcV1wgc

Todo:
Fix the mess that is the input system. if(key>1073​741824) { key = key - 1073741824; }
Add gamepad
Find out what is causing the lag

Videos (may be outdated):

Device Compatibility/Speed (newest version):
Spoiler: show

Samsung Galaxy Tab 10.1: 50FPS full speed
xperia play: 30-50FPS occasional lag spikes
Motorola Droid: 10FPS very slow, even without sound

« Last Edit: December 29, 2012, 09:33:03 PM by xperia64 »

Offline Vincentmrl

  • Cyan Team
  • long
  • *
  • Posts: 121
    • View Profile
Re: NXEngine AE
« Reply #1 on: May 02, 2012, 12:13:44 AM »
Awesome, hope you get a way to make android recognize the files!
Device: Lg Optimus One
CPU: 600 Mhz ARMv6 (Overclocked to 748Mhz ondemand governor)
GPU: Qualcomm Adreno 200
RAM: 512 MB
Resolution: 320 x 480
Rom: Unofficial Cyanogenmod 9

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: NXEngine AE
« Reply #2 on: May 09, 2012, 05:56:24 PM »
Ok i got android to find the files, now i just need to fix the hanging black screen i am getting. Surprisingly, it extracts all of the files properly  :o. Latest apk here http://db.tt/KYl38Rs5
and put the files in this zip file into /sdcard/data/nxengine/ http://db.tt/auEYvyMN

Online Paul

  • Administrator
  • double
  • *****
  • Posts: 3491
  • Developer
    • View Profile
    • PaulsCode.Com
Re: NXEngine AE
« Reply #3 on: May 09, 2012, 06:08:12 PM »
Code: [Select]
05-09 19:05:44.806: I/SDL(19186): [STUB] GL_UnloadLibrary
05-09 19:05:44.837: W/InputDispatcher(182): channel '41cd8c98 com.xperia64.nxengineae/com.xperia64.nxengineae.SDLActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
05-09 19:05:44.837: E/InputDispatcher(182): channel '41cd8c98 com.xperia64.nxengineae/com.xperia64.nxengineae.SDLActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-09 19:05:44.837: W/InputDispatcher(182): Attempted to unregister already unregistered input channel '41cd8c98 com.xperia64.nxengineae/com.xperia64.nxengineae.SDLActivity (server)'
05-09 19:05:44.837: I/WindowManager(182): WINDOW DIED Window{41cd8c98 com.xperia64.nxengineae/com.xperia64.nxengineae.SDLActivity paused=false}
05-09 19:05:44.837: W/WindowManager(182): Force-removing child win Window{41df75c8 SurfaceView paused=false} from container Window{41cd8c98 com.xperia64.nxengineae/com.xperia64.nxengineae.SDLActivity paused=false}
05-09 19:05:44.837: I/ActivityManager(182): Process com.xperia64.nxengineae (pid 19186) has died.
05-09 19:05:44.837: W/ActivityManager(182): Force removing ActivityRecord{41b760d0 com.xperia64.nxengineae/.SDLActivity}: app died, no saved state
05-09 19:05:45.025: I/InputReader(182): Reconfiguring input devices.  changes=0x00000004
05-09 19:05:45.025: I/InputReader(182): Device reconfigured: id=6, name='Melfas MMSxxx Touchscreen', surface size is now 720x1280, mode is 1
05-09 19:05:45.025: W/WindowManager(182): Failed looking up window
05-09 19:05:45.025: W/WindowManager(182): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@41cff8b8 does not exist
05-09 19:05:45.025: W/WindowManager(182): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7029)
05-09 19:05:45.025: W/WindowManager(182): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7020)
05-09 19:05:45.025: W/WindowManager(182): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1439)
05-09 19:05:45.025: W/WindowManager(182): at android.os.BinderProxy.sendDeathNotice(Binder.java:417)
05-09 19:05:45.025: W/WindowManager(182): at dalvik.system.NativeStart.run(Native Method)
05-09 19:05:45.025: I/WindowManager(182): WIN DEATH: null
05-09 19:05:45.025: W/WindowManager(182): Failed looking up window
05-09 19:05:45.025: W/WindowManager(182): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@41dd0e28 does not exist
05-09 19:05:45.025: W/WindowManager(182): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7029)
05-09 19:05:45.025: W/WindowManager(182): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7020)
05-09 19:05:45.025: W/WindowManager(182): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1439)
05-09 19:05:45.025: W/WindowManager(182): at android.os.BinderProxy.sendDeathNotice(Binder.java:417)
05-09 19:05:45.025: W/WindowManager(182): at dalvik.system.NativeStart.run(Native Method)
05-09 19:05:45.025: I/WindowManager(182): WIN DEATH: null
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: NXEngine AE
« Reply #4 on: June 02, 2012, 03:13:46 PM »
Ok made some more progress and found where it is freezing. It appears to be repeatedly loading the drumtable which is apparently what its supposed to do? I sent sebt3 on the open pandora boards another message.

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: NXEngine AE
« Reply #5 on: June 02, 2012, 08:32:37 PM »
Version 1.0 alpha:
APK: http://db.tt/KYl38Rs5
Data files: http://db.tt/6nKdu9Za
Extract the folder 'nxengine' FROM the zip file to /sdcard/data/
Requires an xperia play OR GameKeyboard from the play store configured to emulate the xperia play keys.
Edit: keys can be mapped by pressing the back key, selecting controls, pressing enter and then mapping the keys how you want
« Last Edit: June 02, 2012, 09:26:49 PM by xperia64 »

Offline Vincentmrl

  • Cyan Team
  • long
  • *
  • Posts: 121
    • View Profile
Re: NXEngine AE
« Reply #6 on: June 03, 2012, 02:56:50 AM »
Version 1.0 alpha:
APK: http://db.tt/KYl38Rs5
Data files: http://db.tt/6nKdu9Za
Extract the folder 'nxengine' FROM the zip file to /sdcard/data/
Requires an xperia play OR GameKeyboard from the play store configured to emulate the xperia play keys.
Edit: keys can be mapped by pressing the back key, selecting controls, pressing enter and then mapping the keys how you want
Nice progress! I have a problem tho, I have no clue about setting the gamepad to emulate xperia play's keys, I can't use the.back button to map because it hides gamepad and when I press any button on the gamepad it freezes.
Edit: Freezes after I press any hardware button binded to anything, but menu button works fine when it says press any key
Edit2: I have an idea to use settings without closing gamekeyboard: Make some interface opening before the game, interface having play and settings button, the settings interface would just edit the game's config file and we could play correctly this way
« Last Edit: June 03, 2012, 03:18:27 AM by Vincentmrl »
Device: Lg Optimus One
CPU: 600 Mhz ARMv6 (Overclocked to 748Mhz ondemand governor)
GPU: Qualcomm Adreno 200
RAM: 512 MB
Resolution: 320 x 480
Rom: Unofficial Cyanogenmod 9

Online Paul

  • Administrator
  • double
  • *****
  • Posts: 3491
  • Developer
    • View Profile
    • PaulsCode.Com
Re: NXEngine AE
« Reply #7 on: June 03, 2012, 04:21:20 PM »
So that stack corruption detection code, without the macros:

This would go at the top of a local method:

Code: [Select]
unsigned int u_STACK_CHECK_EBP_VALUE_ENTER = 0;
asm( "str fp, %0 \n" : "=m" (u_STACK_CHECK_EBP_VALUE_ENTER) );
u_STACK_CHECK_EBP_VALUE_ENTER = (u_STACK_CHECK_EBP_VALUE_ENTER & 0x00FFFFFF) | 0xCD000000;

And this would go at the bottom:

Code: [Select]
do
{
    unsigned int u_STACK_CHECK_EBP_VALUE_RETURN = 0;
    asm( "str fp, %0 \n" : "=m" (u_STACK_CHECK_EBP_VALUE_RETURN) );

    u_STACK_CHECK_EBP_VALUE_RETURN = ( (u_STACK_CHECK_EBP_VALUE_RETURN & 0x00FFFFFF) | 0xCD000000);
    if( (u_STACK_CHECK_EBP_VALUE_ENTER & ~0x00FFFFFF) != 0xCD000000 )
    {
        printf( "Corrupted u_STACK_CHECK_EBP_VALUE_ENTER!! It's %x\n", u_STACK_CHECK_EBP_VALUE_ENTER );
        assert( (u_STACK_CHECK_EBP_VALUE_ENTER & ~0x00FFFFFF) == 0xCD000000 );
    }
    if( (u_STACK_CHECK_EBP_VALUE_RETURN & ~0x00FFFFFF) != 0xCD000000 )
    {
        printf( "Corrupted u_STACK_CHECK_EBP_VALUE_RETURN!! It's %x\n", u_STACK_CHECK_EBP_VALUE_RETURN );
        assert( (u_STACK_CHECK_EBP_VALUE_RETURN & ~0x00FFFFFF) == 0xCD000000 );
    }
    if( u_STACK_CHECK_EBP_VALUE_ENTER != u_STACK_CHECK_EBP_VALUE_RETURN )
    {
        printf( "Stack overflow!!!\nThe EBP should be %x, but it's %x( %s )\n\n", u_STACK_CHECK_EBP_VALUE_ENTER, u_STACK_CHECK_EBP_VALUE_RETURN, (char*)&u_STACK_CHECK_EBP_VALUE_RETURN );
        assert( u_STACK_CHECK_EBP_VALUE_RETURN == u_STACK_CHECK_EBP_VALUE_ENTER );
    }
} while( 0 );

Note that I changed the fprintf to stderr into printf (which I am assuming you have defined as __android_log_print at the top of your code.. if not, use that instead).

This will help you figure out what the compiler is having problems with.
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Online Paul

  • Administrator
  • double
  • *****
  • Posts: 3491
  • Developer
    • View Profile
    • PaulsCode.Com
Re: NXEngine AE
« Reply #8 on: June 03, 2012, 04:48:02 PM »
Got it back into a macro.  Here is the test file that I compiled, for copy/pasting:

Code: [Select]
#include <jni.h>
#include <android/log.h>
#define printf(...) __android_log_print(ANDROID_LOG_VERBOSE, "arm-checker", __VA_ARGS__)

#define STACKCHECK

#ifdef STACKCHECK
#define STACK_CHECK_RAND 0xCD000000
#define STACK_CHECK_MASK 0x00FFFFFF

#define STACK_CHECK_END_INTERNAL() u_STACK_CHECK_EBP_VALUE_RETURN = ((u_STACK_CHECK_EBP_VALUE_RETURN & STACK_CHECK_MASK) | STACK_CHECK_RAND);\
if( (u_STACK_CHECK_EBP_VALUE_ENTER & ~STACK_CHECK_MASK) != STACK_CHECK_RAND )\
{\
    printf( "Corrupted u_STACK_CHECK_EBP_VALUE_ENTER!! It's %x\n", u_STACK_CHECK_EBP_VALUE_ENTER );\
    assert( (u_STACK_CHECK_EBP_VALUE_ENTER & ~STACK_CHECK_MASK) == STACK_CHECK_RAND );\
}\
if( (u_STACK_CHECK_EBP_VALUE_RETURN & ~STACK_CHECK_MASK) != STACK_CHECK_RAND )\
{\
    printf( "Corrupted u_STACK_CHECK_EBP_VALUE_RETURN!! It's %x\n", u_STACK_CHECK_EBP_VALUE_RETURN );\
    assert( (u_STACK_CHECK_EBP_VALUE_RETURN & ~STACK_CHECK_MASK) == STACK_CHECK_RAND );\
}\
if( u_STACK_CHECK_EBP_VALUE_ENTER != u_STACK_CHECK_EBP_VALUE_RETURN )\
{\
    printf( "Stack overflow!!!\nThe EBP should be %x, but it's %x( %s )\n\n", u_STACK_CHECK_EBP_VALUE_ENTER, u_STACK_CHECK_EBP_VALUE_RETURN, (char*)&u_STACK_CHECK_EBP_VALUE_RETURN );\
    assert( u_STACK_CHECK_EBP_VALUE_RETURN == u_STACK_CHECK_EBP_VALUE_ENTER );\
}

#define STACK_CHECK_BEGIN() unsigned int u_STACK_CHECK_EBP_VALUE_ENTER = 0; \
asm( "str fp, %0 \n" : "=m" (u_STACK_CHECK_EBP_VALUE_ENTER) ); \
u_STACK_CHECK_EBP_VALUE_ENTER = (u_STACK_CHECK_EBP_VALUE_ENTER & STACK_CHECK_MASK) | STACK_CHECK_RAND

#define STACK_CHECK_END() do{ unsigned int u_STACK_CHECK_EBP_VALUE_RETURN = 0;\
asm( "str fp, %0 \n" : "=m" (u_STACK_CHECK_EBP_VALUE_RETURN) );\
STACK_CHECK_END_INTERNAL(); }while(0)

#else
#define STACK_CHECK_BEGIN() do{}while(0)
#define STACK_CHECK_END() do{}while(0)
#endif


jboolean Java_paulscode_android_mupen64plusae_Utility_isARM7( JNIEnv* env, jclass cls )
{
    STACK_CHECK_BEGIN();

#ifdef _armv7
    printf( "arm-checker determined this is an ARMv7 device" );
    return JNI_TRUE;
#else
    printf( "arm-checker determined this is NOT an ARMv7 device" );
    return JNI_FALSE;
#endif

    STACK_CHECK_END();
}
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: NXEngine AE
« Reply #9 on: November 08, 2012, 05:33:03 AM »
To anyone who may want to pick this up:
Stack Corruption happens between when characters are added to the buffer to be drawn and the time they are actually drawn. If a sign contains the character that tells the entire sign to be drawn instantly (instead of displaying character by character), Stack Corruption will occur.
Changing the sound Hz rate does not fix the sound quality or the sound buffer issues (it just makes the sound faster or slower).

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: NXEngine AE
« Reply #10 on: December 10, 2012, 07:23:30 PM »
Thanks to the people working on the iOS port of NXEngine, the sound issue is mostly fixed. Sound effects wont play for some reason. And, since google released their ndk-r8 with proper c++ support, stack corruption is fixed. For some reason the crystax ndk was causing the stack corruption. Only other issue unique to the android edition is that its very slow.

Online Paul

  • Administrator
  • double
  • *****
  • Posts: 3491
  • Developer
    • View Profile
    • PaulsCode.Com
Re: NXEngine AE
« Reply #11 on: December 11, 2012, 07:19:40 AM »
Excellent work!
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted

Offline OnijJoku

  • byte
  • *
  • Posts: 38
    • View Profile
Re: NXEngine AE
« Reply #12 on: December 11, 2012, 10:12:16 AM »
Awesome, I love the innovative projects on here! Yabause and now this, what's next? Thanks you guys.
Device: T-Mobile MyTouch 4G
Resolution: 480 x 800
Chipset: Qualcomm MSM8255 Snapdragon
CPU: 1 GHz Scorpion
GPU: Adreno 205 245 MHz
RAM: 768 MB RAM

Device: Samsung Galaxy Note 3
Resolution: 1080 x 1920
Chipset: Qualcomm Snapdragon 800
CPU: Quad-core 2.3 GHz Krait 400
GPU: Adreno 330
RAM: 3 GB RAM

Offline xperia64

  • Developer
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: NXEngine AE
« Reply #13 on: December 11, 2012, 06:26:15 PM »
Video of latest update:
http://www.youtube.com/watch?v=NwMQKcV1wgc
And the download links:
App:
http://db.tt/KYl38Rs5
Data (extract the folder named 'nxengine' to /mnt/sdcard/data/):
http://db.tt/6nKdu9Za
« Last Edit: December 11, 2012, 06:43:51 PM by xperia64 »

Online Paul

  • Administrator
  • double
  • *****
  • Posts: 3491
  • Developer
    • View Profile
    • PaulsCode.Com
Re: NXEngine AE
« Reply #14 on: December 11, 2012, 06:31:51 PM »
Looks great!
Device: Samsung Galaxy Nexus i515
CPU: TI OMAP4460, 1.2 GHz (dual core, ARM Cortex-A9)
GPU: PowerVR SGX540, 307 MHz
RAM: 1 GB
Resolution: 720 x 1280
Rom: omni-4.4.4-20141014-toro-FML KitKat 4.4.4, rooted

Device: Eee PC 1015PEM
CPU: Intel Atom N550, 1.5 GHz (dual core, x86)
GPU: Intel GMA 3150, 200 MHz (dual core)
RAM: 2GB
Resolution: 1024 x 600
Rom: android-x86-4.3-20130725 Jelly Bean 4.3, rooted