mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-05 03:24:17 +01:00
Add nn::swkbd library.
This commit is contained in:
parent
9beff5dd0b
commit
75784dbb52
7
include/nn/swkbd.h
Normal file
7
include/nn/swkbd.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* \defgroup nn_swkbd Software Keyboard
|
||||
*/
|
||||
|
||||
#include <nn/swkbd/swkbd_cpp.h>
|
296
include/nn/swkbd/swkbd_cpp.h
Normal file
296
include/nn/swkbd/swkbd_cpp.h
Normal file
@ -0,0 +1,296 @@
|
||||
#pragma once
|
||||
#include <wut.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <nn/result.h>
|
||||
#include <padscore/kpad.h>
|
||||
#include <vpad/input.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* \ingroup nn_swkbd
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace nn
|
||||
{
|
||||
namespace swkbd
|
||||
{
|
||||
|
||||
enum class ControllerType
|
||||
{
|
||||
Unknown0 = 0,
|
||||
};
|
||||
|
||||
enum class LanguageType
|
||||
{
|
||||
Japanese = 0,
|
||||
English = 1,
|
||||
};
|
||||
|
||||
enum class RegionType
|
||||
{
|
||||
Japan = 0,
|
||||
USA = 1,
|
||||
Europe = 2,
|
||||
};
|
||||
|
||||
enum class State
|
||||
{
|
||||
Unknown0 = 0,
|
||||
};
|
||||
|
||||
struct ConfigArg
|
||||
{
|
||||
ConfigArg()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
languageType = LanguageType::English;
|
||||
unk_0x04 = 4;
|
||||
unk_0x0C = 0x7FFFF;
|
||||
unk_0x10 = 19;
|
||||
unk_0x14 = -1;
|
||||
unk_0x9C = 1;
|
||||
unk_0xA4 = -1;
|
||||
}
|
||||
|
||||
LanguageType languageType;
|
||||
uint32_t unk_0x04;
|
||||
uint32_t unk_0x08;
|
||||
uint32_t unk_0x0C;
|
||||
uint32_t unk_0x10;
|
||||
int32_t unk_0x14;
|
||||
UNKNOWN(0x9C - 0x18);
|
||||
uint32_t unk_0x9C;
|
||||
UNKNOWN(4);
|
||||
int32_t unk_0xA4;
|
||||
};
|
||||
CHECK_OFFSET(ConfigArg, languageType, 0x00);
|
||||
CHECK_OFFSET(ConfigArg, unk_0x04, 0x04);
|
||||
CHECK_OFFSET(ConfigArg, unk_0x08, 0x08);
|
||||
CHECK_OFFSET(ConfigArg, unk_0x0C, 0x0C);
|
||||
CHECK_OFFSET(ConfigArg, unk_0x10, 0x10);
|
||||
CHECK_OFFSET(ConfigArg, unk_0x14, 0x14);
|
||||
CHECK_OFFSET(ConfigArg, unk_0x9C, 0x9C);
|
||||
CHECK_OFFSET(ConfigArg, unk_0xA4, 0xA4);
|
||||
CHECK_SIZE(ConfigArg, 0xA8);
|
||||
|
||||
struct ReceiverArg
|
||||
{
|
||||
uint32_t unk_0x00 = 0;
|
||||
uint32_t unk_0x04 = 0;
|
||||
uint32_t unk_0x08 = 0;
|
||||
int32_t unk_0x0C = -1;
|
||||
uint32_t unk_0x10 = 0;
|
||||
int32_t unk_0x14 = -1;
|
||||
};
|
||||
CHECK_OFFSET(ReceiverArg, unk_0x00, 0x00);
|
||||
CHECK_OFFSET(ReceiverArg, unk_0x04, 0x04);
|
||||
CHECK_OFFSET(ReceiverArg, unk_0x08, 0x08);
|
||||
CHECK_OFFSET(ReceiverArg, unk_0x0C, 0x0C);
|
||||
CHECK_OFFSET(ReceiverArg, unk_0x10, 0x10);
|
||||
CHECK_OFFSET(ReceiverArg, unk_0x14, 0x14);
|
||||
CHECK_SIZE(ReceiverArg, 0x18);
|
||||
|
||||
struct KeyboardArg
|
||||
{
|
||||
ConfigArg configArg;
|
||||
ReceiverArg receiverArg;
|
||||
};
|
||||
CHECK_SIZE(KeyboardArg, 0xC0);
|
||||
|
||||
struct InputFormArg
|
||||
{
|
||||
uint32_t unk_0x00 = 1;
|
||||
int32_t unk_0x04 = -1;
|
||||
uint32_t unk_0x08 = 0;
|
||||
uint32_t unk_0x0C = 0;
|
||||
int32_t maxTextLength = -1;
|
||||
uint32_t unk_0x14 = 0;
|
||||
uint32_t unk_0x18 = 0;
|
||||
bool unk_0x1C = false;
|
||||
bool unk_0x1D = false;
|
||||
bool unk_0x1E = false;
|
||||
PADDING(1);
|
||||
};
|
||||
CHECK_OFFSET(InputFormArg, unk_0x00, 0x00);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x04, 0x04);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x08, 0x08);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x0C, 0x0C);
|
||||
CHECK_OFFSET(InputFormArg, maxTextLength, 0x10);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x14, 0x14);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x18, 0x18);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x1C, 0x1C);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x1D, 0x1D);
|
||||
CHECK_OFFSET(InputFormArg, unk_0x1E, 0x1E);
|
||||
CHECK_SIZE(InputFormArg, 0x20);
|
||||
|
||||
struct AppearArg
|
||||
{
|
||||
KeyboardArg keyboardArg;
|
||||
InputFormArg inputFormArg;
|
||||
};
|
||||
CHECK_SIZE(AppearArg, 0xE0);
|
||||
|
||||
struct CreateArg
|
||||
{
|
||||
void *workMemory = nullptr;
|
||||
RegionType regionType = RegionType::Europe;
|
||||
uint32_t unk_0x08 = 0;
|
||||
FSClient *fsClient = nullptr;
|
||||
};
|
||||
CHECK_OFFSET(CreateArg, 0x00, workMemory);
|
||||
CHECK_OFFSET(CreateArg, 0x04, regionType);
|
||||
CHECK_OFFSET(CreateArg, 0x08, unk_0x08);
|
||||
CHECK_OFFSET(CreateArg, 0x0C, fsClient);
|
||||
CHECK_SIZE(CreateArg, 0x10);
|
||||
|
||||
struct ControllerInfo
|
||||
{
|
||||
VPADStatus *vpad = nullptr;
|
||||
KPADStatus *kpad[4] = { nullptr, nullptr, nullptr, nullptr };
|
||||
};
|
||||
CHECK_OFFSET(ControllerInfo, 0x00, vpad);
|
||||
CHECK_OFFSET(ControllerInfo, 0x04, kpad);
|
||||
CHECK_SIZE(ControllerInfo, 0x14);
|
||||
|
||||
struct DrawStringInfo
|
||||
{
|
||||
DrawStringInfo()
|
||||
{
|
||||
memset(this, 0, sizeof(*this));
|
||||
}
|
||||
|
||||
UNKNOWN(0x1C);
|
||||
};
|
||||
CHECK_SIZE(DrawStringInfo, 0x1C);
|
||||
|
||||
struct KeyboardCondition
|
||||
{
|
||||
uint32_t unk_0x00 = 0;
|
||||
uint32_t unk_0x04 = 0;
|
||||
};
|
||||
CHECK_OFFSET(KeyboardCondition, unk_0x00, 0x00);
|
||||
CHECK_OFFSET(KeyboardCondition, unk_0x04, 0x04);
|
||||
CHECK_SIZE(KeyboardCondition, 0x8);
|
||||
|
||||
struct IEventReceiver;
|
||||
struct IControllerEventObj;
|
||||
struct ISoundObj;
|
||||
|
||||
bool
|
||||
AppearInputForm(const AppearArg& args);
|
||||
|
||||
bool
|
||||
AppearKeyboard(const KeyboardArg& args);
|
||||
|
||||
void
|
||||
CalcSubThreadFont();
|
||||
|
||||
void
|
||||
CalcSubThreadPredict();
|
||||
|
||||
void
|
||||
Calc(const ControllerInfo &controllerInfo);
|
||||
|
||||
void
|
||||
ConfirmUnfixAll();
|
||||
|
||||
bool
|
||||
Create(const CreateArg &args);
|
||||
|
||||
void
|
||||
Destroy();
|
||||
|
||||
bool
|
||||
DisappearInputForm();
|
||||
|
||||
bool
|
||||
DisappearKeyboard();
|
||||
|
||||
void
|
||||
DrawDRC();
|
||||
|
||||
void
|
||||
DrawTV();
|
||||
|
||||
void
|
||||
GetDrawStringInfo(DrawStringInfo *drawStringInfo);
|
||||
|
||||
const char16_t *
|
||||
GetInputFormString();
|
||||
|
||||
void
|
||||
GetKeyboardCondition(KeyboardCondition *keyboardCondition);
|
||||
|
||||
State
|
||||
GetStateInputForm();
|
||||
|
||||
State
|
||||
GetStateKeyboard();
|
||||
|
||||
uint32_t
|
||||
GetWorkMemorySize(uint32_t unk);
|
||||
|
||||
void
|
||||
InactivateSelectCursor();
|
||||
|
||||
|
||||
bool
|
||||
InitLearnDic(void *dictionary);
|
||||
|
||||
bool
|
||||
IsCoveredWithSubWindow();
|
||||
|
||||
bool
|
||||
IsDecideCancelButton(bool *outIsSelected);
|
||||
|
||||
bool
|
||||
IsDecideOkButton(bool *outIsSelected);
|
||||
|
||||
bool
|
||||
IsKeyboardTarget(IEventReceiver *eventReceiver);
|
||||
|
||||
bool
|
||||
IsNeedCalcSubThreadFont();
|
||||
|
||||
bool
|
||||
IsNeedCalcSubThreadPredict();
|
||||
|
||||
bool
|
||||
IsSelectCursorActive();
|
||||
|
||||
void
|
||||
MuteAllSound(bool muted);
|
||||
|
||||
void
|
||||
SetControllerRemo(ControllerType type);
|
||||
|
||||
void
|
||||
SetCursorPos(int);
|
||||
|
||||
void
|
||||
SetEnableOkButton(bool);
|
||||
|
||||
void
|
||||
SetInputFormString(const char16_t *str);
|
||||
|
||||
void
|
||||
SetReceiver(const ReceiverArg &receiver);
|
||||
|
||||
void
|
||||
SetSelectFrom(int);
|
||||
|
||||
void
|
||||
SetUserControllerEventObj(IControllerEventObj *controllerEventObj);
|
||||
|
||||
void
|
||||
SetUserSoundObj(ISoundObj *soundObj);
|
||||
|
||||
} // namespace swkbd
|
||||
} // namespace nn
|
||||
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
/** @} */
|
58
include/swkbd/rpl_interface.h
Normal file
58
include/swkbd/rpl_interface.h
Normal file
@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include <wut.h>
|
||||
#include <nn/swkbd.h>
|
||||
|
||||
/**
|
||||
* \defgroup swkbd SYSAPP Launch
|
||||
* \ingroup swkbd
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace Rpl
|
||||
{
|
||||
|
||||
bool SwkbdAppearInputForm(const nn::swkbd::AppearArg &appearArg);
|
||||
bool SwkbdAppearKeyboard(const nn::swkbd::KeyboardArg &keyboardArg);
|
||||
void SwkbdCalcSubThreadFont();
|
||||
void SwkbdCalcSubThreadPredict();
|
||||
void SwkbdCalc(const nn::swkbd::ControllerInfo &controllerInfo);
|
||||
void SwkbdConfirmUnfixAll();
|
||||
void SwkbdCreate(void *buffer, nn::swkbd::RegionType regionType,
|
||||
uint32_t unk, FSClient *fsClient);
|
||||
void SwkbdDestroy();
|
||||
bool SwkbdDisappearInputForm();
|
||||
bool SwkbdDisappearKeyboard();
|
||||
void SwkbdDrawDRC();
|
||||
void SwkbdDrawTV();
|
||||
void SwkbdGetDrawStringInfo(nn::swkbd::DrawStringInfo *drawStringInfo);
|
||||
const char16_t *SwkbdGetInputFormString();
|
||||
void SwkbdGetKeyboardCondition(nn::swkbd::KeyboardCondition *keyboardCondition);
|
||||
nn::swkbd::State SwkbdGetStateInputForm();
|
||||
nn::swkbd::State SwkbdGetStateKeyboard();
|
||||
void SwkbdInactivateSelectCursor();
|
||||
bool SwkbdInitLearnDic(void *buffer);
|
||||
bool SwkbdIsCoveredWithSubWindow();
|
||||
bool SwkbdIsDecideCancelButton(bool *outIsSelectCursor);
|
||||
bool SwkbdIsDecideOkButton(bool *outIsSelectCursor);
|
||||
bool SwkbdIsKeyboardTarget(nn::swkbd::IEventReceiver *eventReceiver);
|
||||
bool SwkbdIsNeedCalcSubThreadFont();
|
||||
bool SwkbdIsNeedCalcSubThreadPredict();
|
||||
bool SwkbdIsSelectCursorActive();
|
||||
void SwkbdMuteAllSound(bool muted);
|
||||
void SwkbdSetControllerRemo(nn::swkbd::ControllerType type);
|
||||
void SwkbdSetCursorPos(int pos);
|
||||
void SwkbdSetEnableOkButton(bool enable);
|
||||
void SwkbdSetInputFormString(const char16_t *str);
|
||||
void SwkbdSetReceiver(const nn::swkbd::ReceiverArg &receiver);
|
||||
void SwkbdSetSelectFrom(int from);
|
||||
void SwkbdSetUserControllerEventObj(nn::swkbd::IControllerEventObj *userControllerEventObj);
|
||||
void SwkbdSetUserSoundObj(nn::swkbd::ISoundObj *userSoundObj);
|
||||
void SwkbdSetVersion(int version);
|
||||
|
||||
}
|
||||
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
/** @} */
|
5
include/swkbd/swkbd.dox
Normal file
5
include/swkbd/swkbd.dox
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* \defgroup swkbd swkbd
|
||||
*
|
||||
* Software Keyboard library.
|
||||
*/
|
@ -3,6 +3,7 @@ project(libraries C)
|
||||
|
||||
add_subdirectory(libgfd)
|
||||
add_subdirectory(libwhb)
|
||||
add_subdirectory(nn_swkbd)
|
||||
add_subdirectory(wutcrt)
|
||||
add_subdirectory(wutdevoptab)
|
||||
add_subdirectory(wutnewlib)
|
||||
|
14
libraries/nn_swkbd/CMakeLists.txt
Normal file
14
libraries/nn_swkbd/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(nn_swkbd CXX)
|
||||
|
||||
add_library(nn_swkbd
|
||||
nn_swkbd.cpp)
|
||||
|
||||
target_include_directories(nn_swkbd
|
||||
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${WUT_ROOT}/include")
|
||||
|
||||
install(TARGETS nn_swkbd
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||
FILES_MATCHING PATTERN "*.h*")
|
488
libraries/nn_swkbd/nn_swkbd.cpp
Normal file
488
libraries/nn_swkbd/nn_swkbd.cpp
Normal file
@ -0,0 +1,488 @@
|
||||
#include <coreinit/debug.h>
|
||||
#include <coreinit/dynload.h>
|
||||
#include <coreinit/memexpheap.h>
|
||||
#include <nn/swkbd.h>
|
||||
#include <swkbd/rpl_interface.h>
|
||||
|
||||
namespace nn
|
||||
{
|
||||
namespace swkbd
|
||||
{
|
||||
|
||||
static const uint32_t sRplAcquireBufferSize = 0x380000;
|
||||
|
||||
static MEMHeapHandle sHeapHandle = NULL;
|
||||
static OSDynLoad_Module sModuleHandle = NULL;
|
||||
|
||||
static void *sAppearInputForm = NULL;
|
||||
static void *sAppearKeyboard = NULL;
|
||||
static void *sCalcSubThreadFont = NULL;
|
||||
static void *sCalcSubThreadPredict = NULL;
|
||||
static void *sCalc = NULL;
|
||||
static void *sConfirmUnfixAll = NULL;
|
||||
static void *sCreate = NULL;
|
||||
static void *sDestroy = NULL;
|
||||
static void *sDisappearInputForm = NULL;
|
||||
static void *sDisappearKeyboard = NULL;
|
||||
static void *sDrawDRC = NULL;
|
||||
static void *sDrawTV = NULL;
|
||||
static void *sGetDrawStringInfo = NULL;
|
||||
static void *sGetInputFormString = NULL;
|
||||
static void *sGetKeyboardCondition = NULL;
|
||||
static void *sGetStateInputForm = NULL;
|
||||
static void *sGetStateKeyboard = NULL;
|
||||
static void *sInactivateSelectCursor = NULL;
|
||||
static void *sInitLearnDic = NULL;
|
||||
static void *sIsCoveredWithSubWindow = NULL;
|
||||
static void *sIsDecideCancelButton = NULL;
|
||||
static void *sIsDecideOkButton = NULL;
|
||||
static void *sIsKeyboardTarget = NULL;
|
||||
static void *sIsNeedCalcSubThreadFont = NULL;
|
||||
static void *sIsNeedCalcSubThreadPredict = NULL;
|
||||
static void *sIsSelectCursorActive = NULL;
|
||||
static void *sMuteAllSound = NULL;
|
||||
static void *sSetControllerRemo = NULL;
|
||||
static void *sSetCursorPos = NULL;
|
||||
static void *sSetEnableOkButton = NULL;
|
||||
static void *sSetInputFormString = NULL;
|
||||
static void *sSetReceiver = NULL;
|
||||
static void *sSetSelectFrom = NULL;
|
||||
static void *sSetUserControllerEventObj = NULL;
|
||||
static void *sSetUserSoundObj = NULL;
|
||||
static void *sSetVersion = NULL;
|
||||
|
||||
static OSDynLoad_Error
|
||||
allocForDynLoad(int32_t size,
|
||||
int32_t align,
|
||||
void **outAddr)
|
||||
{
|
||||
void *addr = MEMAllocFromExpHeapEx(sHeapHandle, size, align);
|
||||
if (!addr) {
|
||||
return OS_DYNLOAD_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*outAddr = addr;
|
||||
return OS_DYNLOAD_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
freeForDynLoad(void *addr)
|
||||
{
|
||||
MEMFreeToExpHeap(sHeapHandle, addr);
|
||||
}
|
||||
|
||||
static void
|
||||
Create(void *buffer,
|
||||
nn::swkbd::RegionType regionType,
|
||||
uint32_t unk,
|
||||
FSClient *fsClient)
|
||||
{
|
||||
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdCreate)>(sCreate)(
|
||||
buffer, regionType, unk, fsClient);
|
||||
}
|
||||
|
||||
static void
|
||||
SetVersion(int version)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetVersion)>(sSetVersion)(
|
||||
version);
|
||||
}
|
||||
|
||||
bool
|
||||
Create(const CreateArg &args)
|
||||
{
|
||||
OSDynLoadAllocFn prevDynLoadAlloc = NULL;
|
||||
OSDynLoadFreeFn prevDynLoadFree = NULL;
|
||||
uint32_t dynloadAcquireUseSize = 0;
|
||||
void *workMemory = NULL;
|
||||
bool result = true;
|
||||
|
||||
if (!args.workMemory) {
|
||||
OSReport("SWKBD: Create failed. CreateArg.workMemory is NULL.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!args.fsClient) {
|
||||
OSReport("SWKBD: Create failed. CreateArg.fsClient is NULL.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create work memory heap
|
||||
sHeapHandle = MEMCreateExpHeapEx(args.workMemory,
|
||||
GetWorkMemorySize(args.unk_0x08),
|
||||
0);
|
||||
|
||||
// Save the old DynLoad allocator functions
|
||||
OSDynLoad_GetAllocator(&prevDynLoadAlloc, &prevDynLoadFree);
|
||||
|
||||
// Set new DynLoad allocator functions
|
||||
OSDynLoad_SetAllocator(allocForDynLoad, freeForDynLoad);
|
||||
|
||||
if (OSDynLoad_Error error = OSDynLoad_Acquire("swkbd.rpl", &sModuleHandle)) {
|
||||
OSReport("SWKBD: Create failed. OSDynLoad_Acquire() return error(%d).\n",
|
||||
error);
|
||||
result = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
dynloadAcquireUseSize = GetWorkMemorySize(args.unk_0x08) -
|
||||
MEMGetAllocatableSizeForExpHeapEx(sHeapHandle, 4);
|
||||
OSReport("SWKBD: OSDynLoad_Acquire() use [%d/%d]\n",
|
||||
dynloadAcquireUseSize, sRplAcquireBufferSize);
|
||||
|
||||
if (dynloadAcquireUseSize > sRplAcquireBufferSize) {
|
||||
OSReport("SWKBD: Create failed. dynload_acquire_use_size > sRplAcquireBufferSize.");
|
||||
result = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdAppearInputForm__3RplFRCQ3_2nn5swkbd9AppearArg", &sAppearInputForm);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdAppearKeyboard__3RplFRCQ3_2nn5swkbd11KeyboardArg", &sAppearKeyboard);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdCalcSubThreadFont__3RplFv", &sCalcSubThreadFont);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdCalcSubThreadPredict__3RplFv", &sCalcSubThreadPredict);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdCalc__3RplFRCQ3_2nn5swkbd14ControllerInfo", &sCalc);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdConfirmUnfixAll__3RplFv", &sConfirmUnfixAll);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdCreate__3RplFPUcQ3_2nn5swkbd10RegionTypeUiP8FSClient", &sCreate);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdDestroy__3RplFv", &sDestroy);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdDisappearInputForm__3RplFv", &sDisappearInputForm);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdDisappearKeyboard__3RplFv", &sDisappearKeyboard);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdDrawDRC__3RplFv", &sDrawDRC);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdDrawTV__3RplFv", &sDrawTV);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdGetDrawStringInfo__3RplFPQ3_2nn5swkbd14DrawStringInfo", &sGetDrawStringInfo);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdGetInputFormString__3RplFv", &sGetInputFormString);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdGetKeyboardCondition__3RplFPQ3_2nn5swkbd17KeyboardCondition", &sGetKeyboardCondition);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdGetStateInputForm__3RplFv", &sGetStateInputForm);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdGetStateKeyboard__3RplFv", &sGetStateKeyboard);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdInactivateSelectCursor__3RplFv", &sInactivateSelectCursor);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdInitLearnDic__3RplFPv", &sInitLearnDic);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsCoveredWithSubWindow__3RplFv", &sIsCoveredWithSubWindow);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsDecideCancelButton__3RplFPb", &sIsDecideCancelButton);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsDecideOkButton__3RplFPb", &sIsDecideOkButton);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsKeyboardTarget__3RplFPQ3_2nn5swkbd14IEventReceiver", &sIsKeyboardTarget);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsNeedCalcSubThreadFont__3RplFv", &sIsNeedCalcSubThreadFont);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsNeedCalcSubThreadPredict__3RplFv", &sIsNeedCalcSubThreadPredict);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdIsSelectCursorActive__3RplFv", &sIsSelectCursorActive);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdMuteAllSound__3RplFb", &sMuteAllSound);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetControllerRemo__3RplFQ3_2nn5swkbd14ControllerType", &sSetControllerRemo);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetCursorPos__3RplFi", &sSetCursorPos);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetEnableOkButton__3RplFb", &sSetEnableOkButton);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetInputFormString__3RplFPCw", &sSetInputFormString);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetReceiver__3RplFRCQ3_2nn5swkbd11ReceiverArg", &sSetReceiver);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetSelectFrom__3RplFi", &sSetSelectFrom);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetUserControllerEventObj__3RplFPQ3_2nn5swkbd19IControllerEventObj", &sSetUserControllerEventObj);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetUserSoundObj__3RplFPQ3_2nn5swkbd9ISoundObj", &sSetUserSoundObj);
|
||||
OSDynLoad_FindExport(sModuleHandle, FALSE, "SwkbdSetVersion__3RplFi", &sSetVersion);
|
||||
|
||||
workMemory = MEMAllocFromExpHeapEx(sHeapHandle,
|
||||
GetWorkMemorySize(args.unk_0x08) - sRplAcquireBufferSize,
|
||||
4);
|
||||
if (!workMemory) {
|
||||
OSReport("SWKBD: Create failed. framework_buffer == NULL.");
|
||||
result = false;
|
||||
goto out;
|
||||
} else {
|
||||
SetVersion(3);
|
||||
Create(workMemory, args.regionType, args.unk_0x08, args.fsClient);
|
||||
result = true;
|
||||
}
|
||||
|
||||
out:
|
||||
if (!result) {
|
||||
MEMDestroyExpHeap(sHeapHandle);
|
||||
}
|
||||
|
||||
OSDynLoad_SetAllocator(prevDynLoadAlloc, prevDynLoadFree);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool
|
||||
AppearInputForm(const AppearArg& args)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdAppearInputForm)>
|
||||
(sAppearInputForm)
|
||||
(args);
|
||||
}
|
||||
|
||||
bool
|
||||
AppearKeyboard(const KeyboardArg& args)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdAppearKeyboard)>
|
||||
(sAppearKeyboard)
|
||||
(args);
|
||||
}
|
||||
|
||||
void
|
||||
CalcSubThreadFont()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdCalcSubThreadFont)>
|
||||
(sCalcSubThreadFont)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
CalcSubThreadPredict()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdCalcSubThreadPredict)>
|
||||
(sCalcSubThreadPredict)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
Calc(const ControllerInfo &controllerInfo)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdCalc)>
|
||||
(sCalc)
|
||||
(controllerInfo);
|
||||
}
|
||||
|
||||
void
|
||||
ConfirmUnfixAll()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdConfirmUnfixAll)>
|
||||
(sConfirmUnfixAll)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
Destroy()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdDestroy)>
|
||||
(sDestroy)
|
||||
();
|
||||
}
|
||||
|
||||
bool
|
||||
DisappearInputForm()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdDisappearInputForm)>
|
||||
(sDisappearInputForm)
|
||||
();
|
||||
}
|
||||
|
||||
bool
|
||||
DisappearKeyboard()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdDisappearKeyboard)>
|
||||
(sDisappearKeyboard)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
DrawDRC()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdDrawDRC)>
|
||||
(sDrawDRC)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
DrawTV()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdDrawTV)>
|
||||
(sDrawTV)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
GetDrawStringInfo(DrawStringInfo *drawStringInfo)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdGetDrawStringInfo)>
|
||||
(sGetDrawStringInfo)
|
||||
(drawStringInfo);
|
||||
}
|
||||
|
||||
const char16_t *
|
||||
GetInputFormString()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdGetInputFormString)>
|
||||
(sGetInputFormString)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
GetKeyboardCondition(KeyboardCondition *keyboardCondition)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdGetKeyboardCondition)>
|
||||
(sGetKeyboardCondition)
|
||||
(keyboardCondition);
|
||||
}
|
||||
|
||||
State
|
||||
GetStateInputForm()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdGetStateInputForm)>
|
||||
(sGetStateInputForm)
|
||||
();
|
||||
}
|
||||
|
||||
State
|
||||
GetStateKeyboard()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdGetStateKeyboard)>
|
||||
(sGetStateKeyboard)
|
||||
();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetWorkMemorySize(uint32_t unk)
|
||||
{
|
||||
uint32_t size = 0;
|
||||
|
||||
if (size & 1) {
|
||||
size = 0xA0000;
|
||||
}
|
||||
|
||||
if (size & 2) {
|
||||
size += 0x120000;
|
||||
}
|
||||
|
||||
return 0x1980000 - size;
|
||||
}
|
||||
|
||||
void
|
||||
InactivateSelectCursor()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdInactivateSelectCursor)>
|
||||
(sInactivateSelectCursor)
|
||||
();
|
||||
}
|
||||
|
||||
bool
|
||||
InitLearnDic(void *dictionary)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdInitLearnDic)>
|
||||
(sInitLearnDic)
|
||||
(dictionary);
|
||||
}
|
||||
|
||||
bool
|
||||
IsCoveredWithSubWindow()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsCoveredWithSubWindow)>
|
||||
(sIsCoveredWithSubWindow)
|
||||
();
|
||||
}
|
||||
|
||||
bool
|
||||
IsDecideCancelButton(bool *outIsSelected)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsDecideCancelButton)>
|
||||
(sIsDecideCancelButton)
|
||||
(outIsSelected);
|
||||
}
|
||||
|
||||
bool
|
||||
IsDecideOkButton(bool *outIsSelected)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsDecideOkButton)>
|
||||
(sIsDecideOkButton)
|
||||
(outIsSelected);
|
||||
}
|
||||
|
||||
bool
|
||||
IsKeyboardTarget(IEventReceiver *eventReceiver)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsKeyboardTarget)>
|
||||
(sIsKeyboardTarget)
|
||||
(eventReceiver);
|
||||
}
|
||||
|
||||
bool
|
||||
IsNeedCalcSubThreadFont()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsNeedCalcSubThreadFont)>
|
||||
(sIsNeedCalcSubThreadFont)
|
||||
();
|
||||
}
|
||||
|
||||
bool
|
||||
IsNeedCalcSubThreadPredict()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsNeedCalcSubThreadPredict)>
|
||||
(sIsNeedCalcSubThreadPredict)
|
||||
();
|
||||
}
|
||||
|
||||
bool
|
||||
IsSelectCursorActive()
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdIsSelectCursorActive)>
|
||||
(sIsSelectCursorActive)
|
||||
();
|
||||
}
|
||||
|
||||
void
|
||||
MuteAllSound(bool muted)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdMuteAllSound)>
|
||||
(sMuteAllSound)
|
||||
(muted);
|
||||
}
|
||||
|
||||
void
|
||||
SetControllerRemo(ControllerType type)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetControllerRemo)>
|
||||
(sSetControllerRemo)
|
||||
(type);
|
||||
}
|
||||
|
||||
void
|
||||
SetCursorPos(int pos)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetCursorPos)>
|
||||
(sSetCursorPos)
|
||||
(pos);
|
||||
}
|
||||
|
||||
void
|
||||
SetEnableOkButton(bool enable)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetEnableOkButton)>
|
||||
(sSetEnableOkButton)
|
||||
(enable);
|
||||
}
|
||||
|
||||
void
|
||||
SetInputFormString(const char16_t *str)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetInputFormString)>
|
||||
(sSetInputFormString)
|
||||
(str);
|
||||
}
|
||||
|
||||
void
|
||||
SetReceiver(const ReceiverArg &receiver)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetReceiver)>
|
||||
(sSetReceiver)
|
||||
(receiver);
|
||||
}
|
||||
|
||||
void
|
||||
SetSelectFrom(int from)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetSelectFrom)>
|
||||
(sSetSelectFrom)
|
||||
(from);
|
||||
}
|
||||
|
||||
void
|
||||
SetUserControllerEventObj(IControllerEventObj *controllerEventObj)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetUserControllerEventObj)>
|
||||
(sSetUserControllerEventObj)
|
||||
(controllerEventObj);
|
||||
}
|
||||
|
||||
void
|
||||
SetUserSoundObj(ISoundObj *soundObj)
|
||||
{
|
||||
return reinterpret_cast<decltype(&Rpl::SwkbdSetUserSoundObj)>
|
||||
(sSetUserSoundObj)
|
||||
(soundObj);
|
||||
}
|
||||
|
||||
} // namespace swkbd
|
||||
} // namespace nn
|
Loading…
Reference in New Issue
Block a user