mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	applets/swkbd: Implement DefaultCitraKeyboard
This commit is contained in:
		
							parent
							
								
									18664c719e
								
							
						
					
					
						commit
						f23443b921
					
				
					 7 changed files with 61 additions and 6 deletions
				
			
		
							
								
								
									
										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
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue