Ryujinx/src/Ryujinx.HLE/HOS/Applets/AppletManager.cs
Zephyron b3ec6628ef
HLE: Implement offline web applet with local HTTP server
Add a lightweight offline web rendering applet (LibAppletOff) that
extracts HTML content from the game's Manual NCA, serves it via a
local HTTP server, and injects NX JavaScript polyfills to capture
applet callbacks.

Key changes:
- Add OfflineWebServer to serve extracted RomFS content and handle
  callback URLs (nx.endApplet, nx.sendMessage, localhost redirects)
- Rewrite BrowserApplet to extract and serve offline HTML content
  from Manual NCAs, with content-aware NCA selection for games that
  ship multiple Manual NCAs (e.g. AC3 Remastered)
- Add XCI/NSP fallback for Manual NCA discovery when ContentManager
  does not register them (common for XCI-loaded games)
- Store ApplicationPath on Switch for game file re-scanning
- Add DisplayWebPage to IHostUIHandler with Avalonia implementation
- Add WindowClosed to WebExitReason enum

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2026-02-14 18:45:51 +10:00

40 lines
1.4 KiB
C#

using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Applets.Browser;
using Ryujinx.HLE.HOS.Applets.Cabinet;
using Ryujinx.HLE.HOS.Applets.Dummy;
using Ryujinx.HLE.HOS.Applets.Error;
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
namespace Ryujinx.HLE.HOS.Applets
{
static class AppletManager
{
public static IApplet Create(AppletId applet, Horizon system)
{
switch (applet)
{
case AppletId.Controller:
return new ControllerApplet(system);
case AppletId.Error:
return new ErrorApplet(system);
case AppletId.PlayerSelect:
return new PlayerSelectApplet(system);
case AppletId.SoftwareKeyboard:
return new SoftwareKeyboardApplet(system);
case AppletId.LibAppletWeb:
case AppletId.LibAppletShop:
case AppletId.LibAppletOff:
return new BrowserApplet(system);
case AppletId.MiiEdit:
Logger.Warning?.Print(LogClass.Application, $"Please use the MiiEdit inside File/Open Applet");
return new DummyApplet(system);
case AppletId.Cabinet:
return new CabinetApplet(system);
}
Logger.Warning?.Print(LogClass.Application, $"Applet {applet} not implemented!");
return new DummyApplet(system);
}
}
}