frontend/applets: frontend swkbd base

Original commits by @jroweboy:

* Rebase out the other commit

* changing branches

* More work on stuff and things ecks DEE

Changes by @zhaowenlan1779:

* Removed #include of result.h
This commit is contained in:
James Rowe 2018-03-21 20:07:11 -06:00 committed by zhupengfei
parent f9a89ff410
commit caacefcc2e
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
7 changed files with 487 additions and 18 deletions

View file

@ -0,0 +1,66 @@
// Copyright 2018 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <atomic>
#include <memory>
namespace Frontend {
enum class AppletType {
SoftwareKeyboard,
};
class AppletConfig {};
class AppletData {};
class AppletInterface {
public:
virtual ~AppletInterface() = default;
/**
* On applet start, the applet specific configuration will be passed in along with the
* framebuffer.
*/
// virtual void Setup(const Config* /*, framebuffer */) = 0;
/**
* Called on a fixed schedule to have the applet update any state such as the framebuffer.
*/
virtual void Update() = 0;
/**
* Checked every update to see if the applet is still running. When the applet is done, the core
* will call ReceiveData
*/
virtual bool IsRunning() {
return running;
}
private:
// framebuffer;
std::atomic_bool running = false;
};
/**
* Frontends call this method to pass a frontend applet implementation to the core. If the core
* already has a applet registered, then this replaces the old applet
*
* @param applet - Frontend Applet implementation that the HLE applet code will launch
* @param type - Which type of applet
*/
void RegisterFrontendApplet(std::shared_ptr<AppletInterface> applet, AppletType type);
/**
* Frontends call this to prevent future requests
*/
void UnregisterFrontendApplet(AppletType type);
/**
* Returns the Frontend Applet for the provided type
*/
std::shared_ptr<AppletInterface> GetRegisteredApplet(AppletType type);
} // namespace Frontend