switchbrew / libnx

Library for Switch Homebrew

Home Page:https://switchbrew.github.io/libnx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forced apm initialization in appletInitialize causing issues in certain circumstances

XorTroll opened this issue · comments

I find it not very useful to force initialize apm within applet initialization (and even worse, fatal if it fails to do so). In normal circumstances this isn't a problem, but I've ran into issues with my custom HOME menu reimplementation project - I even ended up stubbing libnx's apm functions via wraps to make it work:

Apparently apm's OpenSession will return 2010-0011 if apm and the session are already opened/accessed by other 2(?) processes: if qlaunch (a custom libnx-based replacement) has it accessed, an application suspended in the background has it too, and I attempt to open any kind of homebrew via album/hbloader, it will fatal since apm refuses to open the session with the aforementioned result.
Stubbing apm initialization in qlaunch, however, seems to fix the issue, since homebrew will init apm fine.
Wondering if apm could be separated from applet (not forcing to initialize it), or apm's implementation could be changed (for instance, not opening the session directly in apmInitialize)