Lime-3DS-Emulator icon indicating copy to clipboard operation
Lime-3DS-Emulator copied to clipboard

Android external display support

Open OpenSauce04 opened this issue 1 year ago • 45 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

What feature are you suggesting?

Users have requested a feature which would allow an external display to be used to show one or both of the 3DS screens. This would provide an experience analogous to Drastic's external display support or the Wii U's DS virtual console emulation.

Why would this feature be useful?

This would allow for a more faithful hardware experience for users on Android, as it would allow the two 3DS to be displayed on separate real-life displays.

OpenSauce04 avatar Aug 12 '24 16:08 OpenSauce04

Media Projection is the feature we need how is Lime3DS rendering the 2 screens?

DroidlyMobile avatar Aug 12 '24 17:08 DroidlyMobile

I stared at the source code for hours today, only if I knew Kotlin I'd be able to understand how to implement what is called Media Projection so that the Top screen could be rendered on the surface via a second display or monitor. If one of you devs could look into this that would be epic, as the Windows/Linux versions have this feature but not sure how the two screens render on the views.

DroidlyMobile avatar Aug 14 '24 01:08 DroidlyMobile

You can use the open source waylus exactly for that feature. Create a second screen open that with weylus on the phone or tablet.

Papermanzero avatar Aug 23 '24 21:08 Papermanzero

You can use the open source waylus exactly for that feature. Create a second screen open that with weylus on the phone or tablet.

That's not the same thing as native media projection on Android.

DroidlyMobile avatar Aug 23 '24 22:08 DroidlyMobile

Any update to how the two screens render I can add media projection and push an update for this as right now I figured out how to basically copy the screens but I think it's slowing down the performance.

DroidlyMobile avatar Sep 05 '24 20:09 DroidlyMobile

Why would this be marked as low as the ability to play the top screen on my tv and the bottom on my device would be amazing to have this properly rendered with Media Projection on Android. Please look into how the two screens render this would help adding this easy to implement feature.

DroidlyMobile avatar Sep 14 '24 12:09 DroidlyMobile

Droidlymoblie, pls pls pls, push this update if you can, external display support would be amazing. i8h0vkuacor51 It works great on drastic.

RageDeadworth avatar Sep 17 '24 19:09 RageDeadworth

Someone's making a product called the DNA Duo that I want to buy, but support for dual display is limited on Android right now. q7wys3x0gohd1.jpeg

AbbyTheAbsol avatar Sep 18 '24 23:09 AbbyTheAbsol

All they need to do is figure out how it's done on Windows/Linux and implement Media Projection just like Drastic. I personally have no clue how the two screens render or I'd modify the emulator myself.

DroidlyMobile avatar Oct 10 '24 12:10 DroidlyMobile

