mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
am/applets: Add Applet superclass to describe a generic applet
Adds an Initialize and Execute methods which are used by the ILibraryAppletAccessor to start and control the applet.
This commit is contained in:
parent
731b4bd691
commit
5b95de0c9c
|
@ -150,6 +150,8 @@ add_library(core STATIC
|
|||
hle/service/am/applet_ae.h
|
||||
hle/service/am/applet_oe.cpp
|
||||
hle/service/am/applet_oe.h
|
||||
hle/service/am/applets/applets.cpp
|
||||
hle/service/am/applets/applets.h
|
||||
hle/service/am/idle.cpp
|
||||
hle/service/am/idle.h
|
||||
hle/service/am/omm.cpp
|
||||
|
|
29
src/core/hle/service/am/applets/applets.cpp
Normal file
29
src/core/hle/service/am/applets/applets.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2018 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "core/frontend/applets/software_keyboard.h"
|
||||
#include "core/hle/service/am/applets/applets.h"
|
||||
|
||||
namespace Service::AM::Applets {
|
||||
|
||||
std::shared_ptr<Frontend::SoftwareKeyboardApplet> software_keyboard =
|
||||
std::make_shared<Frontend::DefaultSoftwareKeyboardApplet>();
|
||||
|
||||
void Applet::Initialize(std::vector<std::shared_ptr<IStorage>> storage) {
|
||||
storage_stack = std::move(storage);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void RegisterSoftwareKeyboard(std::shared_ptr<Frontend::SoftwareKeyboardApplet> applet) {
|
||||
if (applet == nullptr)
|
||||
return;
|
||||
|
||||
software_keyboard = std::move(applet);
|
||||
}
|
||||
|
||||
std::shared_ptr<Frontend::SoftwareKeyboardApplet> GetSoftwareKeyboard() {
|
||||
return software_keyboard;
|
||||
}
|
||||
|
||||
} // namespace Service::AM::Applets
|
46
src/core/hle/service/am/applets/applets.h
Normal file
46
src/core/hle/service/am/applets/applets.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2018 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "common/swap.h"
|
||||
|
||||
namespace Frontend {
|
||||
class SoftwareKeyboardApplet;
|
||||
}
|
||||
|
||||
namespace Service::AM {
|
||||
|
||||
class IStorage;
|
||||
|
||||
namespace Applets {
|
||||
|
||||
class Applet {
|
||||
public:
|
||||
virtual void Initialize(std::vector<std::shared_ptr<IStorage>> storage);
|
||||
|
||||
virtual IStorage Execute() = 0;
|
||||
|
||||
protected:
|
||||
struct CommonArguments {
|
||||
u32_le arguments_version;
|
||||
u32_le size;
|
||||
u32_le library_version;
|
||||
u32_le theme_color;
|
||||
u8 play_startup_sound;
|
||||
u64_le system_tick;
|
||||
};
|
||||
static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size.");
|
||||
|
||||
std::vector<std::shared_ptr<IStorage>> storage_stack;
|
||||
bool initialized = false;
|
||||
};
|
||||
|
||||
void RegisterSoftwareKeyboard(std::shared_ptr<Frontend::SoftwareKeyboardApplet> applet);
|
||||
std::shared_ptr<Frontend::SoftwareKeyboardApplet> GetSoftwareKeyboard();
|
||||
|
||||
} // namespace Applets
|
||||
} // namespace Service::AM
|
Loading…
Reference in a new issue