mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-17 00:45:10 +00:00
Merge commit 'd5b49b2'
This commit is contained in:
commit
cdac0a8679
10 changed files with 163 additions and 177 deletions
|
@ -29,7 +29,6 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
enum ServerConfigOption {
|
||||
GAMEMODECONFIG,
|
||||
GAMEMODESWITCH,
|
||||
RECONNECT,
|
||||
SETIP,
|
||||
SETPORT
|
||||
};
|
||||
|
@ -42,11 +41,9 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
void exeMainMenu();
|
||||
void exeOpenKeyboardIP();
|
||||
void exeOpenKeyboardPort();
|
||||
void exeRestartServer();
|
||||
void exeGamemodeConfig();
|
||||
void exeGamemodeSelect();
|
||||
void exeSaveData();
|
||||
void exeConnectError();
|
||||
|
||||
void endSubMenu();
|
||||
|
||||
|
@ -63,7 +60,7 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
|
||||
SimpleLayoutMenu* mCurrentMenu = nullptr;
|
||||
CommonVerticalList* mCurrentList = nullptr;
|
||||
// Root Page, contains buttons for gamemode config, server reconnecting, and server ip address changing
|
||||
// Root Page, contains buttons for gamemode config, and server ip address changing
|
||||
SimpleLayoutMenu* mMainOptions = nullptr;
|
||||
CommonVerticalList *mMainOptionsList = nullptr;
|
||||
// Sub-Page of Mode config, used to select a gamemode for the client to use
|
||||
|
@ -86,9 +83,7 @@ namespace {
|
|||
NERVE_HEADER(StageSceneStateServerConfig, MainMenu)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboardIP)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboardPort)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, RestartServer)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, GamemodeConfig)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, GamemodeSelect)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, SaveData)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, ConnectError)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@ class Client {
|
|||
|
||||
bool startThread();
|
||||
void readFunc();
|
||||
static void restartConnection();
|
||||
|
||||
static bool isSocketActive() { return sInstance ? sInstance->mSocket->isConnected() : false; };
|
||||
bool isPlayerConnected(int index) { return mPuppetInfoArr[index]->isConnected; }
|
||||
|
@ -175,11 +174,8 @@ class Client {
|
|||
static bool openKeyboardIP();
|
||||
static bool openKeyboardPort();
|
||||
|
||||
static void showConnect();
|
||||
|
||||
static void showConnectError(const char16_t* msg);
|
||||
|
||||
static void hideConnect();
|
||||
static void showUIMessage(const char16_t* msg);
|
||||
static void hideUIMessage();
|
||||
|
||||
void resetCollectedShines();
|
||||
|
||||
|
@ -229,6 +225,8 @@ class Client {
|
|||
GameInf lastGameInfPacket = GameInf();
|
||||
GameInf emptyGameInfPacket = GameInf();
|
||||
CostumeInf lastCostumeInfPacket = CostumeInf();
|
||||
TagInf lastTagInfPacket = TagInf();
|
||||
CaptureInf lastCaptureInfPacket = CaptureInf();
|
||||
|
||||
Keyboard* mKeyboard = nullptr; // keyboard for setting server IP
|
||||
|
||||
|
@ -240,9 +238,7 @@ class Client {
|
|||
bool mIsFirstConnect = true;
|
||||
|
||||
// --- Game Layouts ---
|
||||
|
||||
al::WindowConfirmWait* mConnectionWait;
|
||||
|
||||
al::WindowConfirmWait* mUIMessage;
|
||||
al::SimpleLayoutAppearWaitEnd *mConnectStatus;
|
||||
|
||||
// --- Game Info ---
|
||||
|
|
|
@ -52,6 +52,10 @@ class SocketClient : public SocketBase {
|
|||
u32 getRecvCount() { return mRecvQueue.getCount(); }
|
||||
u32 getRecvMaxCount() { return mRecvQueue.getMaxCount(); }
|
||||
|
||||
void clearMessageQueues();
|
||||
void setQueueOpen(bool value) { mPacketQueueOpen = value; }
|
||||
|
||||
|
||||
void setIsFirstConn(bool value) { mIsFirstConnect = value; }
|
||||
|
||||
private:
|
||||
|
@ -66,6 +70,8 @@ class SocketClient : public SocketBase {
|
|||
|
||||
int maxBufSize = 100;
|
||||
bool mIsFirstConnect = true;
|
||||
bool mPacketQueueOpen = true;
|
||||
|
||||
|
||||
/**
|
||||
* @param str a string containing an IPv4 address or a hostname that can be resolved via DNS
|
||||
|
|
|
@ -9,11 +9,13 @@ public:
|
|||
HideAndSeekConfigMenu();
|
||||
|
||||
void initMenu(const al::LayoutInitInfo &initInfo) override;
|
||||
const sead::WFixedSafeString<0x200> *getStringData() override;
|
||||
const sead::WFixedSafeString<0x200>* getStringData() override;
|
||||
bool updateMenu(int selectIndex) override;
|
||||
|
||||
const int getMenuSize() override { return mItemCount; }
|
||||
|
||||
private:
|
||||
static constexpr int mItemCount = 2;
|
||||
};
|
||||
static constexpr int mItemCount = 1;
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>* gravityOn = nullptr;
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>* gravityOff = nullptr;
|
||||
};
|
||||
|
|
|
@ -71,16 +71,14 @@ Client::Client() {
|
|||
*/
|
||||
void Client::init(al::LayoutInitInfo const &initInfo, GameDataHolderAccessor holder) {
|
||||
|
||||
mConnectionWait = new (mHeap) al::WindowConfirmWait("ServerWaitConnect", "WindowConfirmWait", initInfo);
|
||||
|
||||
mConnectStatus = new (mHeap) al::SimpleLayoutAppearWaitEnd("", "SaveMessage", initInfo, 0, false);
|
||||
|
||||
mConnectionWait->setTxtMessage(u"Connecting to Server.");
|
||||
mConnectionWait->setTxtMessageConfirm(u"Failed to Connect!");
|
||||
|
||||
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();
|
||||
|
@ -105,44 +103,6 @@ bool Client::startThread() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief restarts currently active connection to server
|
||||
*
|
||||
*/
|
||||
void Client::restartConnection() {
|
||||
|
||||
if (!sInstance) {
|
||||
Logger::log("Static Instance is null!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sead::ScopedCurrentHeapSetter setter(sInstance->mHeap);
|
||||
|
||||
Logger::log("Sending Disconnect.\n");
|
||||
|
||||
PlayerDC *playerDC = new PlayerDC();
|
||||
|
||||
playerDC->mUserID = sInstance->mUserID;
|
||||
|
||||
sInstance->mSocket->queuePacket(playerDC);
|
||||
|
||||
if (sInstance->mSocket->closeSocket()) {
|
||||
Logger::log("Sucessfully Closed Socket.\n");
|
||||
}
|
||||
|
||||
sInstance->mConnectCount = 0;
|
||||
|
||||
sInstance->mIsConnectionActive = sInstance->mSocket->init(sInstance->mServerIP.cstr(), sInstance->mServerPort).isSuccess();
|
||||
|
||||
if(sInstance->mSocket->getLogState() == SOCKET_LOG_CONNECTED) {
|
||||
|
||||
Logger::log("Reconnect Sucessful!\n");
|
||||
|
||||
} else {
|
||||
Logger::log("Reconnect Unsuccessful.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief starts a connection using client's TCP socket class, pulling up the software keyboard for user inputted IP if save file does not have one saved.
|
||||
*
|
||||
|
@ -293,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
|
||||
*
|
||||
|
@ -361,6 +348,10 @@ void Client::readFunc() {
|
|||
mSocket->send(&lastPlayerInfPacket);
|
||||
if (lastCostumeInfPacket.mUserID == mUserID)
|
||||
mSocket->send(&lastCostumeInfPacket);
|
||||
if (lastTagInfPacket.mUserID == mUserID)
|
||||
mSocket->send(&lastTagInfPacket);
|
||||
if (lastCaptureInfPacket.mUserID == mUserID)
|
||||
mSocket->send(&lastCaptureInfPacket);
|
||||
|
||||
break;
|
||||
case PacketType::COSTUMEINF:
|
||||
|
@ -622,13 +613,15 @@ void Client::sendTagInfPacket() {
|
|||
|
||||
packet->mUserID = sInstance->mUserID;
|
||||
|
||||
packet->isIt = hsMode->isPlayerIt();
|
||||
packet->isIt = hsMode->isPlayerIt() && hsMode->isModeActive();
|
||||
|
||||
packet->minutes = curInfo->mHidingTime.mMinutes;
|
||||
packet->seconds = curInfo->mHidingTime.mSeconds;
|
||||
packet->updateType = static_cast<TagUpdateType>(TagUpdateType::STATE | TagUpdateType::TIME);
|
||||
|
||||
sInstance->mSocket->queuePacket(packet);
|
||||
|
||||
sInstance->lastTagInfPacket = *packet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -673,12 +666,14 @@ void Client::sendCaptureInfPacket(const PlayerActorHakoniwa* player) {
|
|||
packet->mUserID = sInstance->mUserID;
|
||||
strcpy(packet->hackName, tryConvertName(player->mHackKeeper->getCurrentHackName()));
|
||||
sInstance->mSocket->queuePacket(packet);
|
||||
sInstance->lastCaptureInfPacket = *packet;
|
||||
sInstance->isSentCaptureInf = true;
|
||||
} else if (!sInstance->isClientCaptured && sInstance->isSentCaptureInf) {
|
||||
CaptureInf *packet = new CaptureInf();
|
||||
packet->mUserID = sInstance->mUserID;
|
||||
strcpy(packet->hackName, "");
|
||||
sInstance->mSocket->queuePacket(packet);
|
||||
sInstance->lastCaptureInfPacket = *packet;
|
||||
sInstance->isSentCaptureInf = false;
|
||||
}
|
||||
}
|
||||
|
@ -696,6 +691,16 @@ void Client::resendInitPackets() {
|
|||
if (lastGameInfPacket != emptyGameInfPacket) {
|
||||
mSocket->queuePacket(&lastGameInfPacket);
|
||||
}
|
||||
|
||||
// TagInfPacket
|
||||
if (lastTagInfPacket.mUserID == mUserID) {
|
||||
mSocket->queuePacket(&lastTagInfPacket);
|
||||
}
|
||||
|
||||
// CaptureInfPacket
|
||||
if (lastCaptureInfPacket.mUserID == mUserID) {
|
||||
mSocket->queuePacket(&lastCaptureInfPacket);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1393,37 +1398,3 @@ Shine* Client::findStageShine(int shineID) {
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Client::showConnectError(const char16_t* msg) {
|
||||
if (!sInstance)
|
||||
return;
|
||||
|
||||
sInstance->mConnectionWait->setTxtMessageConfirm(msg);
|
||||
|
||||
al::hidePane(sInstance->mConnectionWait, "Page01"); // hide A button prompt
|
||||
|
||||
if (!sInstance->mConnectionWait->mIsAlive) {
|
||||
sInstance->mConnectionWait->appear();
|
||||
|
||||
sInstance->mConnectionWait->playLoop();
|
||||
}
|
||||
|
||||
al::startAction(sInstance->mConnectionWait, "Confirm", "State");
|
||||
}
|
||||
|
||||
void Client::showConnect() {
|
||||
if (!sInstance)
|
||||
return;
|
||||
|
||||
sInstance->mConnectionWait->appear();
|
||||
|
||||
sInstance->mConnectionWait->playLoop();
|
||||
|
||||
}
|
||||
|
||||
void Client::hideConnect() {
|
||||
if (!sInstance)
|
||||
return;
|
||||
|
||||
sInstance->mConnectionWait->tryEnd();
|
||||
}
|
||||
|
|
|
@ -72,12 +72,13 @@ s32 SocketBase::getFd() {
|
|||
|
||||
bool SocketBase::closeSocket() {
|
||||
|
||||
this->socket_log_state = SOCKET_LOG_DISCONNECTED; // probably not safe to assume socket will be closed
|
||||
if (this->socket_log_state != SOCKET_LOG_DISCONNECTED) {
|
||||
nn::Result result = nn::socket::Close(this->socket_log_socket);
|
||||
if (result.isSuccess()) {
|
||||
this->socket_log_state = SOCKET_LOG_DISCONNECTED;
|
||||
}
|
||||
return result.isSuccess();
|
||||
}
|
||||
|
||||
nn::Result result = nn::socket::Close(this->socket_log_socket);
|
||||
|
||||
return result.isSuccess();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -80,6 +80,8 @@ nn::Result SocketClient::init(const char* ip, u16 port) {
|
|||
return result;
|
||||
}
|
||||
|
||||
this->mPacketQueueOpen = true;
|
||||
|
||||
this->socket_log_state = SOCKET_LOG_CONNECTED;
|
||||
|
||||
Logger::log("Socket fd: %d\n", socket_log_socket);
|
||||
|
@ -104,6 +106,21 @@ nn::Result SocketClient::init(const char* ip, u16 port) {
|
|||
// on a reconnect, resend some maybe missing packets
|
||||
if (initPacket.conType == ConnectionTypes::RECONNECT) {
|
||||
client->resendInitPackets();
|
||||
} else {
|
||||
// empty TagInf
|
||||
TagInf tagInf;
|
||||
tagInf.mUserID = initPacket.mUserID;
|
||||
tagInf.isIt = false;
|
||||
tagInf.minutes = 0;
|
||||
tagInf.seconds = 0;
|
||||
tagInf.updateType = static_cast<TagUpdateType>(TagUpdateType::STATE | TagUpdateType::TIME);
|
||||
send(&tagInf);
|
||||
|
||||
// empty CaptureInf
|
||||
CaptureInf capInf;
|
||||
capInf.mUserID = initPacket.mUserID;
|
||||
strcpy(capInf.hackName, "");
|
||||
send(&capInf);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -169,8 +186,7 @@ bool SocketClient::recv() {
|
|||
|
||||
int fullSize = header->mPacketSize + sizeof(Packet);
|
||||
|
||||
if (header->mType > PacketType::UNKNOWN && header->mType < PacketType::End &&
|
||||
fullSize <= MAXPACKSIZE && fullSize > 0 && valread == sizeof(Packet)) {
|
||||
if (fullSize <= MAXPACKSIZE && fullSize > 0 && valread == sizeof(Packet)) {
|
||||
|
||||
if (header->mType != PLAYERINF && header->mType != HACKCAPINF) {
|
||||
Logger::log("Received packet (from %02X%02X):", header->mUserID.data[0],
|
||||
|
@ -205,16 +221,22 @@ bool SocketClient::recv() {
|
|||
}
|
||||
}
|
||||
|
||||
Packet* packet = reinterpret_cast<Packet*>(packetBuf);
|
||||
if (!(header->mType > PacketType::UNKNOWN && header->mType < PacketType::End)) {
|
||||
Logger::log("Failed to acquire valid packet type! Packet Type: %d Full Packet Size %d valread size: %d", header->mType, fullSize, valread);
|
||||
mHeap->free(packetBuf);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mRecvQueue.isFull()) {
|
||||
Packet *packet = reinterpret_cast<Packet*>(packetBuf);
|
||||
|
||||
if (!mRecvQueue.isFull() && mPacketQueueOpen) {
|
||||
mRecvQueue.push((s64)packet, sead::MessageQueue::BlockType::NonBlocking);
|
||||
} else {
|
||||
mHeap->free(packetBuf);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger::log("Failed to aquire valid data! Packet Type: %d Full Packet Size %d valread size: %d", header->mType, fullSize, valread);
|
||||
Logger::log("Failed to acquire valid data! Packet Type: %d Full Packet Size %d valread size: %d", header->mType, fullSize, valread);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -259,6 +281,8 @@ bool SocketClient::closeSocket() {
|
|||
|
||||
Logger::log("Closing Socket.\n");
|
||||
|
||||
mPacketQueueOpen = false;
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (!(result = SocketBase::closeSocket())) {
|
||||
|
@ -342,7 +366,7 @@ void SocketClient::recvFunc() {
|
|||
}
|
||||
|
||||
bool SocketClient::queuePacket(Packet* packet) {
|
||||
if (socket_log_state == SOCKET_LOG_CONNECTED) {
|
||||
if (socket_log_state == SOCKET_LOG_CONNECTED && mPacketQueueOpen) {
|
||||
mSendQueue.push((s64)packet,
|
||||
sead::MessageQueue::BlockType::NonBlocking); // as this is non-blocking, it
|
||||
// will always return true.
|
||||
|
@ -365,3 +389,20 @@ void SocketClient::trySendQueue() {
|
|||
Packet* SocketClient::tryGetPacket(sead::MessageQueue::BlockType blockType) {
|
||||
return socket_log_state == SOCKET_LOG_CONNECTED ? (Packet*)mRecvQueue.pop(blockType) : nullptr;
|
||||
}
|
||||
|
||||
void SocketClient::clearMessageQueues() {
|
||||
bool prevQueueOpenness = this->mPacketQueueOpen;
|
||||
this->mPacketQueueOpen = false;
|
||||
|
||||
while (mSendQueue.getCount() > 0) {
|
||||
Packet* curPacket = (Packet*)mSendQueue.pop(sead::MessageQueue::BlockType::Blocking);
|
||||
mHeap->free(curPacket);
|
||||
}
|
||||
|
||||
while (mRecvQueue.getCount() > 0) {
|
||||
Packet* curPacket = (Packet*)mRecvQueue.pop(sead::MessageQueue::BlockType::Blocking);
|
||||
mHeap->free(curPacket);
|
||||
}
|
||||
|
||||
this->mPacketQueueOpen = prevQueueOpenness;
|
||||
}
|
||||
|
|
|
@ -5,20 +5,27 @@
|
|||
#include "server/hns/HideAndSeekMode.hpp"
|
||||
#include "server/Client.hpp"
|
||||
|
||||
HideAndSeekConfigMenu::HideAndSeekConfigMenu() : GameModeConfigMenu() {}
|
||||
HideAndSeekConfigMenu::HideAndSeekConfigMenu() : GameModeConfigMenu() {
|
||||
gravityOn = new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
|
||||
gravityOn->mBuffer[0].copy(u"Toggle H&S Gravity (ON)");
|
||||
|
||||
gravityOff = new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
|
||||
gravityOff->mBuffer[0].copy(u"Toggle H&S Gravity (OFF)");
|
||||
}
|
||||
|
||||
void HideAndSeekConfigMenu::initMenu(const al::LayoutInitInfo &initInfo) {
|
||||
|
||||
}
|
||||
|
||||
const sead::WFixedSafeString<0x200> *HideAndSeekConfigMenu::getStringData() {
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>* gamemodeConfigOptions =
|
||||
new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
|
||||
|
||||
gamemodeConfigOptions->mBuffer[0].copy(u"Toggle H&S Gravity On");
|
||||
gamemodeConfigOptions->mBuffer[1].copy(u"Toggle H&S Gravity Off");
|
||||
|
||||
return gamemodeConfigOptions->mBuffer;
|
||||
const sead::WFixedSafeString<0x200>* HideAndSeekConfigMenu::getStringData() {
|
||||
HideAndSeekInfo *curMode = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
|
||||
return (
|
||||
GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)
|
||||
&& curMode != nullptr
|
||||
&& curMode->mIsUseGravity
|
||||
? gravityOn->mBuffer
|
||||
: gravityOff->mBuffer
|
||||
);
|
||||
}
|
||||
|
||||
bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
|
||||
|
@ -35,13 +42,7 @@ bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
|
|||
switch (selectIndex) {
|
||||
case 0: {
|
||||
if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
|
||||
curMode->mIsUseGravity = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case 1: {
|
||||
if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
|
||||
curMode->mIsUseGravity = false;
|
||||
curMode->mIsUseGravity = !curMode->mIsUseGravity;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -50,4 +51,4 @@ bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,8 @@ void HideAndSeekMode::begin() {
|
|||
playGuideLyt->end();
|
||||
|
||||
GameModeBase::begin();
|
||||
|
||||
Client::sendTagInfPacket();
|
||||
}
|
||||
|
||||
void HideAndSeekMode::end() {
|
||||
|
@ -109,6 +111,8 @@ void HideAndSeekMode::end() {
|
|||
playGuideLyt->appear();
|
||||
|
||||
GameModeBase::end();
|
||||
|
||||
Client::sendTagInfPacket();
|
||||
}
|
||||
|
||||
void HideAndSeekMode::update() {
|
||||
|
|
|
@ -41,14 +41,13 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S
|
|||
|
||||
mMainOptionsList->unkInt1 = 1;
|
||||
|
||||
mMainOptionsList->initDataNoResetSelected(5);
|
||||
mMainOptionsList->initDataNoResetSelected(4);
|
||||
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, 5>* mainMenuOptions =
|
||||
new sead::SafeArray<sead::WFixedSafeString<0x200>, 5>();
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, 4>* mainMenuOptions =
|
||||
new sead::SafeArray<sead::WFixedSafeString<0x200>, 4>();
|
||||
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::GAMEMODECONFIG].copy(u"Gamemode Config");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::GAMEMODESWITCH].copy(u"Change Gamemode");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::RECONNECT].copy(u"Reconnect to Server");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::SETIP].copy(u"Change Server IP");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::SETPORT].copy(u"Change Server Port");
|
||||
|
||||
|
@ -101,11 +100,6 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S
|
|||
entry.mList = new CommonVerticalList(entry.mLayout, initInfo, true);
|
||||
|
||||
al::setPaneString(entry.mLayout, "TxtOption", u"Gamemode Configuration", 0);
|
||||
|
||||
entry.mList->initDataNoResetSelected(entry.mMenu->getMenuSize());
|
||||
|
||||
|
||||
entry.mList->addStringData(entry.mMenu->getStringData(), "TxtContent");
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,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) {
|
||||
|
@ -176,10 +179,6 @@ void StageSceneStateServerConfig::exeMainMenu() {
|
|||
al::setNerve(this, &nrvStageSceneStateServerConfigGamemodeSelect);
|
||||
break;
|
||||
}
|
||||
case ServerConfigOption::RECONNECT: {
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigRestartServer);
|
||||
break;
|
||||
}
|
||||
case ServerConfigOption::SETIP: {
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigOpenKeyboardIP);
|
||||
break;
|
||||
|
@ -233,32 +232,16 @@ void StageSceneStateServerConfig::exeOpenKeyboardPort() {
|
|||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeRestartServer() {
|
||||
if (al::isFirstStep(this)) {
|
||||
mCurrentList->deactivate();
|
||||
|
||||
Client::showConnect();
|
||||
|
||||
Client::restartConnection();
|
||||
}
|
||||
|
||||
if (Client::isSocketActive()) {
|
||||
|
||||
Client::hideConnect();
|
||||
|
||||
al::startHitReaction(mCurrentMenu, "リセット", 0);
|
||||
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
|
||||
} else {
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigConnectError);
|
||||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeGamemodeConfig() {
|
||||
if (al::isFirstStep(this)) {
|
||||
mGamemodeConfigMenu = &mGamemodeConfigMenus[GameModeManager::instance()->getGameMode()];
|
||||
|
||||
mGamemodeConfigMenu->mList->initDataNoResetSelected(mGamemodeConfigMenu->mMenu->getMenuSize());
|
||||
mGamemodeConfigMenu->mList->addStringData(mGamemodeConfigMenu->mMenu->getStringData(), "TxtContent");
|
||||
|
||||
mCurrentList = mGamemodeConfigMenu->mList;
|
||||
mCurrentMenu = mGamemodeConfigMenu->mLayout;
|
||||
|
||||
subMenuStart();
|
||||
}
|
||||
|
||||
|
@ -290,18 +273,6 @@ void StageSceneStateServerConfig::exeGamemodeSelect() {
|
|||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeConnectError() {
|
||||
if (al::isFirstStep(this)) {
|
||||
Client::showConnectError(u"Failed to Reconnect!");
|
||||
}
|
||||
|
||||
if (al::isGreaterEqualStep(this, 60)) { // close after 1 second
|
||||
Client::hideConnect();
|
||||
al::startHitReaction(mCurrentMenu, "リセット", 0);
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
|
||||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeSaveData() {
|
||||
|
||||
if (al::isFirstStep(this)) {
|
||||
|
@ -373,9 +344,7 @@ namespace {
|
|||
NERVE_IMPL(StageSceneStateServerConfig, MainMenu)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboardIP)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboardPort)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, RestartServer)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, GamemodeConfig)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, GamemodeSelect)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, SaveData)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, ConnectError)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue