skmp / reicast-emulator

Reicast was a multiplatform Sega Dreamcast emulator
https://reicast.emudev.org
Other
1.1k stars 344 forks source link

Optimize the emulator for phones with less RAM (Xperia Play) #259

Closed AbandonedCart closed 10 years ago

AbandonedCart commented 10 years ago

Since the Shield is heavily supported as the "new" gaming device, it would be good to support some of the past gaming devices, too.

Currently the controller is supported and I just added the manifest tags to have the emulator show up in the Xperia Play launcher.

There are a lot of gaming kernels and ROMs out there running GLES smoothly, but for some reason there is a lot of lag with rendering for this one.

This is less an issue and more a general discussion on how to accomplish this, continued from the previous controller talks in https://github.com/reicast/reicast-emulator/issues/32

jbakach commented 10 years ago

I think that the first thing is to fix the gui in Android 2.3 because it's the only OS that Xperia Play has optimized for it.

AbandonedCart commented 10 years ago

The GUI should work. I was testing it using 2.2 and if it works on that relic, haha. Is there something specific you are referring to?

jbakach commented 10 years ago

I'm not able to play any game in Android 2.3, that's what I mean, I have the correct files in the correct place, and I'm not able to run the bios! Is there any problem? The format of the game that I'm trying to play is .cdi. And it's name is Jet Set Radio, I love that game.

AbandonedCart commented 10 years ago

Oh. Hmmm. I updated it to ICS so it ran, just really slow. I am downgrading to GB now to see what's up. I assumed with the posts about controls it worked.

jbakach commented 10 years ago

I can't test at the moment if the controls would work now, because I can't even run any game.

AbandonedCart commented 10 years ago

Well yeah. I meant Xperia Play Controls support. #32

jbakach commented 10 years ago

Yes, I'm able to navigate on the menus and options of the GUI using the Xperia Play controls though.

AbandonedCart commented 10 years ago

http://reicast.loungekatt.com/report/logs/1392072790170.txt

jbakach commented 10 years ago

V/SlidingMenu( 2506): setting padding! V/ImageViewFlipper( 2506): Added: VirtuaFighter3TB.cdi V/ImageViewFlipper( 2506): Added: SoulCaliburJP.chd V/ImageViewFlipper( 2506): Added: PsychicForce2012.chd V/ImageViewFlipper( 2506): Added: MakenXJP.chd V/ImageViewFlipper( 2506): Added: JetGrindRadio.chd V/ImageViewFlipper( 2506): Added: IndustrialSpyOpE.chd V/ImageViewFlipper( 2506): Added: DeadorAlive2US.chd V/ImageViewFlipper( 2506): Added: DeadOrAlive2LE.chd V/CustomViewBehind( 2506): behind INVISIBLE D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null D/skia ( 2506): --- SkImageDecoder::Factory returned null I/ActivityManager( 862): Displayed com.reicast.loungekatt/com.reicast.emulator.MainActivity: +329ms (total +393ms) E/iddd-util( 721): Failed to get secure clock: result 0, opResult 8 D/CustomizationProvider( 1155): openFile -- START uri=content://com.sonyericsson.provider.customization/settings/com.sonyericsson.textinput.uxp D/DrmManager(Native)( 712): DrmManager::openDecryptSession: no capable plug-in found D/IDrmManagerService(Native)( 712): NULL decryptHandle is returned D/IDrmManagerService(Native)( 730): no decryptHandle is generated in service side D/DrmManager(Native)( 712): DrmManager::openDecryptSession: no capable plug-in found D/IDrmManagerService(Native)( 712): NULL decryptHandle is returned D/IDrmManagerService(Native)( 730): no decryptHandle is generated in service side D/kernel ( 719): CY8CTMA300_TOUCH: invalid data? V/CustomViewBehind( 2506): behind INVISIBLE D/dalvikvm( 2506): DexOpt: couldn't find static field W/dalvikvm( 2506): VFY: unable to resolve static field 58 (THREAD_POOL_EXECUTOR) in Landroid/os/AsyncTask; D/dalvikvm( 2506): VFY: replacing opcode 0x62 at 0x0021 D/dalvikvm( 2506): VFY: dead code 0x0023-002b in Lcom/reicast/emulator/ConfigureFragment;.generateErrorLog ()V V/CustomViewBehind( 2506): behind INVISIBLE D/CustomizationProvider( 1155): openFile -- START uri=content://com.sonyericsson.provider.customization/settings/com.sonyericsson.textinput.uxp D/DrmManager(Native)( 712): DrmManager::openDecryptSession: no capable plug-in found D/IDrmManagerService(Native)( 712): NULL decryptHandle is returned D/IDrmManagerService(Native)( 730): no decryptHandle is generated in service side D/DrmManager(Native)( 712): DrmManager::openDecryptSession: no capable plug-in found D/IDrmManagerService(Native)( 712): NULL decryptHandle is returned D/IDrmManagerService(Native)( 730): no decryptHandle is generated in service side D/dalvikvm( 2506): DexOpt: couldn't find static field W/dalvikvm( 2506): VFY: unable to resolve static field 58 (THREAD_POOL_EXECUTOR) in Landroid/os/AsyncTask; D/dalvikvm( 2506): VFY: replacing opcode 0x62 at 0x001a D/dalvikvm( 2506): VFY: dead code 0x001c-0022 in Lcom/reicast/emulator/GenerateLogs;.onPostExecute (Ljava/lang/String;)