As Drastic is not open source, we cannot simply see how they do it (which wouldn't be simple anyway but at least would be a start).

I glanced through the code and I think it is likely significantly harder to implement than you are making this out to be, since the android code is designed right now with only one emulation surface (the screen) in mind, and keeping track of a potential second surface within the android code to pass into the C++ code for the core would require more work than you seem to think it would. It isn't easy would take a lot of work and testing. If somebody passionate about this feature wants to take it on, awesome. Until then, be patient.

DavidRGriswold avatar Oct 10 '24 17:10 DavidRGriswold

For future reference for anybody who looks into this more, the API needed for doing this (at least with a Google Cast device) is probably https://developers.google.com/cast/docs/overview?utm_campaign=cast-remote-710&utm_source=gdbc&utm_medium=blog rather than the MediaProjection API mentioned above. MediaProjection seems to be about capturing a real device screen to mirror rather than creating a fully virtual screen on the cast-enabled device. As to supporting physical screens, that seems to be the wild west a bit, no idea how drastic does it.

DavidRGriswold avatar Oct 10 '24 17:10 DavidRGriswold

For future reference for anybody who looks into this more, the API needed for doing this (at least with a Google Cast device) is probably https://developers.google.com/cast/docs/overview?utm_campaign=cast-remote-710&utm_source=gdbc&utm_medium=blog rather than the MediaProjection API mentioned above. MediaProjection seems to be about capturing a real device screen to mirror rather than creating a fully virtual screen on the cast-enabled device. As to supporting physical screens, that seems to be the wild west a bit, no idea how drastic does it.

Inccorrect David, I have seen someone do this for Android what they said they did though was rendered the screen twice using Media Projection. I have also decompiled the .apk of drastic and found the source code that is how I know they are using Media Projection which is something I dabbled with myself to create a dual screen game that utilizes the external display and the main display. The SDK you're linking isn't anything close to what Drastic is using, not sure how you read the other api wrong but I again decompiled Drastics source code and it clearly shows this. I have added a snippet of this that is how I found out how Drastic is utilizing the second screen ability it wasn't a hunch or a matter of knowing how to research this stuff. Screenshot 2024-10-10 153914

DroidlyMobile avatar Oct 10 '24 19:10 DroidlyMobile

@DroidlyMobile not a fan of your tone, don't put down others who aren't thinking the same thing as you are. This is a collaborative environment.

OpenSauce04 avatar Oct 10 '24 21:10 OpenSauce04

It's fine, my tone wasn't great either, I should have been more neutral. Anyway, I stand corrected about the API.

The code to manage rendering surfaces and pass then to the core emulator code seems to be managed in EmulationActiviy.kt and the NativeLibrary code. If you want to take a crack at it that's where you should start.

DavidRGriswold avatar Oct 10 '24 21:10 DavidRGriswold

What tone? You can figure out my tone by messaging? I was stating the facts but thanks 😊 my tone god keyboard warriors love to make something out of nothing I didn't have a tone 😆

On Thu, Oct 10, 2024, 5:19 p.m. OpenSauce @.***> wrote:

@DroidlyMobile https://github.com/DroidlyMobile not a fan of your tone, don't put down others who aren't thinking the same thing as you are.

— Reply to this email directly, view it on GitHub https://github.com/Lime3DS/Lime3DS/issues/351#issuecomment-2406056138, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEUCYWVIVZO77UPJFJQOCW3Z23VM5AVCNFSM6AAAAABMMR2C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBWGA2TMMJTHA . You are receiving this because you were mentioned.Message ID: @.***>

DroidlyMobile avatar Oct 10 '24 22:10 DroidlyMobile

It's fine, my tone wasn't great either, I should have been more neutral. Anyway, I stand corrected about the API.

The code to manage rendering surfaces and pass then to the core emulator code seems to be managed in EmulationActiviy.kt and the NativeLibrary code. If you want to take a crack at it that's where you should start.

I wasn't bringing a tone at all, idk how anyone can get a tone out of messaging unless they start swearing or using caps. I was stating what I did some people just don't leave the house and think everyone is out to get them so they take messages written on paper as snarky 😆

DroidlyMobile avatar Oct 10 '24 22:10 DroidlyMobile

So are we ever going to see this feature as it's a feature that is available on Windows/Linux so why isn't is added to Android yet which is the most popular devices right now.

DroidlyMobile avatar Nov 08 '24 12:11 DroidlyMobile

So are we ever going to see this feature as it's a feature that is available on Windows/Linux so why isn't is added to Android yet which is the most popular devices right now.

Doing this on Android is a lot more complicated. Android doesn't natively support split windows, so apps have to use convoluted tricks to get it to work. I believe DraStic accomplishes this through doubling the screens. There's one invisible top screen and one invisible bottom screen that you can't see.

AbbyTheAbsol avatar Nov 10 '24 05:11 AbbyTheAbsol

No it doesn't I have already advised how Drastic uses this feature via the Media Projection library. If you can figure out how the implement this via Windows/Linux in a second window all you need to do is render the second window via Android using The surfaceview within Media Projection when a secondary display is attached. I don't know Kotlin or C or I'd deep dive into this more myself, I only understand Java and Kotlin isn't something I want to take the time to learn right now.

On Sun, Nov 10, 2024, 12:21 a.m. AbbyTheAbsol @.***> wrote:

So are we ever going to see this feature as it's a feature that is available on Windows/Linux so why isn't is added to Android yet which is the most popular devices right now.

Doing this on Android is a lot more complicated. Android doesn't natively support split windows, so apps have to use convoluted tricks to get it to work. I believe DraStic accomplishes this through doubling the screens. There's one invisible top screen and one invisible bottom screen that you can't see.

— Reply to this email directly, view it on GitHub https://github.com/Lime3DS/Lime3DS/issues/351#issuecomment-2466592225, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEUCYWWCZ3JNRT3VONIQJQTZ73UNJAVCNFSM6AAAAABMMR2C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGU4TEMRSGU . You are receiving this because you were mentioned.Message ID: @.***>

DroidlyMobile avatar Nov 10 '24 11:11 DroidlyMobile

No it doesn't I have already advised how Drastic uses this feature via the Media Projection library. If you can figure out how the implement this via Windows/Linux in a second window all you need to do is render the second window via Android using The surfaceview within Media Projection when a secondary display is attached. I don't know Kotlin or C or I'd deep dive into this more myself, I only understand Java and Kotlin isn't something I want to take the time to learn right now.

Nobody at Lime3DS works for you, or for anybody. It is a volunteer project. Stop demanding features.

If you have figured out how to implement it, great! Implement it yourself and make a PR, but nobody currently working on it seems to be interested.

DavidRGriswold avatar Nov 10 '24 11:11 DavidRGriswold

Cool then why is there a section requesting features clown. Get a life

On Sun, Nov 10, 2024, 6:27 a.m. David Griswold @.***> wrote:

No it doesn't I have already advised how Drastic uses this feature via the Media Projection library. If you can figure out how the implement this via Windows/Linux in a second window all you need to do is render the second window via Android using The surfaceview within Media Projection when a secondary display is attached. I don't know Kotlin or C or I'd deep dive into this more myself, I only understand Java and Kotlin isn't something I want to take the time to learn right now.

On Sun, Nov 10, 2024, 12:21 a.m. AbbyTheAbsol @.***> wrote:

So are we ever going to see this feature as it's a feature that is available on Windows/Linux so why isn't is added to Android yet which is the most popular devices right now.

Doing this on Android is a lot more complicated. Android doesn't natively support split windows, so apps have to use convoluted tricks to get it to work. I believe DraStic accomplishes this through doubling the screens. There's one invisible top screen and one invisible bottom screen that you can't see.

— Reply to this email directly, view it on GitHub #351 (comment) https://github.com/Lime3DS/Lime3DS/issues/351#issuecomment-2466592225, or unsubscribe

https://github.com/notifications/unsubscribe-auth/BEUCYWWCZ3JNRT3VONIQJQTZ73UNJAVCNFSM6AAAAABMMR2C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGU4TEMRSGU . You are receiving this because you were mentioned.Message ID: @.***>

Nobody at Lime3DS works for you, or for anybody. It is a volunteer project. Stop demanding features.

If you have figured out how to implement it, great! Implement it yourself and make a PR, but nobody currently working on it seems to be interested.

— Reply to this email directly, view it on GitHub https://github.com/Lime3DS/Lime3DS/issues/351#issuecomment-2466696235, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEUCYWTZ2YYYZRFQGYXQW2LZ747LRAVCNFSM6AAAAABMMR2C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRWGY4TMMRTGU . You are receiving this because you were mentioned.Message ID: @.***>

DroidlyMobile avatar Nov 10 '24 15:11 DroidlyMobile

Pr #617 attempts at address this issue. If you are interested in testing and providing feedback, you can use the build from that Github action and give feedback. Please note this is still in very beta stage - expect crashing, and consider using a clean user directory.

DavidRGriswold avatar Mar 19 '25 19:03 DavidRGriswold

Pr #617 attempts at address this issue. If you are interested in testing and providing feedback, you can use the build from that Github action and give feedback. Please note this is still in very beta stage - expect crashing, and consider using a clean user directory.

Hey how do I get this version to test it?

DroidlyMobile avatar Mar 20 '25 11:03 DroidlyMobile

Hey how do I get this version to test it?

https://github.com/azahar-emu/azahar/actions/runs/13930845909/artifacts/2775187777

For future reference in case of updates, you can always download the most recent version of a PR build by going into the android build from the Github actions, then choosing the Upload sub-heading, then finding the link for the uploaded file

Image

Image

DavidRGriswold avatar Mar 20 '25 11:03 DavidRGriswold

I tried version with external display support and there are few problems with it, you can't change resolution while in single screen mode and there should be an option too disable stereoscopic 3d on one screen or add it only to external display

Shumakun avatar Apr 11 '25 16:04 Shumakun

I tried version with external display support and there are few problems with it, you can't change resolution while in single screen mode and there should be an option too disable stereoscopic 3d on one screen or add it only to external display

Can you elaborate on the first one? As far as I can tell, resolution changes (e.g. using 3x or 4x rendering) apply to the external display just fine.

I do not think adding separate 3d stereo options for both displays is reasonable at this point - it would require some significant rewriting of the code and would be a UX challenge. Perhaps if/when we address adding separate stereo options in Single Window mode on desktop, this can also be addressed, since the code could be re-used.

DavidRGriswold avatar Apr 11 '25 16:04 DavidRGriswold

Yes you can change internal resolution, but you can't change render resolution in single window mode. The picture don't maintain aspect ratio. About 3D yes it would be great if someone address that since this is how original hardware operate.

Shumakun avatar Apr 14 '25 04:04 Shumakun

I am still really confused by what you mean by "render resolution in single window mode". Can you give some photos or screenshots to make more clear what you mean? The resolution of the external display is set by the system, not azahar, and azahar should treat the external display like any other screen, fitting the layout into the provided resolution while maintaining the aspect ratio.

DavidRGriswold avatar Apr 14 '25 15:04 DavidRGriswold

Been testing, and I do get some crashes, but here's my setup for those interested.

Main phone: Oneplus 8T 5G Secondary phone: Pixel 3 Custom driver: Kimchii Turnip driver (25.1.0 R5)

Why two phones? Because it's Dual Screen, of course!

Image

This could of course be made much more portable with a shorter USB cable and a 3D printed mount (or the like).

Steps:

  1. Install Azahar on main phone
  2. On main phone, enable "Simulate Secondary Display" at lowest resolution in developer options
  3. On secondary phone, initiate screen casting from the main phone (I tested with https://app.tangoapp.dev/, which works over USB between the two phones)
  4. In Azahar, set the secondary display to the top screen, and set the bottom screen to landscape, single screen
  5. Launch a game

Step 5 is where the crashes happen. I can upload logs later, but got work to do for now. Crash seems specific to using developer options, as I didn't get any crashes with an HDMI dongle.

Very cool feature, and I'm excited to see more!

STMS

EDIT: Quick side note, "Simulate Secondary Displays" is only needed for scrcpy. If you have an HDMI dongle or casting device like a Chromecast (Chromecast not recommended, very laggy), it isn't needed.

nhobson99 avatar Apr 16 '25 14:04 nhobson99

This is why you need the DNA Duo it's a portable OLED display that connects over USB C and won't eat your phone's battery.

On Wed, Apr 16, 2025, 10:07 AM Noah Quigley-Hobson @.***> wrote:

Been testing, and I do get some crashes, but here's my setup for those interested.

Main phone: Oneplus 8T 5G Secondary phone: Pixel 3 Custom driver: Kimchii Turnip driver (25.1.0 R5)

Why two phones? Because it's Dual Screen, of course!

WIN_20250416_10_05_44_Pro.jpg (view on web) https://github.com/user-attachments/assets/0abcc580-4661-4cf1-839d-28f4a07bf301

This could of course be made much more portable with a shorter USB cable and a 3D printed mount (or the like).

Steps:

  1. Install Azahar on main phone
  2. On main phone, enable "Simulate Secondary Display" at lowest resolution in developer options
  3. On secondary phone, initiate screen casting from the main phone (I tested with https://app.tangoapp.dev/, which works over USB between the two phones)
  4. In Azahar, set the secondary display to the top screen, and set the bottom screen to landscape, single screen
  5. Launch a game

Step 5 is where the crashes happen. I can upload logs later, but got work to do for now. Crash seems specific to using developer options, as I didn't get any crashes with an HDMI dongle.

Very cool feature, and I'm excited to see more!

STMS

— Reply to this email directly, view it on GitHub https://github.com/azahar-emu/azahar/issues/351#issuecomment-2809708957, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEUCYWRKUJDNXWGQCVZB3FT2ZZP3VAVCNFSM6AAAAABMMR2C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBZG4YDQOJVG4 . You are receiving this because you were mentioned.Message ID: @.***> nhobson99 left a comment (azahar-emu/azahar#351) https://github.com/azahar-emu/azahar/issues/351#issuecomment-2809708957

Been testing, and I do get some crashes, but here's my setup for those interested.

Main phone: Oneplus 8T 5G Secondary phone: Pixel 3 Custom driver: Kimchii Turnip driver (25.1.0 R5)

Why two phones? Because it's Dual Screen, of course!

WIN_20250416_10_05_44_Pro.jpg (view on web) https://github.com/user-attachments/assets/0abcc580-4661-4cf1-839d-28f4a07bf301

This could of course be made much more portable with a shorter USB cable and a 3D printed mount (or the like).

Steps:

  1. Install Azahar on main phone
  2. On main phone, enable "Simulate Secondary Display" at lowest resolution in developer options
  3. On secondary phone, initiate screen casting from the main phone (I tested with https://app.tangoapp.dev/, which works over USB between the two phones)
  4. In Azahar, set the secondary display to the top screen, and set the bottom screen to landscape, single screen
  5. Launch a game

Step 5 is where the crashes happen. I can upload logs later, but got work to do for now. Crash seems specific to using developer options, as I didn't get any crashes with an HDMI dongle.

Very cool feature, and I'm excited to see more!

STMS

— Reply to this email directly, view it on GitHub https://github.com/azahar-emu/azahar/issues/351#issuecomment-2809708957, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEUCYWRKUJDNXWGQCVZB3FT2ZZP3VAVCNFSM6AAAAABMMR2C52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBZG4YDQOJVG4 . You are receiving this because you were mentioned.Message ID: @.***>

DroidlyMobile avatar Apr 16 '25 16:04 DroidlyMobile