mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-24 12:00:04 +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 "common/string_util.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/cia_container.h"
|
#include "core/file_sys/cia_container.h"
|
||||||
|
#include "core/frontend/applets/default_applets.h"
|
||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/hle/service/am/am.h"
|
#include "core/hle/service/am/am.h"
|
||||||
#include "core/loader/loader.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::values.movie_record = std::move(movie_record);
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
|
|
||||||
|
// Register frontend applets
|
||||||
|
Frontend::RegisterDefaultApplets();
|
||||||
|
|
||||||
std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>(fullscreen)};
|
std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>(fullscreen)};
|
||||||
|
|
||||||
Core::System& system{Core::System::GetInstance()};
|
Core::System& system{Core::System::GetInstance()};
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/archive_source_sd_savedata.h"
|
#include "core/file_sys/archive_source_sd_savedata.h"
|
||||||
|
#include "core/frontend/applets/default_applets.h"
|
||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/hle/service/fs/archive.h"
|
#include "core/hle/service/fs/archive.h"
|
||||||
#include "core/loader/loader.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::RegisterFactory("qt", std::make_unique<Camera::QtMultimediaCameraFactory>());
|
||||||
Camera::QtMultimediaCameraHandler::Init();
|
Camera::QtMultimediaCameraHandler::Init();
|
||||||
|
|
||||||
|
// Register frontend applets
|
||||||
|
Frontend::RegisterDefaultApplets();
|
||||||
|
|
||||||
main_window.show();
|
main_window.show();
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,8 @@ add_library(core STATIC
|
|||||||
file_sys/savedata_archive.h
|
file_sys/savedata_archive.h
|
||||||
file_sys/title_metadata.cpp
|
file_sys/title_metadata.cpp
|
||||||
file_sys/title_metadata.h
|
file_sys/title_metadata.h
|
||||||
|
frontend/applets/default_applets.cpp
|
||||||
|
frontend/applets/default_applets.h
|
||||||
frontend/applets/interface.cpp
|
frontend/applets/interface.cpp
|
||||||
frontend/applets/interface.h
|
frontend/applets/interface.h
|
||||||
frontend/applets/swkbd.cpp
|
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 <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "common/assert.h"
|
||||||
#include "core/frontend/applets/interface.h"
|
#include "core/frontend/applets/interface.h"
|
||||||
|
|
||||||
namespace Frontend {
|
namespace Frontend {
|
||||||
@ -93,12 +94,12 @@ enum class ValidationError {
|
|||||||
class SoftwareKeyboard : public AppletInterface {
|
class SoftwareKeyboard : public AppletInterface {
|
||||||
public:
|
public:
|
||||||
explicit SoftwareKeyboard() : AppletInterface() {}
|
explicit SoftwareKeyboard() : AppletInterface() {}
|
||||||
const AppletData* ReceiveData() override {
|
|
||||||
return &data;
|
|
||||||
}
|
|
||||||
void Setup(const AppletConfig* config) override {
|
void Setup(const AppletConfig* config) override {
|
||||||
this->config = KeyboardConfig(*static_cast<const KeyboardConfig*>(config));
|
this->config = KeyboardConfig(*static_cast<const KeyboardConfig*>(config));
|
||||||
}
|
}
|
||||||
|
const AppletData* ReceiveData() override {
|
||||||
|
return &data;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -126,9 +127,29 @@ protected:
|
|||||||
*/
|
*/
|
||||||
ValidationError Finalize(const std::string& text, u8 button);
|
ValidationError Finalize(const std::string& text, u8 button);
|
||||||
|
|
||||||
private:
|
|
||||||
KeyboardConfig config;
|
KeyboardConfig config;
|
||||||
KeyboardData data;
|
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
|
} // namespace Frontend
|
||||||
|
@ -174,8 +174,6 @@ struct SoftwareKeyboardConfig {
|
|||||||
*/
|
*/
|
||||||
static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config size is wrong");
|
static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config size is wrong");
|
||||||
|
|
||||||
class DefaultCitraKeyboard : Frontend::AppletInterface {};
|
|
||||||
|
|
||||||
class SoftwareKeyboard final : public Applet {
|
class SoftwareKeyboard final : public Applet {
|
||||||
public:
|
public:
|
||||||
SoftwareKeyboard(Service::APT::AppletId id, std::weak_ptr<Service::APT::AppletManager> manager)
|
SoftwareKeyboard(Service::APT::AppletId id, std::weak_ptr<Service::APT::AppletManager> manager)
|
||||||
|
Loading…
Reference in New Issue
Block a user