jbakach commented 10 years ago

Why these errors?

Elwood89 commented 10 years ago

I'm using reicast on my xperia play without problems. I'm running "racing rom" which is a modded cm10 (jelly bean 4.1.2). Speed is around 50~70% without frameskip. I think the known xplay touchpads cm10 bug is present in reicast also (heavy stutter when touching the pads), will confirm tomorrow.

jbakach commented 10 years ago

The best gaming experience is on Android GB.

AbandonedCart commented 10 years ago

Sadly no gaming experience is on GB right now.

The errors are because of https://github.com/reicast/reicast-emulator/issues/6

AbandonedCart commented 10 years ago

The app needs the 512 region, which is unavailable because I think 512 is not much less than what it has. It's only available in later ROMs because they optimize the processes to take less RAM and the RAM to handle more. So...

I just nuked the entire SDCard in the name of science. I am going to try making a swap partition and see if it can allow the emulator to use that as the required 512MB.

AbandonedCart commented 10 years ago

Yeah, GB just isn't happening right now...

jbakach commented 10 years ago

I don't think making a swap partition will make the emulator work on this device.. ICS or JB is heavy for this device, I think if we find the way to make it work in GB it will be better. In my Xperia Play I have 384 MB of RAM in total.

AbandonedCart commented 10 years ago

384 < 512 which means it won't work.

AbandonedCart commented 10 years ago

Running some tests with a 64 gb class 10, a 2gb swap, and some ICS gaming ROM with software rendering enabled in the emulator and the results are much better than they have been. Still tweaking swappiness and such before I can make any solid recommendations.

It may come down to requirements on the card for decent results. The class 4 was horrid, class 6 was bearable, but class 10 is decent.

Elwood89 commented 10 years ago

Wait... I believe I was running Ikaruga, Rez and Headhunter on my JB rom with no swapfile? Is this required only for some games?

AbandonedCart commented 10 years ago

It's not required. I am trying to get full speed with this emulator.

Elwood89 commented 10 years ago

Sounds great! You think that it's possible? Is there an option now to turn on software rendering? Can't see it in the settings...

AbandonedCart commented 10 years ago

At the bottom there should be a switch that's labeled Force Software Render

stodag commented 10 years ago

@loungeKatt, pls can you give me the link to this apk? I want to test software rendering. thx

AbandonedCart commented 10 years ago

@stodag I'll do one better. Here is the APK with:

http://loungekatt.com/ReicastBot/experimental/compiled/reicast-experimental-6a85428.apk

Keep in mind if you disable sound, un-mute will not enable it. Disabling sound is meant to remove the process entirely so if you have to frame skip heavily you don't waste the thread.

stodag commented 10 years ago

thx man, appreciated:)

stodag commented 10 years ago

@ loungeKatt, liking the new Ui (new to me anyway lol) seems slower for me (dual core a5 ) I'm plannin on buyin something better though.. dual core1ghz a9 (Mali 400) or dual core 1ghz krait (adreno 305).. anyway, great work and keep it up .. soon as we are able to donate , I'm in. thx again.

AbandonedCart commented 10 years ago

@stodag I think @skmp still needs a decent test device if you end up with one you don't use. Other than that, my motive for doing this is to see how far I can push my Android coding.

I admit a lot of the UI is porting parts from https://play.google.com/store/apps/details?id=com.loungecat.oblige <- Dynamic UI that had more options than space for them haha.

stodag commented 10 years ago

My current device is a Huawei ascend y300.. 1ghz dual core a5 with an adreno 203.. a very capable device for peanuts lol If you give me a couple of weeks to a month (when I get my new phone, xperia m I'm thinking) then I'll gladly donate this device :) I usually give them to my bro but he fcks seem up anyway so if this device will do, y'all can have it.. closer to the time I'll need postage details etc..

stodag commented 10 years ago

drk said gles 3 capable.. I wish I had a gles 3 device period lol.

AbandonedCart commented 10 years ago

I wasn't sure what he was looking for, I just know I read that he would accept devices. I have like 7 spares, but they range in quality from garbage to trash or they are school issued and have to be kept on "file" haha.

Elwood89 commented 10 years ago

I tested this experimental version on my S3 and the software mode is looking identical to standard rendering... including bugs that I thought were gpu-dependent like UT flickering. Is that the expected behavior?

AbandonedCart commented 10 years ago

On an S3 without it being configured for newer devices yet, yes. It was only there for when a device that had the option (from something like a custom ICS) didn't actually support hardware.

skmp commented 10 years ago

The issue isn't ram, the issue is some random .so getting in the middle of memory addresses, leaving me without addressing space. Virtual address space is limited to 2gbs or 4gbs per process, no matter how much physical ram you have.

On a sidenote, linux will give you as much real ram as you ask for, and only fail later on with an "oopisie, turns out didn't have that much ram afterall" error. It also randomly kills a process to free ram.

AbandonedCart commented 10 years ago

@skmp Regardless, it doesn't make it faster asking for more RAM than you have. The memory leaks don't help either.

AbandonedCart commented 10 years ago

Well I reverted to GB, so how do I track down which lib it is?

skmp commented 10 years ago

You need to dump the memory space. The profiler should be able to do that for you, do we still have the profiler buttons on the OSD ?

AbandonedCart commented 10 years ago

cat /proc/self/maps 00008000-000a6000 r-xp 00000000 00:01 77 /sbin/busybox 000ae000-000b1000 rw-p 0009e000 00:01 77 /sbin/busybox 000b1000-000bb000 rw-p 00000000 00:00 0 [heap] 2aaab000-2aabb000 r--s 00000000 00:0d 2191 /dev/properties (deleted) 2aabb000-2aabc000 r--p 00000000 00:00 0 7eb7b000-7eb7d000 rw-p 00000000 00:00 0 [stack]

There's that while I reinstall everything.

AbandonedCart commented 10 years ago

I was reading StackOverflow to see if there was a way to do a verification from the Android side as well.

Minor issue is the BIOS can't be launched to do the memory dump...

skmp commented 10 years ago

Well, you need a dump while the emulator is "allocating". look for _vmem_reserve on vmem.cpp, and add relevant code there to dump /proc/self/maps :)

AbandonedCart commented 10 years ago

printf("%d\n",system("cat /proc/self/maps")); returns the most amazing... nothing. Started in _vmem_reserve and eventually moved it all the way up to UnLockRegion.

skmp commented 10 years ago

well, that makes sense.

you gotta do it the painful way (fopen, fgets/printf, fclose). There are other myriads way to do that, i'm sure fgets/printf aren't the best ones but they should do with a large enough buffer since you don't care about exploiting yourself.

system creates a new process so it doesn't return the results from the current one. It also pipes to fd0, but we want the (redirected) printf.

FILE* f=fopen("/.../maps", "r"); while!(feof(f)) { char temp[2048] fgets(f, temp); printf("%s\n", temp); } fclose(f); //or something close enough

On Thu, Feb 13, 2014 at 6:15 AM, TwistedUmbrella notifications@github.comwrote:

printf("%d\n",system("cat /proc/self/maps")); returns the most amazing... nothing. Started in _vmem_reserve and eventually moved it all the way up to UnLockRegion.

— Reply to this email directly or view it on GitHubhttps://github.com/reicast/reicast-emulator/issues/259#issuecomment-34946971 .

~skmp

AbandonedCart commented 10 years ago

Did that too and nothing. It was some project a guy did for cat using just system commands. It's the wrong output anyway. The one I get doing a straight file read as text in root explorer isn't the one I get from terminal.

I'm going to try getting it manually as it happens and see if I can get the valid read.

AbandonedCart commented 10 years ago

Haha, I got it to print to a file. And for the future: https://github.com/NoblesseOblige/reicast-emulator/commit/4d322feacc77e67e0e6d88750341e93cfefc57b7 https://github.com/NoblesseOblige/reicast-emulator/commit/9281d2f2adbf19436fa961199e7f9e1fcb766a5d

Now if the emulator won't even launch we can at least get some useful info.

AbandonedCart commented 10 years ago

http://reicast.loungekatt.com/report/logs/Xperia%20Play%20Memory%20Readout.txt

AbandonedCart commented 10 years ago

http://reicast.loungekatt.com/report/logs/1392271848950.txt

From a fresh boot just in case

skmp commented 10 years ago

its libjpeg.so getting in the middle of that very cute 0x2a+ space region. DAMN IT. We also almost get a region (0x1axx) near the top but then more allocations happen.

skmp commented 10 years ago

Now, if we could map a new executable and android didn't suck that much, that'd be an easy fix. Thanks google.

RetroMarioBros commented 10 years ago

any news about xperia play 2.3 (GB) ?????

Skynightfire commented 10 years ago

Hi, I'm from Rio de Janeiro, Brazil. First, I want to thanks the effort and the DEV's excellent job with this amazing emulator. I'd like to know if there really exist the possibility of this emulator works full speed on the xperia play. I watched some videos on YOUTUBE (user Owriço Winchester) and it looks working nicely. I wish good luck to everyone and I'll be waiting for good news!

AbandonedCart commented 10 years ago

GB is looking impossible. I attempted some fancy relocations and still nothing wants to come together. ICS can be slimmed down and it does work. As far as the "tailored" aspect of GB on the Play, Sony did release an ICS build and did provide all the usual stuff for it. Part of what Google was aiming for in ICS and JB was to free up some of their allocations so I think it is best to focus efforts on improvement for running on ICS.