OdysseyDecomp icon indicating copy to clipboard operation
OdysseyDecomp copied to clipboard

ApplicationMessageReceiver functions

Open Fuzzy2319 opened this issue 1 year ago • 3 comments

this pr adds ApplicationMessageReceiver definition and it's implementation


This change is Reviewable

Fuzzy2319 avatar Apr 23 '24 19:04 Fuzzy2319

lib/al/include/Library/Application/ApplicationMessageReceiver.h line 19 at r1 (raw file):

    nn::oe::OperationMode getOperationMode() const;
    nn::oe::PerformanceMode getPerformaceMode() const;

I think they just return bools, or do you have reason to assume otherwise?

Code quote:

    nn::oe::OperationMode getOperationMode() const;
    nn::oe::PerformanceMode getPerformaceMode() const;

I tried with bool as return type but I never manage to get them matching so I tried to change the return type and I discover they get inlined inside the init function. image image

Fuzzy2319 avatar Apr 25 '24 21:04 Fuzzy2319

lib/al/include/Library/Application/ApplicationMessageReceiver.h line 11 at r1 (raw file):

    NotificationMessage_PerformanceModeChanged = 0x1f
};  // should go into oe.h
}  // namespace nn::oe

This should go into the nnheaders project itself, to avoid defining it twice when it gets added there. Feel free to PR it there yourself, or tell me and I'll try getting this into there.

Also, taking a deep dive through Atmosphere and libnx, I think the full list of message codes is defined here: https://switchbrew.org/wiki/Applet_Manager_services#AppletMessage https://github.com/switchbrew/libnx/blob/master/nx/include/switch/services/applet.h#L53-L64

Code quote:

namespace nn::oe {
enum NotificationMessage {
    NotificationMessage_FocusStateChanged = 0xf,  // not sure
    NotificationMessage_OperationModeChanged = 0x1e,
    NotificationMessage_PerformanceModeChanged = 0x1f
};  // should go into oe.h
}  // namespace nn::oe

lib/al/src/Library/Application/ApplicationMessageReceiver.cpp line 40 at r1 (raw file):

    nn::oe::SetOperationModeChangedNotificationEnabled(true);
    nn::oe::SetPerformanceModeChangedNotificationEnabled(true);
    nn::oe::SetFocusHandlingMode(3);  // enum?

Definitely an enum, it is even included in the function signature (nn::oe::FocusHandlingMode).

See libnx: https://github.com/switchbrew/libnx/blob/master/nx/include/switch/services/applet.h#L73-L81

I will be busy for the rest of the week so I will try to make the PR next week or you can do it if you have time by the end of the week :)

Fuzzy2319 avatar Apr 25 '24 22:04 Fuzzy2319

https://github.com/open-ead/nnheaders/pull/29

This has been merged since, feel free to update nnheaders in this PR!

MonsterDruide1 avatar May 08 '24 17:05 MonsterDruide1

@MonsterDruide1 I pushed the changes

Fuzzy2319 avatar May 15 '24 20:05 Fuzzy2319