2018-12-24 22:21:12 +01:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-06-05 18:17:31 +02:00
|
|
|
#include <map>
|
2018-12-24 22:21:12 +01:00
|
|
|
#include "core/file_sys/vfs_types.h"
|
|
|
|
#include "core/hle/service/am/am.h"
|
|
|
|
#include "core/hle/service/am/applets/applets.h"
|
|
|
|
|
|
|
|
namespace Service::AM::Applets {
|
|
|
|
|
2019-06-05 18:16:02 +02:00
|
|
|
enum class ShimKind : u32;
|
2019-06-05 18:17:31 +02:00
|
|
|
enum class ShopWebTarget;
|
2019-06-05 18:16:02 +02:00
|
|
|
enum class WebArgTLVType : u16;
|
|
|
|
|
2018-12-24 22:21:12 +01:00
|
|
|
class WebBrowser final : public Applet {
|
|
|
|
public:
|
2019-06-05 18:18:53 +02:00
|
|
|
WebBrowser(Core::Frontend::WebBrowserApplet& frontend,
|
|
|
|
Core::Frontend::ECommerceApplet* frontend_e_commerce = nullptr);
|
|
|
|
|
2018-12-24 22:21:12 +01:00
|
|
|
~WebBrowser() override;
|
|
|
|
|
|
|
|
void Initialize() override;
|
|
|
|
|
|
|
|
bool TransactionComplete() const override;
|
|
|
|
ResultCode GetStatus() const override;
|
|
|
|
void ExecuteInteractive() override;
|
|
|
|
void Execute() override;
|
|
|
|
|
|
|
|
// Callback to be fired when the frontend needs the manual RomFS unpacked to temporary
|
|
|
|
// directory. This is a blocking call and may take a while as some manuals can be up to 100MB in
|
|
|
|
// size. Attempting to access files at filename before invocation is likely to not work.
|
|
|
|
void UnpackRomFS();
|
|
|
|
|
|
|
|
// Callback to be fired when the frontend is finished browsing. This will delete the temporary
|
|
|
|
// manual RomFS extracted files, so ensure this is only called at actual finalization.
|
|
|
|
void Finalize();
|
|
|
|
|
|
|
|
private:
|
2019-06-05 18:17:31 +02:00
|
|
|
void InitializeInternal();
|
|
|
|
void ExecuteInternal();
|
|
|
|
|
|
|
|
// Specific initializers for the types of web applets
|
|
|
|
void InitializeShop();
|
|
|
|
void InitializeOffline();
|
|
|
|
|
|
|
|
// Specific executors for the types of web applets
|
|
|
|
void ExecuteShop();
|
|
|
|
void ExecuteOffline();
|
|
|
|
|
2019-04-05 00:09:42 +02:00
|
|
|
Core::Frontend::WebBrowserApplet& frontend;
|
2019-03-12 00:35:01 +01:00
|
|
|
|
2019-06-05 18:18:53 +02:00
|
|
|
// Extra frontends for specialized functions
|
|
|
|
Core::Frontend::ECommerceApplet* frontend_e_commerce;
|
|
|
|
|
2018-12-24 22:21:12 +01:00
|
|
|
bool complete = false;
|
|
|
|
bool unpacked = false;
|
|
|
|
ResultCode status = RESULT_SUCCESS;
|
|
|
|
|
2019-06-05 18:16:02 +02:00
|
|
|
ShimKind kind;
|
|
|
|
std::map<WebArgTLVType, std::vector<u8>> args;
|
|
|
|
|
2019-06-05 18:17:31 +02:00
|
|
|
FileSys::VirtualFile offline_romfs;
|
2018-12-24 22:21:12 +01:00
|
|
|
std::string temporary_dir;
|
|
|
|
std::string filename;
|
2019-06-05 18:17:31 +02:00
|
|
|
|
|
|
|
ShopWebTarget shop_web_target;
|
2019-06-07 00:40:59 +02:00
|
|
|
std::map<std::string, std::string, std::less<>> shop_query;
|
2019-06-05 18:17:31 +02:00
|
|
|
std::optional<u64> title_id = 0;
|
|
|
|
std::optional<u128> user_id;
|
|
|
|
std::optional<bool> shop_full_display;
|
|
|
|
std::string shop_extra_parameter;
|
2018-12-24 22:21:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Service::AM::Applets
|