Add nn::swkbd library.

This commit is contained in:
James Benton
2018-06-13 12:12:22 +01:00
parent 9beff5dd0b
commit 75784dbb52
7 changed files with 869 additions and 0 deletions

7
include/nn/swkbd.h Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
/**
* \defgroup nn_swkbd Software Keyboard
*/
#include <nn/swkbd/swkbd_cpp.h>

View 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
/** @} */

View 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
View File

@@ -0,0 +1,5 @@
/**
* \defgroup swkbd swkbd
*
* Software Keyboard library.
*/