XITRIX / Moonlight-Switch

Moonlight port for Nintendo Switch
779 stars 47 forks source link

App crashes after connecting to host or right after starting it #56

Closed noclueoncoding closed 4 months ago

noclueoncoding commented 2 years ago

I have been using Moonlight-NX for a long while without any issues besides the unpolishedness of this particular app and the lack of continued development. After discovering Moonlight-Switch I decided to "switch". Initially I was running FW 12.1.0 and Atmosphere 0.19.5 and I encountered the following issue: After installing Version 0.11 from the HB App Store and launching it via Title Redirection (for FULL RAM access) I had the issue that the App would crash as soon as I tried to connect to the Moonlight host (Windows10VM in my LAN). The crash happened with no particular error message besides the standard Message from the Switch "The software was closed because an error occurred." after the described crash in most cases the App would begin crashing directly after launch until I rebooted the Switch into Atmosphere again. Btw. Moonlight streaming from above host works flawlessly with the MacOS and the Android client. What did I try:

  1. I noticed that the crashes after trying to connect to the host often did not happen instantly but after 1-2 seconds. So I sometimes could see parts of the game library and how the cover thumbnails populated. After inspecting the boxart folder on the switch I noticed that there where some really big cover pictures (like 1-2MB). So I thought that might be the issue and I changed the cover pictures of every game in my library to a minuscule png (about 4KB) but that didn't help at all.
  2. I removed Moonlight-Switch and Moonlight-NX via the HB App Store and deleted all remaining moonlight directories within /switch. After that I created /switch/Moonlight-Switch and put the latest version in there myself -> same issue
  3. I updated my FW and Atmosphere to 13.2.1 and 1.2.6 -> same issue
  4. I tried every suggestion in https://github.com/XITRIX/Moonlight-Switch/issues/7 -> same issue

To be honest I am out of clues and I would appreciate any help. Thanks upfront.

XITRIX commented 2 years ago

Hi, thanks for so detailed report, could you tell how many games in your library? May be the reason is in amount of pictures which need to be stored in ram... To test this idea I could compile a build for you without image processing, so if it will work, I'll try to find the way to compress them before displaying

XITRIX commented 2 years ago

Moonlight-Switch.nro.zip Try to use it

noclueoncoding commented 2 years ago

Great it works. Thanks for the prompt support. Only downside is, that now the Client doesn't display any images at all. But besides that everything works flawlessly. Ah, and I have 26 games in my library.

XITRIX commented 2 years ago

Yea, I've disabled images to check my theory. So... I could tell, that it's the problem on your host side, because you have large images, but.... I don't think it's a solution :D I'll try to implement some compression for images, so they will not crash an entire app. I'll leave that issue opened, hope you'll help me to test a solution when it will be ready!)

noclueoncoding commented 2 years ago

Thanks. Of course I will. The thing curious to me ist that i had the same hunch and thus I changed all cover pictures of every game in my library to a minuscule png (about 4KB) but that didn't improve the situation. Im looking forward to your implementation.

Olfdev commented 2 years ago

I have the same issue and no games, only mstsc.exe, so no pictures. It was working fine a few weeks back. The only thing I did is to update Nvidia drivers. I tried the archive provided above but it still crashes. EDIT: I removed and added back my host and it works. My two cents: Because I had to reinstall Geforce Experience, I then needed a new pairing code, hence the app crash which didn't know that.

By the way, when I tried the .nro from the archive, Moonlight was in French. My Switch is in French but I like having my apps in English, so please, if you add localization, let us choose the language from within Moonlight. 👍

XITRIX commented 2 years ago

let us choose the language from within Moonlight

It's not a part of this issue, but yes, it's in plan (but not for the next update I think...)

@noclueoncoding, I've played with compression libraries a bit and somehow made it work on Switch, so could you try to run this one?

XITRIX commented 2 years ago

Or better artifact from that build

noclueoncoding commented 2 years ago

