Provenance-Emu / Provenance

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |
https://provenance-emu.com
Other
5.93k stars 684 forks source link

HDMI Lightning AV adapter with GBA emulation - video freezes on different LED TV #631

Open RiqZio opened 6 years ago

RiqZio commented 6 years ago

Greetings. From the start, i have to thank all your efforts for maintaining this application alive and making it big like it is now.

Now i will explain my problem. The issue that i am having is with the use of iphone lightning AV adapter (HDMI output). I have a 10 years old LCD tv, SAMSUNG LN32R8 model with hdmi input slots. I open my provenance -- version 1.4(829) and git revision ddfeefd -- then connect my adapter to the hdmi cable and i have my GBA emulator playing direct on my tv (the adapter is connected to my iphone). Video and sound are fluid and consistent. My iphone is a 6S PLUS with IOS 10.3.1.

I have another TV, also SAMSUNG, but a newer model UN48J5200, a smart tv led model. On this tv, when i connect the hdmi adapter to my iphone, i can emulate and display perfectly sega genesis games, but with GBA player the image just freezes or is not visible. However, the sound is clear. When video is not visible, i disconnect the hdmi cable and the iphone displays a white screen that is only cleaned when i reset the App (provenance) or open the Game Library.

I have used an 8bitdo NES30 Pro controller to play with my phone and Ipad, but i had made tests with and without the controller, and results are the same. So, i discarded a problem from the use of this controller.

I think that the GBA emulator doesn't have same compatibilities like the Sega Genesis emulator with the video display or the frequency is not supported on the UN48J5200 tv. Please take a look on this, to see is there a problem with the adapter or with different LED TVs and the GBA emulator.

RiqZio commented 6 years ago

Hello. I've just made another test. I installed Provenance (same version) on my iPad Air (Model A1475) with same ios 10.3.1. I used the same adapter and the display of GBA emulator was flawless on the Smart Tv UN48J5200 model.

When i use the GBA emulator on my iphone and the video is not working (although i do have sound), if i disconnect the adapter, the screen at the iphone goes white and i have to reset the application.

From where in the code do i should start to search libraries or implementation for tv out on ios? I want to make some old-brute-style "print out" debbuging using the iphone to find out the problem.

Thanks in advance, RiqZio

sevdestruct commented 6 years ago

@RiqZio, can i ask why you aren't just using the native tvOS app? This is kind of an edge case and not sure this is going to get fixed, at least any time soon unless you're up to the task..

jasarien commented 6 years ago

@sevdestruct sounds like he doesn’t have an AppleTV

sevdestruct commented 6 years ago

I gather that… what's the holdup? 😝

jasarien commented 6 years ago

Cost? 💸💸💸 🤪

RiqZio commented 6 years ago

Hello @sevdestruct. I have an old model of Apple TV (3rd gen with Apple TV os), but the portability of an iPad or my phone had me the idea of using it like a N Switch retro style. As I used my iPad with a 8bitdo controller feels like a "retro" N Switch.

I have tried to navigate the source code looking for a hint but I haven't had enough time to study it. In the short, I had realized that the options for tv output for iPhone are not well polished although iPad is fine. I want to retake this when my steelseries nimbus arrives, as I have used the 8bitdo NES icade controller to play Metroid Zero Mission long enough to beat the game, but the controls arent precise and trying to make specific plays results very hard.

Best regards, Riq

JoeMatt commented 6 years ago

There's no specialised code for tv OUT. I'd wager it's an OpenGL / framebuffer size / frame rate issue on the conversion to HDMI depending on the output specs of the tv. Hell, the HDMI version and cable probably even make some difference. I think this would be impossible for a dev to test unless they had the excact same setup. Only think I would suggest trying is playing with the refresh rate and output sizes. I even wonder if the pixel format matters when using OpenGL to the HDMI out since the color space of a TV is different than the built in screen. I'd wager this is an incredibly rare thing for any app to deal with.

There is a way to render different content to the TV using the a second UIScreen, which is how I think the existing OpenGL code actually creates its buffer, so that may or may not be an issue. The official Lightening to HDMI adapters are also ridiculously priced. I could maybe get a knock off one to try but not sure if that will add another variable to the problem.

I could see this being kind of useful for travel. bring a phone and a small MFi controller and you can play in the hotel.

JoeMatt commented 6 years ago

There's some documentation on multiple screens here.

https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/UsingExternalDisplay/UsingExternalDisplay.html

Looks like I was wrong too. PVEmulatorViewController does have code to handle a tv out connection. I would try messing around there. With the rendering changes that have been made, I don't know if any of that has been taken into consideration. @braindx would know more on that.

JoeMatt commented 6 years ago

What's also interesting is that OpenEMU has deprecated their VisualBoyAdvance core in favour of mGBA. VisualBoyAdvanced core code has a frame interval hardcoded at 59.727501, which I wonder causes issues with external displays. Can try setting this to 60 but it might cause other issues, game speed might be slightly off.

JoeMatt commented 6 years ago

I got a cheap HDMI adapter but it turns out it works completely differently than the stock apple one. It's some kind of hack, it's a little slow and it only support mirror mode, not dual screen like the Apple one. So I can't really fix this until I get a proper Apple adapt and just not feeling spending the money to fix this right now. Hopefully someone with an adapter already takes it upon themselves or someone can donate me an adapter.

RedLucas commented 6 years ago

From what I remember able the light night to HDMI adaptor is that it’s actually a mini OS that spins up when plugged in. Something about HDMI specifications.

The data coming from the iPhone is not the HDMI signal, but gets converted by that micro-OS. https://www.cultofmac.com/218192/apples-lightning-digital-av-adapter-has-an-incredible-secret/