diff options
author | Liam <byteslice@airmail.cc> | 2023-12-31 15:40:32 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-30 00:43:45 +0100 |
commit | dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6 (patch) | |
tree | b90633109392383feaa8420e984c40c9a1799903 /src/core/hle/service/am/frontend/applet_web_browser.h | |
parent | am: add new datatypes for per-applet state (diff) | |
download | yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.tar yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.tar.gz yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.tar.bz2 yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.tar.lz yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.tar.xz yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.tar.zst yuzu-dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6.zip |
Diffstat (limited to 'src/core/hle/service/am/frontend/applet_web_browser.h')
-rw-r--r-- | src/core/hle/service/am/frontend/applet_web_browser.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/core/hle/service/am/frontend/applet_web_browser.h b/src/core/hle/service/am/frontend/applet_web_browser.h new file mode 100644 index 000000000..613d8e9ea --- /dev/null +++ b/src/core/hle/service/am/frontend/applet_web_browser.h @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include <filesystem> +#include <optional> + +#include "common/common_types.h" +#include "core/file_sys/vfs/vfs_types.h" +#include "core/hle/result.h" +#include "core/hle/service/am/frontend/applet_web_browser_types.h" +#include "core/hle/service/am/frontend/applets.h" + +namespace Core { +class System; +} + +namespace FileSys { +enum class ContentRecordType : u8; +} + +namespace Service::AM::Frontend { + +class WebBrowser final : public FrontendApplet { +public: + WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_, + const Core::Frontend::WebBrowserApplet& frontend_); + + ~WebBrowser() override; + + void Initialize() override; + + bool TransactionComplete() const override; + Result GetStatus() const override; + void ExecuteInteractive() override; + void Execute() override; + Result RequestExit() override; + + void ExtractOfflineRomFS(); + + void WebBrowserExit(WebExitReason exit_reason, std::string last_url = ""); + +private: + bool InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const; + + std::optional<std::vector<u8>> GetInputTLVData(WebArgInputTLVType input_tlv_type); + + // Initializers for the various types of browser applets + void InitializeShop(); + void InitializeLogin(); + void InitializeOffline(); + void InitializeShare(); + void InitializeWeb(); + void InitializeWifi(); + void InitializeLobby(); + + // Executors for the various types of browser applets + void ExecuteShop(); + void ExecuteLogin(); + void ExecuteOffline(); + void ExecuteShare(); + void ExecuteWeb(); + void ExecuteWifi(); + void ExecuteLobby(); + + const Core::Frontend::WebBrowserApplet& frontend; + + bool complete{false}; + Result status{ResultSuccess}; + + WebAppletVersion web_applet_version{}; + WebArgHeader web_arg_header{}; + WebArgInputTLVMap web_arg_input_tlv_map; + + u64 title_id{}; + FileSys::ContentRecordType nca_type{}; + std::filesystem::path offline_cache_dir; + std::filesystem::path offline_document; + FileSys::VirtualFile offline_romfs; + + std::string external_url; + + Core::System& system; +}; + +} // namespace Service::AM::Frontend |