Tested the last build you provided. You got it aaaalmost... When connecting to the host it tries to populate the library with the now compressed covers but crashes half way through. To get it working again I had to reboot Atmosphere. But surprise... after launching Moonlight-Switch it seems he managed to download all covers but connecting to the host via the Connect button crashes the app again. Before trying this version I favorited each and every game in the library so that I can launch the directly after starting the app. Funny thing is since he managed to download every cover the favorites have ther cover an are completely functional. The app only crashes when I try to connect and browse the whole library.

noclueoncoding commented 2 years ago

Thanks for your quick support btw.

XITRIX commented 2 years ago

May be I need to implement image hiding as debug option inside app...

XITRIX commented 2 years ago

@noclueoncoding, I have an idea, maybe it's some kind of broken image, that crashes entire app. Try to add all your games into favorites using "no images" app version from above, then install version with images and download them by opening "Apps list" screen. Check that app crashes on favorites screen now, and try deleting images one by one trying to find out when app will stop crashing, if you will find it, you could share it with me, and I'll try to debug that crash and fix it

noclueoncoding commented 2 years ago

Thanks for the suggestion. Unfortunatelly the above process doesn't single one specific cover out since iteratively deleting the images doens't stop the app from crashing. even after i removed all images the app crashes with the exact same pattern. Is there may be any debug logging I can provide you with? For the time being I resorted to the version without any pictures, which is completely stable for me.

Wuzaa commented 2 years ago

I have 3 titles and seeing the same issue. I'm lately running the latest Nvidia drivers if related. Still works intermittently and looks amazing. Thx for working on this.

XITRIX commented 2 years ago

Hi @Wuzaa, do you mean that normal release app crashes while debug version from above work fine?

xyourmomx commented 2 years ago

I absolutely love this app… when it works. But like the original poster. It crashes on me, a lot. Prolly more than 50% of the time.

Mostly when starting the app. Sometimes when connecting to the host. Sometimes when exiting the app (via disconnect and using the b button to back out)

And it crashes 100% of the time when pressing the home button.

If it didn’t crash as much, this would be my go to method for using Moonlight.

Thanks for all your hard work. Seriously. Thank you!

XITRIX commented 2 years ago

Hmm... it's strange that it crashes on pressing home button, I've never got crashes in that case... Finally I think that I learned the way to debug app crashes on Switch, so I think I'll try to fix most of them soon

bad1dea commented 2 years ago

Great :) It's been annoying..

I've managed to.. work around the Panic.. by launching it via another app (not applet).. so when it does crash.. either on connect, disconnect, or whatever.. it only crashes the app and forces it to close.. versus rebooting.

You can use IDA to attach it to the GDB debugger, to debug crashes.. if you'd like I can see if I can pull some crashes for ya.

XITRIX commented 2 years ago

@bad1dea, wait a minute... Moonlight should not be launched in applet mode, I've wrote about it on ReadMe page... Also, does Switch has GDB debugger?

bad1dea commented 2 years ago

@XITRIX hah I normally always launch apps in applet but yeah that causes panic when it crashes.

My switch has GDB Debugger running (for making game hacks/cheats) -- so if you need anything just let me know.

XITRIX commented 2 years ago

@bad1dea, could you tell me how to install it? Is it Twili or something else?

bad1dea commented 2 years ago
To enable gdbstub add the this line to /atmosphere/config/system_settings.ini under [atmosphere]
enable_standalone_gdbstub = u8!0x1
Restart Switch after the change.
TsukiruP commented 2 years ago

Having a similar issue now. Usually it would constantly crash if I tried to use my digital apps, so I used my Xenoblade 2 cart. Now it crashes with that too. I got it to run once and then booted up into a game, and then it immediately crashed. I haven't changed anything with my Switch besides my 3rd party joycons. image

TsukiruP commented 2 years ago

Or well apparently I guess I just had my switch on for too long? Wonder if this is just an atmosphere issue.

keymaster777 commented 1 year ago

Are there any updates on this bug? I am getting the same thing when I try and launch it after I have closed it. I have had luck with trying to launch via a different game title.

XITRIX commented 4 months ago

Should be fixed in v1.0