2022-06-16 21:33:18 +00:00
|
|
|
#include "main.hpp"
|
|
|
|
#include <cmath>
|
|
|
|
#include <math.h>
|
2022-09-04 09:23:02 +00:00
|
|
|
#include "al/execute/ExecuteOrder.h"
|
|
|
|
#include "al/execute/ExecuteTable.h"
|
|
|
|
#include "al/execute/ExecuteTableHolderDraw.h"
|
|
|
|
#include "al/util/GraphicsUtil.h"
|
|
|
|
#include "container/seadSafeArray.h"
|
|
|
|
#include "game/GameData/GameDataHolderAccessor.h"
|
2022-08-10 21:11:52 +00:00
|
|
|
#include "game/Player/PlayerActorBase.h"
|
|
|
|
#include "game/Player/PlayerActorHakoniwa.h"
|
|
|
|
#include "game/Player/PlayerHackKeeper.h"
|
2022-09-04 09:23:02 +00:00
|
|
|
#include "heap/seadHeap.h"
|
2022-08-10 21:11:52 +00:00
|
|
|
#include "math/seadVector.h"
|
2022-06-16 21:33:18 +00:00
|
|
|
#include "server/Client.hpp"
|
|
|
|
#include "puppets/PuppetInfo.h"
|
|
|
|
#include "actors/PuppetActor.h"
|
|
|
|
#include "al/LiveActor/LiveActor.h"
|
|
|
|
#include "al/util.hpp"
|
|
|
|
#include "al/util/AudioUtil.h"
|
|
|
|
#include "al/util/CameraUtil.h"
|
|
|
|
#include "al/util/ControllerUtil.h"
|
|
|
|
#include "al/util/LiveActorUtil.h"
|
|
|
|
#include "al/util/NerveUtil.h"
|
|
|
|
#include "debugMenu.hpp"
|
|
|
|
#include "game/GameData/GameDataFunction.h"
|
|
|
|
#include "game/HakoniwaSequence/HakoniwaSequence.h"
|
|
|
|
#include "game/Player/PlayerFunction.h"
|
|
|
|
#include "game/StageScene/StageScene.h"
|
|
|
|
#include "helpers.hpp"
|
|
|
|
#include "layouts/HideAndSeekIcon.h"
|
|
|
|
#include "logger.hpp"
|
|
|
|
#include "rs/util.hpp"
|
|
|
|
#include "server/gamemode/GameModeBase.hpp"
|
2022-08-07 21:42:56 +00:00
|
|
|
#include "server/hns/HideAndSeekMode.hpp"
|
|
|
|
#include "server/gamemode/GameModeManager.hpp"
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
static int pInfSendTimer = 0;
|
|
|
|
static int gameInfSendTimer = 0;
|
|
|
|
|
2022-08-10 21:11:52 +00:00
|
|
|
void updatePlayerInfo(GameDataHolderAccessor holder, PlayerActorBase* playerBase, bool isYukimaru) {
|
|
|
|
if (pInfSendTimer >= 3) {
|
|
|
|
Client::sendPlayerInfPacket(playerBase, isYukimaru);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2022-08-10 21:11:52 +00:00
|
|
|
if (!isYukimaru) {
|
|
|
|
Client::sendHackCapInfPacket(((PlayerActorHakoniwa*)playerBase)->mHackCap);
|
|
|
|
|
|
|
|
Client::sendCaptureInfPacket((PlayerActorHakoniwa*)playerBase);
|
|
|
|
}
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
pInfSendTimer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gameInfSendTimer >= 60) {
|
2022-08-10 21:11:52 +00:00
|
|
|
if (isYukimaru) {
|
|
|
|
Client::sendGameInfPacket(holder);
|
|
|
|
} else {
|
|
|
|
Client::sendGameInfPacket((PlayerActorHakoniwa*)playerBase, holder);
|
|
|
|
}
|
2024-06-14 09:21:27 +00:00
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
gameInfSendTimer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pInfSendTimer++;
|
|
|
|
gameInfSendTimer++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------- Hooks -------------
|
|
|
|
|
|
|
|
int debugPuppetIndex = 0;
|
|
|
|
int debugCaptureIndex = 0;
|
|
|
|
static int pageIndex = 0;
|
|
|
|
|
2024-10-07 19:54:24 +00:00
|
|
|
static const int maxPages = 3;
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
void drawMainHook(HakoniwaSequence* curSequence, sead::Viewport* viewport, sead::DrawContext* drawContext) {
|
2022-09-04 09:23:02 +00:00
|
|
|
Time::calcTime(); // this needs to be ran every frame, so running it here works
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-05-15 19:59:28 +00:00
|
|
|
if (!debugMode) {
|
2022-06-16 21:33:18 +00:00
|
|
|
al::executeDraw(curSequence->mLytKit, "2Dバック(メイン画面)");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
Client* client = Client::instance();
|
|
|
|
SocketClient* socket = client->mSocket;
|
|
|
|
bool isConnected = socket->isConnected();
|
2024-05-15 20:12:01 +00:00
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
int dispHeight = al::getLayoutDisplayHeight();
|
|
|
|
|
|
|
|
gTextWriter->mViewport = viewport;
|
|
|
|
|
|
|
|
gTextWriter->mColor = sead::Color4f(1.f, 1.f, 1.f, 0.8f);
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
drawBackground((agl::DrawContext*)drawContext);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
gTextWriter->beginDraw();
|
|
|
|
gTextWriter->setCursorFromTopLeft(sead::Vector2f(10.f, 10.f));
|
|
|
|
|
|
|
|
gTextWriter->printf("FPS: %d\n", static_cast<int>(round(Application::sInstance->mFramework->calcFps())));
|
|
|
|
|
|
|
|
gTextWriter->setCursorFromTopLeft(sead::Vector2f(10.f, (dispHeight / 3) + 30.f));
|
|
|
|
gTextWriter->setScaleFromFontHeight(20.f);
|
|
|
|
|
2024-05-29 07:12:45 +00:00
|
|
|
if (Client::isServerHidden()) {
|
2024-05-15 20:27:53 +00:00
|
|
|
gTextWriter->printf(
|
2024-05-29 07:12:45 +00:00
|
|
|
isConnected ? "Server: <hidden> | %d/%d Players\n" : "Server: <hidden>\n",
|
|
|
|
isConnected ? Client::getConnectCount() + 1 : 0,
|
|
|
|
isConnected ? Client::getMaxPlayerCount() : 0
|
2024-05-15 20:27:53 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
gTextWriter->printf(
|
2024-05-29 07:12:45 +00:00
|
|
|
isConnected ? "Server: %s:%d | %d/%d Players\n" : "Server: %s:%d\n",
|
2024-05-15 20:27:53 +00:00
|
|
|
socket->getIP(),
|
2024-05-29 07:12:45 +00:00
|
|
|
socket->getPort(),
|
|
|
|
isConnected ? Client::getConnectCount() + 1 : 0,
|
|
|
|
isConnected ? Client::getMaxPlayerCount() : 0
|
2024-05-15 20:27:53 +00:00
|
|
|
);
|
|
|
|
}
|
2024-05-15 20:12:01 +00:00
|
|
|
gTextWriter->printf("Your TCP status: %s\n", socket->getStateChar());
|
|
|
|
gTextWriter->printf("Your UDP status: %s\n", socket->getUdpStateChar());
|
|
|
|
|
2022-09-04 09:23:02 +00:00
|
|
|
sead::Heap* clientHeap = Client::getClientHeap();
|
|
|
|
if (clientHeap) {
|
2024-06-14 09:21:27 +00:00
|
|
|
sead::Heap* gmHeap = GameModeManager::instance()->getHeap();
|
2024-05-15 19:59:28 +00:00
|
|
|
gTextWriter->printf(
|
|
|
|
"Heap Use: %.1f/%.0f (Client) %.1f/%.0f (Gmode)\n",
|
|
|
|
0.0009765625 * (clientHeap->getSize() - clientHeap->getFreeSize()),
|
|
|
|
0.0009765625 * clientHeap->getSize(),
|
|
|
|
0.0009765625 * (gmHeap->getSize() - gmHeap->getFreeSize()),
|
|
|
|
0.0009765625 * gmHeap->getSize()
|
|
|
|
);
|
2022-09-04 09:23:02 +00:00
|
|
|
}
|
|
|
|
|
2024-05-15 20:01:49 +00:00
|
|
|
gTextWriter->printf(
|
|
|
|
"Queue Count: %d/%d (Send) %d/%d (Receive)\n",
|
|
|
|
socket->getSendCount(),
|
|
|
|
socket->getSendMaxCount(),
|
|
|
|
socket->getRecvCount(),
|
|
|
|
socket->getRecvMaxCount()
|
|
|
|
);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-05-15 20:15:49 +00:00
|
|
|
#if EMU
|
|
|
|
gTextWriter->printf("Mod version: %s for Emulators\n", TOSTRING(BUILDVERSTR));
|
|
|
|
#else
|
|
|
|
gTextWriter->printf("Mod version: %s for Switch\n", TOSTRING(BUILDVERSTR));
|
|
|
|
#endif
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
al::Scene* curScene = curSequence->curScene;
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-05-15 19:59:28 +00:00
|
|
|
if (curScene && isInGame) {
|
2024-06-14 09:21:27 +00:00
|
|
|
sead::LookAtCamera* cam = al::getLookAtCamera(curScene, 0);
|
|
|
|
sead::Projection* projection = al::getProjectionSead(curScene, 0);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2022-08-10 21:11:52 +00:00
|
|
|
PlayerActorBase* playerBase = rs::getPlayerActor(curScene);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
PuppetActor* curPuppet = Client::getPuppet(debugPuppetIndex - 1);
|
|
|
|
PuppetActor* debugPuppet = Client::getDebugPuppet();
|
2022-06-16 21:33:18 +00:00
|
|
|
if (debugPuppet) {
|
|
|
|
curPuppet = debugPuppet;
|
|
|
|
}
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
sead::PrimitiveRenderer* renderer = sead::PrimitiveRenderer::instance();
|
2022-06-16 21:33:18 +00:00
|
|
|
renderer->setDrawContext(drawContext);
|
|
|
|
renderer->setCamera(*cam);
|
|
|
|
renderer->setProjection(*projection);
|
|
|
|
|
2024-05-15 20:04:18 +00:00
|
|
|
gTextWriter->printf("(ZR ←)------------ Page %d/%d -------------(ZR →)\n", pageIndex + 1, maxPages);
|
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
switch (pageIndex)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2024-05-15 20:05:05 +00:00
|
|
|
gTextWriter->printf(
|
|
|
|
"(ZL ←)----------%s Player %d/%d %s-----------(ZL →)\n\n",
|
|
|
|
debugPuppetIndex + 1 < 10 ? "-" : "",
|
|
|
|
debugPuppetIndex + 1,
|
2024-05-15 20:23:04 +00:00
|
|
|
Client::getMaxPlayerCount(),
|
|
|
|
Client::getMaxPlayerCount() < 10 ? "-" : ""
|
2024-05-15 20:05:05 +00:00
|
|
|
);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-05-15 20:23:04 +00:00
|
|
|
if (debugPuppetIndex == 0) {
|
|
|
|
gTextWriter->printf("Player Name: %s\n", Client::getClientName());
|
|
|
|
gTextWriter->printf("Connection Status: %s\n", isConnected ? "Online" : "Offline");
|
|
|
|
gTextWriter->printf("Is in same Stage: Yes\n");
|
|
|
|
gTextWriter->printf("Stage: %s\n", client->getLastGameInfPacket()->stageName);
|
|
|
|
gTextWriter->printf("Scenario: %u\n", client->getLastGameInfPacket()->scenarioNo);
|
|
|
|
gTextWriter->printf("Costume: H: %s B: %s\n", client->getLastCostumeInfPacket()->capModel, client->getLastCostumeInfPacket()->bodyModel);
|
|
|
|
gTextWriter->printf("Capture: %s\n", client->getLastCaptureInfPacket()->hackName);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-05-15 20:23:04 +00:00
|
|
|
PlayerHackKeeper* hackKeeper = playerBase->getPlayerHackKeeper();
|
|
|
|
if (hackKeeper) {
|
2024-06-14 09:21:27 +00:00
|
|
|
PlayerActorHakoniwa* p1 = (PlayerActorHakoniwa*)playerBase;
|
2024-05-15 20:23:04 +00:00
|
|
|
if (hackKeeper->currentHackActor) {
|
|
|
|
gTextWriter->printf("Animation: %s\n", al::getActionName(hackKeeper->currentHackActor));
|
|
|
|
} else {
|
|
|
|
gTextWriter->printf("Animation: %s\n", p1->mPlayerAnimator->mAnimFrameCtrl->getActionName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (curPuppet) {
|
2022-06-16 21:33:18 +00:00
|
|
|
al::LiveActor* curModel = curPuppet->getCurrentModel();
|
|
|
|
|
|
|
|
PuppetInfo* curPupInfo = curPuppet->getInfo();
|
|
|
|
|
2022-09-04 09:23:02 +00:00
|
|
|
if (curModel && curPupInfo) {
|
2024-05-15 20:19:44 +00:00
|
|
|
gTextWriter->printf("Player Name: %s\n", curPupInfo->puppetName);
|
2022-09-04 09:23:02 +00:00
|
|
|
gTextWriter->printf("Connection Status: %s\n", curPupInfo->isConnected ? "Online" : "Offline");
|
2024-05-15 20:19:44 +00:00
|
|
|
gTextWriter->printf("Is in same Stage: %s\n", curPupInfo->isInSameStage ? "Yes" : "No");
|
|
|
|
gTextWriter->printf("Stage: %s\n", curPupInfo->stageName);
|
|
|
|
gTextWriter->printf("Scenario: %u\n", curPupInfo->scenarioNo);
|
|
|
|
gTextWriter->printf("Costume: H: %s B: %s\n", curPupInfo->costumeHead, curPupInfo->costumeBody);
|
|
|
|
gTextWriter->printf("Capture: %s\n", curPupInfo->isCaptured ? curPupInfo->curHack : "");
|
|
|
|
gTextWriter->printf("Animation: %d %s\n", curPupInfo->curAnim, curPupInfo->curAnimStr);
|
|
|
|
if (!curPupInfo->isCaptured) {
|
|
|
|
gTextWriter->printf("Model Animation: %s\n", al::getActionName(curModel));
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2022-06-25 00:47:23 +00:00
|
|
|
{
|
2024-05-15 23:55:40 +00:00
|
|
|
gTextWriter->printf("--------------- Animation & Cappy ---------------\n\n");
|
|
|
|
PlayerHackKeeper* hackKeeper = playerBase->getPlayerHackKeeper();
|
|
|
|
|
|
|
|
if (hackKeeper) {
|
2024-06-14 09:21:27 +00:00
|
|
|
PlayerActorHakoniwa* p1 = (PlayerActorHakoniwa*)playerBase; // its safe to assume that we're using a playeractorhakoniwa if the hack keeper isnt null
|
2024-05-15 23:55:40 +00:00
|
|
|
|
|
|
|
if (hackKeeper->currentHackActor) {
|
2024-06-14 09:21:27 +00:00
|
|
|
al::LiveActor* curHack = hackKeeper->currentHackActor;
|
2024-05-15 23:55:40 +00:00
|
|
|
|
|
|
|
gTextWriter->printf("Current Hack Animation: %s\n", al::getActionName(curHack));
|
|
|
|
gTextWriter->printf("Current Hack Name: %s\n", hackKeeper->getCurrentHackName());
|
|
|
|
sead::Quatf captureRot = curHack->mPoseKeeper->getQuat();
|
|
|
|
gTextWriter->printf("Current Hack Rot: %.3f %.3f %.3f %f\n", captureRot.x, captureRot.y, captureRot.z, captureRot.w);
|
|
|
|
sead::Quatf calcRot;
|
|
|
|
al::calcQuat(&calcRot, curHack);
|
|
|
|
gTextWriter->printf("Calc Hack Rot: %.3f %.3f %.3f %.3f\n", calcRot.x, calcRot.y, calcRot.z, calcRot.w);
|
|
|
|
} else {
|
|
|
|
gTextWriter->printf("Cur Action: %s\n", p1->mPlayerAnimator->mAnimFrameCtrl->getActionName());
|
|
|
|
gTextWriter->printf("Cur Sub Action: %s\n", p1->mPlayerAnimator->curSubAnim.cstr());
|
|
|
|
gTextWriter->printf("Is Cappy Flying? %s\n", BTOC(p1->mHackCap->isFlying()));
|
|
|
|
if (p1->mHackCap->isFlying()) {
|
|
|
|
gTextWriter->printf("Cappy Action: %s\n", al::getActionName(p1->mHackCap));
|
2024-06-14 09:21:27 +00:00
|
|
|
sead::Vector3f* capTrans = al::getTransPtr(p1->mHackCap);
|
|
|
|
sead::Vector3f* capRot = &p1->mHackCap->mJointKeeper->mJointRot;
|
2024-05-15 23:55:40 +00:00
|
|
|
gTextWriter->printf("Cappy: Position Rotation\nX: % 10.3f % 10.3f\nY: % 10.3f % 10.3f\nZ: % 10.3f % 10.3f\n",
|
|
|
|
capTrans->x, capRot->x,
|
|
|
|
capTrans->y, capRot->y,
|
|
|
|
capTrans->z, capRot->z
|
|
|
|
);
|
|
|
|
gTextWriter->printf("Cappy Skew: %.3f\n", p1->mHackCap->mJointKeeper->mSkew);
|
|
|
|
}
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-25 00:47:23 +00:00
|
|
|
}
|
2022-06-16 21:33:18 +00:00
|
|
|
break;
|
2024-10-07 19:54:24 +00:00
|
|
|
case 2:
|
2024-05-15 23:52:49 +00:00
|
|
|
{
|
|
|
|
gTextWriter->printf("------------------- Controls --------------------\n\n");
|
|
|
|
gTextWriter->printf("Main/Pause Menu:\n");
|
|
|
|
gTextWriter->printf("- ZL + A | Mod configuration\n");
|
|
|
|
gTextWriter->printf("\nIn-game:\n");
|
|
|
|
gTextWriter->printf("- L + ← | Enable/disable Hide & Seek [H&S]\n");
|
|
|
|
gTextWriter->printf("- [H&S] ↑ | Switch between hider and seeker\n");
|
|
|
|
gTextWriter->printf("- [H&S][Hider] ← | Decrease hiding time\n");
|
|
|
|
gTextWriter->printf("- [H&S][Hider] → | Increase hiding time\n");
|
|
|
|
gTextWriter->printf("- [H&S][Hider] L + ↓ | Reset hiding time\n");
|
|
|
|
gTextWriter->printf("- [H&S][Gravity] L + → | Toggle gravity camera\n");
|
|
|
|
gTextWriter->printf("\n- ZR + ↑ | Open/close this debug menu\n");
|
|
|
|
}
|
|
|
|
break;
|
2022-06-16 21:33:18 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
renderer->begin();
|
2022-06-25 00:47:23 +00:00
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
// sead::Matrix34f mat = sead::Matrix34f::ident;
|
|
|
|
// mat.setBase(3, sead::Vector3f::zero); // Sets the position of the matrix.
|
|
|
|
// For cubes, you need to put this at the location.
|
|
|
|
// For spheres, you can leave this at 0 0 0 since you set it in its draw function.
|
2022-06-16 21:33:18 +00:00
|
|
|
renderer->setModelMatrix(sead::Matrix34f::ident);
|
|
|
|
|
|
|
|
if (curPuppet) {
|
|
|
|
renderer->drawSphere4x8(curPuppet->getInfo()->playerPos, 20, sead::Color4f(1.f, 0.f, 0.f, 0.25f));
|
|
|
|
renderer->drawSphere4x8(al::getTrans(curPuppet), 20, sead::Color4f(0.f, 0.f, 1.f, 0.25f));
|
2024-05-15 20:23:04 +00:00
|
|
|
} else if (debugPuppetIndex == 0) {
|
|
|
|
renderer->drawSphere4x8(client->getLastPlayerInfPacket()->playerPos, 20, sead::Color4f(1.f, 0.f, 0.f, 0.25f));
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
renderer->end();
|
|
|
|
|
|
|
|
isInGame = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
gTextWriter->endDraw();
|
|
|
|
|
|
|
|
al::executeDraw(curSequence->mLytKit, "2Dバック(メイン画面)");
|
|
|
|
}
|
|
|
|
|
2022-09-04 09:23:02 +00:00
|
|
|
void sendShinePacket(GameDataHolderAccessor thisPtr, Shine* curShine) {
|
2022-06-16 21:33:18 +00:00
|
|
|
if (!curShine->isGot()) {
|
2024-06-14 09:21:27 +00:00
|
|
|
GameDataFile::HintInfo* curHintInfo = &thisPtr.mData->mGameDataFile->mShineHintList[curShine->mShineIdx];
|
2022-09-04 09:23:02 +00:00
|
|
|
|
|
|
|
Client::sendShineCollectPacket(curHintInfo->mUniqueID);
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
2022-06-25 00:47:23 +00:00
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
GameDataFunction::setGotShine(thisPtr, curShine->curShineInfo);
|
|
|
|
}
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
void stageInitHook(
|
|
|
|
al::ActorInitInfo* info,
|
|
|
|
StageScene* curScene,
|
|
|
|
al::PlacementInfo const* placement,
|
|
|
|
al::LayoutInitInfo const* lytInfo,
|
|
|
|
al::ActorFactory const* factory,
|
|
|
|
al::SceneMsgCtrl* sceneMsgCtrl,
|
|
|
|
al::GameDataHolderBase* dataHolder
|
|
|
|
) {
|
|
|
|
al::initActorInitInfo(info, curScene, placement, lytInfo, factory, sceneMsgCtrl, dataHolder);
|
2022-06-25 00:47:23 +00:00
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
Client::clearArrays();
|
|
|
|
|
|
|
|
Client::setSceneInfo(*info, curScene);
|
|
|
|
|
2022-08-07 21:42:56 +00:00
|
|
|
if (GameModeManager::instance()->getGameMode() != NONE) {
|
2022-06-16 21:33:18 +00:00
|
|
|
GameModeInitInfo initModeInfo(info, curScene);
|
2022-08-07 21:42:56 +00:00
|
|
|
initModeInfo.initServerInfo(GameModeManager::instance()->getGameMode(), Client::getPuppetHolder());
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2022-08-07 21:42:56 +00:00
|
|
|
GameModeManager::instance()->initScene(initModeInfo);
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Client::sendGameInfPacket(info->mActorSceneInfo.mSceneObjHolder);
|
|
|
|
}
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
PlayerCostumeInfo* setPlayerModel(
|
|
|
|
al::LiveActor* player,
|
|
|
|
const al::ActorInitInfo& initInfo,
|
|
|
|
const char* bodyModel,
|
|
|
|
const char* capModel,
|
|
|
|
al::AudioKeeper* keeper,
|
|
|
|
bool isCloset
|
|
|
|
) {
|
2022-06-16 21:33:18 +00:00
|
|
|
Client::sendCostumeInfPacket(bodyModel, capModel);
|
|
|
|
return PlayerFunction::initMarioModelActor(player, initInfo, bodyModel, capModel, keeper, isCloset);
|
|
|
|
}
|
|
|
|
|
|
|
|
al::SequenceInitInfo* initInfo;
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
ulong constructHook() { // hook for constructing anything we need to globally be accesible
|
|
|
|
asm("STR X21, [X19,#0x208]"); // stores WorldResourceLoader into HakoniwaSequence
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
asm("MOV %[result], X20" : [result] "=r"(initInfo)); // Save our scenes init info to a gloabl ptr so we can access it later
|
2022-06-25 00:47:23 +00:00
|
|
|
|
2022-07-08 08:02:28 +00:00
|
|
|
Client::createInstance(al::getCurrentHeap());
|
2022-08-07 21:42:56 +00:00
|
|
|
GameModeManager::createInstance(al::getCurrentHeap()); // Create the GameModeManager on the current al heap
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
return 0x20;
|
|
|
|
}
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
bool threadInit(HakoniwaSequence* mainSeq) { // hook for initializing client class
|
2022-06-16 21:33:18 +00:00
|
|
|
al::LayoutInitInfo lytInfo = al::LayoutInitInfo();
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
al::initLayoutInitInfo(
|
|
|
|
&lytInfo,
|
|
|
|
mainSeq->mLytKit,
|
|
|
|
0,
|
|
|
|
mainSeq->mAudioDirector,
|
|
|
|
initInfo->mSystemInfo->mLayoutSys,
|
|
|
|
initInfo->mSystemInfo->mMessageSys,
|
|
|
|
initInfo->mSystemInfo->mGamePadSys
|
|
|
|
);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2022-07-08 08:02:28 +00:00
|
|
|
Client::instance()->init(lytInfo, mainSeq->mGameDataHolder);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
return GameDataFunction::isPlayDemoOpening(mainSeq->mGameDataHolder);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool hakoniwaSequenceHook(HakoniwaSequence* sequence) {
|
|
|
|
StageScene* stageScene = (StageScene*)sequence->curScene;
|
|
|
|
|
|
|
|
bool isFirstStep = al::isFirstStep(sequence);
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
al::PlayerHolder* pHolder = al::getScenePlayerHolder(stageScene);
|
|
|
|
PlayerActorBase* playerBase = al::tryGetPlayerActor(pHolder, 0);
|
|
|
|
|
2022-08-10 21:11:52 +00:00
|
|
|
bool isYukimaru = !playerBase->getPlayerInfo();
|
2022-06-25 00:47:23 +00:00
|
|
|
|
2022-06-16 21:33:18 +00:00
|
|
|
isInGame = !stageScene->isPause();
|
|
|
|
|
2022-08-07 21:42:56 +00:00
|
|
|
GameModeManager::instance()->setPaused(stageScene->isPause());
|
2022-06-16 21:33:18 +00:00
|
|
|
Client::setStageInfo(stageScene->mHolder);
|
|
|
|
|
2022-09-04 09:23:02 +00:00
|
|
|
Client::update();
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2022-08-10 21:11:52 +00:00
|
|
|
updatePlayerInfo(stageScene->mHolder, playerBase, isYukimaru);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
2022-06-19 01:38:46 +00:00
|
|
|
static bool isDisableMusic = false;
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
if (al::isPadHoldZR(-1)) {
|
2024-06-14 12:18:18 +00:00
|
|
|
if (al::isPadTriggerUp(-1)) { // ZR + Up => Debug menu
|
|
|
|
debugMode = !debugMode;
|
|
|
|
}
|
2024-07-02 17:24:06 +00:00
|
|
|
if (debugMode) {
|
|
|
|
if (al::isPadTriggerLeft(-1)) { // [Debug menu] ZR + Left => Previous page
|
|
|
|
pageIndex--;
|
|
|
|
if (pageIndex < 0) {
|
|
|
|
pageIndex = maxPages - 1;
|
|
|
|
}
|
2024-06-14 12:18:18 +00:00
|
|
|
}
|
2024-07-02 17:24:06 +00:00
|
|
|
if (al::isPadTriggerRight(-1)) { // [Debug menu] ZR + Right => Next page
|
|
|
|
pageIndex++;
|
|
|
|
if (pageIndex >= maxPages) {
|
|
|
|
pageIndex = 0;
|
|
|
|
}
|
2024-06-14 12:18:18 +00:00
|
|
|
}
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
} else if (al::isPadHoldZL(-1)) {
|
2024-07-02 17:24:33 +00:00
|
|
|
if (debugMode && pageIndex == 0) {
|
2024-06-14 12:18:18 +00:00
|
|
|
if (al::isPadTriggerLeft(-1)) { // [Debug menu] ZL + Left => Previous player
|
|
|
|
debugPuppetIndex--;
|
|
|
|
if (debugPuppetIndex < 0) {
|
|
|
|
debugPuppetIndex = Client::getMaxPlayerCount() - 1;
|
|
|
|
}
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
2024-06-14 12:18:18 +00:00
|
|
|
if (al::isPadTriggerRight(-1)) { // [Debug menu] ZL + Right => Next player
|
|
|
|
debugPuppetIndex++;
|
|
|
|
if (debugPuppetIndex >= Client::getMaxPlayerCount()) {
|
|
|
|
debugPuppetIndex = 0;
|
|
|
|
}
|
2024-05-15 20:23:04 +00:00
|
|
|
}
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
} else if (al::isPadHoldL(-1)) {
|
2024-06-14 12:18:18 +00:00
|
|
|
if (al::isPadTriggerLeft(-1)) { // L + Left => Activate gamemode
|
|
|
|
GameModeManager::instance()->toggleActive();
|
|
|
|
}
|
2024-07-02 17:25:28 +00:00
|
|
|
if (al::isPadTriggerUp(-1)) { // L + Up => Disable background music
|
|
|
|
isDisableMusic = !isDisableMusic;
|
2022-06-16 21:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isDisableMusic) {
|
|
|
|
if (al::isPlayingBgm(stageScene)) {
|
|
|
|
al::stopAllBgm(stageScene, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return isFirstStep;
|
|
|
|
}
|
|
|
|
|
2024-06-14 09:21:27 +00:00
|
|
|
void seadPrintHook(const char* fmt, ...) {
|
2022-06-16 21:33:18 +00:00
|
|
|
va_list args;
|
2024-06-14 09:21:27 +00:00
|
|
|
va_start(args, fmt);
|
2022-06-16 21:33:18 +00:00
|
|
|
|
|
|
|
Logger::log(fmt, args);
|
|
|
|
|
|
|
|
va_end(args);
|
2024-06-14 09:21:27 +00:00
|
|
|
}
|