mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-20 05:20:15 +00:00
applets/swkbd: Implement DefaultCitraKeyboard
This commit is contained in:
parent
18664c719e
commit
f23443b921
@ -35,6 +35,7 @@
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/cia_container.h"
|
||||
#include "core/frontend/applets/default_applets.h"
|
||||
#include "core/gdbstub/gdbstub.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/loader/loader.h"
|
||||
@ -271,6 +272,9 @@ int main(int argc, char** argv) {
|
||||
Settings::values.movie_record = std::move(movie_record);
|
||||
Settings::Apply();
|
||||
|
||||
// Register frontend applets
|
||||
Frontend::RegisterDefaultApplets();
|
||||
|
||||
std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>(fullscreen)};
|
||||
|
||||
Core::System& system{Core::System::GetInstance()};
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/archive_source_sd_savedata.h"
|
||||
#include "core/frontend/applets/default_applets.h"
|
||||
#include "core/gdbstub/gdbstub.h"
|
||||
#include "core/hle/service/fs/archive.h"
|
||||
#include "core/loader/loader.h"
|
||||
@ -1467,6 +1468,9 @@ int main(int argc, char* argv[]) {
|
||||
Camera::RegisterFactory("qt", std::make_unique<Camera::QtMultimediaCameraFactory>());
|
||||
Camera::QtMultimediaCameraHandler::Init();
|
||||
|
||||
// Register frontend applets
|
||||
Frontend::RegisterDefaultApplets();
|
||||
|
||||
main_window.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ add_library(core STATIC
|
||||
file_sys/savedata_archive.h
|
||||
file_sys/title_metadata.cpp
|
||||
file_sys/title_metadata.h
|
||||
frontend/applets/default_applets.cpp
|
||||
frontend/applets/default_applets.h
|
||||
frontend/applets/interface.cpp
|
||||
frontend/applets/interface.h
|
||||
frontend/applets/swkbd.cpp
|
||||
|
13
src/core/frontend/applets/default_applets.cpp
Normal file
13
src/core/frontend/applets/default_applets.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "core/frontend/applets/default_applets.h"
|
||||
#include "core/frontend/applets/interface.h"
|
||||
#include "core/frontend/applets/swkbd.h"
|
||||
|
||||
namespace Frontend {
|
||||
void RegisterDefaultApplets() {
|
||||
RegisterFrontendApplet(std::make_shared<DefaultCitraKeyboard>(), AppletType::SoftwareKeyboard);
|
||||
}
|
||||
} // namespace Frontend
|
13
src/core/frontend/applets/default_applets.h
Normal file
13
src/core/frontend/applets/default_applets.h
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Frontend {
|
||||
/**
|
||||
* Registers default, frontend-independent applet implementations.
|
||||
* Will be replaced later if any frontend-specific implementation is available.
|
||||
*/
|
||||
void RegisterDefaultApplets();
|
||||
} // namespace Frontend
|
@ -9,6 +9,7 @@
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "common/assert.h"
|
||||
#include "core/frontend/applets/interface.h"
|
||||
|
||||
namespace Frontend {
|
||||
@ -93,12 +94,12 @@ enum class ValidationError {
|
||||
class SoftwareKeyboard : public AppletInterface {
|
||||
public:
|
||||
explicit SoftwareKeyboard() : AppletInterface() {}
|
||||
const AppletData* ReceiveData() override {
|
||||
return &data;
|
||||
}
|
||||
void Setup(const AppletConfig* config) override {
|
||||
this->config = KeyboardConfig(*static_cast<const KeyboardConfig*>(config));
|
||||
}
|
||||
const AppletData* ReceiveData() override {
|
||||
return &data;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
@ -126,9 +127,29 @@ protected:
|
||||
*/
|
||||
ValidationError Finalize(const std::string& text, u8 button);
|
||||
|
||||
private:
|
||||
KeyboardConfig config;
|
||||
KeyboardData data;
|
||||
};
|
||||
|
||||
class DefaultCitraKeyboard final : public SoftwareKeyboard {
|
||||
public:
|
||||
void Setup(const AppletConfig* config) override {
|
||||
SoftwareKeyboard::Setup(config);
|
||||
switch (this->config.button_config) {
|
||||
case ButtonConfig::None:
|
||||
case ButtonConfig::Single:
|
||||
Finalize("Citra", 0);
|
||||
break;
|
||||
case ButtonConfig::Dual:
|
||||
Finalize("Citra", 1);
|
||||
break;
|
||||
case ButtonConfig::Triple:
|
||||
Finalize("Citra", 2);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Frontend
|
||||
|
@ -174,8 +174,6 @@ struct SoftwareKeyboardConfig {
|
||||
*/
|
||||
static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config size is wrong");
|
||||
|
||||
class DefaultCitraKeyboard : Frontend::AppletInterface {};
|
||||
|
||||
class SoftwareKeyboard final : public Applet {
|
||||
public:
|
||||
SoftwareKeyboard(Service::APT::AppletId id, std::weak_ptr<Service::APT::AppletManager> manager)
|
||||
|
Loading…
Reference in New Issue
Block a user