diff --git a/include/server/Client.hpp b/include/server/Client.hpp index fb63593..7d3d898 100644 --- a/include/server/Client.hpp +++ b/include/server/Client.hpp @@ -16,6 +16,7 @@ #include "al/LiveActor/LiveActor.h" #include "al/layout/LayoutInitInfo.h" #include "al/layout/SimpleLayoutAppearWaitEnd.h" +#include "al/layout/WindowConfirmWait.h" #include "al/util.hpp" #include "al/layout/LayoutActor.h" #include "al/gamepad/util.h" @@ -173,6 +174,9 @@ class Client { static bool openKeyboardIP(); static bool openKeyboardPort(); + static void showUIMessage(const char16_t* msg); + static void hideUIMessage(); + void resetCollectedShines(); void removeShine(int shineId); @@ -232,7 +236,7 @@ class Client { bool mIsFirstConnect = true; // --- Game Layouts --- - + al::WindowConfirmWait* mUIMessage; al::SimpleLayoutAppearWaitEnd *mConnectStatus; // --- Game Info --- diff --git a/source/server/Client.cpp b/source/server/Client.cpp index a53fcda..207adcf 100644 --- a/source/server/Client.cpp +++ b/source/server/Client.cpp @@ -72,10 +72,13 @@ Client::Client() { void Client::init(al::LayoutInitInfo const &initInfo, GameDataHolderAccessor holder) { mConnectStatus = new (mHeap) al::SimpleLayoutAppearWaitEnd("", "SaveMessage", initInfo, 0, false); - al::setPaneString(mConnectStatus, "TxtSave", u"Connecting to Server.", 0); al::setPaneString(mConnectStatus, "TxtSaveSh", u"Connecting to Server.", 0); + mUIMessage = new (mHeap) al::WindowConfirmWait("ServerWaitConnect", "WindowConfirmWait", initInfo); + mUIMessage->setTxtMessage(u"a"); + mUIMessage->setTxtMessageConfirm(u"b"); + mHolder = holder; startThread(); @@ -250,6 +253,33 @@ bool Client::openKeyboardPort() { return isFirstConnect; } + +void Client::showUIMessage(const char16_t* msg) { + if (!sInstance) { + return; + } + + sInstance->mUIMessage->setTxtMessageConfirm(msg); + + al::hidePane(sInstance->mUIMessage, "Page01"); // hide A button prompt + + if (!sInstance->mUIMessage->mIsAlive) { + sInstance->mUIMessage->appear(); + + sInstance->mUIMessage->playLoop(); + } + + al::startAction(sInstance->mUIMessage, "Confirm", "State"); +} + +void Client::hideUIMessage() { + if (!sInstance) { + return; + } + + sInstance->mUIMessage->tryEnd(); +} + /** * @brief main thread function for read thread, responsible for processing packets from server * diff --git a/source/states/StageSceneStateServerConfig.cpp b/source/states/StageSceneStateServerConfig.cpp index 4ec5bfc..3d6a096 100644 --- a/source/states/StageSceneStateServerConfig.cpp +++ b/source/states/StageSceneStateServerConfig.cpp @@ -109,6 +109,15 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S void StageSceneStateServerConfig::init() { initNerve(&nrvStageSceneStateServerConfigMainMenu, 0); + + #ifdef EMU + char ryujinx[0x10] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + nn::account::Uid user; + nn::account::GetLastOpenedUser(&user); + if (memcmp(user.data, ryujinx, 0x10) == 0) { + Client::showUIMessage(u"Error: Ryujinx default profile detected.\nYou have to create a new user profile!"); + } + #endif } void StageSceneStateServerConfig::appear(void) {