Skip to content

swkbd: Add support for multiple FW versions#62

Open
german77 wants to merge 3 commits intoopen-ead:masterfrom
german77:swkbd
Open

swkbd: Add support for multiple FW versions#62
german77 wants to merge 3 commits intoopen-ead:masterfrom
german77:swkbd

Conversation

@german77
Copy link
Copy Markdown

@german77 german77 commented Apr 10, 2026

Add headers for all swkbd revisions from 0x5 up to 0x8000D or firmware 0 to 16.

Apparently there's a new revision in fw 19 but I don't have anything higher than fw 16 to validate against. NN_SDK_VER is null if the target definition is set to private for whatever reason on SMO. If anyone has an actual understanding on how that works you are welcome.

closes #50


This change is Reviewable

Copy link
Copy Markdown

@Fuzzy2319 Fuzzy2319 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fuzzy2319 reviewed 1 file and all commit messages, and made 7 comments.
Reviewable status: 1 of 3 files reviewed, 7 unresolved discussions (waiting on german77).


include/nn/applet.h line 5 at r1 (raw file):

namespace nn::applet {
enum class ExitReason { Normal = 0, Canceled = 1, Abnormal = 2, Unexpected = 10 };
typedef int LibraryAppletHandle;

please use using instead of typedef

suggestion:

using LibraryAppletHandle = s32;

include/nn/swkbd/swkbd.h line 121 at r1 (raw file):

    bool isUseUtf8;
    bool isUseBlurBackground;
    int initialStringOffset;

please use s32 instead of int


include/nn/swkbd/swkbd.h line 186 at r1 (raw file):

};

typedef TextCheckResult (*TextCheckCb)(void*, ulong*, String*);

suggestion:

using TextCheckCb = TextCheckResult (*)(void*, ulong*, String*);

include/nn/swkbd/swkbd.h line 197 at r1 (raw file):

Result GetInteractiveOutStorageCallback(nn::applet::LibraryAppletHandle, String*,
                                        const ShowKeyboardArg&);
ulong GetRequiredTextCheckWorkBufferSize();

Shouldn't this one return a size_t instead?


include/nn/swkbd/swkbd.h line 221 at r1 (raw file):

ulong GetRequiredWorkBufferSize(bool);

#if NN_SDK_VER >= NN_MAKE_VER(1, 0, 0) && NN_SDK_VER < NN_MAKE_VER(2, 0, 0)

This function is listed in SMO's sdk which use NN_SDK_VER 3.5.1


include/nn/swkbd/swkbd.h line 226 at r1 (raw file):

#if NN_SDK_VER >= NN_MAKE_VER(3, 0, 0)
ulong GetRequiredWorkBufferSize();

This function doesn't exist in SMO's sdk


include/nn/swkbd/swkbd.h line 256 at r1 (raw file):

#if NN_SDK_VER < NN_MAKE_VER(4, 0, 0)
nn::applet::ExitReason GetExitReason();

For some reason this one start with g instead of G

suggestion:

nn::applet::ExitReason getExitReason();

Copy link
Copy Markdown
Author

@german77 german77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@german77 made 7 comments.
Reviewable status: 1 of 3 files reviewed, 7 unresolved discussions (waiting on Fuzzy2319).


include/nn/applet.h line 5 at r1 (raw file):

Previously, Fuzzy2319 wrote…

please use using instead of typedef

suggestion:

using LibraryAppletHandle = s32;

Done.


include/nn/swkbd/swkbd.h line 121 at r1 (raw file):

Previously, Fuzzy2319 wrote…

please use s32 instead of int

Done.


include/nn/swkbd/swkbd.h line 186 at r1 (raw file):

Previously, Fuzzy2319 wrote…

suggestion:

using TextCheckCb = TextCheckResult (*)(void*, ulong*, String*);

Done.


include/nn/swkbd/swkbd.h line 197 at r1 (raw file):

Previously, Fuzzy2319 wrote…

Shouldn't this one return a size_t instead?

Done.


include/nn/swkbd/swkbd.h line 221 at r1 (raw file):

Previously, Fuzzy2319 wrote…

This function is listed in SMO's sdk which use NN_SDK_VER 3.5.1

Done. Fun this function moved places


include/nn/swkbd/swkbd.h line 226 at r1 (raw file):

Previously, Fuzzy2319 wrote…

This function doesn't exist in SMO's sdk

Done. I confused GetRequiredWorkBufferSize with GetRequiredStringBufferSize


include/nn/swkbd/swkbd.h line 256 at r1 (raw file):

Previously, Fuzzy2319 wrote…

For some reason this one start with g instead of G

suggestion:

nn::applet::ExitReason getExitReason();

Done.

Copy link
Copy Markdown

@Fuzzy2319 Fuzzy2319 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fuzzy2319 reviewed all commit messages, made 1 comment, and resolved 6 discussions.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on german77).


include/nn/applet.h line 5 at r1 (raw file):

Previously, german77 (Narr the Reg) wrote…

Done.

Forgot what I said LibraryAppletHandle is a struct because it appear in the mangled name of _ZN2nn5swkbd24ReadCloseResultAndStringENS_6applet19LibraryAppletHandleEPNS0_11CloseResultEPNS0_6StringE and with a using or a typedef it will mangle like this _ZN2nn5swkbd24ReadCloseResultAndStringEiEPNS0_11CloseResultEPNS0_6StringE https://godbolt.org/z/f7jqcd98Y

Copy link
Copy Markdown
Author

@german77 german77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@german77 made 1 comment.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on Fuzzy2319).


include/nn/applet.h line 5 at r1 (raw file):

Previously, Fuzzy2319 wrote…

Forgot what I said LibraryAppletHandle is a struct because it appear in the mangled name of _ZN2nn5swkbd24ReadCloseResultAndStringENS_6applet19LibraryAppletHandleEPNS0_11CloseResultEPNS0_6StringE and with a using or a typedef it will mangle like this _ZN2nn5swkbd24ReadCloseResultAndStringEiEPNS0_11CloseResultEPNS0_6StringE https://godbolt.org/z/f7jqcd98Y

Done. I always forget who is an alias and who overrides the type. Thanks for checking. The handle is indeed a struct but handles are only a number in the client side.

Copy link
Copy Markdown

@Fuzzy2319 Fuzzy2319 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fuzzy2319 reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on german77).


include/nn/applet.h line 5 at r1 (raw file):

Previously, german77 (Narr the Reg) wrote…

Done. I always forget who is an alias and who overrides the type. Thanks for checking. The handle is indeed a struct but handles are only a number in the client side.

Something happend on this file it was rolled back.

Copy link
Copy Markdown
Author

@german77 german77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@german77 made 1 comment.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on Fuzzy2319).


include/nn/applet.h line 5 at r1 (raw file):

Previously, Fuzzy2319 wrote…

Something happend on this file it was rolled back.

Not sure why it rolled back but I did a bit of research. This struct contains a service handle, applet id, applet mode, exit event, exit reason, indirect layer consumer handle along with other status flags.
I only have the locations but not the actual type so I decided to stub these for now.

Copy link
Copy Markdown

@Fuzzy2319 Fuzzy2319 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@Fuzzy2319 reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on german77).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShowKeyboardArg size mismatch

2 participants