Merge commit 'd4df8f0'

This commit is contained in:
Jack Garrard 2023-09-12 13:28:08 -07:00
commit 89154d6c20
96 changed files with 3078 additions and 1044 deletions

View file

@ -6,6 +6,10 @@ inputs:
description : 'version tag' description : 'version tag'
required : false required : false
default : '' default : ''
prefix:
description : 'filename prefix'
required : false
default : ''
outputs: outputs:
@ -24,7 +28,7 @@ runs:
run: | run: |
VERS=${{ inputs.tag }} VERS=${{ inputs.tag }}
echo "::set-output name=version::${VERS:1}" echo "::set-output name=version::${VERS:1}"
echo "::set-output name=filename::SMO_Online${{ (inputs.tag != '' && format('_{0}', inputs.tag)) || '' }}" echo "::set-output name=filename::${{ inputs.prefix }}SMO_Online${{ (inputs.tag != '' && format('_{0}', inputs.tag)) || '' }}"
- -
name : Set up Docker Buildx name : Set up Docker Buildx
uses : docker/setup-buildx-action@v2 uses : docker/setup-buildx-action@v2

View file

@ -30,7 +30,7 @@ runs:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
with: with:
tag_name : ${{ inputs.tag }} tag_name : ${{ inputs.tag }}
release_name : Release ${{ inputs.tag }} release_name : ${{ inputs.tag }}
body : '' body : ''
draft : true draft : true
prerelease : false prerelease : false

View file

@ -5,9 +5,13 @@ on:
push: push:
branches: branches:
- '**' - '**'
- '!dev'
tags: tags:
- '**' - '**'
- '!v[0-9]+.[0-9]+.[0-9]+' - '!v[0-9]+.[0-9]+.[0-9]+'
- '!v[0-9]+.[0-9]+.[0-9]+\+*'
- '!v[0-9]+.[0-9]+.[0-9]+-*'
- '!latest-dev'
pull_request: pull_request:
branches: branches:
- '**' - '**'

77
.github/workflows/dev-release.yml vendored Normal file
View file

@ -0,0 +1,77 @@
name: Dev Release
on:
push:
branches:
- 'dev'
env:
TAG : 'latest-dev'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
outputs:
filename: ${{ steps.build.outputs.filename }}
steps:
-
name : Checkout
uses : actions/checkout@v3
-
name : Environment
id : env
shell : bash
run: |
echo "::set-output name=prefix::$(date +'%Y%m%d_%H%M%S_' --utc)"
-
name : Build artifacts
id : build
uses : ./.github/actions/build
with:
prefix : ${{ steps.env.outputs.prefix }}
attach:
needs: build
runs-on: ubuntu-latest
steps:
-
name : Checkout
uses : actions/checkout@v3
-
name : Get release info
id : release
shell : bash
run: |
url=`curl -sS --fail ${{ github.api_url }}/repos/${{ github.repository }}/releases/tags/${{ env.TAG }} | jq .upload_url -r`
echo "::set-output name=upload_url::$url"
-
name : Attach build artifacts to release
uses : ./.github/actions/attach
with:
filename : ${{ needs.build.outputs.filename }}
upload_url : ${{ steps.release.outputs.upload_url }}
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
move:
needs: attach
runs-on: ubuntu-latest
steps:
-
name : Checkout
uses : actions/checkout@v3
-
name : Move ${{ env.TAG }} tag
shell : bash
run: |
git config user.email "${{ github.actor }}@users.noreply.github.com"
git tag -f ${{ env.TAG }}
git push --force origin ${{ env.TAG }}

View file

@ -5,6 +5,8 @@ on:
push: push:
tags: tags:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+\+*'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs: jobs:

1
.gitignore vendored
View file

@ -5,5 +5,6 @@ romfs stuff/**
Crash Reports/** Crash Reports/**
.cache/** .cache/**
Custom Stage Builds/** Custom Stage Builds/**
*.lst
compile_commands.json compile_commands.json

View file

@ -4,17 +4,19 @@
.PHONY: all clean starlight send .PHONY: all clean starlight send
SMOVER ?= 100 SMOVER ?= 100
BUILDVER ?= 99.37 BUILDVER ?= 101
IP ?= 10.0.0.221 BUILDVERSTR ?= 1.0.1
IP ?= 10.0.0.221 # ftp server ip (usually is switch's local IP)
DEBUGLOG ?= 0 # defaults to disable debug logger DEBUGLOG ?= 0 # defaults to disable debug logger
SERVERIP ?= 0.0.0.0 # put debug logger server IP here SERVERIP ?= 0.0.0.0 # put debug logger server IP here
ISEMU ?= 0 # set to 1 to compile for emulators
PROJNAME ?= StarlightBase PROJNAME ?= StarlightBase
all: starlight all: starlight
starlight: starlight:
$(MAKE) all -f MakefileNSO SMOVER=$(SMOVER) BUILDVER=$(BUILDVER) DEBUGLOG=$(DEBUGLOG) SERVERIP=${SERVERIP} $(MAKE) all -f MakefileNSO SMOVER=$(SMOVER) BUILDVERSTR=$(BUILDVERSTR) BUILDVER=$(BUILDVER) DEBUGLOG=$(DEBUGLOG) SERVERIP=${SERVERIP} EMU=${ISEMU}
$(MAKE) starlight_patch_$(SMOVER)/*.ips $(MAKE) starlight_patch_$(SMOVER)/*.ips
mkdir -p starlight_patch_$(SMOVER)/atmosphere/exefs_patches/$(PROJNAME)/ mkdir -p starlight_patch_$(SMOVER)/atmosphere/exefs_patches/$(PROJNAME)/
@ -24,14 +26,16 @@ starlight:
mv $(shell basename $(CURDIR))$(SMOVER).elf starlight_patch_$(SMOVER)/subsdk1.elf mv $(shell basename $(CURDIR))$(SMOVER).elf starlight_patch_$(SMOVER)/subsdk1.elf
mv $(shell basename $(CURDIR))$(SMOVER).nso starlight_patch_$(SMOVER)/atmosphere/contents/0100000000010000/exefs/subsdk1 mv $(shell basename $(CURDIR))$(SMOVER).nso starlight_patch_$(SMOVER)/atmosphere/contents/0100000000010000/exefs/subsdk1
cp -R romfs starlight_patch_$(SMOVER)/atmosphere/contents/0100000000010000
starlight_patch_$(SMOVER)/*.ips: patches/*.slpatch patches/configs/$(SMOVER).config patches/maps/$(SMOVER)/*.map \ starlight_patch_$(SMOVER)/*.ips: patches/*.slpatch patches/configs/$(SMOVER).config patches/maps/$(SMOVER)/*.map \
build$(SMOVER)/$(shell basename $(CURDIR))$(SMOVER).map scripts/genPatch.py build$(SMOVER)/$(shell basename $(CURDIR))$(SMOVER).map scripts/genPatch.py
@rm -f starlight_patch_$(SMOVER)/*.ips @rm -f starlight_patch_$(SMOVER)/*.ips
python3 scripts/genPatch.py $(SMOVER) python3 scripts/genPatch.py $(SMOVER)
# builds project with the file structure used in the yuzu emulator # builds project with the file structure and flags used for emulators
yuzu: emu:
$(MAKE) all -f MakefileNSO SMOVER=$(SMOVER) BUILDVER=$(BUILDVER) $(MAKE) all -f MakefileNSO SMOVER=$(SMOVER) BUILDVERSTR=$(BUILDVERSTR) BUILDVER=$(BUILDVER) EMU=1
$(MAKE) starlight_patch_$(SMOVER)/*.ips $(MAKE) starlight_patch_$(SMOVER)/*.ips
mkdir -p starlight_patch_$(SMOVER)/yuzu/ mkdir -p starlight_patch_$(SMOVER)/yuzu/

View file

@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
TARGET ?= $(notdir $(CURDIR))$(SMOVER) TARGET ?= $(notdir $(CURDIR))$(SMOVER)
BUILD ?= build$(SMOVER) BUILD ?= build$(SMOVER)
SOURCES := source/sead/time source/sead source/puppets source/server source/layouts source/states source/cameras source SOURCES := source/sead/time source/sead source/puppets source/server/hns source/server/gamemode source/server source/layouts source/states source/cameras source/nx source
DATA := data DATA := data
INCLUDES := include include/sead INCLUDES := include include/sead
@ -44,14 +44,14 @@ ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec
CFLAGS := -g -Wall -ffunction-sections \ CFLAGS := -g -Wall -ffunction-sections \
$(ARCH) $(DEFINES) $(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__ -DSMOVER=$(SMOVER) -O3 -DNNSDK -DSWITCH -DBUILDVER=$(BUILDVER) -DDEBUGLOG=$(DEBUGLOG) -DSERVERIP=$(SERVERIP) CFLAGS += $(INCLUDE) -D__SWITCH__ -DSMOVER=$(SMOVER) -O3 -DNNSDK -DSWITCH -DBUILDVERSTR=$(BUILDVERSTR) -DBUILDVER=$(BUILDVER) -DDEBUGLOG=$(DEBUGLOG) -DSERVERIP=$(SERVERIP) -DEMU=$(EMU)
CXXFLAGS := $(CFLAGS) -fno-rtti -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -std=gnu++20 CXXFLAGS := $(CFLAGS) -Wno-invalid-offsetof -Wno-volatile -fno-rtti -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -std=gnu++20
ASFLAGS := -g $(ARCH) ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=../switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -Wl,--version-script=$(TOPDIR)/exported.txt -Wl,-init=__custom_init -Wl,-fini=__custom_fini -nostdlib LDFLAGS = -specs=../switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -Wl,--version-script=$(TOPDIR)/exported.txt -Wl,-init=__custom_init -Wl,-fini=__custom_fini -nostdlib
LIBS := -lnx LIBS :=
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing

View file

@ -7,14 +7,15 @@
#include "nn/swkbd/swkbd.h" #include "nn/swkbd/swkbd.h"
#include "logger.hpp" #include "logger.hpp"
#include "sead/prim/seadSafeString.h"
typedef void (*KeyboardSetup)(nn::swkbd::KeyboardConfig&);
class Keyboard { class Keyboard {
public: public:
Keyboard(ulong strSize); Keyboard(ulong strSize);
void keyboardThread(); void keyboardThread();
void openKeyboard(const char* initialText); void openKeyboard(const char* initialText, KeyboardSetup setup);
const char* getResult() { const char* getResult() {
if (mThread->isDone()) { if (mThread->isDone()) {
@ -23,6 +24,8 @@ class Keyboard {
return nullptr; return nullptr;
}; };
bool isKeyboardCancelled() const { return mIsCancelled; }
bool isThreadDone() { return mThread->isDone(); } bool isThreadDone() { return mThread->isDone(); }
void setHeaderText(const char16_t* text) { mHeaderText = text; } void setHeaderText(const char16_t* text) { mHeaderText = text; }
@ -33,13 +36,14 @@ class Keyboard {
al::AsyncFunctorThread* mThread; al::AsyncFunctorThread* mThread;
nn::swkbd::String mResultString; nn::swkbd::String mResultString;
bool mIsDoneKeyboard; hostname mInitialText;
KeyboardSetup mSetupFunc;
sead::FixedSafeString<0x10> mInitialText;
const char16_t *mHeaderText = u"Enter Server IP Here!"; const char16_t *mHeaderText = u"Enter Server IP Here!";
const char16_t* mSubText = u"Must be a Valid Address."; const char16_t* mSubText = u"Must be a Valid Address.";
bool mIsCancelled = false;
char* mWorkBuf; char* mWorkBuf;
int mWorkBufSize; int mWorkBufSize;
char* mTextCheckBuf; char* mTextCheckBuf;

View file

@ -12,16 +12,17 @@ class SocketBase {
SocketBase(const char *name); SocketBase(const char *name);
virtual nn::Result init(const char * ip, u16 port) = 0; virtual nn::Result init(const char * ip, u16 port) = 0;
virtual bool closeSocket();
const char *getStateChar(); const char *getStateChar();
u8 getLogState(); u8 getLogState();
s32 getSocket(); s32 getFd();
void set_sock_flags(int flags); void set_sock_flags(int flags);
bool closeSocket();
void setName(const char *name) {strcpy(sockName, name);}; void setName(const char *name) {strcpy(sockName, name);};
u32 socket_errno;
protected: protected:
s32 socket_log(const char* str); s32 socket_log(const char* str);
@ -31,7 +32,7 @@ class SocketBase {
const char *sock_ip; const char *sock_ip;
u16 port; u16 port;
u8 socket_log_state; u8 socket_log_state = SOCKET_LOG_UNINITIALIZED;
s32 socket_log_socket; s32 socket_log_socket;
int sock_flags; int sock_flags;

View file

@ -34,6 +34,15 @@ class PuppetActor : public al::LiveActor {
virtual void makeActorAlive(void) override; virtual void makeActorAlive(void) override;
virtual void makeActorDead(void) override; virtual void makeActorDead(void) override;
virtual void attackSensor(al::HitSensor *, al::HitSensor *) override;
virtual bool receiveMsg(const al::SensorMsg*, al::HitSensor*, al::HitSensor*) override;
virtual const char* getName() const override {
if (mInfo)
return mInfo->puppetName;
return mActorName;
}
void initOnline(PuppetInfo *pupInfo); void initOnline(PuppetInfo *pupInfo);
void startAction(const char *actName); void startAction(const char *actName);
@ -47,8 +56,6 @@ class PuppetActor : public al::LiveActor {
PuppetInfo* getInfo() { return mInfo; } PuppetInfo* getInfo() { return mInfo; }
const char *getPuppetName() { return mInfo->puppetName; }
bool addCapture(PuppetHackActor *capture, const char *hackType); bool addCapture(PuppetHackActor *capture, const char *hackType);
al::LiveActor* getCurrentModel(); al::LiveActor* getCurrentModel();
@ -59,11 +66,10 @@ class PuppetActor : public al::LiveActor {
void debugTeleportCapture(const sead::Vector3f& pos, int index); void debugTeleportCapture(const sead::Vector3f& pos, int index);
void emitJoinEffect();
bool mIsDebug = false; bool mIsDebug = false;
float mClosingSpeed = 0;
NameTag *mNameTag = nullptr; // temp public
private: private:
void changeModel(const char* newModel); void changeModel(const char* newModel);
@ -76,10 +82,13 @@ class PuppetActor : public al::LiveActor {
PuppetCapActor *mPuppetCap = nullptr; PuppetCapActor *mPuppetCap = nullptr;
PlayerModelHolder *mModelHolder = nullptr; PlayerModelHolder *mModelHolder = nullptr;
HackModelHolder* mCaptures = nullptr; HackModelHolder* mCaptures = nullptr;
NameTag *mNameTag = nullptr;
CaptureTypes::Type mCurCapture = CaptureTypes::Type::Unknown; CaptureTypes::Type mCurCapture = CaptureTypes::Type::Unknown;
bool mIs2DModel = false; bool mIs2DModel = false;
bool mIsCaptureModel = false; bool mIsCaptureModel = false;
float mClosingSpeed = 0;
}; };

View file

@ -61,8 +61,10 @@ namespace al
virtual void draw() const; virtual void draw() const;
virtual void startClipped(); virtual void startClipped();
virtual void endClipped(); virtual void endClipped();
virtual void attackSensor(HitSensor *, HitSensor *); // source = sensor belonging to this actor
virtual bool receiveMsg(const SensorMsg *, HitSensor *, HitSensor *); // target = sensor belonging to other actor
virtual void attackSensor(HitSensor *source, HitSensor *target);
virtual bool receiveMsg(const SensorMsg *msg, HitSensor *source, HitSensor *target);
virtual bool receiveMsgScreenPoint(const SensorMsg *, ScreenPointer *, ScreenPointTarget *); virtual bool receiveMsgScreenPoint(const SensorMsg *, ScreenPointer *, ScreenPointTarget *);
virtual const char *getName() const { return this->mActorName; }; virtual const char *getName() const { return this->mActorName; };

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "game/Player/PlayerActorBase.h"
#include "sead/math/seadVector.h" #include "sead/math/seadVector.h"
#include "al/scene/Scene.h" #include "al/scene/Scene.h"
#include "al/LiveActor/LiveActor.h" #include "al/LiveActor/LiveActor.h"
@ -15,8 +16,8 @@ namespace al {
PlayerHolder(int bufSize); PlayerHolder(int bufSize);
void clear(void); void clear(void);
void registerPlayer(al::LiveActor *, al::PadRumbleKeeper *); void registerPlayer(al::LiveActor *, al::PadRumbleKeeper *);
PlayerActorHakoniwa *getPlayer(int) const; PlayerActorBase *getPlayer(int) const;
PlayerActorHakoniwa *tryGetPlayer(int) const; PlayerActorBase *tryGetPlayer(int) const;
int getPlayerNum() const; int getPlayerNum() const;
int getBufferSize() const {return bufferSize;}; int getBufferSize() const {return bufferSize;};
bool isFull(void) const; bool isFull(void) const;

View file

@ -0,0 +1,89 @@
#pragma once
#include "al/scene/ISceneObj.h"
#include "al/scene/SceneObjHolder.h"
#include "SceneObjs.h"
al::ISceneObj *sub_4C4300(int objIndex) {
switch (objIndex)
{
case 0:
return new AmiiboNpcDirector();
case 1:
return new BgmAnimeSyncDirector();
case 3:
return new CapManHeroDemoDirector();
case 4:
return new CapMessageDirector();
case 5:
return new CapMessageMoonNotifier();
case 7:
return new CoinCollectHolder();
case 8:
return new CoinCollectWatcher();
case 9:
return new CollectBgmPlayer();
case 11:
return new EchoEmitterHolder();
case 12:
return new ElectricWireCameraTicketHolder();
case 17:
return new FukankunZoomObjHolder();
case 21:
return new GrowPlantDirector();
case 22:
return new GuidePosInfoHolder();
case 23:
return new HintPhotoLayoutHolder();
case 26:
return new HtmlViewerRequester();
case 29:
return new KidsModeLayoutAccessor();
case 34:
return new LoginLotteryDirector();
case 36:
return new MoviePlayer();
case 39:
return new PaintObjHolder();
case 42:
return new PlayerStartInfoHolder();
case 44:
return new QuestInfoHolder(64);
case 49:
return new RandomItemSelector();
case 52:
return nullptr;
case 53:
return new RhyhtmInfoWatcher("");
case 55:
return new RouteGuideDirector();
case 56:
return new SceneEventNotifier();
case 60:
return new al::StageSyncCounter();
case 62:
return new TalkNpcParamHolder();
case 63:
return new TalkNpcSceneEventSwitcher();
case 64:
return new TestStageTimeDirector();
case 65:
return new TimeBalloonDirector();
case 70:
return new TsukkunTraceHolder();
case 71:
return new WipeHolderRequester();
case 72:
return new YoshiFruitWatcher();
case 73:
return new HelpAmiiboDirector();
default:
return nullptr;
}
}
class SceneObjFactory {
public:
al::SceneObjHolder *createSceneObjHolder(void) { return new al::SceneObjHolder(&sub_4C4300, 0x4A);}
};

View file

@ -4,9 +4,11 @@
namespace al { namespace al {
typedef al::ISceneObj* (*SceneObjCreator)(int);
class SceneObjHolder { class SceneObjHolder {
public: public:
SceneObjHolder(al::ISceneObj* (*)(int), int); SceneObjHolder(SceneObjCreator, int);
ISceneObj *tryGetObj(int) const; // unsafe get still ISceneObj *tryGetObj(int) const; // unsafe get still
void setSceneObj(al::ISceneObj *,int); void setSceneObj(al::ISceneObj *,int);
@ -15,8 +17,14 @@ namespace al {
ISceneObj *getObj(int) const; ISceneObj *getObj(int) const;
void create(int); void create(int);
SceneObjCreator mObjCreator;
al::ISceneObj **mSceneObjs;
int mMaxObjCount;
}; };
static_assert(sizeof(SceneObjHolder) == 0x18, "SceneObjHolder Size");
class IUseSceneObjHolder class IUseSceneObjHolder
{ {
public: public:

View file

@ -0,0 +1,179 @@
#pragma once
#include "al/scene/ISceneObj.h"
#include "al/scene/SceneObjHolder.h"
#include "game/SceneObjs/RouteGuideDirector.h"
// temp header to cleanup SceneObjFactory
namespace al {
struct StageSyncCounter : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
}
struct AmiiboNpcDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct BgmAnimeSyncDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct CapManHeroDemoDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct CapMessageDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct CapMessageMoonNotifier : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct CoinCollectHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct CoinCollectWatcher : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct CollectBgmPlayer : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct EchoEmitterHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct ElectricWireCameraTicketHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct FukankunZoomObjHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct GrowPlantDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct GuidePosInfoHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct HintPhotoLayoutHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct HtmlViewerRequester : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct KidsModeLayoutAccessor : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct LoginLotteryDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct MoviePlayer : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct PaintObjHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct PlayerStartInfoHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct RandomItemSelector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct SceneEventNotifier : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct TalkNpcParamHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct TalkNpcSceneEventSwitcher : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct TestStageTimeDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct TimeBalloonDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct TsukkunTraceHolder : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct WipeHolderRequester : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct YoshiFruitWatcher : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct HelpAmiiboDirector : public al::ISceneObj {
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct QuestInfoHolder : public al::ISceneObj {
QuestInfoHolder(int);
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};
struct RhyhtmInfoWatcher : public al::ISceneObj {
RhyhtmInfoWatcher(const char*);
virtual const char* getSceneObjName() override;
virtual void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
virtual void initSceneObj(void) override;
};

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "types.h" #include "types.h"
#include "al/LiveActor/LiveActor.h"
#include "al/sensor/SensorHitGroup.h" #include "al/sensor/SensorHitGroup.h"
#include "sead/math/seadVector.h" #include "sead/math/seadVector.h"
#include "sead/math/seadMatrix.h" #include "sead/math/seadMatrix.h"
@ -9,6 +8,9 @@
namespace al namespace al
{ {
class LiveActor;
class HitSensorKeeper class HitSensorKeeper
{ {
public: public:

View file

@ -72,6 +72,9 @@ namespace al
PlayerActorBase *tryGetPlayerActor(al::PlayerHolder const *, int); PlayerActorBase *tryGetPlayerActor(al::PlayerHolder const *, int);
sead::Heap *getCurrentHeap(void); sead::Heap *getCurrentHeap(void);
sead::Heap* getStationedHeap();
sead::Heap* getSequenceHeap();
sead::Heap* getSceneHeap();
al::Projection *getProjection(al::IUseCamera const *, int); al::Projection *getProjection(al::IUseCamera const *, int);
@ -242,7 +245,7 @@ namespace al
bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&); bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&);
bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&,char const*); bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&,char const*);
bool tryGetByamlBool(bool *,al::ByamlIter const&,char const*); bool tryGetByamlBool(bool *,al::ByamlIter const&,char const*);
bool tryGetByamlKeyStringOrNULL(al::ByamlIter const&,char const*); const char * tryGetByamlKeyStringOrNULL(al::ByamlIter const&,char const*);
bool tryGetByamlKeyIntOrZero(al::ByamlIter const&,char const*); bool tryGetByamlKeyIntOrZero(al::ByamlIter const&,char const*);
bool tryGetByamlKeyU32OrZero(al::ByamlIter const&,char const*); bool tryGetByamlKeyU32OrZero(al::ByamlIter const&,char const*);
bool tryGetByamlKeyFloatOrZero(al::ByamlIter const&,char const*); bool tryGetByamlKeyFloatOrZero(al::ByamlIter const&,char const*);

View file

@ -7,6 +7,7 @@
#include "al/LiveActor/LiveActor.h" #include "al/LiveActor/LiveActor.h"
#include "al/async/FunctorBase.h" #include "al/async/FunctorBase.h"
#include "al/collision/Collider.h" #include "al/collision/Collider.h"
#include "game/Player/PlayerActorBase.h"
#include "game/Player/PlayerActorHakoniwa.h" #include "game/Player/PlayerActorHakoniwa.h"
#include "al/layout/LayoutActor.h" #include "al/layout/LayoutActor.h"
#include "al/layout/LayoutInitInfo.h" #include "al/layout/LayoutInitInfo.h"
@ -29,7 +30,7 @@ namespace al {
void startAction(LiveActor*, char const*); void startAction(LiveActor*, char const*);
void startAction(IUseLayoutAction*, const char *, const char *); void startAction(IUseLayoutAction*, const char *, const char *);
void startFreezeActionEnd(IUseLayoutAction *,char const*,char const*); void startFreezeActionEnd(IUseLayoutAction *,char const*,char const*);
void startHitReaction(LiveActor*, char const*); void startHitReaction(const LiveActor *, char const*);
void invalidateClipping(const LiveActor *); void invalidateClipping(const LiveActor *);
void validateClipping(const LiveActor *); void validateClipping(const LiveActor *);
void setNerveAtActionEnd(LiveActor*, const al::Nerve*); void setNerveAtActionEnd(LiveActor*, const al::Nerve*);
@ -91,7 +92,7 @@ namespace al {
bool tryOnSwitchDeadOn(IUseStageSwitch *); bool tryOnSwitchDeadOn(IUseStageSwitch *);
bool trySyncStageSwitchAppear(LiveActor *); bool trySyncStageSwitchAppear(LiveActor *);
PlayerActorHakoniwa* tryFindNearestPlayerActor(const LiveActor *); PlayerActorBase* tryFindNearestPlayerActor(const LiveActor *);
bool tryFindNearestPlayerPos(sead::Vector3f *, const LiveActor *); bool tryFindNearestPlayerPos(sead::Vector3f *, const LiveActor *);
bool tryAddRippleMiddle(LiveActor*); bool tryAddRippleMiddle(LiveActor*);
bool tryStartActionIfNotPlaying(LiveActor*, const char*); bool tryStartActionIfNotPlaying(LiveActor*, const char*);

View file

@ -0,0 +1,480 @@
#pragma once
#include "al/sensor/HitSensor.h"
#include "al/sensor/HitSensorKeeper.h"
#include "al/sensor/SensorHitGroup.h"
#include "al/LiveActor/LiveActor.h" // for SensorMsg
#include <math/seadVector.h>
struct SaveObjInfo;
struct HackEndParam;
struct IUsePlayerCollision;
struct IUsePlayerHack;
struct DigPoint;
struct TouchTargetInfo;
struct WhipTargetInfo;
struct CapTargetInfo;
struct GotogotonMark;
struct FishingFish;
typedef unsigned int uint;
namespace al
{
struct ComboCounter;
struct EventFlowExecutor;
struct ParabolicPath;
sead::Vector3f *getSensorPos(al::HitSensor const *);
sead::Vector3f* getActorTrans(al::HitSensor const*);
bool tryReceiveMsgPushAndAddVelocity(al::LiveActor*, al::SensorMsg const*, al::HitSensor const*,
al::HitSensor const*, float);
bool isSensorTypeYoshiEnableSendPush(al::HitSensor const*);
bool isSensorTypeYoshiMsgReceivable(al::HitSensor const*);
bool isSensorValid(al::HitSensor const*);
bool isSensorName(al::HitSensor const*, char const*);
bool isSensorHostName(al::HitSensor const*, char const*);
bool isSensorHost(al::HitSensor const*, al::LiveActor const*);
bool isSensorValid(al::LiveActor const*, char const*);
bool isSensorBindableAll(al::HitSensor const*);
bool isSensorEnemy(al::HitSensor const*);
bool isSensorEnemyAttack(al::HitSensor const*);
bool isSensorEnemyBody(al::HitSensor const*);
bool isSensorEye(al::HitSensor const*);
bool isSensorMapObj(al::HitSensor const*);
bool isSensorNpc(al::HitSensor const*);
bool isSensorPlayerAll(al::HitSensor const*);
bool isSensorRide(al::HitSensor const*);
bool isSensorPlayerAttack(al::HitSensor const*);
bool isSensorPlayer(al::HitSensor const*);
bool isSensorPlayerFoot(al::HitSensor const*);
bool isSensorPlayerDecoration(al::HitSensor const*);
bool isSensorPlayerEye(al::HitSensor const*);
bool isSensorPlayerOrPlayerWeapon(al::HitSensor const*);
bool isSensorCollision(al::HitSensor const*);
bool isSensorPlayerFireBall(al::HitSensor const*);
bool isSensorHoldObj(al::HitSensor const*);
bool isSensorLookAt(al::HitSensor const*);
bool isSensorBindableGoal(al::HitSensor const*);
bool isSensorBindableAllPlayer(al::HitSensor const*);
bool isSensorBindableBubbleOutScreen(al::HitSensor const*);
bool isSensorBindableKoura(al::HitSensor const*);
bool isSensorBindableRouteDokan(al::HitSensor const*);
bool isSensorBindableBubblePadInput(al::HitSensor const*);
bool isSensorBindable(al::HitSensor const*);
bool isSensorSimple(al::HitSensor const*);
bool isSensorHitAnyPlane(al::HitSensor const*,al::HitSensor const*, sead::Vector3<float> const&);
bool isSensorHitRingShape(al::HitSensor const*, al::HitSensor const*, float);
bool isMsgRequestPlayerStainWet(al::SensorMsg const *, int *);
bool isMsgPushAll(al::SensorMsg const *);
bool isMsgPush(al::SensorMsg const *);
bool isMsgPushStrong(al::SensorMsg const *);
bool isMsgPushVeryStrong(al::SensorMsg const *);
bool isMsgHoldReleaseAll(al::SensorMsg const *);
bool isMsgHoldCancel(al::SensorMsg const *);
bool isMsgPlayerRelease(al::SensorMsg const *);
bool isMsgPlayerReleaseBySwing(al::SensorMsg const *);
bool isMsgPlayerReleaseDead(al::SensorMsg const *);
bool isMsgPlayerReleaseDamage(al::SensorMsg const *);
bool isMsgPlayerReleaseDemo(al::SensorMsg const *);
bool isMsgItemGetDirectAll(al::SensorMsg const *);
bool isMsgPlayerItemGet(al::SensorMsg const *);
bool isMsgRideAllPlayerItemGet(al::SensorMsg const *);
bool isMsgPlayerTailAttack(al::SensorMsg const *);
bool isMsgItemGetByObjAll(al::SensorMsg const *);
bool isMsgBallItemGet(al::SensorMsg const *);
bool isMsgKickKouraItemGet(al::SensorMsg const *);
bool isMsgKillerItemGet(al::SensorMsg const *);
bool isMsgItemGetAll(al::SensorMsg const *);
bool isMsgFloorTouch(al::SensorMsg const *);
bool isMsgPlayerFloorTouch(al::SensorMsg const *);
bool isMsgEnemyFloorTouch(al::SensorMsg const *);
bool isMsgUpperPunch(al::SensorMsg const *);
bool isMsgPlayerUpperPunch(al::SensorMsg const *);
bool isMsgEnemyUpperPunch(al::SensorMsg const *);
bool isMsgPlayerTrample(al::SensorMsg const *);
bool isMsgPlayerTrampleReflect(al::SensorMsg const *);
bool isMsgPlayerHipDropAll(al::SensorMsg const *);
bool isMsgPlayerStatueDrop(al::SensorMsg const *);
bool isMsgPlayerObjHipDropAll(al::SensorMsg const *);
bool isMsgPlayerObjStatueDrop(al::SensorMsg const *);
bool isMsgPlayerObjHipDropReflectAll(al::SensorMsg const *);
bool isMsgPlayerObjStatueDropReflect(al::SensorMsg const *);
bool isMsgPlayerObjHipDropHighJump(al::SensorMsg const *);
bool isMsgPlayerHipDropKnockDown(al::SensorMsg const *);
bool isMsgPlayerObjStatueDropReflectNoCondition(al::SensorMsg const *);
bool isMsgPlayerStatueTouch(al::SensorMsg const *);
bool isMsgPlayerObjUpperPunch(al::SensorMsg const *);
bool isMsgPlayerRollingAttack(al::SensorMsg const *);
bool isMsgPlayerRollingReflect(al::SensorMsg const *);
bool isMsgPlayerObjRollingAttack(al::SensorMsg const *);
bool isMsgPlayerObjRollingAttackFailure(al::SensorMsg const *);
bool isMsgPlayerInvincibleAttack(al::SensorMsg const *);
bool isMsgPlayerFireBallAttack(al::SensorMsg const *);
bool isMsgPlayerRouteDokanFireBallAttack(al::SensorMsg const *);
bool isMsgPlayerKick(al::SensorMsg const *);
bool isMsgPlayerCatch(al::SensorMsg const *);
bool isMsgPlayerSlidingAttack(al::SensorMsg const *);
bool isMsgPlayerBoomerangAttack(al::SensorMsg const *);
bool isMsgPlayerBoomerangAttackCollide(al::SensorMsg const *);
bool isMsgPlayerBoomerangReflect(al::SensorMsg const *);
bool isMsgPlayerBoomerangBreak(al::SensorMsg const *);
bool isMsgPlayerBodyAttack(al::SensorMsg const *);
bool isMsgPlayerBodyLanding(al::SensorMsg const *);
bool isMsgPlayerBodyAttackReflect(al::SensorMsg const *);
bool isMsgPlayerClimbAttack(al::SensorMsg const *);
bool isMsgPlayerSpinAttack(al::SensorMsg const *);
bool isMsgPlayerGiantAttack(al::SensorMsg const *);
bool isMsgPlayerCooperationHipDrop(al::SensorMsg const *);
bool isMsgPlayerClimbSlidingAttack(al::SensorMsg const *);
bool isMsgPlayerClimbRollingAttack(al::SensorMsg const *);
bool isMsgPlayerGiantHipDrop(al::SensorMsg const *);
bool isMsgPlayerDisregard(al::SensorMsg const *);
bool isMsgPlayerDash(al::SensorMsg const *);
bool isMsgPlayerDamageTouch(al::SensorMsg const *);
bool isMsgPlayerFloorTouchBind(al::SensorMsg const *);
bool isMsgPlayerTouch(al::SensorMsg const *);
bool isMsgPlayerInvincibleTouch(al::SensorMsg const *);
bool isMsgPlayerGiantTouch(al::SensorMsg const *);
bool isMsgPlayerObjTouch(al::SensorMsg const *);
bool isMsgPlayerPutOnEquipment(al::SensorMsg const *);
bool isMsgPlayerReleaseEquipment(al::SensorMsg const *);
bool isMsgPlayerReleaseEquipmentGoal(al::SensorMsg const *);
bool isMsgPlayerCarryFront(al::SensorMsg const *);
bool isMsgPlayerCarryFrontWallKeep(al::SensorMsg const *);
bool isMsgPlayerCarryUp(al::SensorMsg const *);
bool isMsgPlayerCarryKeepDemo(al::SensorMsg const *);
bool isMsgPlayerCarryWarp(al::SensorMsg const *);
bool isMsgPlayerLeave(al::SensorMsg const *);
bool isMsgPlayerToss(al::SensorMsg const *);
bool isMsgEnemyAttack(al::SensorMsg const *);
bool isMsgEnemyAttackFire(al::SensorMsg const *);
bool isMsgEnemyAttackKnockDown(al::SensorMsg const *);
bool isMsgEnemyAttackBoomerang(al::SensorMsg const *);
bool isMsgEnemyAttackNeedle(al::SensorMsg const *);
bool isMsgEnemyItemGet(al::SensorMsg const *);
bool isMsgEnemyRouteDokanAttack(al::SensorMsg const *);
bool isMsgEnemyRouteDokanFire(al::SensorMsg const *);
bool isMsgExplosion(al::SensorMsg const *);
bool isMsgExplosionCollide(al::SensorMsg const *);
bool isMsgBindStart(al::SensorMsg const *);
bool isMsgBindInit(al::SensorMsg const *);
bool isMsgBindEnd(al::SensorMsg const *);
bool isMsgBindCancel(al::SensorMsg const *);
bool isMsgBindCancelByDemo(al::SensorMsg const *);
bool isMsgBindDamage(al::SensorMsg const *);
bool isMsgBindSteal(al::SensorMsg const *);
bool isMsgBindGiant(al::SensorMsg const *);
bool isMsgPressureDeath(al::SensorMsg const *);
bool isMsgNpcTouch(al::SensorMsg const *);
bool isMsgHit(al::SensorMsg const *);
bool isMsgHitStrong(al::SensorMsg const *);
bool isMsgHitVeryStrong(al::SensorMsg const *);
bool isMsgKnockDown(al::SensorMsg const *);
bool isMsgMapPush(al::SensorMsg const *);
bool isMsgVanish(al::SensorMsg const *);
bool isMsgChangeAlpha(al::SensorMsg const *);
bool isMsgShowModel(al::SensorMsg const *);
bool isMsgHideModel(al::SensorMsg const *);
bool isMsgRestart(al::SensorMsg const *);
bool isMsgEnemyTouch(al::SensorMsg const *);
bool isMsgEnemyTrample(al::SensorMsg const *);
bool isMsgMapObjTrample(al::SensorMsg const *);
bool isMsgNeedleBallAttack(al::SensorMsg const *);
bool isMsgPunpunFloorTouch(al::SensorMsg const *);
bool isMsgInvalidateFootPrint(al::SensorMsg const *);
bool isMsgKickKouraAttack(al::SensorMsg const *);
bool isMsgKickKouraAttackCollide(al::SensorMsg const *);
bool isMsgKickKouraReflect(al::SensorMsg const *);
bool isMsgKickKouraCollideNoReflect(al::SensorMsg const *);
bool isMsgKickKouraBreak(al::SensorMsg const *);
bool isMsgKickKouraBlow(al::SensorMsg const *);
bool isMsgKickStoneAttack(al::SensorMsg const *);
bool isMsgKickStoneAttackCollide(al::SensorMsg const *);
bool isMsgKickStoneAttackHold(al::SensorMsg const *);
bool isMsgKickStoneAttackReflect(al::SensorMsg const *);
bool isMsgKickStoneTrample(al::SensorMsg const *);
bool isMsgKillerAttack(al::SensorMsg const *);
bool isMsgLiftGeyser(al::SensorMsg const *);
bool isMsgWarpStart(al::SensorMsg const *);
bool isMsgWarpEnd(al::SensorMsg const *);
bool isMsgHoleIn(al::SensorMsg const *);
bool isMsgJumpInhibit(al::SensorMsg const *);
bool isMsgGoalKill(al::SensorMsg const *);
bool isMsgGoal(al::SensorMsg const *);
bool isMsgBallAttack(al::SensorMsg const *);
bool isMsgBallRouteDokanAttack(al::SensorMsg const *);
bool isMsgBallAttackHold(al::SensorMsg const *);
bool isMsgBallAttackDRCHold(al::SensorMsg const *);
bool isMsgBallAttackCollide(al::SensorMsg const *);
bool isMsgBallTrample(al::SensorMsg const *);
bool isMsgBallTrampleCollide(al::SensorMsg const *);
bool isMsgFireBallCollide(al::SensorMsg const *);
bool isMsgFireBallFloorTouch(al::SensorMsg const *);
bool isMsgDokanBazookaAttack(al::SensorMsg const *);
bool isMsgSwitchOn(al::SensorMsg const *);
bool isMsgSwitchOnInit(al::SensorMsg const *);
bool isMsgSwitchOffInit(al::SensorMsg const *);
bool isMsgSwitchKillOn(al::SensorMsg const *);
bool isMsgSwitchKillOnInit(al::SensorMsg const *);
bool isMsgSwitchKillOffInit(al::SensorMsg const *);
bool isMsgAskSafetyPoint(al::SensorMsg const *);
bool isMsgTouchAssist(al::SensorMsg const *);
bool isMsgTouchAssistNoPat(al::SensorMsg const *);
bool isMsgTouchAssistTrig(al::SensorMsg const *);
bool isMsgTouchAssistTrigOff(al::SensorMsg const *);
bool isMsgTouchAssistTrigNoPat(al::SensorMsg const *);
bool isMsgTouchAssistBurn(al::SensorMsg const *);
bool isMsgTouchAssistAll(al::SensorMsg const *);
bool isMsgTouchCarryItem(al::SensorMsg const *);
bool isMsgTouchReleaseItem(al::SensorMsg const *);
bool isMsgTouchStroke(al::SensorMsg const *);
bool isMsgIsNerveSupportFreeze(al::SensorMsg const *);
bool isMsgOnSyncSupportFreeze(al::SensorMsg const *);
bool isMsgOffSyncSupportFreeze(al::SensorMsg const *);
bool isMsgScreenPointInvalidCollisionParts(al::SensorMsg const *);
bool isMsgBlockUpperPunch(al::SensorMsg const *);
bool isMsgBlockLowerPunch(al::SensorMsg const *);
bool isMsgBlockItemGet(al::SensorMsg const *);
bool isMsgPlayerKouraAttack(al::SensorMsg const *);
bool isMsgLightFlash(al::SensorMsg const *);
bool isMsgForceAbyss(al::SensorMsg const *);
bool isMsgSwordAttackHigh(al::SensorMsg const *);
bool isMsgSwordAttackHighLeft(al::SensorMsg const *);
bool isMsgSwordAttackHighRight(al::SensorMsg const *);
bool isMsgSwordAttackLow(al::SensorMsg const *);
bool isMsgSwordAttackLowLeft(al::SensorMsg const *);
bool isMsgSwordAttackLowRight(al::SensorMsg const *);
bool isMsgSwordBeamAttack(al::SensorMsg const *);
bool isMsgSwordBeamReflectAttack(al::SensorMsg const *);
bool isMsgSwordAttackJumpUnder(al::SensorMsg const *);
bool isMsgShieldGuard(al::SensorMsg const *);
bool isMsgAskMultiPlayerEnemy(al::SensorMsg const *);
bool isMsgItemGettable(al::SensorMsg const *);
bool isMsgKikkiThrow(al::SensorMsg const *);
bool isMsgIsKikkiThrowTarget(al::SensorMsg const *);
bool isMsgPlayerCloudGet(al::SensorMsg const *);
bool isMsgAutoJump(al::SensorMsg const *);
bool isMsgPlayerTouchShadow(al::SensorMsg const *);
bool isMsgPlayerPullOutShadow(al::SensorMsg const *);
bool isMsgPlayerAttackShadow(al::SensorMsg const *);
bool isMsgPlayerAttackShadowStrong(al::SensorMsg const *);
bool isMsgPlayerAttackChangePos(al::SensorMsg const *);
bool isMsgAtmosOnlineLight(al::SensorMsg const *);
bool isMsgLightBurn(al::SensorMsg const *);
bool isMsgMoonLightBurn(al::SensorMsg const *);
bool isMsgString(al::SensorMsg const *);
bool isMsgStringV4fPtr(al::SensorMsg const *);
bool isMsgStringV4fSensorPtr(al::SensorMsg const *);
bool isMsgStringVoidPtr(al::SensorMsg const *);
bool isMsgPlayerTrampleForCrossoverSensor(al::SensorMsg const *, al::HitSensor const *, al::HitSensor const *);
bool isMsgPlayerTrampleReflectForCrossoverSensor(al::SensorMsg const *, al::HitSensor const *, al::HitSensor const *);
bool isMsgPlayerUpperPunchForCrossoverSensor(al::SensorMsg const *, al::HitSensor const *, al::HitSensor const *, float);
bool isMsgKickStoneTrampleForCrossoverSensor(al::SensorMsg const *, al::HitSensor const *, al::HitSensor const *);
bool sendMsgPlayerAttackTrample(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerTrampleReflect(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerReflectOrTrample(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerHipDrop(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerObjHipDrop(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerObjHipDropReflect(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerObjHipDropHighJump(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerHipDropKnockDown(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerStatueDrop(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerObjStatueDrop(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerObjStatueDropReflect(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerObjStatueDropReflectNoCondition(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerStatueTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerUpperPunch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerObjUpperPunch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerRollingAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerRollingReflect(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerObjRollingAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerObjRollingAttackFailure(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerInvincibleAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerFireBallAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerRouteDokanFireBallAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerTailAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerKick(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCatch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerSlidingAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerBoomerangAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerBoomerangAttackCollide(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerBoomerangReflect(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerBoomerangBreak(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerBodyAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerBodyLanding(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerBodyAttackReflect(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerClimbAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerSpinAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerGiantAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerCooperationHipDrop(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerClimbSlidingAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerClimbRollingAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerGiantHipDrop(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPlayerDisregard(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerItemGet(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerPutOnEquipment(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerReleaseEquipment(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerReleaseEquipmentGoal(al::HitSensor *, al::HitSensor *, uint);
bool sendMsgPlayerFloorTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerDamageTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCarryFront(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCarryFrontWallKeep(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCarryUp(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCarryKeepDemo(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCarryWarp(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerLeave(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerRelease(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerReleaseBySwing(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerReleaseDamage(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerReleaseDead(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerReleaseDemo(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerToss(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerInvincibleTouch(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgEnemyAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyAttackBoomerang(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyAttackFire(al::HitSensor *, al::HitSensor *, char const *);
bool sendMsgEnemyAttackNeedle(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyFloorTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyItemGet(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyRouteDokanAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyRouteDokanFire(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyUpperPunch(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyTrample(al::HitSensor *, al::HitSensor *);
bool sendMsgMapObjTrample(al::HitSensor *, al::HitSensor *);
bool sendMsgPressureDeath(al::HitSensor *, al::HitSensor *);
bool sendMsgNpcTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgExplosion(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgExplosionCollide(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgPush(al::HitSensor *, al::HitSensor *);
bool sendMsgPushStrong(al::HitSensor *, al::HitSensor *);
bool sendMsgPushVeryStrong(al::HitSensor *, al::HitSensor *);
bool sendMsgHit(al::HitSensor *, al::HitSensor *);
bool sendMsgHitStrong(al::HitSensor *, al::HitSensor *);
bool sendMsgHitVeryStrong(al::HitSensor *, al::HitSensor *);
bool sendMsgKnockDown(al::HitSensor *, al::HitSensor *);
bool sendMsgMapPush(al::HitSensor *, al::HitSensor *);
bool sendMsgVanish(al::HitSensor *, al::HitSensor *);
bool sendMsgChangeAlpha(al::LiveActor *, float);
bool sendMsgShowModel(al::HitSensor *, al::HitSensor *);
bool sendMsgHideModel(al::HitSensor *, al::HitSensor *);
bool sendMsgRestart(al::HitSensor *, al::HitSensor *);
bool sendMsgNeedleBallAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgPunpunFloorTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgInvalidateFootPrint(al::HitSensor *, al::HitSensor *);
bool sendMsgKickKouraAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgKickKouraAttackCollide(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgKickKouraGetItem(al::HitSensor *, al::HitSensor *);
bool sendMsgKickKouraReflect(al::HitSensor *, al::HitSensor *);
bool sendMsgKickKouraCollideNoReflect(al::HitSensor *, al::HitSensor *);
bool sendMsgKickKouraBreak(al::HitSensor *, al::HitSensor *);
bool sendMsgKickKouraBlow(al::HitSensor *, al::HitSensor *);
bool sendMsgKickStoneAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgKickStoneAttackCollide(al::HitSensor *, al::HitSensor *);
bool sendMsgKickStoneAttackHold(al::HitSensor *, al::HitSensor *);
bool sendMsgKickStoneAttackReflect(al::HitSensor *, al::HitSensor *);
bool sendMsgKickStoneTrample(al::HitSensor *, al::HitSensor *);
bool sendMsgKillerAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgLiftGeyser(al::HitSensor *, al::HitSensor *);
bool sendMsgWarpStart(al::HitSensor *, al::HitSensor *);
bool sendMsgWarpEnd(al::HitSensor *, al::HitSensor *);
bool sendMsgHoldCancel(al::HitSensor *, al::HitSensor *);
bool sendMsgHoleIn(al::HitSensor *, al::HitSensor *);
bool sendMsgJumpInhibit(al::HitSensor *, al::HitSensor *);
bool sendMsgGoalKill(al::HitSensor *, al::HitSensor *);
bool sendMsgGoal(al::HitSensor *, al::HitSensor *);
bool sendMsgBindStart(al::HitSensor *, al::HitSensor *);
bool sendMsgBindInit(al::HitSensor *, al::HitSensor *, uint);
bool sendMsgBindEnd(al::HitSensor *, al::HitSensor *);
bool sendMsgBindCancel(al::HitSensor *, al::HitSensor *);
bool sendMsgBindCancelByDemo(al::HitSensor *, al::HitSensor *);
bool sendMsgBindDamage(al::HitSensor *, al::HitSensor *);
bool sendMsgBindSteal(al::HitSensor *, al::HitSensor *);
bool sendMsgBindGiant(al::HitSensor *, al::HitSensor *);
bool sendMsgBallAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgBallRouteDokanAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgBallAttackHold(al::HitSensor *, al::HitSensor *);
bool sendMsgBallAttackDRCHold(al::HitSensor *, al::HitSensor *);
bool sendMsgBallAttackCollide(al::HitSensor *, al::HitSensor *);
bool sendMsgBallTrample(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgBallTrampleCollide(al::HitSensor *, al::HitSensor *);
bool sendMsgBallItemGet(al::HitSensor *, al::HitSensor *);
bool sendMsgFireBalCollide(al::HitSensor *, al::HitSensor *);
bool sendMsgFireBallFloorTouch(al::HitSensor *, al::HitSensor *);
bool sendMsgDokanBazookaAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgRideAllPlayerItemGet(al::HitSensor *, al::HitSensor *);
bool sendMsgHideModel(al::LiveActor *);
bool sendMsgShowModel(al::LiveActor *);
bool sendMsgRestart(al::LiveActor *);
bool sendMsgCollisionImpulse(al::HitSensor *, al::HitSensor *, sead::Vector3f *, sead::Vector3f const &, float, sead::Vector3f const &, float);
bool sendMsgSwitchOn(al::LiveActor *);
bool sendMsgSwitchOnInit(al::LiveActor *);
bool sendMsgSwitchOffInit(al::LiveActor *);
bool sendMsgSwitchKillOn(al::LiveActor *);
bool sendMsgSwitchKillOnInit(al::LiveActor *);
bool sendMsgSwitchKillOffInit(al::LiveActor *);
bool sendMsgPlayerFloorTouchToColliderGround(al::LiveActor *, al::HitSensor *);
bool sendMsgPlayerUpperPunchToColliderCeiling(al::LiveActor *, al::HitSensor *);
bool sendMsgEnemyFloorTouchToColliderGround(al::LiveActor *, al::HitSensor *);
bool sendMsgEnemyUpperPunchToColliderCeiling(al::LiveActor *, al::HitSensor *);
bool sendMsgAskSafetyPoint(al::HitSensor *, al::HitSensor *, sead::Vector3f **);
bool sendMsgAskSafetyPointToColliderGround(al::LiveActor *, al::HitSensor *, sead::Vector3f **);
bool sendMsgTouchAssist(al::HitSensor *, al::HitSensor *);
bool sendMsgTouchAssistTrig(al::HitSensor *, al::HitSensor *);
bool sendMsgTouchStroke(al::HitSensor *, al::HitSensor *);
bool sendMsgScreenPointInvalidCollisionParts(al::HitSensor *, al::HitSensor *);
bool sendMsgBlockUpperPunch(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgBlockLowerPunch(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgBlockItemGet(al::HitSensor *, al::HitSensor *);
bool sendMsgKillerItemGet(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerKouraAttack(al::HitSensor *, al::HitSensor *, al::ComboCounter *);
bool sendMsgLightFlash(al::HitSensor *, al::HitSensor *);
bool sendMsgForceAbyss(al::HitSensor *, al::HitSensor *);
bool sendMsgIsNerveSupportFreeze(al::HitSensor *, al::HitSensor *);
bool sendMsgOnSyncSupportFreeze(al::HitSensor *, al::HitSensor *);
bool sendMsgOffSyncSupportFreeze(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordAttackHighLeft(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordAttackLowLeft(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordAttackHighRight(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordAttackLowRight(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordAttackJumpUnder(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordBeamAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgSwordBeamReflectAttack(al::HitSensor *, al::HitSensor *);
bool sendMsgShieldGuard(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyAttackKnockDown(al::HitSensor *, al::HitSensor *);
bool sendMsgAskMultiPlayerEnemy(al::HitSensor *, al::HitSensor *);
bool sendMsgItemGettable(al::HitSensor *, al::HitSensor *);
bool sendMsgKikkiThrow(al::HitSensor *, al::HitSensor *);
bool sendMsgIsKikkiThrowTarget(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerCloudGet(al::HitSensor *, al::HitSensor *);
bool sendMsgAutoJump(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerTouchShadow(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerPullOutShadow(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerAttackShadow(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerAttackShadowStrong(al::HitSensor *, al::HitSensor *);
bool sendMsgPlayerAttackChangePos(al::HitSensor *, al::HitSensor *, sead::Vector3f *);
bool sendMsgAtmosOnlineLight(al::HitSensor *, al::HitSensor *);
bool sendMsgLightBurn(al::HitSensor *, al::HitSensor *);
bool sendMsgMoonLightBurn(al::HitSensor *, al::HitSensor *);
bool sendMsgString(al::HitSensor *, al::HitSensor *, char const *);
bool sendMsgStringV4fPtr(al::HitSensor *, al::HitSensor *, char const *, sead::Vector4f *);
bool sendMsgStringV4fSensorPtr(al::HitSensor *, al::HitSensor *, char const *, sead::Vector4f *);
bool sendMsgStringVoidPtr(al::HitSensor *, al::HitSensor *, char const *, void *);
bool sendMsgEnemyAttackForCrossoverSensor(al::HitSensor *, al::HitSensor *);
bool sendMsgEnemyAttackForCrossoverCylinderSensor(al::HitSensor *, al::HitSensor *, sead::Vector3f const &, sead::Vector3f const &, float);
bool sendMsgPushAndKillVelocityToTarget(al::LiveActor *, al::HitSensor *, al::HitSensor *);
bool sendMsgPushAndKillVelocityToTargetH(al::LiveActor *, al::HitSensor *, al::HitSensor *);
bool sendMsgCollidePush(al::HitSensor *, al::HitSensor *, sead::Vector3f const &);
bool sendMsgScreenPointTarget(al::SensorMsg const &, al::ScreenPointer *, al::ScreenPointTarget *);
} // namespace al

View file

@ -488,6 +488,10 @@ namespace CaptureAnims {
} }
static constexpr const char *FindStr(Type type) { static constexpr const char *FindStr(Type type) {
return s_Strs.at(ToValue(type)); const s16 type_ = (s16)type;
if (0 <= type_ && type_ < s_Strs.size())
return s_Strs[type_];
else
return "";
} }
} }

View file

@ -98,6 +98,10 @@ namespace CaptureTypes {
} }
static constexpr const char *FindStr(Type type) { static constexpr const char *FindStr(Type type) {
return s_Strs.at(ToValue(type)); const s16 type_ = (s16)type;
if (0 <= type_ && type_ < s_Strs.size())
return s_Strs[type_];
else
return "";
} }
} }

View file

@ -1154,6 +1154,10 @@ namespace PlayerAnims {
} }
static constexpr const char *FindStr(Type type) { static constexpr const char *FindStr(Type type) {
return s_Strs.at(ToValue(type)); const s16 type_ = (s16)type;
if (0 <= type_ && type_ < s_Strs.size())
return s_Strs[type_];
else
return "";
} }
} }

View file

@ -72,6 +72,10 @@ namespace WipeTypes {
} }
static constexpr const char *FindStr(Type type) { static constexpr const char *FindStr(Type type) {
return s_Strs.at(ToValue(type)); const s16 type_ = (s16)type;
if (0 <= type_ && type_ < s_Strs.size())
return s_Strs[type_];
else
return "";
} }
} }

View file

@ -0,0 +1,38 @@
#pragma once
#include "al/camera/CameraPoser.h"
#include "al/nerve/NerveExecutor.h"
#include "math/seadVector.h"
namespace al {
class CameraVerticalAbsorber2DGalaxy : public al::NerveExecutor {
public:
CameraVerticalAbsorber2DGalaxy(void);
void start(al::CameraPoser const*);
void update(al::CameraPoser const*);
void applyLimit(sead::Vector3f* output);
void exeNone(void);
void exeGround(void);
void exeLimit(void);
void exeLimitOver(void);
void exeLimitAfter(void);
sead::Vector3f mTargetTrans;
sead::Vector3f mTargetGravity;
sead::Vector3f mTargetUp;
bool mIsTargetCollideGround;
sead::Vector3f mPrevTargetTrans;
sead::Vector3f mPrevTargetGravity;
float unkFloat;
sead::Vector3f mLimit;
sead::Vector3f unkVec;
float unkFloat2;
};
static_assert(sizeof(CameraVerticalAbsorber2DGalaxy) == 0x70, "");
}

View file

@ -8,6 +8,12 @@
#include "game/Interfaces/IUseDimension.h" #include "game/Interfaces/IUseDimension.h"
#include "al/LiveActor/LiveActor.h" #include "al/LiveActor/LiveActor.h"
enum ShineType { Normal, Dot, Grand };
namespace al {
struct RateParamV3f;
}
class Shine : public al::LiveActor , public IUseDimension { class Shine : public al::LiveActor , public IUseDimension {
public: public:
Shine(const char* actorName); Shine(const char* actorName);
@ -16,23 +22,79 @@ class Shine : public al::LiveActor , public IUseDimension {
void offAppear(); void offAppear();
void onAppear(); void onAppear();
void getDirectWithDemo(void); void getDirectWithDemo(void);
void getDirect(); void getDirect();
void get(); void get();
void onSwitchGet(void); void onSwitchGet(void);
bool isGot() const; bool isGot() const;
void setGrandShine(void); void setGrandShine(void);
unsigned char padding[0x10]; void *qword110;
// 0x11C mIsEmptyShine int dword118;
bool mIsGotShine;
ShineInfo *curShineInfo; // 0x120 ShineInfo *curShineInfo; // 0x120
unsigned char padding_290[0x278 - 0x128]; unsigned char padding_188[0x188 - 0x128];
al::RateParamV3f *mRateParam;
void * qword190;
void * qword198;
ShineType mModelType;
void * qword1A8;
bool byte1B0;
void * qword1B8;
int dword1C0;
int dword1C4;
sead::FixedSafeString<0x80> mShineLabel;
void * qword260;
int dword268;
bool byte26C;
void * qword270;
QuestInfo *shineQuestInfo; // 0x278 QuestInfo *shineQuestInfo; // 0x278
void *unkPtr1; // 0x280 void *unkPtr1; // 0x280
ActorDimensionKeeper *mDimensionKeeper; // 0x288 ActorDimensionKeeper *mDimensionKeeper; // 0x288
int shineId; // 0x290 int shineId; // 0x290
bool mIsMainShine;
void *qword298;
void *qword2A0;
void *qword2A8;
void *qword2B0;
void *qword2B8;
int dword2C0;
__attribute__((packed)) void * qword2C4;
int dword2CC;
int dword2D0;
bool mIsAddHeight;
int dword2D8;
al::LiveActor *mModelEmpty;
al::LiveActor *mModelShine;
int dword2F0;
u16 word2F4;
int dword2F8;
bool mIsNoRotate;
void * qword300;
bool mIsUseDemoCam;
struct WaterSurfaceShadow *mWaterShadow;
void * qword318;
int dword320;
int dword324;
bool byte328;
void * qword330;
bool mIsCheckGroundHeightMoon;
bool mIsHintPhoto;
void * qword340;
bool byte348;
void * qword350;
bool mIsUseAppearDemoForce;
int dword35C;
int dword360;
int dword364;
int dword368;
bool mIsPowerStar;
bool mIsAppearDemoHeightHigh;
void * qword370;
u16 word378;
int dword37C;
}; };
namespace rs {
void setStageShineAnimFrame(al::LiveActor *,char const*,int,bool);
}

View file

@ -6,8 +6,10 @@
#pragma once #pragma once
#include "al/scene/SceneObjHolder.h" #include "al/scene/SceneObjHolder.h"
#include "container/seadPtrArray.h"
#include "types.h" #include "types.h"
#include "UniqueObjInfo.h" #include "UniqueObjInfo.h"
#include "GameProgressData.h"
#include "sead/math/seadVector.h" #include "sead/math/seadVector.h"
#include "sead/stream/seadStream.h" #include "sead/stream/seadStream.h"
@ -16,7 +18,24 @@ namespace al {
class ActorInitInfo; class ActorInitInfo;
class PlacementInfo; class PlacementInfo;
class PlacementId; class PlacementId;
} } // namespace al
class SphinxQuizData;
class TimeBalloonSaveData;
class WorldWarpTalkData;
class VisitStageData;
class MoonRockData;
class BossSaveData;
class AchievementSaveData;
class SearchAmiiboDataTable;
class NetworkUploadFlag;
class SequenceDemoSkipData;
class HintPhotoData;
class ShopTalkData;
class RaceRecord;
class PlayerHitPointData;
class GameDataHolder; class GameDataHolder;
class ShineInfo; class ShineInfo;
@ -296,15 +315,176 @@ class GameDataFile
bool isEmpty(void) const; bool isEmpty(void) const;
bool isKidsMode(void) const; bool isKidsMode(void) const;
undefined padding[0x5C8]; ShineInfo **mShineInfoArray;
UniqObjInfo** mUniqueInfo; // 0x5C8 ShineInfo **mShineInfoArray2;
void *unkPtr1; // 0x5D0 ShineInfo *mShineInfo;
void *unkPtr2; // 0x5D8 void *qword18;
void *unkPtr3; // 0x5E0 void *qword20;
void* unkPtr4; // 0x5E8 int dword28;
void* unkPtr5; // 0x5F0 int dword2C;
bool unkBool1; // 0x5F8 sead::FixedSafeString<0x80> char30;
bool unkBool2; // 0x5F9 sead::FixedSafeString<0x80> charC8;
bool mIsCapEnable; // 0x5FA sead::FixedSafeString<0x80> char160;
sead::FixedSafeString<0x80> char1F8;
sead::FixedSafeString<0x80> char290;
sead::FixedSafeString<0x80> char328;
sead::FixedSafeString<0x80> char3C0;
u16 word458;
char gap45A[6];
void *qword460;
void *qword468;
void *qword470;
void *qword478;
void *qword480;
void *qword488;
sead::FixedSafeString<0x100> char490;
void *qword5A8;
bool byte5B0;
void *qword5B4;
sead::FixedSafeString<0x80> *qword5C0;
UniqObjInfo** mUniqueObjInfoArr;
void *qword5D0;
void *qword5D8;
void *qword5E0;
void *qword5E8;
void *qword5F0;
u16 word5F8;
bool byte5FA;
void *qword600;
int dword608;
bool byte60C;
SphinxQuizData *mSphinxQuizData;
void *qword618;
void *qword620;
void *qword628;
TimeBalloonSaveData *qword630;
sead::FixedSafeString<0x40> char638;
int dword690;
WorldWarpTalkData *mWorldWarpTalkData;
VisitStageData *mVisitStageData;
GameProgressData *mGameProgressData;
MoonRockData *mMoonRockData;
BossSaveData *mBossSaveData;
AchievementSaveData *mAchievementSaveData;
SearchAmiiboDataTable *mSearchAmiiboDataTable;
NetworkUploadFlag *mNetworkUploadFlag;
SequenceDemoSkipData *mSequenceDemoSkipData;
HintPhotoData *mHintPhotoData;
void *qword6E8;
void *qword6F0;
void *qword6F8;
void *qword700;
void *qword708;
sead::FixedSafeString<0x40> char710;
sead::FixedSafeString<0x40> char768;
u16 word7C0;
void *qword7C8;
u16 word7D0;
void *qword7D8;
sead::PtrArray<RaceRecord> mLatestRaceRecords;
void *qword7F0;
void *qword7F8;
void *qword800;
void *qword808;
void *qword810;
bool byte818;
void *qword820;
bool byte828;
sead::PtrArrayImpl sead__ptrarrayimpl830;
u16 word840;
bool byte842;
int dword844;
bool byte848;
GameDataHolder *mGameDataHolder;
void *qword858;
PlayerHitPointData *mPlayerHintPointData;
sead::FixedSafeString<0x80> char868;
bool byte900;
bool byte901;
int dword904;
sead::FixedSafeString<0x80> char908;
void *char9A0;
sead::PtrArrayImpl sead__ptrarrayimpl9A8;
sead::PtrArrayImpl sead__ptrarrayimpl9B8;
sead::PtrArrayImpl sead__ptrarrayimpl9C8;
sead::PtrArrayImpl sead__ptrarrayimpl9D8;
void *qword9E8;
int mCurWorldID;
void *qword9F8;
void *qwordA00;
u16 wordA08;
bool byteA0A;
void *qwordA10;
void *qwordA18;
int dwordA20;
int dwordA24;
int dwordA28;
bool byteA2C;
ChangeStageInfo *mChangeStageInfo;
ChangeStageInfo *mChangeStageInfo2;
void *qwordA40;
void *qwordA48;
void *qwordA50;
void *qwordA58;
ShopTalkData *mShopTalkData;
void *qwordA68;
bool byteA70;
char gapA71[3];
void *qwordA74;
void *qwordA7C;
int dwordA84;
bool byteA88;
char gapA89[3];
void *qwordA8C;
int dwordA94;
bool byteA98;
char gapA99[3];
void *qwordA9C;
int dwordAA4;
bool byteAA8;
char gapAA9[3];
void *qwordAAC;
int dwordAB4;
bool byteAB8;
char gapAB9[3];
void *qwordABC;
int dwordAC4;
bool byteAC8;
char gapAC9[3];
void *qwordACC;
int dwordAD4;
bool byteAD8;
char gapAD9[3];
void *qwordADC;
int dwordAE4;
bool byteAE8;
char gapAE9[3];
void *qwordAEC;
int dwordAF4;
bool byteAF8;
char gapAF9[3];
void *qwordAFC;
int dwordB04;
bool byteB08;
char gapB09[3];
void *qwordB0C;
int dwordB14;
bool byteB18;
char gapB19[3];
void *qwordB1C;
int dwordB24;
bool byteB28;
char gapB29[7];
void *qwordB30;
bool byteB38;
char gapB39[7];
void *qwordB40;
int dwordB48;
char gapB4C[4];
void *qwordB50;
int dwordB58;
int dwordB5C;
int dwordB60;
u16 wordB64;
}; };

View file

@ -138,4 +138,18 @@ public:
// subtracts the supplied int value from the current coin count // subtracts the supplied int value from the current coin count
static void subCoin(GameDataHolderWriter, int value); static void subCoin(GameDataHolderWriter, int value);
static bool isUnlockedWorld(GameDataHolderAccessor, int);
static bool isUnlockedNextWorld(GameDataHolderAccessor);
static bool isUnlockedAllWorld(GameDataHolderAccessor);
static bool isUnlockedCurrentWorld(GameDataHolderAccessor);
static bool isUnlockWorld(int);
static bool isUnlockFirstForest(void);
static bool isUnlockFirstSea(void);
}; };

View file

@ -18,4 +18,5 @@ class GameDataHolderAccessor : public GameDataHolderWriter
public: public:
GameDataHolderAccessor(al::IUseSceneObjHolder const *IUseObjHolder) {mData = (GameDataHolder*)al::getSceneObj(IUseObjHolder, 18);} GameDataHolderAccessor(al::IUseSceneObjHolder const *IUseObjHolder) {mData = (GameDataHolder*)al::getSceneObj(IUseObjHolder, 18);}
GameDataHolderAccessor(al::SceneObjHolder const *objHolder) {mData = (GameDataHolder*)objHolder->getObj(18); } GameDataHolderAccessor(al::SceneObjHolder const *objHolder) {mData = (GameDataHolder*)objHolder->getObj(18); }
GameDataHolderAccessor() {mData = nullptr; } // default ctor
}; };

View file

@ -70,32 +70,6 @@ class HakoniwaSequence : public al::Sequence {
HakoniwaStateBootLoadData *mBootLoadData; // 0xE8 HakoniwaStateBootLoadData *mBootLoadData; // 0xE8
HakoniwaStateDeleteScene *mDeleteScene; // 0xF0 HakoniwaStateDeleteScene *mDeleteScene; // 0xF0
al::LayoutKit* mLytKit; // 0xF8 al::LayoutKit* mLytKit; // 0xF8
unsigned char padding_168[0x108];
// al::initSceneCreator(al::IUseSceneCreator *,al::SequenceInitInfo const&,al::GameDataHolderBase *,al::AudioDirector *,al::ScreenCaptureExecutor *,alSceneFunction::SceneFactory *) .text 00000000009F2270 0000007C 00000050 FFFFFFFFFFFFFFF8 R . . . B . . WorldResourceLoader* mResourceLoader; // 0x208
// undefined * * field_0x0;
// undefined padding_120[0x120];
// al::Scene * curScene;
// undefined padding_8[0x8];
// al::AudioDirector * field_0x90;
// undefined padding_24[0x24];
// StageScene * stageScene;
// GameDataHolderAccessor *gameDataHolder;
// undefined padding_024[0x24];
// HakoniwaStateDemoWorldWarp * stateDemoWorldWarp;
// undefined padding_192[0x192];
// int nextScenarioNo;
// undefined padding_12[0x12];
// al::WipeHolder * field_0x1b0;
// undefined padding_0024[0x24];
// long * field_0x1d0;
// undefined padding_48[0x48];
// WorldResourceLoader * worldResourceLoader;
// undefined padding_0x16[0x16];
// undefined * field_0x220;
// undefined padding_0x144[0x144];
// undefined * field_0x2b8;
// undefined padding_0x160[0x160];
// undefined8 field_0x360;
}; };

View file

@ -6,5 +6,6 @@
*/ */
class IUsePlayerHack { class IUsePlayerHack {
public:
virtual struct PlayerHackKeeper *getPlayerHackKeeper() const = 0;
}; };

View file

@ -6,7 +6,10 @@
#include "prim/seadSafeString.h" #include "prim/seadSafeString.h"
struct RollPartsData { struct RollPartsData {
int mRollMsgCount = 0; // 0x0
const char16_t **mRollMsgList; // 0x8
int unkInt1 = 0; // 0x10
bool mUnkBool = false; // 0x14
}; };
class CommonVerticalList : public al::NerveExecutor { class CommonVerticalList : public al::NerveExecutor {
@ -75,14 +78,14 @@ public:
void *unkPtr3; // 0x50 void *unkPtr3; // 0x50
sead::Vector2f mCursorPos; // 0x58 sead::Vector2f mCursorPos; // 0x58
void *unkPtr4; // 0x60 void *unkPtr4; // 0x60
void *unkPtr5; // 0x68 int unkInt1; // 0x68
sead::WFixedSafeString<0x200> **mStringDataArr; // 0x70 sead::WFixedSafeString<0x200> **mStringDataArr; // 0x70
sead::FixedSafeString<0x90> **mPaneNameList; // 0x78 sead::FixedSafeString<0x90> **mPaneNameList; // 0x78
void *unkPtr8; // 0x80 void *unkPtr8; // 0x80
void *unkPtr9; // 0x88 void *unkPtr9; // 0x88
const bool *mIsEnableData; // 0x90 const bool *mIsEnableData; // 0x90
int mStringDataCount; // 0x98 int mStringDataCount; // 0x98
int unkInt2; // 0x9C int mDataCount; // 0x9C
void *unkPtr12; // 0xA0 void *unkPtr12; // 0xA0
void *unkPtr13; // 0xA8 void *unkPtr13; // 0xA8
void *unkPtr14; // 0xB0 void *unkPtr14; // 0xB0

View file

@ -14,9 +14,9 @@
#include "HackCapThrowParam.h" #include "HackCapThrowParam.h"
#include "HackCap/HackCapJointControlKeeper.h" #include "HackCap/HackCapJointControlKeeper.h"
#include "HackCap/PlayerCapActionHistory.h"
class PlayerWallActionHistory; class PlayerWallActionHistory;
class PlayerCapActionHistory;
class PlayerEyeSensorHitHolder; class PlayerEyeSensorHitHolder;
class IUsePlayerHeightCheck; class IUsePlayerHeightCheck;
class PlayerWetControl; class PlayerWetControl;
@ -201,6 +201,9 @@ class HackCap : public al::LiveActor {
al::LiveActor *mCapEyes; // 0x120 al::LiveActor *mCapEyes; // 0x120
PlayerActorHakoniwa *mPlayerActor; // 0x128 PlayerActorHakoniwa *mPlayerActor; // 0x128
unsigned char padding_220[0x220-0x130]; unsigned char padding_220[0x220-0x130];
HackCapThrowParam throwParam; // 0x220 HackCapThrowParam *throwParam; // 0x220
unsigned char padding_2B8[0x2B8-0x228];
PlayerCapActionHistory *mCapActionHistory; // 0x2B8
unsigned char padding_2E0[0x2E0-0x2C0];
HackCapJointControlKeeper *mJointKeeper; // 0x2E0 HackCapJointControlKeeper *mJointKeeper; // 0x2E0
}; };

View file

@ -0,0 +1,29 @@
#pragma once
#include "al/LiveActor/LiveActor.h"
#include "game/Interfaces/IUsePlayerCollision.h"
#include "game/Player/PlayerConst.h"
#include "math/seadVector.h"
class PlayerCapActionHistory {
public:
PlayerCapActionHistory(al::LiveActor const*,PlayerConst const*,struct PlayerTrigger const*,IUsePlayerCollision const*);
void update(void);
void clearLandLimit(void);
void clearLimitHeight(void);
void clearCapJump(void);
void clearLandLimitStandAngle(void);
void clearWallAirLimit(void);
void recordLimitHeight(void);
bool isOverLimitHeight(void) const;
al::LiveActor* mHostActor; // 0x0
PlayerConst* mPlayerConst; // 0x8
PlayerTrigger* mPlayerTrigger; // 0x10
IUsePlayerCollision* mCollider; // 0x18
struct PlayerCounterAfterCapCatch* mCapCatchCounter; // 0x20
bool mIsCapBounced = false; // 0x28
sead::Vector3f mUnkVec = sead::Vector3f::zero; // 0x2C
bool mIsCapJumpReady = true; // 0x38
bool mIsLimited = true; // 0x39 (unsure what this actually is called)
};

View file

@ -7,11 +7,61 @@
#include "PlayerHackKeeper.h" #include "PlayerHackKeeper.h"
#include "al/LiveActor/LiveActor.h" #include "al/LiveActor/LiveActor.h"
#include "game/Interfaces/IUsePlayerCollision.h"
#include "game/Interfaces/IUsePlayerHack.h" #include "game/Interfaces/IUsePlayerHack.h"
#include "game/Player/PlayerCollider.h"
#include "game/Player/PlayerInfo.h"
#include "game/Player/PlayerInitInfo.h"
#include "game/Player/PlayerPuppet.h"
class PlayerActorBase : public al::LiveActor, public IUsePlayerHack { class PlayerActorBase : public al::LiveActor, public IUsePlayerHack {
public: public:
PlayerHackKeeper *getPlayerHackKeeper() const; PlayerActorBase(char const*);
void movement(void);
int getPortNo(); virtual void movement(void) override;
virtual void init(al::ActorInitInfo const&) override;
virtual void initPlayer(al::ActorInitInfo const&, PlayerInitInfo const&);
virtual int getPortNo(void);
virtual sead::Matrix34f *getViewMtx(void) const;
virtual IUsePlayerCollision* getPlayerCollision(void) const;
virtual bool isEnableDemo(void);
virtual void startDemo(void);
virtual void endDemo(void);
virtual void startDemoPuppetable(void);
virtual void endDemoPuppetable(void);
virtual void startDemoShineGet(void);
virtual void endDemoShineGet(void);
virtual void startDemoMainShineGet(void);
virtual void endDemoMainShineGet(void);
virtual void startDemoHack(void);
virtual void endDemoHack(void);
virtual void startDemoKeepBind(void);
virtual void noticeDemoKeepBindExecute(void);
virtual void endDemoKeepBind(void);
virtual void startDemoKeepCarry(void);
virtual void endDemoKeepCarry(void);
virtual void getDemoActor(void);
virtual void getDemoAnimator(void);
virtual bool isDamageStopDemo(void) const;
virtual PlayerPuppet *getPlayerPuppet(void);
virtual PlayerInfo *getPlayerInfo(void) const;
virtual bool checkDeathArea(void);
virtual void sendCollisionMsg(void);
virtual bool receivePushMsg(al::SensorMsg const*,al::HitSensor *,al::HitSensor *,float);
virtual PlayerHackKeeper* getPlayerHackKeeper() const override;
sead::Matrix34f* mViewMtx; // 0x110
int mPortNo; // 0x118
}; };

View file

@ -25,7 +25,9 @@
#include "Attacks/PlayerSpinCapAttack.h" #include "Attacks/PlayerSpinCapAttack.h"
#define PACTORSIZE 0xC8 namespace al {
class WaterSurfaceFinder;
}
class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension { class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension {
public: public:
@ -36,11 +38,10 @@ class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension {
void startPlayerPuppet(void); void startPlayerPuppet(void);
void initPlayer(al::ActorInitInfo const&, PlayerInitInfo const&); void initPlayer(al::ActorInitInfo const&, PlayerInitInfo const&);
unsigned char padding[0x18]; // 0x108
PlayerInfo *mPlayerInfo; // 0x128 PlayerInfo *mPlayerInfo; // 0x128
PlayerConst *mPlayerConst; // 0x130 PlayerConst *mPlayerConst; // 0x130
PlayerInput *mPlayerInput; //0x138 PlayerInput *mPlayerInput; //0x138
unsigned char padding_148[0x8]; // PlayerTrigger PlayerTrigger *mPlayerTrigger; // 0x140
HackCap *mHackCap; // 0x148 HackCap *mHackCap; // 0x148
ActorDimensionKeeper *mDimKeeper; // 0x150 ActorDimensionKeeper *mDimKeeper; // 0x150
PlayerModelKeeper *mPlayerModelKeeper; // 0x158 PlayerModelKeeper *mPlayerModelKeeper; // 0x158
@ -48,27 +49,117 @@ class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension {
PlayerAnimator *mPlayerAnimator; // 0x168 PlayerAnimator *mPlayerAnimator; // 0x168
PlayerColliderHakoniwa *mPlayerCollider; // 0x170 PlayerColliderHakoniwa *mPlayerCollider; // 0x170
PlayerPuppet *mPlayerPuppet; // 0x178 PlayerPuppet *mPlayerPuppet; // 0x178
// 0x180 PlayerAreaChecker PlayerAreaChecker *mAreaChecker; // 0x180
// 0x188 WaterSurfaceFinder al::WaterSurfaceFinder *mWaterSurfaceFinder; // 0x188
// 0x190 unk PlayerOxygen* mPlayerOxygen; // 0x190
// 0x198 unk PlayerDamageKeeper* mPlayerDamageKeeper; // 0x198
// 0x1A0 unk PlayerDemoActionFlag* mPlayerDemoActionFlag; // 0x1A0
// 0x1A8 unk PlayerCapActionHistory* mPlayerCapActionHistory; // 0x1A8
// 0x1B0 unk PlayerCapManHeroEyesControl* mPlayerCapManHeroEyesControl; // 0x1B0
// 0x1B8 unk struct PlayerContinuousJump* mPlayerContinuousJump; // 0x1B8
// 0x1C0 unk struct PlayerContinuousLongJump* mPlayerContinuousLongJump; // 0x1C0
// 0x1C8 unk struct PlayerCounterAfterUpperPunch* mPlayerCounterAfterUpperPunch; // 0x1C8
// 0x1D0 unk struct PlayerCounterForceRun* mPlayerCounterForceRun; // 0x1D0
// 0x1D8 unk PlayerCounterIceWater* mPlayerCounterIceWater; // 0x1D8
// 0x1E0 unk struct PlayerCounterQuickTurnJump* mPlayerCounterQuickTurnJump; // 0x1E0
// 0x1E8 unk PlayerWallActionHistory* mPlayerWallActionHistory; // 0x1E8
// 0x1F0 unk PlayerBindKeeper* mPlayerBindKeeper; // 0x1F0
// 0x1F8 PlayerBindKeeper PlayerCarryKeeper* mPlayerCarryKeeper; // 0x1F8
unsigned char padding_208[0x208 - 0x180]; PlayerEquipmentUser* mPlayerEquipmentUser; // 0x200
PlayerHackKeeper *mHackKeeper; // 0x208 PlayerHackKeeper *mHackKeeper; // 0x208
PlayerFormSensorCollisionArranger *mCollArranger; // 0x210 PlayerFormSensorCollisionArranger *mCollArranger; // 0x210
void *unkPtr2; // 0x218 struct PlayerJumpMessageRequest* mPlayerJumpMessageRequest; // 0x218
void *unkPtr3; // 0x220 struct PlayerSandSinkAffect* mPlayerSandSinkAffect; // 0x220
PlayerSpinCapAttack* mSpinCapAttack; // 0x228 PlayerSpinCapAttack* mSpinCapAttack; // 0x228
struct PlayerActionDiveInWater* mPlayerActionDiveInWater;
struct PlayerEffect* mPlayerEffect;
PlayerEyeSensorHitHolder* mPlayerEyeSensorHitHolder;
struct PlayerPushReceiver* mPlayerPushReceiver;
struct PlayerHitPush* mPlayerHitPush;
struct PlayerExternalVelocity* mPlayerExternalVelocity;
PlayerJointControlKeeper* mPlayerJointControlKeeper;
PlayerPainPartsKeeper* mPlayerPainPartsKeeper;
PlayerRecoverySafetyPoint* mPlayerRecoverySafetyPoint;
struct PlayerRippleGenerator* mPlayerRippleGenerator;
PlayerSeparateCapFlag* mPlayerSeparateCapFlag;
PlayerWetControl* mPlayerWetControl;
PlayerStainControl* mPlayerStainControl;
al::FootPrintHolder* mFootPrintHolder;
struct GaugeAir* mGaugeAir;
struct WaterSurfaceShadow* mWaterSurfaceShadow;
WorldEndBorderKeeper* mWorldEndBorderKeeper;
void* gap;
struct PlayerSeCtrl* mPlayerSeCtrl;
al::HitSensor* mBodyHitSensor;
bool mIsLongShadow;
struct PlayerStateWait* mPlayerStateWait;
struct PlayerStateSquat* mPlayerStateSquat;
struct PlayerStateRunHakoniwa2D3D* mPlayerStateRunHakoniwa2D3D;
struct PlayerStateSlope* mPlayerStateSlope;
struct PlayerStateRolling* mPlayerStateRolling;
struct PlayerStateSpinCap* mPlayerStateSpinCap;
struct PlayerStateJump* mPlayerStateJump;
struct PlayerStateCapCatchPop* mPlayerStateCapCatchPop;
struct PlayerStateWallAir* mPlayerStateWallAir;
struct PlayerStateWallCatch* mPlayerStateWallCatch;
struct PlayerStateGrabCeil* mPlayerStateGrabCeil;
struct PlayerStatePoleClimb* mPlayerStatePoleClimb;
struct PlayerStateHipDrop* mPlayerStateHipDrop;
struct PlayerStateHeadSliding* mPlayerStateHeadSliding;
struct PlayerStateLongJump* mPlayerStateLongJump;
struct PlayerStateFallHakoniwa* mPlayerStateFallHakoniwa;
struct PlayerStateSandSink* mPlayerStateSandSink;
struct ActorStateSandGeyser* mActorStateSandGeyser;
struct PlayerStateRise* mPlayerStateRise;
struct PlayerStateSwim* mPlayerStateSwim;
struct PlayerStateDamageLife* mPlayerStateDamageLife;
struct PlayerStateDamageSwim* mPlayerStateDamageSwim;
struct PlayerStateDamageFire* mPlayerStateDamageFire;
struct PlayerStatePress* mPlayerStatePress;
struct PlayerStateBind* mPlayerStateBind;
struct PlayerStateHack* mPlayerStateHack;
struct PlayerStateEndHack* mPlayerStateEndHack;
struct PlayerStateCameraSubjective* mPlayerStateCameraSubjective;
struct PlayerStateAbyss* mPlayerStateAbyss;
struct PlayerJudgeAirForceCount* mPlayerJudgeAirForceCount;
struct PlayerJudgeCameraSubjective* mPlayerJudgeCameraSubjective;
struct PlayerJudgeCapCatchPop* mPlayerJudgeCapCatchPop;
struct PlayerJudgeDeadWipeStart* mPlayerJudgeDeadWipeStart;
struct PlayerJudgeDirectRolling* mPlayerJudgeDirectRolling;
struct PlayerJudgeEnableStandUp* mPlayerJudgeEnableStandUp;
struct PlayerJudgeForceLand* mPlayerJudgeForceLand;
struct PlayerJudgeForceSlopeSlide* mPlayerJudgeForceSlopeSlide;
struct PlayerJudgeForceRolling* mPlayerJudgeForceRolling;
struct PlayerJudgeGrabCeil* mPlayerJudgeGrabCeil;
struct PlayerJudgeInWater* mPlayerJudgeInWater1;
struct PlayerJudgeInWater* mPlayerJudgeInWater2;
struct PlayerJudgeInWater* mPlayerJudgeInWater3;
struct PlayerJudgeInWater* mPlayerJudgeInWater4;
struct PlayerJudgeInvalidateInputFall* mPlayerJudgeInvalidateInputFall;
struct PlayerJudgeLongFall* mPlayerJudgeLongFall;
struct PlayerJudgeOutInWater* mPlayerJudgeOutInWater;
struct PlayerJudgeRecoveryLifeFast* mPlayerJudgeRecoveryLifeFast;
struct PlayerJudgeSandSink* mPlayerJudgeSandSink;
struct PlayerJudgeSpeedCheckFall* mPlayerJudgeSpeedCheckFall;
struct PlayerJudgeStartHipDrop* mPlayerJudgeStartHipDrop;
struct PlayerJudgeStartRise* mPlayerJudgeStartRise;
struct PlayerJudgeStartRolling* mPlayerJudgeStartRolling;
struct PlayerJudgeStartRun* mPlayerJudgeStartRun;
struct PlayerJudgeStartSquat* mPlayerJudgeStartSquat;
struct PlayerJudgeStartWaterSurfaceRun* mPlayerJudgeStartWaterSurfaceRun;
struct PlayerJudgeSlopeSlide* mPlayerJudgeSlopeSlide;
struct PlayerJudgePoleClimb* mPlayerJudgePoleClimb;
struct PlayerJudgePreInputJump* mPlayerJudgePreInputJump;
struct PlayerJudgePreInputCapThrow* mPlayerJudgePreInputCapThrow;
struct PlayerJudgePreInputHackAction* mPlayerJudgePreInputHackAction;
struct HackCapJudgePreInputHoveringJump* mHackCapJudgePreInputHoveringJump;
struct HackCapJudgePreInputSeparateThrow* mHackCapJudgePreInputSeparateThrow;
struct HackCapJudgePreInputSeparateJump* mHackCapJudgePreInputSeparateJump;
struct PlayerJudgeWallCatch* mPlayerJudgeWallCatch;
struct PlayerJudgeWallCatchInputDir* mPlayerJudgeWallCatchInputDir;
struct PlayerJudgeWallHitDown* mPlayerJudgeWallHitDown;
struct PlayerJudgeWallHitDownForceRun* mPlayerJudgeWallHitDownForceRun;
struct PlayerJudgeWallHitDownRolling* mPlayerJudgeWallHitDownRolling;
struct PlayerJudgeWallKeep* mPlayerJudgeWallKeep;
void* gap_2;
}; };

View file

@ -9,6 +9,10 @@
#include "PlayerCostumeInfo.h" #include "PlayerCostumeInfo.h"
#include "PlayerModelChangerHakoniwa.h" #include "PlayerModelChangerHakoniwa.h"
namespace al {
struct FootPrintHolder;
}
class PlayerInfo { class PlayerInfo {
public: public:
PlayerInfo(); PlayerInfo();
@ -26,7 +30,7 @@ class PlayerInfo {
struct PlayerJointControlKeeper *pJoinControlKeeper; // 0x50 struct PlayerJointControlKeeper *pJoinControlKeeper; // 0x50
struct PlayerCounterIceWater *pCounterIceWater; // 0x58 struct PlayerCounterIceWater *pCounterIceWater; // 0x58
struct PlayerStainControl *pStainControl; // 0x60 struct PlayerStainControl *pStainControl; // 0x60
struct FootPrintHolder *mFootPrintHolder; // 0x68 al::FootPrintHolder *mFootPrintHolder; // 0x68
al::HitSensor *mHitSensor; // 0x70 al::HitSensor *mHitSensor; // 0x70
struct PlayerFormSensorCollisionArranger *pSensorCollArranger; // 0x78 struct PlayerFormSensorCollisionArranger *pSensorCollArranger; // 0x78
PlayerInput *pInput; // 0x80 PlayerInput *pInput; // 0x80

View file

@ -0,0 +1,19 @@
#pragma once
#include "game/GameData/GameDataHolder.h"
namespace SaveDataAccessFunction {
void startSaveDataInit(GameDataHolder *);
void startSaveDataInitSync(GameDataHolder *);
void startSaveDataLoadFile(GameDataHolder *);
void startSaveDataReadSync(GameDataHolder *);
void startSaveDataReadAll(GameDataHolder *);
void startSaveDataWrite(GameDataHolder *);
void startSaveDataWriteWithWindow(GameDataHolder *);
void startSaveDataCopyWithWindow(GameDataHolder *,int,int);
void startSaveDataDeleteWithWindow(GameDataHolder *,int);
void startSaveDataWriteSync(GameDataHolder *);
bool updateSaveDataAccess(GameDataHolder *,bool);
bool isEnableSave(GameDataHolder const*);
bool isDoneSave(GameDataHolder *);
}

View file

@ -0,0 +1,31 @@
#pragma once
#include "al/LiveActor/LiveActor.h"
#include "al/scene/ISceneObj.h"
class RouteGuideDirector : public al::LiveActor, public al::ISceneObj {
public:
RouteGuideDirector();
void initAfterPlacementSceneObj(al::ActorInitInfo const&) override;
bool isValidate(void) const;
void offGuideSystem(void);
void deactivateGuide(void);
void onGuideSystem(void);
void activateGuide(void);
void offGuideByActor(al::LiveActor *);
void addInvidateList(al::LiveActor *);
void onGuideByActor(al::LiveActor *);
void removeInvidateList(al::LiveActor const*);
void addRouteGuidePointBufferCount(int);
void registerRouteGuidePoint(struct RouteGuidePoint *);
void addRouteGuideArrowBufferCount(int);
void registerRouteGuideArrow(struct RouteGuideArrowBase*);
void exeOff(void);
void exeOn(void);
virtual const char* getSceneObjName() override;
virtual void initSceneObj(void) override;
};

View file

@ -0,0 +1,6 @@
#pragma once
class SequenceFactory {
public:
static void createSequence(const char *);
};

View file

@ -4,22 +4,113 @@
#include "game/StageScene/StageSceneLayout.h" #include "game/StageScene/StageSceneLayout.h"
#include "game/StageScene/StageSceneStatePauseMenu.h" #include "game/StageScene/StageSceneStatePauseMenu.h"
#define INHERITSIZE sizeof(al::Scene) namespace al {
struct LayoutTextureRenderer;
struct SimpleAudioUser;
struct ParabolicPath;
struct DemoSyncedEventKeeper;
struct ChromakeyDrawer;
struct WipeHolder;
}
class StageScene : public al::Scene class StageScene : public al::Scene
{ {
public: public:
bool isPause() const; bool isPause() const;
// 0x88 StageResourceKeeper *
// 0x90 LiveActorKit *
// 0x98 LayoutKit *
// 0xA0 SceneObjHolder *
// 0xA8 SceneStopCtrl *
unsigned char padding_180[0x180 - INHERITSIZE]; sead::FixedSafeString<0x40> mStageName;
StageSceneStatePauseMenu *mStatePauseMenu; // 0x180 int field_130;
unsigned char padding_2D0[0x148]; struct StageSceneStateWorldMap *field_138;
GameDataHolderAccessor mHolder; // 0x2D0 struct StageSceneStateShop *field_140;
unsigned char padding_2F8[0x20]; struct StageSceneStateSnapShot *field_148;
StageSceneLayout *stageSceneLayout; // 0x2F8 struct StageSceneStateGetShine *field_150;
struct StageSceneStateGetShineMain *field_158;
struct StageSceneStateGetShineGrand *field_160;
struct StageSceneStateCollectBgm *field_168;
struct StageSceneStateCollectionList *field_170;
struct StageSceneStateMiniGameRanking *field_178;
struct StageSceneStatePauseMenu *field_180;
struct StageSceneStateCloset *field_188;
struct StageSceneStateSkipDemo *field_190;
struct StageSceneStateCheckpointWarp *field_198;
struct StageSceneStateCarryMeat *field_1A0;
void *field_1A8;
void *field_1B0;
struct StageSceneStateMiss *field_1B8;
struct StageSceneStateYukimaruRace *field_1C0;
struct StageSceneStateYukimaruRaceTutorial *field_1C8;
struct StageSceneStateRaceManRace *field_1D0;
struct StageSceneStateRadicon *field_1D8;
struct StageSceneStateScenarioCamera *field_1E0;
struct StageSceneStateRecoverLife *field_1E8;
struct StageSceneStateGetShineMainSandWorld *field_1F0;
void *field_1F8;
struct StageSceneStateWarp *field_200;
void *field_208;
struct ScenarioStartCameraHolder *field_210;
sead::FixedSafeString<0x40> field_218;
sead::FixedSafeString<0x40> field_270;
void *qword2C8;
GameDataHolderAccessor mHolder;
void *qword2D8;
al::LayoutTextureRenderer *qword2E0;
struct PlayGuideSkip *qword2E8;
struct CinemaCaption *qword2F0;
StageSceneLayout *mSceneLayout;
char field_300;
char field_301;
al::SimpleLayoutAppearWaitEnd *char308;
al::SimpleLayoutAppearWaitEnd *field_310;
al::SimpleLayoutAppearWaitEnd *field_318;
struct ControllerGuideSnapShotCtrl *field_320;
InputSeparator *field_328;
al::WipeSimple *field_330;
al::WipeHolder *field_338;
void *field_340;
al::WindowConfirm *field_348;
struct MiniGameMenu *field_350;
bool field_358;
char gap359[15];
char char368;
struct MapLayout *field_370;
al::SimpleLayoutAppearWaitEnd *field_378;
al::LiveActorGroup *field_380;
void *field_388;
void *mKoopaLv1Actor;
struct TimeBalloonNpc *mTimeBalloonNpc;
struct ProjectItemDirector *field_3A0;
struct Pyramid *field_3A8;
void *field_3B0;
al::Nerve *field_3B8;
SceneAudioSystemPauseController *field_3C0;
struct DemoSoundSynchronizer *mDemoSoundSynchronizer;
al::SimpleAudioUser *mStageStartAtmosSe;
al::SimpleAudioUser *mSePlayArea;
al::SimpleAudioUser *mSnapShotCameraCtrlAudio;
struct ProjectSeNamedList *field_3E8;
void *field_3F0;
struct TimeBalloonDirector *mTimeBalloonDirector;
struct TimeBalloonSequenceInfo *mTimeBalloonSequenceInfo;
void *qword408;
void *qword410;
sead::Vector3f qword418;
sead::Vector3f qword424;
void *qword430;
int dword438;
const al::LiveActor *field_440;
al::ParabolicPath *field_448;
al::LiveActor *field_450;
void *qword458;
int dword460;
struct CollectBgmPlayer *qword468;
struct CollectBgmRegister *qword470;
struct BgmAnimeSyncDirector *qword478;
al::DemoSyncedEventKeeper *field_480;
void *field_488;
int field_490;
struct NpcEventDirector *qword498;
al::ChromakeyDrawer *field_4A0;
void *qword4A8;
ProjectNfpDirector *qword4B0;
void *qword4B8;
}; };

View file

@ -126,3 +126,5 @@ class StageSceneStateOption : public al::HostStateBase<al::Scene>, public al::IU
al::MessageSystem *mMsgSystem; al::MessageSystem *mMsgSystem;
InputSeparator *mInputSeperator; InputSeparator *mInputSeperator;
}; };
static_assert(sizeof(StageSceneStateOption) == 0x198, "StageSceneStateOption Size");

View file

@ -17,6 +17,7 @@
#include "logger.hpp" #include "logger.hpp"
#include "server/gamemode/GameModeConfigMenu.hpp" #include "server/gamemode/GameModeConfigMenu.hpp"
#include "server/gamemode/GameModeConfigMenuFactory.hpp"
class FooterParts; class FooterParts;
@ -29,7 +30,8 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
GAMEMODECONFIG, GAMEMODECONFIG,
GAMEMODESWITCH, GAMEMODESWITCH,
RECONNECT, RECONNECT,
SETIP SETIP,
SETPORT
}; };
virtual al::MessageSystem* getMessageSystem(void) const override; virtual al::MessageSystem* getMessageSystem(void) const override;
@ -38,10 +40,13 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
virtual void kill(void) override; virtual void kill(void) override;
void exeMainMenu(); void exeMainMenu();
void exeOpenKeyboard(); void exeOpenKeyboardIP();
void exeOpenKeyboardPort();
void exeRestartServer(); void exeRestartServer();
void exeGamemodeConfig(); void exeGamemodeConfig();
void exeGamemodeSelect(); void exeGamemodeSelect();
void exeSaveData();
void exeConnectError();
void endSubMenu(); void endSubMenu();
@ -61,22 +66,29 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
// Root Page, contains buttons for gamemode config, server reconnecting, and server ip address changing // Root Page, contains buttons for gamemode config, server reconnecting, and server ip address changing
SimpleLayoutMenu* mMainOptions = nullptr; SimpleLayoutMenu* mMainOptions = nullptr;
CommonVerticalList *mMainOptionsList = nullptr; CommonVerticalList *mMainOptionsList = nullptr;
// Sub-Page for Mode configuration, has buttons for selecting current gamemode and configuring currently selected mode (if no mode is chosen, button will not do anything)
SimpleLayoutMenu* mGamemodeConfig = nullptr;
CommonVerticalList* mGameModeConfigList = nullptr;
// Sub-Page of Mode config, used to select a gamemode for the client to use // Sub-Page of Mode config, used to select a gamemode for the client to use
SimpleLayoutMenu* mModeSelect = nullptr; SimpleLayoutMenu* mModeSelect = nullptr;
CommonVerticalList* mModeSelectList = nullptr; CommonVerticalList* mModeSelectList = nullptr;
// Controls what shows up in specific gamemode config page
GameModeConfigMenu *mGamemodeConfigMenu = nullptr; // Sub-Pages for Mode configuration, has buttons for selecting current gamemode and configuring currently selected mode (if no mode is chosen, button will not do anything)
struct GameModeEntry {
GameModeConfigMenu* mMenu;
SimpleLayoutMenu* mLayout = nullptr;
CommonVerticalList* mList = nullptr;
};
sead::SafeArray<GameModeEntry, GameModeConfigMenuFactory::getMenuCount()> mGamemodeConfigMenus;
GameModeEntry *mGamemodeConfigMenu = nullptr;
bool mIsDecideConfig = false; bool mIsDecideConfig = false;
}; };
namespace { namespace {
NERVE_HEADER(StageSceneStateServerConfig, MainMenu) NERVE_HEADER(StageSceneStateServerConfig, MainMenu)
NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboard) NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboardIP)
NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboardPort)
NERVE_HEADER(StageSceneStateServerConfig, RestartServer) NERVE_HEADER(StageSceneStateServerConfig, RestartServer)
NERVE_HEADER(StageSceneStateServerConfig, GamemodeConfig) NERVE_HEADER(StageSceneStateServerConfig, GamemodeConfig)
NERVE_HEADER(StageSceneStateServerConfig, GamemodeSelect) NERVE_HEADER(StageSceneStateServerConfig, GamemodeSelect)
NERVE_HEADER(StageSceneStateServerConfig, SaveData)
NERVE_HEADER(StageSceneStateServerConfig, ConnectError)
} }

View file

@ -51,12 +51,16 @@
#include "Keyboard.hpp" #include "Keyboard.hpp"
#include "server/DeltaTime.hpp" #include "server/DeltaTime.hpp"
static const int playBufSize = 8;
static bool isInGame = false; static bool isInGame = false;
static bool debugMode = false; static bool debugMode = false;
static bool isSmallMode = true;
static float scale = 0.3f;
extern float camDist;
constexpr const char* captureNames[] = { constexpr const char* captureNames[] = {
"AnagramAlphabetCharacter", "Byugo", "Bubble", "Bull", "Car", "ElectricWire", "AnagramAlphabetCharacter", "Byugo", "Bubble", "Bull", "Car", "ElectricWire",
"KillerLauncherMagnum", "KuriboPossessed", "KillerLauncherMagnum", "KuriboPossessed",

View file

@ -33,7 +33,11 @@ namespace nn
return *this; return *this;
} }
inline void print() { inline bool isEmpty() const {
return *this == EmptyId;
}
inline void print() const {
Logger::log("Player ID: 0x"); Logger::log("Player ID: 0x");
Logger::disableName(); Logger::disableName();
for (size_t i = 0; i < 0x10; i++) { Logger::log("%02X", data[i]); } for (size_t i = 0; i < 0x10; i++) { Logger::log("%02X", data[i]); }
@ -41,13 +45,15 @@ namespace nn
Logger::enableName(); Logger::enableName();
} }
inline void print(const char *prefix) { inline void print(const char *prefix) const {
Logger::log("%s: 0x", prefix); Logger::log("%s: 0x", prefix);
Logger::disableName(); Logger::disableName();
for (size_t i = 0; i < 0x10; i++) { Logger::log("%02X", data[i]); } for (size_t i = 0; i < 0x10; i++) { Logger::log("%02X", data[i]); }
Logger::log("\n"); Logger::log("\n");
Logger::enableName(); Logger::enableName();
} }
static const Uid EmptyId;
}; };
typedef u64 NetworkServiceAccountId; typedef u64 NetworkServiceAccountId;

View file

@ -17,6 +17,15 @@ struct sockaddr
u8 _8[8]; // 8 u8 _8[8]; // 8
}; };
struct hostent
{
char* h_name;
char** h_aliases;
int h_addrtype;
int h_length;
char** h_addr_list;
};
namespace nn { namespace socket { namespace nn { namespace socket {
@ -34,4 +43,8 @@ s32 Recv(s32 socket, void* out, ulong outLen, s32 flags);
u16 InetHtons(u16 val); u16 InetHtons(u16 val);
s32 InetAton(const char* addressStr, in_addr* addressOut); s32 InetAton(const char* addressStr, in_addr* addressOut);
struct hostent* GetHostByName(const char* name);
u32 GetLastErrno();
} } } }

View file

@ -2,13 +2,23 @@
#include <cstdint> #include <cstdint>
#include <cstdlib> #include <cstdlib>
#include "types.h"
typedef unsigned long int ulong; typedef unsigned long int ulong;
typedef unsigned short int ushort; typedef unsigned short int ushort;
typedef unsigned int uint; typedef unsigned int uint;
typedef unsigned char uchar; typedef unsigned char uchar;
namespace nn namespace nn {
{
namespace applet {
enum ExitReason {
Normal = 0,
Canceled = 1,
Abnormal = 2,
Unexpected = 10
};
}
namespace swkbd namespace swkbd
{ {
enum Preset enum Preset
@ -103,6 +113,12 @@ namespace nn
Max_DictionaryLang Max_DictionaryLang
}; };
enum CloseResult
{
Enter,
Cancel
};
struct DictionaryInfo struct DictionaryInfo
{ {
uint offset; // 0x0 uint offset; // 0x0
@ -110,34 +126,6 @@ namespace nn
DictionaryLang lang; // 0x6 DictionaryLang lang; // 0x6
}; };
// KeyboardMode keyboardMode; // 0x0
// const char okText[0x8]; // 0x8
// char leftOptionalSymbolKey; // 0x10
// char rightOptionalSymbolKey; // 0x12
// bool isPredictionEnabled; // 0x14
// InvalidChar invalidCharFlag; // 0x18
// InitialCursorPos initialCursorPos; // 0x1C
// const char headerText[0x40]; // 0x20
// const char subText[0x80]; // 0x28
// const char guideText[0x100]; // 0x30
// int textMaxLength; // 0x38
// int textMinLength; // 0x3C
// PasswordMode passwordMode; // 0x40
// InputFormMode inputFormMode; // 0x44
// bool isUseNewLine; // 0x48
// bool isUseUtf8; // 0x49
// bool isUseBlurBackground; // 0x4A
// int _initialStringOffset; // 0x4C
// int _initialStringLength; // 0x50
// int _userDictionaryOffset; // 0x54
// int _userDictionaryNum; // 0x58
// bool _isUseTextCheck; // 0x5C
// void *_textCheckCallback; // 0x60
// int* separateTextPos; // 0x68
// DictionaryInfo* _customizedDicInfoList; // 0x70
// unsigned char _customizedDicCount; // 0x78
// unsigned char* _reserved; // 0x80
struct KeyboardConfig struct KeyboardConfig
{ {
@ -193,6 +181,7 @@ namespace nn
ulong GetRequiredWorkBufferSize(bool); ulong GetRequiredWorkBufferSize(bool);
ulong GetRequiredStringBufferSize(void); ulong GetRequiredStringBufferSize(void);
nn::applet::ExitReason getExitReason();
void MakePreset(nn::swkbd::KeyboardConfig *,nn::swkbd::Preset); void MakePreset(nn::swkbd::KeyboardConfig *,nn::swkbd::Preset);
//void SetHeaderText(nn::swkbd::KeyboardConfig *,char16_t const*); //void SetHeaderText(nn::swkbd::KeyboardConfig *,char16_t const*);
//void SetSubText(nn::swkbd::KeyboardConfig*, char16_t const*); //void SetSubText(nn::swkbd::KeyboardConfig*, char16_t const*);
@ -211,7 +200,9 @@ namespace nn
void SetInitialText(nn::swkbd::ShowKeyboardArg *,char16_t const*); void SetInitialText(nn::swkbd::ShowKeyboardArg *,char16_t const*);
void SetInitialTextUtf8(nn::swkbd::ShowKeyboardArg *,char const*); void SetInitialTextUtf8(nn::swkbd::ShowKeyboardArg *,char const*);
//void SetUserWordList(nn::swkbd::ShowKeyboardArg *,nn::swkbd::UserWord const*,int); //void SetUserWordList(nn::swkbd::ShowKeyboardArg *,nn::swkbd::UserWord const*,int);
void ShowKeyboard(nn::swkbd::String *,nn::swkbd::ShowKeyboardArg const&); int ShowKeyboard(nn::swkbd::String*, nn::swkbd::ShowKeyboardArg const&);
__attribute__((used)) static nn::applet::ExitReason g_ExitReason;
} // namespace swkbd } // namespace swkbd
} // namespace nn } // namespace nn

View file

@ -1,53 +0,0 @@
; Disable uploading error reports to Nintendo
[eupld]
; upload_enabled = u8!0x0
; Control whether RO should ease its validation of NROs.
; (note: this is normally not necessary, and ips patches can be used.)
[ro]
; ease_nro_restriction = u8!0x1
; Atmosphere custom settings
[atmosphere]
; Reboot from fatal automatically after some number of milliseconds.
; If field is not present or 0, fatal will wait indefinitely for user input.
; fatal_auto_reboot_interval = u64!0x0
; Make the power menu's "reboot" button reboot to payload.
; Set to "normal" for normal reboot, "rcm" for rcm reboot.
; power_menu_reboot_function = str!payload
; Controls whether dmnt cheats should be toggled on or off by
; default. 1 = toggled on by default, 0 = toggled off by default.
; dmnt_cheats_enabled_by_default = u8!0x1
; Controls whether dmnt should always save cheat toggle state
; for restoration on new game launch. 1 = always save toggles,
; 0 = only save toggles if toggle file exists.
; dmnt_always_save_cheat_toggles = u8!0x0
; Enable writing to BIS partitions for HBL.
; This is probably undesirable for normal usage.
; enable_hbl_bis_write = u8!0x0
; Enable reading the CAL0 partition for HBL.
; This is probably undesirable for normal usage.
; enable_hbl_cal_read = u8!0x0
; Controls whether fs.mitm should redirect save files
; to directories on the sd card.
; 0 = Do not redirect, 1 = Redirect.
; NOTE: EXPERIMENTAL
; If you do not know what you are doing, do not touch this yet.
; fsmitm_redirect_saves_to_sd = u8!0x0
; Controls whether to enable the deprecated hid mitm
; to fix compatibility with old homebrew.
; 0 = Do not enable, 1 = Enable.
; Please note this setting may be removed in a
; future release of Atmosphere.
; enable_deprecated_hid_mitm = u8!0x0
; Controls whether am sees system settings "DebugModeFlag" as
; enabled or disabled.
; 0 = Disabled (not debug mode), 1 = Enabled (debug mode)
; enable_am_debug_mode = u8!0x0
[hbloader]
; Controls the size of the homebrew heap when running as applet.
; If set to zero, all available applet memory is used as heap.
; The default is zero.
; applet_heap_size = u64!0x0
; Controls the amount of memory to reserve when running as applet
; for usage by other applets. This setting has no effect if
; applet_heap_size is non-zero. The default is 0x8600000.
; applet_heap_reservation_size = u64!0x8600000

20
include/nx/svc.h Normal file
View file

@ -0,0 +1,20 @@
/**
* @file svc.h
* @brief Wrappers for kernel syscalls.
* @copyright libnx Authors
*/
#pragma once
extern "C" {
/**
* @brief Outputs debug text, if used during debugging.
* @param[in] str Text to output.
* @param[in] size Size of the text in bytes.
* @return Result code.
* @note Syscall number 0x27.
*/
Result svcOutputDebugString(const char *str, u64 size);
}

View file

@ -2,7 +2,7 @@
#include "Packet.h" #include "Packet.h"
struct CaptureInf : Packet { struct PACKED CaptureInf : Packet {
CaptureInf() : Packet() { CaptureInf() : Packet() {
this->mType = PacketType::CAPTUREINF; this->mType = PacketType::CAPTUREINF;
mPacketSize = sizeof(CaptureInf) - sizeof(Packet); mPacketSize = sizeof(CaptureInf) - sizeof(Packet);

View file

@ -2,7 +2,7 @@
#include "Packet.h" #include "Packet.h"
struct ChangeStagePacket : Packet { struct PACKED ChangeStagePacket : Packet {
ChangeStagePacket() : Packet() { ChangeStagePacket() : Packet() {
this->mType = PacketType::CHANGESTAGE; this->mType = PacketType::CHANGESTAGE;
mPacketSize = sizeof(ChangeStagePacket) - sizeof(Packet); mPacketSize = sizeof(ChangeStagePacket) - sizeof(Packet);

View file

@ -2,7 +2,7 @@
#include "Packet.h" #include "Packet.h"
struct CostumeInf : Packet { struct PACKED CostumeInf : Packet {
CostumeInf() : Packet() {this->mType = PacketType::COSTUMEINF; mPacketSize = sizeof(CostumeInf) - sizeof(Packet);}; CostumeInf() : Packet() {this->mType = PacketType::COSTUMEINF; mPacketSize = sizeof(CostumeInf) - sizeof(Packet);};
CostumeInf(const char* body, const char* cap) : Packet() { CostumeInf(const char* body, const char* cap) : Packet() {
this->mType = PacketType::COSTUMEINF; this->mType = PacketType::COSTUMEINF;

View file

@ -3,9 +3,9 @@
#include "Packet.h" #include "Packet.h"
#include "al/util.hpp" #include "al/util.hpp"
struct GameInf : Packet { struct PACKED GameInf : Packet {
GameInf() : Packet() {this->mType = PacketType::GAMEINF; mPacketSize = sizeof(GameInf) - sizeof(Packet);}; GameInf() : Packet() {this->mType = PacketType::GAMEINF; mPacketSize = sizeof(GameInf) - sizeof(Packet);};
bool is2D = false; bool1 is2D = false;
u8 scenarioNo = -1; u8 scenarioNo = -1;
char stageName[0x40] = {}; char stageName[0x40] = {};

View file

@ -2,10 +2,10 @@
#include "Packet.h" #include "Packet.h"
struct HackCapInf : Packet { struct PACKED HackCapInf : Packet {
HackCapInf() : Packet() {this->mType = PacketType::HACKCAPINF; mPacketSize = sizeof(HackCapInf) - sizeof(Packet);}; HackCapInf() : Packet() {this->mType = PacketType::HACKCAPINF; mPacketSize = sizeof(HackCapInf) - sizeof(Packet);};
sead::Vector3f capPos; sead::Vector3f capPos;
sead::Quatf capQuat; sead::Quatf capQuat;
bool isCapVisible = false; bool1 isCapVisible = false;
char capAnim[PACKBUFSIZE] = {}; char capAnim[PACKBUFSIZE] = {};
}; };

View file

@ -2,7 +2,7 @@
#include "Packet.h" #include "Packet.h"
struct InitPacket : Packet { struct PACKED InitPacket : Packet {
InitPacket() : Packet() {this->mType = PacketType::CLIENTINIT; mPacketSize = sizeof(InitPacket) - sizeof(Packet);}; InitPacket() : Packet() {this->mType = PacketType::CLIENTINIT; mPacketSize = sizeof(InitPacket) - sizeof(Packet);};
u16 maxPlayers = 0; u16 maxPlayers = 0;
}; };

View file

@ -5,6 +5,8 @@
#include "nn/account.h" #include "nn/account.h"
#include "types.h"
#define PACKBUFSIZE 0x30 #define PACKBUFSIZE 0x30
#define COSTUMEBUFSIZE 0x20 #define COSTUMEBUFSIZE 0x20
@ -23,12 +25,14 @@ enum PacketType : short {
SHINECOLL, SHINECOLL,
CAPTUREINF, CAPTUREINF,
CHANGESTAGE, CHANGESTAGE,
CMD CMD,
End // end of enum for bounds checking
}; };
// attribute otherwise the build log is spammed with unused warnings // attribute otherwise the build log is spammed with unused warnings
__attribute((used)) static const char *packetNames[] = { USED static const char *packetNames[] = {
"Unknown", "Unknown",
"Client Initialization",
"Player Info", "Player Info",
"Player Cap Info", "Player Cap Info",
"Game Info", "Game Info",
@ -38,6 +42,7 @@ __attribute((used)) static const char *packetNames[] = {
"Costume Info", "Costume Info",
"Moon Collection", "Moon Collection",
"Capture Info", "Capture Info",
"Change Stage",
"Server Command" "Server Command"
}; };
@ -59,7 +64,7 @@ static const char *senderNames[] = {
}; };
*/ */
struct Packet { struct PACKED Packet {
nn::account::Uid mUserID; // User ID of the packet owner nn::account::Uid mUserID; // User ID of the packet owner
PacketType mType = PacketType::UNKNOWN; PacketType mType = PacketType::UNKNOWN;
short mPacketSize = 0; // represents packet size without size of header short mPacketSize = 0; // represents packet size without size of header

View file

@ -2,9 +2,11 @@
#include "Packet.h" #include "Packet.h"
struct PlayerConnect : Packet { #include <cstdint>
struct PACKED PlayerConnect : Packet {
PlayerConnect() : Packet() {this->mType = PacketType::PLAYERCON; mPacketSize = sizeof(PlayerConnect) - sizeof(Packet);}; PlayerConnect() : Packet() {this->mType = PacketType::PLAYERCON; mPacketSize = sizeof(PlayerConnect) - sizeof(Packet);};
ConnectionTypes conType; ConnectionTypes conType;
u16 maxPlayerCount; u16 maxPlayerCount = USHRT_MAX;
char clientName[COSTUMEBUFSIZE] = {}; char clientName[COSTUMEBUFSIZE] = {};
}; };

View file

@ -2,6 +2,6 @@
#include "Packet.h" #include "Packet.h"
struct PlayerDC : Packet { struct PACKED PlayerDC : Packet {
PlayerDC() : Packet() {this->mType = PacketType::PLAYERDC; mPacketSize = sizeof(PlayerDC) - sizeof(Packet);}; PlayerDC() : Packet() {this->mType = PacketType::PLAYERDC; mPacketSize = sizeof(PlayerDC) - sizeof(Packet);};
}; };

View file

@ -4,7 +4,7 @@
#include "al/util.hpp" #include "al/util.hpp"
#include "algorithms/PlayerAnims.h" #include "algorithms/PlayerAnims.h"
struct PlayerInf : Packet { struct PACKED PlayerInf : Packet {
PlayerInf() : Packet() {mType = PacketType::PLAYERINF; mPacketSize = sizeof(PlayerInf) - sizeof(Packet);}; PlayerInf() : Packet() {mType = PacketType::PLAYERINF; mPacketSize = sizeof(PlayerInf) - sizeof(Packet);};
sead::Vector3f playerPos; sead::Vector3f playerPos;
sead::Quatf playerRot; sead::Quatf playerRot;

View file

@ -2,7 +2,7 @@
#include "Packet.h" #include "Packet.h"
struct ServerCommand : Packet { struct PACKED ServerCommand : Packet {
ServerCommand(const char *command) : Packet() {this->mType = PacketType::CMD; strcpy(srvCmd, command); mPacketSize = sizeof(ServerCommand) - sizeof(Packet);}; ServerCommand(const char *command) : Packet() {this->mType = PacketType::CMD; strcpy(srvCmd, command); mPacketSize = sizeof(ServerCommand) - sizeof(Packet);};
char srvCmd[PACKBUFSIZE] = {}; char srvCmd[PACKBUFSIZE] = {};
}; };

View file

@ -2,8 +2,8 @@
#include "Packet.h" #include "Packet.h"
struct ShineCollect : Packet { struct PACKED ShineCollect : Packet {
ShineCollect() : Packet() {this->mType = PacketType::SHINECOLL; mPacketSize = sizeof(ShineCollect) - sizeof(Packet);}; ShineCollect() : Packet() {this->mType = PacketType::SHINECOLL; mPacketSize = sizeof(ShineCollect) - sizeof(Packet);};
int shineId = -1; int shineId = -1;
bool isGrand = false; bool1 isGrand = false;
}; };

View file

@ -8,10 +8,10 @@ enum TagUpdateType : u8 {
STATE = 1 << 1 STATE = 1 << 1
}; };
struct TagInf : Packet { struct PACKED TagInf : Packet {
TagInf() : Packet() { this->mType = PacketType::TAGINF; mPacketSize = sizeof(TagInf) - sizeof(Packet);}; TagInf() : Packet() { this->mType = PacketType::TAGINF; mPacketSize = sizeof(TagInf) - sizeof(Packet);};
TagUpdateType updateType; TagUpdateType updateType;
bool isIt = false; bool1 isIt = false;
u8 seconds; u8 seconds;
u16 minutes; u16 minutes;
}; };

View file

@ -28,8 +28,10 @@ class PuppetHolder {
void clearPuppets() { mPuppetArr.clear(); } void clearPuppets() { mPuppetArr.clear(); }
bool resizeHolder(int size);
private: private:
sead::PtrArray<PuppetActor> mPuppetArr; sead::PtrArray<PuppetActor> mPuppetArr = sead::PtrArray<PuppetActor>();
PuppetActor *mDebugPuppet; PuppetActor *mDebugPuppet;

View file

@ -2,6 +2,7 @@
#include "game/GameData/GameDataFile.h" #include "game/GameData/GameDataFile.h"
#include "game/Info/QuestInfoHolder.h" #include "game/Info/QuestInfoHolder.h"
#include "game/Player/PlayerActorBase.h"
#include "sead/math/seadVector.h" #include "sead/math/seadVector.h"
#include "al/util.hpp" #include "al/util.hpp"
#include "al/sensor/SensorMsg.h" #include "al/sensor/SensorMsg.h"
@ -33,7 +34,7 @@ namespace rs {
bool isPlayerDamageStopDemo(const al::LiveActor *); bool isPlayerDamageStopDemo(const al::LiveActor *);
PlayerActorHakoniwa * getPlayerActor(const al::Scene *); PlayerActorBase * getPlayerActor(const al::Scene *);
void get2DAreaPos(sead::Vector3<f32> *, al::AreaObj const *); void get2DAreaPos(sead::Vector3<f32> *, al::AreaObj const *);
@ -76,4 +77,8 @@ namespace rs {
void calcGroundNormalOrGravityDir(sead::Vector3f *result, al::LiveActor const *actor, IUsePlayerCollision const *col); void calcGroundNormalOrGravityDir(sead::Vector3f *result, al::LiveActor const *actor, IUsePlayerCollision const *col);
void calcPlayerFrontDir(sead::Vector3f* result, al::LiveActor const*); void calcPlayerFrontDir(sead::Vector3f* result, al::LiveActor const*);
int getStageShineAnimFrame(al::LiveActor const*, char const*);
const char* getStageShineArchiveName(al::LiveActor const*, char const*);
const char* getStageShineEmptyArchiveName(al::LiveActor const*, char const*);
} }

View file

@ -5,6 +5,8 @@
#include "al/sensor/SensorHitGroup.h" #include "al/sensor/SensorHitGroup.h"
#include "al/LiveActor/LiveActor.h" // for SensorMsg #include "al/LiveActor/LiveActor.h" // for SensorMsg
#include "game/Interfaces/IUsePlayerHack.h"
#include "game/Player/PlayerHackKeeper.h"
#include <sead/math/seadVector.h> #include <sead/math/seadVector.h>
@ -880,7 +882,7 @@ bool sendMsgGolemStampPress(al::HitSensor*, al::HitSensor*);
// bool sendMsgSwitchOnWithSaveRequest(al::LiveActor*, SaveObjInfo*); // bool sendMsgSwitchOnWithSaveRequest(al::LiveActor*, SaveObjInfo*);
bool sendMsgWanwanReboundAttackToCollided(al::LiveActor const*, al::HitSensor*); bool sendMsgWanwanReboundAttackToCollided(al::LiveActor const*, al::HitSensor*);
bool sendMsgWanwanBlockAttackToCollided(al::LiveActor const*, al::HitSensor*); bool sendMsgWanwanBlockAttackToCollided(al::LiveActor const*, al::HitSensor*);
bool sendMsgDigPointSmell(al::HitSensor*, al::HitSensor*, DigPoint*); bool sendMsgDigPointSmell(al::HitSensor*, al::HitSensor*, struct DigPoint*);
bool sendMsgMofumofuBodyChainExplode(al::HitSensor*, al::HitSensor*, int); bool sendMsgMofumofuBodyChainExplode(al::HitSensor*, al::HitSensor*, int);
bool sendMsgMoonBasementRockThroughCollision(al::HitSensor*, al::HitSensor*, bool); bool sendMsgMoonBasementRockThroughCollision(al::HitSensor*, al::HitSensor*, bool);
bool sendMsgFishingWait(al::HitSensor*, al::HitSensor*, al::HitSensor*); bool sendMsgFishingWait(al::HitSensor*, al::HitSensor*, al::HitSensor*);
@ -1006,7 +1008,7 @@ bool sendMsgBossMagmaDeadDemoStart(al::HitSensor*, al::HitSensor*);
bool sendMsgBossMagmaDeadDemoEnd(al::HitSensor*, al::HitSensor*, sead::Vector3<float> const&); bool sendMsgBossMagmaDeadDemoEnd(al::HitSensor*, al::HitSensor*, sead::Vector3<float> const&);
bool sendMsgBossMagmaResetPos(al::HitSensor*, al::HitSensor*, sead::Vector3<float> const&); bool sendMsgBossMagmaResetPos(al::HitSensor*, al::HitSensor*, sead::Vector3<float> const&);
bool sendMsgBossMagmaQueryToBubble(al::HitSensor*, al::HitSensor*); bool sendMsgBossMagmaQueryToBubble(al::HitSensor*, al::HitSensor*);
bool sendMsgCheckFishingTarget(al::HitSensor*, al::HitSensor*, FishingFish const*); bool sendMsgCheckFishingTarget(al::HitSensor*, al::HitSensor*, struct FishingFish const*);
bool sendMsgPushToPlayerAndKillVelocityToTarget(al::LiveActor*, al::HitSensor*, al::HitSensor*); bool sendMsgPushToPlayerAndKillVelocityToTarget(al::LiveActor*, al::HitSensor*, al::HitSensor*);
bool sendMsgPushToPlayerAndKillVelocityToTargetH(al::LiveActor*, al::HitSensor*, al::HitSensor*); bool sendMsgPushToPlayerAndKillVelocityToTargetH(al::LiveActor*, al::HitSensor*, al::HitSensor*);
bool sendMsgInitCapTarget(al::HitSensor*, al::HitSensor*, CapTargetInfo const**); bool sendMsgInitCapTarget(al::HitSensor*, al::HitSensor*, CapTargetInfo const**);

View file

@ -24,6 +24,7 @@
#include "container/seadPtrArray.h" #include "container/seadPtrArray.h"
#include "game/Actors/Shine.h" #include "game/Actors/Shine.h"
#include "game/GameData/GameDataHolderAccessor.h"
#include "game/Player/PlayerActorHakoniwa.h" #include "game/Player/PlayerActorHakoniwa.h"
#include "game/StageScene/StageScene.h" #include "game/StageScene/StageScene.h"
#include "game/Layouts/CoinCounter.h" #include "game/Layouts/CoinCounter.h"
@ -31,6 +32,8 @@
#include "game/GameData/GameDataHolderWriter.h" #include "game/GameData/GameDataHolderWriter.h"
#include "game/GameData/GameDataFunction.h" #include "game/GameData/GameDataFunction.h"
#include "heap/seadFrameHeap.h"
#include "heap/seadHeap.h"
#include "layouts/HideAndSeekIcon.h" #include "layouts/HideAndSeekIcon.h"
#include "rs/util.hpp" #include "rs/util.hpp"
@ -65,6 +68,8 @@
#include <stdlib.h> #include <stdlib.h>
#define MAXPUPINDEX 32
struct UIDIndexNode { struct UIDIndexNode {
nn::account::Uid uid; nn::account::Uid uid;
int puppetIndex; int puppetIndex;
@ -73,17 +78,17 @@ struct UIDIndexNode {
class HideAndSeekIcon; class HideAndSeekIcon;
class Client { class Client {
SEAD_SINGLETON_DISPOSER(Client)
public: public:
static Client *sInstance; Client();
Client(int bufferSize); void init(al::LayoutInitInfo const &initInfo, GameDataHolderAccessor holder);
void init(al::LayoutInitInfo const &initInfo);
bool StartThreads(); bool StartThreads();
void readFunc(); void readFunc();
void recvFunc(); void recvFunc();
static void stopConnection(); static void restartConnection();
bool isDone() { return mReadThread->isDone(); }; bool isDone() { return mReadThread->isDone(); };
static bool isSocketActive() { return sInstance ? sInstance->mSocket->isConnected() : false; }; static bool isSocketActive() { return sInstance ? sInstance->mSocket->isConnected() : false; };
@ -91,10 +96,8 @@ class Client {
static bool isNeedUpdateShines(); static bool isNeedUpdateShines();
bool isShineCollected(int shineId); bool isShineCollected(int shineId);
static void initMode(GameModeInitInfo const &initInfo);
static void sendHackCapInfPacket(const HackCap *hackCap); static void sendHackCapInfPacket(const HackCap *hackCap);
static void sendPlayerInfPacket(const PlayerActorHakoniwa *player); static void sendPlayerInfPacket(const PlayerActorBase *player, bool isYukimaru);
static void sendGameInfPacket(const PlayerActorHakoniwa *player, GameDataHolderAccessor holder); static void sendGameInfPacket(const PlayerActorHakoniwa *player, GameDataHolderAccessor holder);
static void sendGameInfPacket(GameDataHolderAccessor holder); static void sendGameInfPacket(GameDataHolderAccessor holder);
static void sendCostumeInfPacket(const char *body, const char *cap); static void sendCostumeInfPacket(const char *body, const char *cap);
@ -105,8 +108,6 @@ class Client {
int getCollectedShinesCount() { return curCollectedShines.size(); } int getCollectedShinesCount() { return curCollectedShines.size(); }
int getShineID(int index) { if (index < curCollectedShines.size()) { return curCollectedShines[index]; } return -1; } int getShineID(int index) { if (index < curCollectedShines.size()) { return curCollectedShines[index]; } return -1; }
static void setGameActive(bool state);
static void setStageInfo(GameDataHolderAccessor holder); static void setStageInfo(GameDataHolderAccessor holder);
static bool tryAddPuppet(PuppetActor *puppet); static bool tryAddPuppet(PuppetActor *puppet);
@ -125,35 +126,22 @@ class Client {
static PuppetActor* getDebugPuppet(); static PuppetActor* getDebugPuppet();
static GameMode getServerMode() { static int getMaxPlayerCount() { return sInstance ? sInstance->maxPuppets + 1 : 10;}
return sInstance ? sInstance->mServerMode : GameMode::NONE;
}
static void setServerMode(GameMode mode) {
if (sInstance) sInstance->mServerMode = mode;
}
static GameMode getCurrentMode();
static GameModeBase* getModeBase() { return sInstance ? sInstance->mCurMode : nullptr; }
template <typename T>
static T* getMode() {return sInstance ? (T*)sInstance->mCurMode : nullptr;}
static GameModeConfigMenu* tryCreateModeMenu();
static int getMaxPlayerCount() { return sInstance ? sInstance->maxPuppets : 10;}
static void toggleCurrentMode();
static void updateStates(); static void updateStates();
static void clearArrays(); static void clearArrays();
static Keyboard* getKeyboard();
static const char* getCurrentIP(); static const char* getCurrentIP();
static void setLastUsedIP(const char* ip); static void setLastUsedIP(const char* ip);
static const int getCurrentPort();
static void setLastUsedPort(const int port);
static void setTagState(bool state); static void setTagState(bool state);
static int getConnectCount() { static int getConnectCount() {
@ -162,6 +150,12 @@ class Client {
return 0; return 0;
} }
static PuppetHolder* getPuppetHolder() {
if (sInstance)
return sInstance->mPuppetHolder;
return nullptr;
}
static void setSceneInfo(const al::ActorInitInfo& initInfo, const StageScene *stageScene); static void setSceneInfo(const al::ActorInitInfo& initInfo, const StageScene *stageScene);
static bool tryRegisterShine(Shine* shine); static bool tryRegisterShine(Shine* shine);
@ -170,22 +164,14 @@ class Client {
static void updateShines(); static void updateShines();
static void openKeyboardIP(); static bool openKeyboardIP();
static bool openKeyboardPort();
static GameModeInfoBase* getModeInfo() { static void showConnect();
return sInstance ? sInstance->mModeInfo : nullptr;
}
// should only be called during mode init static void showConnectError(const char16_t* msg);
static void setModeInfo(GameModeInfoBase* info) {
if(sInstance) sInstance->mModeInfo = info;
}
static void tryRestartCurrentMode(); static void hideConnect();
static bool isModeActive() { return sInstance ? sInstance->mIsModeActive : false; }
static bool isSelectedMode(GameMode mode) { return sInstance ? sInstance->mCurMode->getMode() == mode: false; }
void resetCollectedShines(); void resetCollectedShines();
@ -194,8 +180,6 @@ class Client {
// public for debug purposes // public for debug purposes
SocketClient *mSocket; SocketClient *mSocket;
int maxPuppets;
private: private:
void updatePlayerInfo(PlayerInf *packet); void updatePlayerInfo(PlayerInf *packet);
void updateHackCapInfo(HackCapInf *packet); void updateHackCapInfo(HackCapInf *packet);
@ -208,7 +192,7 @@ class Client {
void sendToStage(ChangeStagePacket* packet); void sendToStage(ChangeStagePacket* packet);
void disconnectPlayer(PlayerDC *packet); void disconnectPlayer(PlayerDC *packet);
int findPuppetID(const nn::account::Uid& id); PuppetInfo* findPuppetInfo(const nn::account::Uid& id, bool isFindAvailable);
bool startConnection(); bool startConnection();
@ -218,14 +202,14 @@ class Client {
al::AsyncFunctorThread *mReadThread = nullptr; // TODO: use this thread to send any queued packets al::AsyncFunctorThread *mReadThread = nullptr; // TODO: use this thread to send any queued packets
// al::AsyncFunctorThread *mRecvThread; // TODO: use this thread to recieve packets and update PuppetInfo // al::AsyncFunctorThread *mRecvThread; // TODO: use this thread to recieve packets and update PuppetInfo
sead::SafeArray<UIDIndexNode, 16> puppetPlayerID;
int mConnectCount = 0; int mConnectCount = 0;
nn::account::Uid mUserID; nn::account::Uid mUserID;
sead::FixedSafeString<0x20> mUsername; sead::FixedSafeString<0x20> mUsername;
bool mIsConnectionActive = false;
// --- Server Syncing Members --- // --- Server Syncing Members ---
// array of shine IDs for checking if multiple shines have been collected in quick sucession, all moons within the players stage that match the ID will be deleted // array of shine IDs for checking if multiple shines have been collected in quick sucession, all moons within the players stage that match the ID will be deleted
@ -234,17 +218,18 @@ class Client {
int lastCollectedShine = -1; int lastCollectedShine = -1;
PlayerInf lastPlayerInfPacket = // Backups for our last player/game packets, used for example to re-send them for newly connected clients
PlayerInf(); // Info struct for storing our currently logged player information PlayerInf lastPlayerInfPacket = PlayerInf();
GameInf lastGameInfPacket = GameInf(); GameInf lastGameInfPacket = GameInf();
CostumeInf lastCostumeInfPacket = CostumeInf();
Keyboard* mKeyboard = nullptr; // keyboard for setting server IP Keyboard* mKeyboard = nullptr; // keyboard for setting server IP
sead::FixedSafeString<0x10> mServerIP; hostname mServerIP;
int mServerPort = 1027; // TODO: implement a way to set this the same way the IP can int mServerPort = 0;
bool waitForGameInit = true;
bool isFirstConnect = true; bool isFirstConnect = true;
// --- Game Layouts --- // --- Game Layouts ---
@ -253,8 +238,6 @@ class Client {
// --- Game Info --- // --- Game Info ---
bool mIsInGame = false;
bool isClientCaptured = false; bool isClientCaptured = false;
bool isSentCaptureInf = false; bool isSentCaptureInf = false;
@ -270,21 +253,17 @@ class Client {
sead::FixedSafeString<0x40> mStageName; sead::FixedSafeString<0x40> mStageName;
GameDataHolderAccessor mHolder;
u8 mScenario = 0; u8 mScenario = 0;
// --- Mode Info --- sead::FrameHeap *mHeap = nullptr; // Custom FrameHeap used for all Client related memory
GameModeBase* mCurMode = nullptr;
GameMode mServerMode = GameMode::NONE; // current mode set by server, will sometimes not match up with current game mode (until scene re-init) if server switches gamemodes
GameModeInfoBase *mModeInfo = nullptr;
bool mIsModeActive = false;
// --- Puppet Info --- // --- Puppet Info ---
PuppetInfo *mPuppetInfoArr[32]; int maxPuppets = 9; // default max player count is 10, so default max puppets will be 9
PuppetInfo *mPuppetInfoArr[MAXPUPINDEX] = {};
PuppetHolder *mPuppetHolder = nullptr; PuppetHolder *mPuppetHolder = nullptr;

View file

@ -23,6 +23,7 @@ class SocketClient : public SocketBase {
mPacketQueue.tryAllocBuffer(maxBufSize, nullptr); mPacketQueue.tryAllocBuffer(maxBufSize, nullptr);
}; };
nn::Result init(const char* ip, u16 port) override; nn::Result init(const char* ip, u16 port) override;
bool closeSocket() override;
bool SEND(Packet *packet); bool SEND(Packet *packet);
bool RECV(); bool RECV();
void printPacket(Packet* packet); void printPacket(Packet* packet);
@ -32,4 +33,11 @@ class SocketClient : public SocketBase {
private: private:
int maxBufSize = 100; int maxBufSize = 100;
/**
* @param str a string containing an IPv4 address or a hostname that can be resolved via DNS
* @param out IPv4 address
* @return if this function was successfull and out contains a valid IP address
*/
bool stringToIPAddress(const char* str, in_addr* out);
}; };

View file

@ -21,7 +21,6 @@ enum GameMode : s8 {
// struct containing info about the games state for use in gamemodes // struct containing info about the games state for use in gamemodes
struct GameModeInitInfo { struct GameModeInitInfo {
GameModeInitInfo(al::ActorInitInfo* info, al::Scene *scene){ GameModeInitInfo(al::ActorInitInfo* info, al::Scene *scene){
mLayoutInitInfo = info->mLayoutInitInfo; mLayoutInitInfo = info->mLayoutInitInfo;
mPlayerHolder = info->mActorSceneInfo.mPlayerHolder; mPlayerHolder = info->mActorSceneInfo.mPlayerHolder;
@ -47,6 +46,7 @@ struct GameModeInitInfo {
class GameModeBase : public al::IUseName, public al::IUseSceneObjHolder { class GameModeBase : public al::IUseName, public al::IUseSceneObjHolder {
public: public:
GameModeBase(const char* name) { mName = name; } GameModeBase(const char* name) { mName = name; }
virtual ~GameModeBase() = default;
const char* getName() const override { return mName.cstr(); } const char* getName() const override { return mName.cstr(); }
al::SceneObjHolder* getSceneObjHolder() const override { return mSceneObjHolder; } al::SceneObjHolder* getSceneObjHolder() const override { return mSceneObjHolder; }

View file

@ -0,0 +1,38 @@
#pragma once
#include "al/factory/Factory.h"
#include "server/hns/HideAndSeekConfigMenu.hpp"
#include "server/gamemode/GameModeConfigMenu.hpp"
typedef GameModeConfigMenu* (*createMenu)(const char* name);
template <class T>
GameModeConfigMenu* createGameModeConfigMenu(const char* name) {
return new T();
};
__attribute((used)) constexpr al::NameToCreator<createMenu> menuTable[] = {
{"HideAndSeek", &createGameModeConfigMenu<HideAndSeekConfigMenu>},
};
class GameModeConfigMenuFactory : public al::Factory<createMenu> {
public:
GameModeConfigMenuFactory(const char* fName) {
this->factoryName = fName;
this->actorTable = menuTable;
this->factoryCount = sizeof(menuTable) / sizeof(menuTable[0]);
};
constexpr static const char* getMenuName(int idx);
constexpr static int getMenuCount();
};
constexpr const char* GameModeConfigMenuFactory::getMenuName(int idx) {
if (idx >= 0 && idx < sizeof(menuTable) / sizeof(menuTable[0]))
return menuTable[idx].creatorName;
return nullptr;
}
constexpr int GameModeConfigMenuFactory::getMenuCount() {
return sizeof(menuTable) / sizeof(menuTable[0]);
}

View file

@ -1,9 +1,8 @@
#pragma once #pragma once
#include "al/factory/Factory.h" #include "al/factory/Factory.h"
#include "layouts/HideAndSeekIcon.h"
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include "server/HideAndSeekMode.hpp" #include "server/hns/HideAndSeekMode.hpp"
typedef GameModeBase* (*createMode)(const char* name); typedef GameModeBase* (*createMode)(const char* name);
@ -37,19 +36,19 @@ class GameModeFactory : public al::Factory<createMode> {
// TODO: possibly use shadows' crc32 hash algorithm for this // TODO: possibly use shadows' crc32 hash algorithm for this
constexpr const char* GameModeFactory::getModeString(GameMode mode) { constexpr const char* GameModeFactory::getModeString(GameMode mode) {
if(mode >= 0 && mode < sizeof(modeTable)/sizeof(modeTable[0])) if(mode >= 0 && (size_t)mode < sizeof(modeTable)/sizeof(modeTable[0]))
return modeTable[mode].creatorName; return modeTable[mode].creatorName;
return nullptr; return nullptr;
} }
constexpr const char* GameModeFactory::getModeName(GameMode mode) { constexpr const char* GameModeFactory::getModeName(GameMode mode) {
if(mode >= 0 && mode < sizeof(modeNames)/sizeof(modeNames[0])) if(mode >= 0 && (size_t)mode < sizeof(modeNames)/sizeof(modeNames[0]))
return modeNames[mode]; return modeNames[mode];
return nullptr; return nullptr;
} }
constexpr const char* GameModeFactory::getModeName(int idx) { constexpr const char* GameModeFactory::getModeName(int idx) {
if(idx >= 0 && idx < sizeof(modeNames)/sizeof(modeNames[0])) if(idx >= 0 && (size_t)idx < sizeof(modeNames)/sizeof(modeNames[0]))
return modeNames[idx]; return modeNames[idx];
return nullptr; return nullptr;
} }

View file

@ -1,21 +1,11 @@
#pragma once #pragma once
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include <heap/seadHeap.h>
// base struct containing info about the current gamemode // base struct containing info about the current gamemode
struct GameModeInfoBase { struct GameModeInfoBase {
GameMode mMode; GameMode mMode;
}; };
template<class T> #include "server/gamemode/GameModeManager.hpp"
T *createModeInfo() {
// using sequence heap to create mode info should allow for mode info to persist between scenes
sead::Heap* seqHeap = sead::HeapMgr::instance()->findHeapByName("SequenceHeap", 0);
if (seqHeap) {
return new (seqHeap) T();
} else {
// if failed to get sequence heap, fall back to current heap (will return null if current heap is also null)
return new T();
}
}

View file

@ -0,0 +1,59 @@
#pragma once
#include <heap/seadDisposer.h>
#include <heap/seadHeap.h>
#include <container/seadSafeArray.h>
#include "server/gamemode/GameModeBase.hpp"
#include "server/gamemode/GameModeInfoBase.hpp"
class GameModeManager {
SEAD_SINGLETON_DISPOSER(GameModeManager)
GameModeManager();
~GameModeManager();
public:
void setMode(GameMode mode);
void initScene(const GameModeInitInfo& info);
void begin();
void end();
void update();
GameMode getGameMode() const { return mCurMode; }
template<class T> T* getMode() const { return static_cast<T*>(mCurModeBase); }
template<class T> T* getInfo() const { return static_cast<T*>(mModeInfo); }
void setInfo(GameModeInfoBase* info) {
mModeInfo = info;
}
template<class T>
T* createModeInfo();
sead::Heap* getHeap() { return mHeap; }
void toggleActive();
void setActive(bool active) { mActive = active; }
void setPaused(bool paused);
bool isMode(GameMode mode) const { return mCurMode == mode; }
bool isActive() const { return mActive; }
bool isModeAndActive(GameMode mode) const { return isMode(mode) && isActive(); }
bool isPaused() const { return mPaused; }
private:
sead::Heap* mHeap = nullptr;
bool mActive = false;
bool mPaused = false;
bool mWasSceneTrans = false;
bool mWasSetMode = false;
GameMode mCurMode = GameMode::NONE;
GameModeBase* mCurModeBase = nullptr;
GameModeInfoBase *mModeInfo = nullptr;
GameModeInitInfo *mLastInitInfo = nullptr;
};
template<class T>
T* GameModeManager::createModeInfo() {
sead::ScopedCurrentHeapSetter heapSetter(mHeap);
T* info = new T();
mModeInfo = info;
return info;
}

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "gamemode/GameModeConfigMenu.hpp" #include "server/gamemode/GameModeConfigMenu.hpp"
#include "game/Layouts/CommonVerticalList.h" #include "game/Layouts/CommonVerticalList.h"
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"

View file

@ -2,11 +2,11 @@
#include <math.h> #include <math.h>
#include "al/camera/CameraTicket.h" #include "al/camera/CameraTicket.h"
#include "gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include "gamemode/GameModeInfoBase.hpp" #include "server/gamemode/GameModeInfoBase.hpp"
#include "server/gamemode/GameModeConfigMenu.hpp" #include "server/gamemode/GameModeConfigMenu.hpp"
#include "server/gamemode/GameModeTimer.hpp" #include "server/gamemode/GameModeTimer.hpp"
#include "server/HideAndSeekConfigMenu.hpp" #include "server/hns/HideAndSeekConfigMenu.hpp"
struct HideAndSeekInfo : GameModeInfoBase { struct HideAndSeekInfo : GameModeInfoBase {
HideAndSeekInfo() { mMode = GameMode::HIDEANDSEEK; } HideAndSeekInfo() { mMode = GameMode::HIDEANDSEEK; }

View file

@ -5,6 +5,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "sead/prim/seadSafeString.h"
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned short u16; typedef unsigned short u16;
@ -18,6 +19,10 @@ typedef signed int s32;
typedef int64_t s64; typedef int64_t s64;
typedef __int128_t s128; typedef __int128_t s128;
// bool size is implementation defined, so use these where it's important
typedef u8 bool1;
typedef u32 bool4;
typedef float f32; typedef float f32;
typedef double f64; typedef double f64;
@ -37,6 +42,9 @@ typedef unsigned int undefined3;
typedef unsigned int undefined4; typedef unsigned int undefined4;
typedef unsigned long undefined8; typedef unsigned long undefined8;
const u8 MAX_HOSTNAME_LENGTH = 50;
typedef sead::FixedSafeString<MAX_HOSTNAME_LENGTH + 1> hostname;
enum SocketLogState { enum SocketLogState {
SOCKET_LOG_UNINITIALIZED = 0, SOCKET_LOG_UNINITIALIZED = 0,
SOCKET_LOG_CONNECTED = 1, SOCKET_LOG_CONNECTED = 1,
@ -76,3 +84,6 @@ struct Rect
float right; float right;
float top; float top;
}; };
#define PACKED __attribute__((packed))
#define USED __attribute__((used))

View file

@ -29,6 +29,7 @@ B59E28 B seadPrintHook // sead::system::print
1B3F0C NOP // disables call to open HTML viewer during first time odyssey flight 1B3F0C NOP // disables call to open HTML viewer during first time odyssey flight
1F2A2C MOV W0, #1 // patches checkpoint system to always allow warping 1F2A2C MOV W0, #1 // patches checkpoint system to always allow warping
216FAC MOV W0, #0 // disables AppearSwitchTimer's camera switch
// Puppet Actor Setup // Puppet Actor Setup
4B5E30 B ProjectActorFactory // patches actor factory ctor with custom matching factory 4B5E30 B ProjectActorFactory // patches actor factory ctor with custom matching factory
@ -111,3 +112,4 @@ B59E28 B seadPrintHook // sead::system::print
5C00B0 BL borderPullBackHook // hooks over isFirstStep in WorldEndBorderKeeper::exePullBack so we can kill the player if they reach the border of the map 5C00B0 BL borderPullBackHook // hooks over isFirstStep in WorldEndBorderKeeper::exePullBack so we can kill the player if they reach the border of the map
// 4E46BC NOP // removes call to setEnableData for one of the commonverticallists in the options menu, which makes all entries in the menu look the same

Binary file not shown.

View file

@ -6,8 +6,12 @@ import sys
# Create a TCP/IP socket # Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 3080
if len(sys.argv) == 3:
port = int(sys.argv[2])
# Bind the socket to the port # Bind the socket to the port
server_address = (sys.argv[1], 3080) server_address = (sys.argv[1], port)
print(f"Starting TCP Server with IP {server_address[0]} and Port {server_address[1]}.") print(f"Starting TCP Server with IP {server_address[0]} and Port {server_address[1]}.")
sock.bind(server_address) sock.bind(server_address)
@ -22,12 +26,17 @@ while True:
print(f'Switch Connected! IP: {client_address[0]} Port: {client_address[1]}') print(f'Switch Connected! IP: {client_address[0]} Port: {client_address[1]}')
while True: while True:
data = connection.recv(1024) data = connection.recv(1024)
if data: if data:
print(data.decode("utf-8")) print(data.decode("utf-8"), end='', flush=True)
else: else:
print(f'Connection Terminated.') print(f'Connection Terminated.')
break break
except ConnectionResetError:
print("Connection reset")
finally: finally:
# Clean up the connection # Clean up the connection
connection.close() connection.close()

View file

@ -16,23 +16,14 @@ Keyboard::Keyboard(ulong strSize) : mResultString(strSize) {
mCustomizeDicSize = 0x400; mCustomizeDicSize = 0x400;
mCustomizeDicBuf = (char*)malloc(mCustomizeDicSize); mCustomizeDicBuf = (char*)malloc(mCustomizeDicSize);
mIsDoneKeyboard = false;
} }
void Keyboard::keyboardThread() { void Keyboard::keyboardThread() {
mIsDoneKeyboard = false;
nn::swkbd::ShowKeyboardArg keyboardArg = nn::swkbd::ShowKeyboardArg(); nn::swkbd::ShowKeyboardArg keyboardArg = nn::swkbd::ShowKeyboardArg();
nn::swkbd::MakePreset(&keyboardArg.keyboardConfig, nn::swkbd::Preset::Default); nn::swkbd::MakePreset(&keyboardArg.keyboardConfig, nn::swkbd::Preset::Default);
keyboardArg.keyboardConfig.keyboardMode = nn::swkbd::KeyboardMode::ModeNumeric; mSetupFunc(keyboardArg.keyboardConfig);
keyboardArg.keyboardConfig.leftOptionalSymbolKey = '.';
keyboardArg.keyboardConfig.textMaxLength = 15;
keyboardArg.keyboardConfig.textMinLength = 1;
keyboardArg.keyboardConfig.isUseUtf8 = true;
keyboardArg.keyboardConfig.inputFormMode = nn::swkbd::InputFormMode::OneLine;
nn::swkbd::SetHeaderText(&keyboardArg.keyboardConfig, mHeaderText); nn::swkbd::SetHeaderText(&keyboardArg.keyboardConfig, mHeaderText);
nn::swkbd::SetSubText(&keyboardArg.keyboardConfig, mSubText); nn::swkbd::SetSubText(&keyboardArg.keyboardConfig, mSubText);
@ -49,15 +40,15 @@ void Keyboard::keyboardThread() {
nn::swkbd::SetInitialTextUtf8(&keyboardArg, mInitialText.cstr()); nn::swkbd::SetInitialTextUtf8(&keyboardArg, mInitialText.cstr());
} }
nn::swkbd::ShowKeyboard(&mResultString, keyboardArg); mIsCancelled =
nn::swkbd::ShowKeyboard(&mResultString, keyboardArg) == 671; // no idea what 671 could be
mIsDoneKeyboard = true;
} }
void Keyboard::openKeyboard(const char* initialText) { void Keyboard::openKeyboard(const char* initialText, KeyboardSetup setupFunc) {
mInitialText = initialText; mInitialText = initialText;
mSetupFunc = setupFunc;
mThread->start(); mThread->start();
} }

View file

@ -26,10 +26,10 @@
#include "math/seadVector.h" #include "math/seadVector.h"
#include "rs/util/InputUtil.h" #include "rs/util/InputUtil.h"
#include "sead/prim/seadSafeString.h" #include "sead/prim/seadSafeString.h"
#include "server/HideAndSeekMode.hpp" #include "server/hns/HideAndSeekMode.hpp"
bool comboBtnHook(int port) { bool comboBtnHook(int port) {
if (Client::isModeActive()) { // only switch to combo if any gamemode is active if (GameModeManager::instance()->isActive()) { // only switch to combo if any gamemode is active
return !al::isPadHoldL(port) && al::isPadTriggerDown(port); return !al::isPadHoldL(port) && al::isPadTriggerDown(port);
} else { } else {
return al::isPadTriggerDown(port); return al::isPadTriggerDown(port);
@ -39,11 +39,18 @@ bool comboBtnHook(int port) {
void saveWriteHook(al::ByamlWriter* saveByml) { void saveWriteHook(al::ByamlWriter* saveByml) {
const char *serverIP = Client::getCurrentIP(); const char *serverIP = Client::getCurrentIP();
const int serverPort = Client::getCurrentPort();
if (serverIP) { if (serverIP) {
saveByml->addString("ServerIP", serverIP); saveByml->addString("ServerIP", serverIP);
} else { } else {
saveByml->addString("ServerIP", "0.0.0.0"); saveByml->addString("ServerIP", "127.0.0.1");
}
if (serverPort) {
saveByml->addInt("ServerPort", serverPort);
} else {
saveByml->addInt("ServerPort", 0);
} }
saveByml->pop(); saveByml->pop();
@ -52,11 +59,16 @@ void saveWriteHook(al::ByamlWriter* saveByml) {
bool saveReadHook(int* padRumbleInt, al::ByamlIter const& saveByml, char const* padRumbleKey) { bool saveReadHook(int* padRumbleInt, al::ByamlIter const& saveByml, char const* padRumbleKey) {
const char *serverIP = ""; const char *serverIP = "";
int serverPort = 0;
if (al::tryGetByamlString(&serverIP, saveByml, "ServerIP")) { if (al::tryGetByamlString(&serverIP, saveByml, "ServerIP")) {
Client::setLastUsedIP(serverIP); Client::setLastUsedIP(serverIP);
} }
if (al::tryGetByamlS32(&serverPort, saveByml, "ServerPort")) {
Client::setLastUsedPort(serverPort);
}
return al::tryGetByamlS32(padRumbleInt, saveByml, padRumbleKey); return al::tryGetByamlS32(padRumbleInt, saveByml, padRumbleKey);
} }
@ -98,19 +110,19 @@ void initNerveStateHook(StageSceneStatePauseMenu* stateParent, StageSceneStateOp
// skips starting both coin counters // skips starting both coin counters
void startCounterHook(CoinCounter* thisPtr) { void startCounterHook(CoinCounter* thisPtr) {
if (!Client::isModeActive()) { if (!GameModeManager::instance()->isActive()) {
thisPtr->tryStart(); thisPtr->tryStart();
} }
} }
// Simple hook that can be used to override isModeE3 checks to enable/disable certain behaviors // Simple hook that can be used to override isModeE3 checks to enable/disable certain behaviors
bool modeE3Hook() { bool modeE3Hook() {
return Client::isModeActive(); return GameModeManager::instance()->isActive();
} }
// Skips ending the play guide layout if a mode is active, since the mode would have already ended it // Skips ending the play guide layout if a mode is active, since the mode would have already ended it
void playGuideEndHook(al::SimpleLayoutAppearWaitEnd* thisPtr) { void playGuideEndHook(al::SimpleLayoutAppearWaitEnd* thisPtr) {
if (!Client::isModeActive()) { if (!GameModeManager::instance()->isActive()) {
thisPtr->end(); thisPtr->end();
} }
} }
@ -123,14 +135,14 @@ void initHackCapHook(al::LiveActor *cappy) {
al::PlayerHolder* createTicketHook(StageScene* curScene) { al::PlayerHolder* createTicketHook(StageScene* curScene) {
// only creates custom gravity camera ticket if hide and seek mode is active // only creates custom gravity camera ticket if hide and seek mode is active
if (Client::isSelectedMode(GameMode::HIDEANDSEEK)) { if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
al::CameraDirector* director = curScene->getCameraDirector(); al::CameraDirector* director = curScene->getCameraDirector();
if (director) { if (director) {
if (director->mFactory) { if (director->mFactory) {
al::CameraTicket* gravityCamera = director->createCameraFromFactory( al::CameraTicket* gravityCamera = director->createCameraFromFactory(
"CameraPoserCustom", nullptr, 0, 5, sead::Matrix34f::ident); "CameraPoserCustom", nullptr, 0, 5, sead::Matrix34f::ident);
HideAndSeekMode* mode = Client::getMode<HideAndSeekMode>(); HideAndSeekMode* mode = GameModeManager::instance()->getMode<HideAndSeekMode>();
mode->setCameraTicket(gravityCamera); mode->setCameraTicket(gravityCamera);
} }
@ -145,9 +157,9 @@ bool borderPullBackHook(WorldEndBorderKeeper* thisPtr) {
bool isFirstStep = al::isFirstStep(thisPtr); bool isFirstStep = al::isFirstStep(thisPtr);
if (isFirstStep) { if (isFirstStep) {
if (Client::isSelectedMode(GameMode::HIDEANDSEEK) && Client::isModeActive()) { if (GameModeManager::instance()->isModeAndActive(GameMode::HIDEANDSEEK)) {
HideAndSeekMode* mode = Client::getMode<HideAndSeekMode>(); HideAndSeekMode* mode = GameModeManager::instance()->getMode<HideAndSeekMode>();
if (mode->isUseGravity()) { if (mode->isUseGravity()) {
killMainPlayer(thisPtr->mActor); killMainPlayer(thisPtr->mActor);

View file

@ -5,7 +5,7 @@
#include "al/string/StringTmp.h" #include "al/string/StringTmp.h"
#include "prim/seadSafeString.h" #include "prim/seadSafeString.h"
#include "server/gamemode/GameModeTimer.hpp" #include "server/gamemode/GameModeTimer.hpp"
#include "server/HideAndSeekMode.hpp" #include "server/hns/HideAndSeekMode.hpp"
#include "server/Client.hpp" #include "server/Client.hpp"
#include "al/util.hpp" #include "al/util.hpp"
#include "logger.hpp" #include "logger.hpp"
@ -16,7 +16,7 @@ HideAndSeekIcon::HideAndSeekIcon(const char* name, const al::LayoutInitInfo& ini
al::initLayoutActor(this, initInfo, "HideAndSeekIcon", 0); al::initLayoutActor(this, initInfo, "HideAndSeekIcon", 0);
mInfo = (HideAndSeekInfo*)Client::getModeInfo(); mInfo = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
initNerve(&nrvHideAndSeekIconEnd, 0); initNerve(&nrvHideAndSeekIconEnd, 0);
@ -80,7 +80,7 @@ void HideAndSeekIcon::exeWait() {
int playerCount = Client::getConnectCount(); int playerCount = Client::getMaxPlayerCount();
if (playerCount > 0) { if (playerCount > 0) {
@ -91,7 +91,7 @@ void HideAndSeekIcon::exeWait() {
for (size_t i = 0; i < playerCount; i++) { for (size_t i = 0; i < playerCount; i++) {
PuppetInfo* curPuppet = Client::getPuppetInfo(i); PuppetInfo* curPuppet = Client::getPuppetInfo(i);
if (curPuppet->isConnected && (curPuppet->isIt == mInfo->mIsPlayerIt)) { if (curPuppet && curPuppet->isConnected && (curPuppet->isIt == mInfo->mIsPlayerIt)) {
playerList.appendWithFormat("%s\n", curPuppet->puppetName); playerList.appendWithFormat("%s\n", curPuppet->puppetName);
} }
} }

View file

@ -37,7 +37,7 @@ void NameTag::appear() {
return; return;
} }
setText(mPuppet->getPuppetName()); setText(mPuppet->getName());
al::startAction(this, "Appear", 0); al::startAction(this, "Appear", 0);
LayoutActor::appear(); LayoutActor::appear();

View file

@ -1,6 +1,10 @@
#include "main.hpp" #include "main.hpp"
#include <cmath> #include <cmath>
#include <math.h> #include <math.h>
#include "game/Player/PlayerActorBase.h"
#include "game/Player/PlayerActorHakoniwa.h"
#include "game/Player/PlayerHackKeeper.h"
#include "math/seadVector.h"
#include "server/Client.hpp" #include "server/Client.hpp"
#include "puppets/PuppetInfo.h" #include "puppets/PuppetInfo.h"
#include "actors/PuppetActor.h" #include "actors/PuppetActor.h"
@ -21,24 +25,34 @@
#include "logger.hpp" #include "logger.hpp"
#include "rs/util.hpp" #include "rs/util.hpp"
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include "server/HideAndSeekMode.hpp" #include "server/hns/HideAndSeekMode.hpp"
#include "server/gamemode/GameModeManager.hpp"
static int pInfSendTimer = 0; static int pInfSendTimer = 0;
static int gameInfSendTimer = 0; static int gameInfSendTimer = 0;
void updatePlayerInfo(GameDataHolderAccessor holder, PlayerActorHakoniwa *p1) { void updatePlayerInfo(GameDataHolderAccessor holder, PlayerActorBase* playerBase, bool isYukimaru) {
if (pInfSendTimer >= 3) { if (pInfSendTimer >= 3) {
Client::sendPlayerInfPacket(p1);
Client::sendHackCapInfPacket(p1->mHackCap); Client::sendPlayerInfPacket(playerBase, isYukimaru);
Client::sendCaptureInfPacket(p1); if (!isYukimaru) {
Client::sendHackCapInfPacket(((PlayerActorHakoniwa*)playerBase)->mHackCap);
Client::sendCaptureInfPacket((PlayerActorHakoniwa*)playerBase);
}
pInfSendTimer = 0; pInfSendTimer = 0;
} }
if (gameInfSendTimer >= 60) { if (gameInfSendTimer >= 60) {
Client::sendGameInfPacket(p1, holder);
if (isYukimaru) {
Client::sendGameInfPacket(holder);
} else {
Client::sendGameInfPacket((PlayerActorHakoniwa*)playerBase, holder);
}
gameInfSendTimer = 0; gameInfSendTimer = 0;
} }
@ -88,8 +102,9 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead:
gTextWriter->setCursorFromTopLeft(sead::Vector2f(10.f, (dispHeight / 3) + 30.f)); gTextWriter->setCursorFromTopLeft(sead::Vector2f(10.f, (dispHeight / 3) + 30.f));
gTextWriter->setScaleFromFontHeight(20.f); gTextWriter->setScaleFromFontHeight(20.f);
gTextWriter->printf("Client Socket Connection Status: %s\n", Client::sInstance->mSocket->getStateChar()); gTextWriter->printf("Client Socket Connection Status: %s\n", Client::instance()->mSocket->getStateChar());
gTextWriter->printf("Packet Queue Length: %d\n", Client::sInstance->mSocket->mPacketQueue.size()); gTextWriter->printf("nn::socket::GetLastErrno: 0x%x\n", Client::instance()->mSocket->socket_errno);
gTextWriter->printf("Packet Queue Length: %d\n", Client::instance()->mSocket->mPacketQueue.size());
gTextWriter->printf("Total Connected Players: %d\n", Client::getConnectCount() + 1); gTextWriter->printf("Total Connected Players: %d\n", Client::getConnectCount() + 1);
al::Scene *curScene = curSequence->curScene; al::Scene *curScene = curSequence->curScene;
@ -99,7 +114,7 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead:
sead::LookAtCamera *cam = al::getLookAtCamera(curScene, 0); sead::LookAtCamera *cam = al::getLookAtCamera(curScene, 0);
sead::Projection* projection = al::getProjectionSead(curScene, 0); sead::Projection* projection = al::getProjectionSead(curScene, 0);
PlayerActorHakoniwa* p1 = rs::getPlayerActor(curScene); PlayerActorBase* playerBase = rs::getPlayerActor(curScene);
PuppetActor* curPuppet = Client::getPuppet(debugPuppetIndex); PuppetActor* curPuppet = Client::getPuppet(debugPuppetIndex);
@ -136,6 +151,7 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead:
gTextWriter->printf("Is in Capture: %s\n", curPupInfo->isCaptured ? "True" : "False"); gTextWriter->printf("Is in Capture: %s\n", curPupInfo->isCaptured ? "True" : "False");
gTextWriter->printf("Puppet Stage: %s\n", curPupInfo->stageName); gTextWriter->printf("Puppet Stage: %s\n", curPupInfo->stageName);
gTextWriter->printf("Puppet Scenario: %u\n", curPupInfo->scenarioNo); gTextWriter->printf("Puppet Scenario: %u\n", curPupInfo->scenarioNo);
gTextWriter->printf("Puppet Costume: H: %s B: %s\n", curPupInfo->costumeHead, curPupInfo->costumeBody);
//gTextWriter->printf("Packet Coords:\nX: %f\nY: %f\nZ: %f\n", curPupInfo->playerPos.x, curPupInfo->playerPos.y, curPupInfo->playerPos.z); //gTextWriter->printf("Packet Coords:\nX: %f\nY: %f\nZ: %f\n", curPupInfo->playerPos.x, curPupInfo->playerPos.y, curPupInfo->playerPos.z);
// if (curModel) { // if (curModel) {
// sead::Vector3f* pupPos = al::getTrans(curModel); // sead::Vector3f* pupPos = al::getTrans(curModel);
@ -165,12 +181,6 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead:
al::LiveActor *curModel = debugPuppet->getCurrentModel(); al::LiveActor *curModel = debugPuppet->getCurrentModel();
gTextWriter->printf("Is Nametag Visible: %s\n", BTOC(debugPuppet->mNameTag->isVisible()));
gTextWriter->printf("Is Nametag Alive: %s\n", BTOC(debugPuppet->mNameTag->mIsAlive));
gTextWriter->printf("Nametag Normalized Dist: %f\n", debugPuppet->mNameTag->mNormalizedDist);
gTextWriter->printf("Nametag State: %s\n", debugPuppet->mNameTag->getCurrentState());
gTextWriter->printf("Is Current Model Clipped: %s\n",
BTOC(al::isClipped(curModel)));
gTextWriter->printf("Is Debug Puppet Tagged: %s\n", BTOC(debugInfo->isIt)); gTextWriter->printf("Is Debug Puppet Tagged: %s\n", BTOC(debugInfo->isIt));
} }
@ -178,16 +188,19 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead:
break; break;
case 2: case 2:
{ {
al::PlayerHolder *pHolder = al::getScenePlayerHolder(curScene); PlayerHackKeeper* hackKeeper = playerBase->getPlayerHackKeeper();
PlayerActorHakoniwa *p1 = pHolder->tryGetPlayer(0);
if (p1->mHackKeeper && p1->mHackKeeper->currentHackActor) { if (hackKeeper) {
al::LiveActor *curHack = p1->mHackKeeper->currentHackActor; PlayerActorHakoniwa *p1 = (PlayerActorHakoniwa*)playerBase; // its safe to assume that we're using a playeractorhakoniwa if the hack keeper isnt null
if(hackKeeper->currentHackActor) {
al::LiveActor *curHack = hackKeeper->currentHackActor;
gTextWriter->printf("Current Hack Animation: %s\n", al::getActionName(curHack)); gTextWriter->printf("Current Hack Animation: %s\n", al::getActionName(curHack));
gTextWriter->printf("Current Hack Name: %s\n", gTextWriter->printf("Current Hack Name: %s\n",
p1->mHackKeeper->getCurrentHackName()); hackKeeper->getCurrentHackName());
sead::Quatf captureRot = curHack->mPoseKeeper->getQuat(); sead::Quatf captureRot = curHack->mPoseKeeper->getQuat();
gTextWriter->printf("Current Hack Rot: %f %f %f %f\n", captureRot.x, gTextWriter->printf("Current Hack Rot: %f %f %f %f\n", captureRot.x,
captureRot.y, captureRot.z, captureRot.w); captureRot.y, captureRot.z, captureRot.w);
@ -209,6 +222,8 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead:
} }
} }
} }
}
break; break;
default: default:
break; break;
@ -256,10 +271,11 @@ void stageInitHook(al::ActorInitInfo *info, StageScene *curScene, al::PlacementI
Client::setSceneInfo(*info, curScene); Client::setSceneInfo(*info, curScene);
if (Client::getServerMode() != NONE) { if (GameModeManager::instance()->getGameMode() != NONE) {
GameModeInitInfo initModeInfo(info, curScene); GameModeInitInfo initModeInfo(info, curScene);
initModeInfo.initServerInfo(GameModeManager::instance()->getGameMode(), Client::getPuppetHolder());
Client::initMode(initModeInfo); GameModeManager::instance()->initScene(initModeInfo);
} }
Client::sendGameInfPacket(info->mActorSceneInfo.mSceneObjHolder); Client::sendGameInfPacket(info->mActorSceneInfo.mSceneObjHolder);
@ -281,7 +297,8 @@ ulong constructHook() { // hook for constructing anything we need to globally b
: [result] "=r"( : [result] "=r"(
initInfo)); // Save our scenes init info to a gloabl ptr so we can access it later initInfo)); // Save our scenes init info to a gloabl ptr so we can access it later
Client::sInstance = new Client(playBufSize); Client::createInstance(al::getCurrentHeap());
GameModeManager::createInstance(al::getCurrentHeap()); // Create the GameModeManager on the current al heap
return 0x20; return 0x20;
} }
@ -292,7 +309,7 @@ bool threadInit(HakoniwaSequence *mainSeq) { // hook for initializing client cl
al::initLayoutInitInfo(&lytInfo, mainSeq->mLytKit, 0, mainSeq->mAudioDirector, initInfo->mSystemInfo->mLayoutSys, initInfo->mSystemInfo->mMessageSys, initInfo->mSystemInfo->mGamePadSys); al::initLayoutInitInfo(&lytInfo, mainSeq->mLytKit, 0, mainSeq->mAudioDirector, initInfo->mSystemInfo->mLayoutSys, initInfo->mSystemInfo->mMessageSys, initInfo->mSystemInfo->mGamePadSys);
Client::sInstance->init(lytInfo); Client::instance()->init(lytInfo, mainSeq->mGameDataHolder);
return GameDataFunction::isPlayDemoOpening(mainSeq->mGameDataHolder); return GameDataFunction::isPlayDemoOpening(mainSeq->mGameDataHolder);
} }
@ -305,15 +322,13 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) {
bool isFirstStep = al::isFirstStep(sequence); bool isFirstStep = al::isFirstStep(sequence);
al::PlayerHolder *pHolder = al::getScenePlayerHolder(stageScene); al::PlayerHolder *pHolder = al::getScenePlayerHolder(stageScene);
PlayerActorHakoniwa* p1 = (PlayerActorHakoniwa*)al::tryGetPlayerActor(pHolder, 0); PlayerActorBase* playerBase = al::tryGetPlayerActor(pHolder, 0);
if (isFirstStep) { bool isYukimaru = !playerBase->getPlayerInfo();
Client::tryRestartCurrentMode();
}
isInGame = !stageScene->isPause(); isInGame = !stageScene->isPause();
Client::setGameActive(!stageScene->isPause()); GameModeManager::instance()->setPaused(stageScene->isPause());
Client::setStageInfo(stageScene->mHolder); Client::setStageInfo(stageScene->mHolder);
Client::updateStates(); Client::updateStates();
@ -322,9 +337,9 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) {
Client::updateShines(); Client::updateShines();
} }
updatePlayerInfo(stageScene->mHolder, p1); updatePlayerInfo(stageScene->mHolder, playerBase, isYukimaru);
static bool isDisableMusic = true; static bool isDisableMusic = false;
if (al::isPadHoldZR(-1)) { if (al::isPadHoldZR(-1)) {
if (al::isPadTriggerUp(-1)) debugMode = !debugMode; if (al::isPadTriggerUp(-1)) debugMode = !debugMode;
@ -342,21 +357,28 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) {
if (al::isPadTriggerRight(-1)) debugPuppetIndex++; if (al::isPadTriggerRight(-1)) debugPuppetIndex++;
if(debugPuppetIndex < 0) { if(debugPuppetIndex < 0) {
debugPuppetIndex = playBufSize - 2; debugPuppetIndex = Client::getMaxPlayerCount() - 2;
} }
if (debugPuppetIndex >= playBufSize) if (debugPuppetIndex >= Client::getMaxPlayerCount() - 1)
debugPuppetIndex = 0; debugPuppetIndex = 0;
} }
} else if (al::isPadHoldL(-1)) { } else if (al::isPadHoldL(-1)) {
if (al::isPadTriggerLeft(-1)) Client::toggleCurrentMode(); if (al::isPadTriggerLeft(-1)) GameModeManager::instance()->toggleActive();
if (al::isPadTriggerRight(-1)) { if (al::isPadTriggerRight(-1)) {
if (debugMode) { if (debugMode) {
PuppetInfo* debugPuppet = Client::getDebugPuppetInfo(); PuppetInfo* debugPuppet = Client::getDebugPuppetInfo();
if (debugPuppet) { if (debugPuppet) {
debugPuppet->playerPos = al::getTrans(p1);
al::calcQuat(&debugPuppet->playerRot, p1); debugPuppet->playerPos = al::getTrans(playerBase);
const char *hackName = p1->mHackKeeper->getCurrentHackName(); al::calcQuat(&debugPuppet->playerRot, playerBase);
PlayerHackKeeper* hackKeeper = playerBase->getPlayerHackKeeper();
if (hackKeeper) {
const char *hackName = hackKeeper->getCurrentHackName();
debugPuppet->isCaptured = hackName != nullptr; debugPuppet->isCaptured = hackName != nullptr;
if (debugPuppet->isCaptured) { if (debugPuppet->isCaptured) {
strcpy(debugPuppet->curHack, hackName); strcpy(debugPuppet->curHack, hackName);
@ -364,13 +386,19 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) {
strcpy(debugPuppet->curHack, ""); strcpy(debugPuppet->curHack, "");
} }
} }
}
} }
} }
if (al::isPadTriggerUp(-1)) { if (al::isPadTriggerUp(-1)) {
if (debugMode) { if (debugMode) {
PuppetInfo* debugPuppet = Client::getDebugPuppetInfo(); PuppetActor* debugPuppet = Client::getDebugPuppet();
if (debugPuppet) { if (debugPuppet) {
debugPuppet->isIt = !debugPuppet->isIt; PuppetInfo *info = debugPuppet->getInfo();
// info->isIt = !info->isIt;
debugPuppet->emitJoinEffect();
} }
} else { } else {
isDisableMusic = !isDisableMusic; isDisableMusic = !isDisableMusic;

17
source/nx/svc.s Normal file
View file

@ -0,0 +1,17 @@
.macro SVC_BEGIN name
.section .text.\name, "ax", %progbits
.global \name
.type \name, %function
.align 2
.cfi_startproc
\name:
.endm
.macro SVC_END
.cfi_endproc
.endm
SVC_BEGIN svcOutputDebugString
svc 0x27
ret
SVC_END

View file

@ -1,3 +1,7 @@
#include <cmath>
#include <cstddef>
#include "al/util/SensorUtil.h"
#include "rs/util/SensorUtil.h"
#include "server/Client.hpp" #include "server/Client.hpp"
#include "al/LiveActor/LiveActor.h" #include "al/LiveActor/LiveActor.h"
#include "al/layout/BalloonMessage.h" #include "al/layout/BalloonMessage.h"
@ -10,8 +14,9 @@
#include "actors/PuppetActor.h" #include "actors/PuppetActor.h"
#include "math/seadQuat.h" #include "math/seadQuat.h"
#include "math/seadVector.h" #include "math/seadVector.h"
#include "server/gamemode/GameModeManager.hpp"
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include "server/HideAndSeekMode.hpp" #include "server/hns/HideAndSeekMode.hpp"
static const char *subActorNames[] = { static const char *subActorNames[] = {
"", // Face "", // Face
@ -31,7 +36,7 @@ void PuppetActor::init(al::ActorInitInfo const &initInfo) {
mPuppetCap->init(initInfo); mPuppetCap->init(initInfo);
al::initActorWithArchiveName(this, initInfo, "PlayerActorHakoniwa", nullptr); al::initActorWithArchiveName(this, initInfo, "PuppetActor", nullptr);
const char *bodyName = "Mario"; const char *bodyName = "Mario";
const char *capName = "Mario"; const char *capName = "Mario";
@ -185,9 +190,9 @@ void PuppetActor::control() {
} }
if (mNameTag) { if (mNameTag) {
if (Client::isSelectedMode(GameMode::HIDEANDSEEK) && Client::isModeActive()) { if (GameModeManager::instance()->isModeAndActive(GameMode::HIDEANDSEEK)) {
mNameTag->mIsAlive = mNameTag->mIsAlive =
Client::getMode<HideAndSeekMode>()->isPlayerIt() && mInfo->isIt; GameModeManager::instance()->getMode<HideAndSeekMode>()->isPlayerIt() && mInfo->isIt;
} else { } else {
if(!mNameTag->mIsAlive) if(!mNameTag->mIsAlive)
@ -214,8 +219,6 @@ void PuppetActor::makeActorAlive() {
curModel->makeActorAlive(); curModel->makeActorAlive();
} }
if (al::isDead(this)) {
// update name tag when puppet becomes active again // update name tag when puppet becomes active again
if (mInfo) { if (mInfo) {
if (mNameTag) { if (mNameTag) {
@ -224,7 +227,6 @@ void PuppetActor::makeActorAlive() {
} }
al::LiveActor::makeActorAlive(); al::LiveActor::makeActorAlive();
}
} }
@ -236,11 +238,29 @@ void PuppetActor::makeActorDead() {
curModel->makeActorDead(); curModel->makeActorDead();
} }
if (!al::isDead(this)) { mPuppetCap->makeActorDead();
mPuppetCap->makeActorDead(); // make sure we kill the cap puppet along with regular puppet
al::LiveActor::makeActorDead(); al::LiveActor::makeActorDead();
} }
void PuppetActor::attackSensor(al::HitSensor* source, al::HitSensor* target) {
if (!al::sendMsgPush(target, source)) {
rs::sendMsgPushToPlayer(target, source);
}
}
bool PuppetActor::receiveMsg(const al::SensorMsg* msg, al::HitSensor* source,
al::HitSensor* target) {
if ((al::isMsgPlayerTrampleReflect(msg) || rs::isMsgPlayerAndCapObjHipDropReflectAll(msg)) && al::isSensorName(target, "Body"))
{
rs::requestHitReactionToAttacker(msg, target, source);
return true;
}
return false;
} }
// this is more or less how nintendo does it with marios demo puppet // this is more or less how nintendo does it with marios demo puppet
@ -379,3 +399,10 @@ void PuppetActor::syncPose() {
al::setTrans(curModel, al::getTrans(this)); al::setTrans(curModel, al::getTrans(this));
} }
void PuppetActor::emitJoinEffect() {
al::tryDeleteEffect(this, "Disappear"); // remove previous effect (if played previously)
al::tryEmitEffect(this, "Disappear", nullptr);
}

View file

@ -1,13 +1,53 @@
#include "puppets/PuppetHolder.hpp" #include "puppets/PuppetHolder.hpp"
#include <math.h>
#include "actors/PuppetActor.h"
#include "al/util.hpp" #include "al/util.hpp"
#include "al/util/LiveActorUtil.h"
#include "container/seadPtrArray.h"
#include "heap/seadHeap.h"
#include "heap/seadHeapMgr.h"
#include "logger.hpp" #include "logger.hpp"
PuppetHolder::PuppetHolder(int size) { PuppetHolder::PuppetHolder(int size) {
mPuppetArr = sead::PtrArray<PuppetActor>();
if(!mPuppetArr.tryAllocBuffer(size, nullptr)) { if(!mPuppetArr.tryAllocBuffer(size, nullptr)) {
Logger::log("Buffer Alloc Failed on Puppet Holder!\n"); Logger::log("Buffer Alloc Failed on Puppet Holder!\n");
} }
} }
/**
* @brief resizes puppet ptr array by creating a new ptr array and storing previous ptrs in it, before freeing the previous array
*
* @param size the size of the new ptr array
* @return returns true if resizing was sucessful
*/
bool PuppetHolder::resizeHolder(int size) {
if (mPuppetArr.capacity() == size)
return true; // no need to resize if we're already at the same capacity
sead::Heap *seqHeap = sead::HeapMgr::instance()->findHeapByName("SequenceHeap", 0);
if (!mPuppetArr.isBufferReady())
return mPuppetArr.tryAllocBuffer(size, seqHeap);
sead::PtrArray<PuppetActor> newPuppets = sead::PtrArray<PuppetActor>();
if (newPuppets.tryAllocBuffer(size, seqHeap)) {
int curPupCount = mPuppetArr.size();
for (int i = 0; i < curPupCount > size ? size : curPupCount; i++) {
newPuppets.pushBack(mPuppetArr[i]);
}
mPuppetArr.freeBuffer();
mPuppetArr = newPuppets;
return true;
} else {
return false;
}
}
bool PuppetHolder::tryRegisterPuppet(PuppetActor *puppet) { bool PuppetHolder::tryRegisterPuppet(PuppetActor *puppet) {
if(!mPuppetArr.isFull()) { if(!mPuppetArr.isFull()) {
@ -39,10 +79,14 @@ void PuppetHolder::update() {
curInfo->isInSameStage = checkInfoIsInStage(curInfo); curInfo->isInSameStage = checkInfoIsInStage(curInfo);
if(curInfo->isInSameStage) { if(curInfo->isInSameStage && al::isDead(curPuppet)) {
curPuppet->makeActorAlive(); curPuppet->makeActorAlive();
}else if(!curInfo->isInSameStage) {
curPuppet->emitJoinEffect();
}else if(!curInfo->isInSameStage && !al::isDead(curPuppet)) {
curPuppet->makeActorDead(); curPuppet->makeActorDead();
curPuppet->emitJoinEffect();
} }
} }
} }

View file

@ -60,7 +60,7 @@ void initPuppetActors(al::Scene *scene, al::ActorInitInfo const &rootInfo, char
al::PlacementInfo playerPlacement = al::PlacementInfo(); al::PlacementInfo playerPlacement = al::PlacementInfo();
al::getPlacementInfoByIndex(&playerPlacement, rootPlacement, 0); al::getPlacementInfoByIndex(&playerPlacement, rootPlacement, 0);
for (size_t i = 0; i < Client::sInstance->maxPuppets; i++) for (size_t i = 0; i < Client::getMaxPlayerCount(); i++)
{ {
createPuppetActorFromFactory(rootInfo, playerPlacement, false); createPuppetActorFromFactory(rootInfo, playerPlacement, false);
} }

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@ SocketBase::SocketBase(const char *name)
{ {
strcpy(this->sockName, name); strcpy(this->sockName, name);
this->sock_flags = 0; this->sock_flags = 0x80;
} }
const char *SocketBase::getStateChar() { const char *SocketBase::getStateChar() {
@ -59,7 +59,7 @@ s32 SocketBase::socket_read_char(char *out) {
return valread; return valread;
} }
s32 SocketBase::getSocket() { s32 SocketBase::getFd() {
if(this->socket_log_state == SOCKET_LOG_CONNECTED) { if(this->socket_log_state == SOCKET_LOG_CONNECTED) {
return this->socket_log_socket; return this->socket_log_socket;
}else { }else {
@ -69,11 +69,9 @@ s32 SocketBase::getSocket() {
bool SocketBase::closeSocket() { bool SocketBase::closeSocket() {
nn::Result result = nn::socket::Close(this->socket_log_socket); this->socket_log_state = SOCKET_LOG_DISCONNECTED; // probably not safe to assume socket will be closed
if (result.isSuccess()) { nn::Result result = nn::socket::Close(this->socket_log_socket);
this->socket_log_state = SOCKET_LOG_DISCONNECTED;
}
return result.isSuccess(); return result.isSuccess();
} }

View file

@ -2,6 +2,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "SocketBase.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "nn/result.h" #include "nn/result.h"
#include "nn/socket.h" #include "nn/socket.h"
@ -10,15 +11,13 @@
nn::Result SocketClient::init(const char* ip, u16 port) { nn::Result SocketClient::init(const char* ip, u16 port) {
sock_ip = ip; this->sock_ip = ip;
this->port = port; this->port = port;
in_addr hostAddress = { 0 }; in_addr hostAddress = { 0 };
sockaddr serverAddress = { 0 }; sockaddr serverAddress = { 0 };
if (socket_log_state != SOCKET_LOG_UNINITIALIZED && socket_log_state != SOCKET_LOG_DISCONNECTED) Logger::log("SocketClient::init: %s:%d sock %s\n", ip, port, getStateChar());
return -1;
nn::nifm::Initialize(); nn::nifm::Initialize();
nn::nifm::SubmitNetworkRequest(); nn::nifm::SubmitNetworkRequest();
@ -30,38 +29,46 @@ nn::Result SocketClient::init(const char* ip, u16 port) {
if (!nn::nifm::IsNetworkAvailable()) { if (!nn::nifm::IsNetworkAvailable()) {
Logger::log("Network Unavailable.\n"); Logger::log("Network Unavailable.\n");
this->socket_log_state = SOCKET_LOG_UNAVAILABLE; this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
this->socket_errno = nn::socket::GetLastErrno();
return -1; return -1;
} }
#endif #endif
if ((this->socket_log_socket = nn::socket::Socket(2, 1, 0)) < 0) { if ((this->socket_log_socket = nn::socket::Socket(2, 1, 6)) < 0) {
Logger::log("Socket Unavailable.\n"); Logger::log("Socket Unavailable.\n");
this->socket_errno = nn::socket::GetLastErrno();
this->socket_log_state = SOCKET_LOG_UNAVAILABLE; this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return -1; return -1;
} }
if (! this->stringToIPAddress(this->sock_ip, &hostAddress)) {
nn::socket::InetAton(this->sock_ip, &hostAddress); Logger::log("IP address is invalid or hostname not resolveable.\n");
this->socket_errno = nn::socket::GetLastErrno();
this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return -1;
}
serverAddress.address = hostAddress; serverAddress.address = hostAddress;
serverAddress.port = nn::socket::InetHtons(this->port); serverAddress.port = nn::socket::InetHtons(this->port);
serverAddress.family = 2; serverAddress.family = 2;
bool sockOptValue = true; int sockOptValue = true;
nn::socket::SetSockOpt(this->socket_log_socket, 0, TCP_NODELAY, &sockOptValue, sizeof(bool)); nn::socket::SetSockOpt(this->socket_log_socket, 6, TCP_NODELAY, &sockOptValue, sizeof(sockOptValue));
nn::Result result; nn::Result result;
if((result = nn::socket::Connect(this->socket_log_socket, &serverAddress, sizeof(serverAddress))).isFailure()) { if((result = nn::socket::Connect(this->socket_log_socket, &serverAddress, sizeof(serverAddress))).isFailure()) {
Logger::log("Socket Connection Failed!\n");
this->socket_errno = nn::socket::GetLastErrno();
this->socket_log_state = SOCKET_LOG_UNAVAILABLE; this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return result; return result;
} }
this->socket_log_state = SOCKET_LOG_CONNECTED; this->socket_log_state = SOCKET_LOG_CONNECTED;
Logger::log("Socket fd: %d\n", socket_log_socket);
return result; return result;
} }
@ -75,12 +82,14 @@ bool SocketClient::SEND(Packet *packet) {
int valread = 0; int valread = 0;
//Logger::log("Sending Packet Size: %d Sending Type: %s\n", packet->mPacketSize, packetNames[packet->mType]); if (packet->mType != PLAYERINF && packet->mType != HACKCAPINF)
Logger::log("Sending packet: %s\n", packetNames[packet->mType]);
if ((valread = nn::socket::Send(this->socket_log_socket, buffer, packet->mPacketSize + sizeof(Packet), this->sock_flags) > 0)) { if ((valread = nn::socket::Send(this->socket_log_socket, buffer, packet->mPacketSize + sizeof(Packet), 0) > 0)) {
return true; return true;
} else { } else {
Logger::log("Failed to Fully Send Packet! Result: %d Type: %s Packet Size: %d\n", valread, packetNames[packet->mType], packet->mPacketSize); Logger::log("Failed to Fully Send Packet! Result: %d Type: %s Packet Size: %d\n", valread, packetNames[packet->mType], packet->mPacketSize);
this->socket_errno = nn::socket::GetLastErrno();
this->closeSocket(); this->closeSocket();
return false; return false;
} }
@ -90,7 +99,8 @@ bool SocketClient::SEND(Packet *packet) {
bool SocketClient::RECV() { bool SocketClient::RECV() {
if (this->socket_log_state != SOCKET_LOG_CONNECTED) { if (this->socket_log_state != SOCKET_LOG_CONNECTED) {
Logger::log("Unable To Recieve! Socket Not Connected.\n"); Logger::log("Unable To Receive! Socket Not Connected.\n");
this->socket_errno = nn::socket::GetLastErrno();
return false; return false;
} }
@ -100,22 +110,43 @@ bool SocketClient::RECV() {
// read only the size of a header // read only the size of a header
while(valread < headerSize) { while(valread < headerSize) {
int result = nn::socket::Recv(this->socket_log_socket, headerBuf + valread, headerSize - valread, this->sock_flags); int result = nn::socket::Recv(this->socket_log_socket, headerBuf + valread,
headerSize - valread, this->sock_flags);
this->socket_errno = nn::socket::GetLastErrno();
if(result > 0) { if(result > 0) {
valread += result; valread += result;
} else {
if(this->socket_errno==11){
return true;
} else { } else {
Logger::log("Header Read Failed! Value: %d Total Read: %d\n", result, valread); Logger::log("Header Read Failed! Value: %d Total Read: %d\n", result, valread);
this->closeSocket(); this->closeSocket();
return false; return false;
} }
} }
}
if(valread > 0) { if(valread > 0) {
Packet* header = reinterpret_cast<Packet*>(headerBuf); Packet* header = reinterpret_cast<Packet*>(headerBuf);
int fullSize = header->mPacketSize + sizeof(Packet); int fullSize = header->mPacketSize + sizeof(Packet);
if (header->mType != PacketType::UNKNOWN && fullSize <= MAXPACKSIZE && fullSize > 0) { if (header->mType > PacketType::UNKNOWN && header->mType < PacketType::End &&
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],
header->mUserID.data[1]);
Logger::disableName();
Logger::log(" Size: %d", header->mPacketSize);
Logger::log(" Type: %d", header->mType);
if(packetNames[header->mType])
Logger::log(" Type String: %s\n", packetNames[header->mType]);
Logger::enableName();
}
char* packetBuf = (char*)malloc(fullSize); char* packetBuf = (char*)malloc(fullSize);
@ -125,7 +156,10 @@ bool SocketClient::RECV() {
while (valread < fullSize) { while (valread < fullSize) {
int result = nn::socket::Recv(this->socket_log_socket, packetBuf + valread, fullSize - valread, this->sock_flags); int result = nn::socket::Recv(this->socket_log_socket, packetBuf + valread,
fullSize - valread, this->sock_flags);
this->socket_errno = nn::socket::GetLastErrno();
if (result > 0) { if (result > 0) {
valread += result; valread += result;
@ -144,16 +178,15 @@ bool SocketClient::RECV() {
} else { } else {
free(packetBuf); free(packetBuf);
} }
} else {
// Logger::log("Heap Allocation Failed! Returned nullptr\n");
} }
} else { } else {
// Logger::log("Recieved Unknown Packet Type! Size: %d\n", header->mPacketSize); Logger::log("Failed to aquire valid data! Packet Type: %d Full Packet Size %d valread size: %d", header->mType, fullSize, valread);
} }
return true; return true;
} else { // if we error'd, close the socket } else { // if we error'd, close the socket
Logger::log("valread was zero! Disconnecting.\n"); Logger::log("valread was zero! Disconnecting.\n");
this->socket_errno = nn::socket::GetLastErrno();
this->closeSocket(); this->closeSocket();
return false; return false;
} }
@ -175,3 +208,35 @@ void SocketClient::printPacket(Packet *packet) {
} }
} }
bool SocketClient::closeSocket() {
Logger::log("Closing Socket.\n");
bool result = false;
if (!(result = SocketBase::closeSocket())) {
Logger::log("Failed to close socket!\n");
}
return result;
}
bool SocketClient::stringToIPAddress(const char* str, in_addr* out) {
// string to IPv4
if (nn::socket::InetAton(str, out)) {
return true;
}
// get IPs via DNS
struct hostent *he = nn::socket::GetHostByName(str);
if (! he) { return false; }
// might give us multiple IP addresses, so pick the first one
struct in_addr **addr_list = (struct in_addr **) he->h_addr_list;
for (int i = 0 ; addr_list[i] != NULL ; i++) {
*out = *addr_list[i];
return true;
}
return false;
}

View file

@ -0,0 +1,91 @@
#include "server/gamemode/GameModeManager.hpp"
#include <cstring>
#include <heap/seadFrameHeap.h>
#include "al/util.hpp"
#include "basis/seadNew.h"
#include "heap/seadHeapMgr.h"
#include "server/gamemode/GameModeBase.hpp"
#include "server/gamemode/GameModeFactory.hpp"
SEAD_SINGLETON_DISPOSER_IMPL(GameModeManager)
GameModeManager::GameModeManager() {
mHeap = sead::FrameHeap::create(0x100000, "GameModeHeap", al::getSequenceHeap(), 8,
sead::Heap::HeapDirection::cHeapDirection_Reverse, false);
setMode(GameMode::HIDEANDSEEK);
}
void GameModeManager::begin() {
if (mCurModeBase) {
sead::ScopedCurrentHeapSetter heapSetter(mHeap);
mCurModeBase->begin();
}
}
void GameModeManager::end() {
if (mCurModeBase) {
sead::ScopedCurrentHeapSetter heapSetter(mHeap);
mCurModeBase->end();
}
}
void GameModeManager::toggleActive() {
mActive = !mActive;
}
void GameModeManager::setPaused(bool paused) {
mPaused = paused;
}
void GameModeManager::setMode(GameMode mode) {
mCurMode = mode;
mWasSetMode = true; // recreate in initScene
}
void GameModeManager::update() {
if (!mCurModeBase) return;
bool inScene = al::getSceneHeap() != nullptr;
if ((mActive && inScene && !mPaused && !mCurModeBase->isModeActive()) || mWasSceneTrans) begin();
if ((!mActive || mPaused || !inScene) && mCurModeBase->isModeActive()) end();
mWasSceneTrans = false;
if (mCurModeBase && mCurModeBase->isModeActive()) {
sead::ScopedCurrentHeapSetter heapSetter(mHeap);
mCurModeBase->update();
}
}
void GameModeManager::initScene(const GameModeInitInfo& info) {
sead::ScopedCurrentHeapSetter heapSetter(mHeap);
if (mCurModeBase != nullptr && mWasSetMode) {
delete mCurModeBase;
mCurModeBase = nullptr;
}
if (mLastInitInfo != nullptr) {
delete mLastInitInfo;
}
if (mCurMode == GameMode::NONE) {
mCurModeBase = nullptr;
delete mModeInfo;
mModeInfo = nullptr;
return;
}
mLastInitInfo = new GameModeInitInfo(info);
if (mWasSetMode) {
GameModeFactory factory("GameModeFactory");
const char* name = factory.getModeString(mCurMode);
mCurModeBase = factory.getCreator(name)(name);
mWasSetMode = false;
}
if (mCurModeBase) {
mCurModeBase->init(*mLastInitInfo);
if (mCurModeBase->isModeActive())
mWasSceneTrans = true;
}
}

View file

@ -2,6 +2,7 @@
#include <math.h> #include <math.h>
#include "al/util/ControllerUtil.h" #include "al/util/ControllerUtil.h"
#include "server/DeltaTime.hpp" #include "server/DeltaTime.hpp"
#include "logger.hpp"
GameModeTimer::GameModeTimer(bool isCountUp, float milli, int seconds, int minutes, int hours) { GameModeTimer::GameModeTimer(bool isCountUp, float milli, int seconds, int minutes, int hours) {
mIsCountUp = isCountUp; mIsCountUp = isCountUp;
@ -24,10 +25,14 @@ GameModeTimer::GameModeTimer() {
} }
void GameModeTimer::setTime(float milli, int seconds, int minutes, int hours) { void GameModeTimer::setTime(float milli, int seconds, int minutes, int hours) {
if(milli >= 0) mTime.mMilliseconds = milli; if (milli >= 0)
if(seconds >= 0) mTime.mSeconds = seconds; mTime.mMilliseconds = milli;
if(minutes >= 0) mTime.mMinutes = minutes; if (seconds >= 0)
if(hours >= 0) mTime.mHours = hours; mTime.mSeconds = seconds;
if (minutes >= 0)
mTime.mMinutes = minutes;
if (hours >= 0)
mTime.mHours = hours;
} }
void GameModeTimer::setTime(GameTime const& time) { void GameModeTimer::setTime(GameTime const& time) {
@ -35,7 +40,6 @@ void GameModeTimer::setTime(GameTime const& time) {
} }
void GameModeTimer::updateTimer() { void GameModeTimer::updateTimer() {
if (mIsUseControl) { if (mIsUseControl) {
timerControl(); timerControl();
} }
@ -79,7 +83,14 @@ void GameModeTimer::updateTimer() {
} }
void GameModeTimer::timerControl() { void GameModeTimer::timerControl() {
if (al::isPadHoldL(-1)) {
if (al::isPadTriggerDown(-1)) {
mTime.mMilliseconds = 0;
mTime.mSeconds = 0;
mTime.mMinutes = 0;
mTime.mHours = 0;
}
} else {
if (al::isPadHoldRight(-1)) { if (al::isPadHoldRight(-1)) {
mTime.mMilliseconds = 0; mTime.mMilliseconds = 0;
mTime.mSeconds++; mTime.mSeconds++;
@ -95,6 +106,7 @@ void GameModeTimer::timerControl() {
if (al::isPadTriggerLeft(-1)) { if (al::isPadTriggerLeft(-1)) {
mTime.mMilliseconds = 0; mTime.mMilliseconds = 0;
if (mTime.mMinutes != 0) {
mTime.mSeconds--; mTime.mSeconds--;
if (mTime.mSeconds < 0) { if (mTime.mSeconds < 0) {
mTime.mSeconds = 59; mTime.mSeconds = 59;
@ -109,11 +121,6 @@ void GameModeTimer::timerControl() {
} }
} }
} }
}
if(al::isPadHoldL(-1) && al::isPadTriggerDown(-1)) {
mTime.mMilliseconds = 0;
mTime.mSeconds = 0;
mTime.mMinutes = 0;
mTime.mHours = 0;
} }
} }

View file

@ -1,7 +1,8 @@
#include "server/HideAndSeekConfigMenu.hpp" #include "server/hns/HideAndSeekConfigMenu.hpp"
#include <cmath> #include <cmath>
#include "logger.hpp" #include "logger.hpp"
#include "server/HideAndSeekMode.hpp" #include "server/gamemode/GameModeManager.hpp"
#include "server/hns/HideAndSeekMode.hpp"
#include "server/Client.hpp" #include "server/Client.hpp"
HideAndSeekConfigMenu::HideAndSeekConfigMenu() : GameModeConfigMenu() {} HideAndSeekConfigMenu::HideAndSeekConfigMenu() : GameModeConfigMenu() {}
@ -22,7 +23,7 @@ const sead::WFixedSafeString<0x200> *HideAndSeekConfigMenu::getStringData() {
bool HideAndSeekConfigMenu::updateMenu(int selectIndex) { bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
HideAndSeekInfo *curMode = (HideAndSeekInfo*)Client::getModeInfo(); HideAndSeekInfo *curMode = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
Logger::log("Setting Gravity Mode.\n"); Logger::log("Setting Gravity Mode.\n");
@ -33,13 +34,13 @@ bool HideAndSeekConfigMenu::updateMenu(int selectIndex) {
switch (selectIndex) { switch (selectIndex) {
case 0: { case 0: {
if (Client::isSelectedMode(GameMode::HIDEANDSEEK)) { if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
curMode->mIsUseGravity = true; curMode->mIsUseGravity = true;
} }
return true; return true;
} }
case 1: { case 1: {
if (Client::isSelectedMode(GameMode::HIDEANDSEEK)) { if (GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
curMode->mIsUseGravity = false; curMode->mIsUseGravity = false;
} }
return true; return true;

View file

@ -1,4 +1,4 @@
#include "server/HideAndSeekMode.hpp" #include "server/hns/HideAndSeekMode.hpp"
#include <cmath> #include <cmath>
#include "al/async/FunctorV0M.hpp" #include "al/async/FunctorV0M.hpp"
#include "al/util.hpp" #include "al/util.hpp"
@ -6,16 +6,21 @@
#include "game/GameData/GameDataHolderAccessor.h" #include "game/GameData/GameDataHolderAccessor.h"
#include "game/Layouts/CoinCounter.h" #include "game/Layouts/CoinCounter.h"
#include "game/Layouts/MapMini.h" #include "game/Layouts/MapMini.h"
#include "game/Player/PlayerActorBase.h"
#include "game/Player/PlayerActorHakoniwa.h" #include "game/Player/PlayerActorHakoniwa.h"
#include "heap/seadHeapMgr.h"
#include "layouts/HideAndSeekIcon.h" #include "layouts/HideAndSeekIcon.h"
#include "logger.hpp" #include "logger.hpp"
#include "rs/util.hpp" #include "rs/util.hpp"
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include "server/Client.hpp" #include "server/Client.hpp"
#include "server/gamemode/GameModeTimer.hpp" #include "server/gamemode/GameModeTimer.hpp"
#include <heap/seadHeap.h>
#include "server/gamemode/GameModeManager.hpp"
#include "server/gamemode/GameModeFactory.hpp"
#include "basis/seadNew.h" #include "basis/seadNew.h"
#include "server/HideAndSeekConfigMenu.hpp" #include "server/hns/HideAndSeekConfigMenu.hpp"
HideAndSeekMode::HideAndSeekMode(const char* name) : GameModeBase(name) {} HideAndSeekMode::HideAndSeekMode(const char* name) : GameModeBase(name) {}
@ -25,17 +30,21 @@ void HideAndSeekMode::init(const GameModeInitInfo& info) {
mCurScene = (StageScene*)info.mScene; mCurScene = (StageScene*)info.mScene;
mPuppetHolder = info.mPuppetHolder; mPuppetHolder = info.mPuppetHolder;
GameModeInfoBase* curGameInfo = Client::getModeInfo(); GameModeInfoBase* curGameInfo = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
sead::ScopedCurrentHeapSetter heapSetter(GameModeManager::instance()->getHeap());
if (curGameInfo) Logger::log("Gamemode info found: %s %s\n", GameModeFactory::getModeString(curGameInfo->mMode), GameModeFactory::getModeString(info.mMode));
else Logger::log("No gamemode info found\n");
if (curGameInfo && curGameInfo->mMode == mMode) { if (curGameInfo && curGameInfo->mMode == mMode) {
mInfo = (HideAndSeekInfo*)curGameInfo; mInfo = (HideAndSeekInfo*)curGameInfo;
mModeTimer = new GameModeTimer(mInfo->mHidingTime); mModeTimer = new GameModeTimer(mInfo->mHidingTime);
Logger::log("Reinitialized timer with time %d:%.2d\n", mInfo->mHidingTime.mMinutes, mInfo->mHidingTime.mSeconds);
} else { } else {
sead::system::DeleteImpl( if (curGameInfo) delete curGameInfo; // attempt to destory previous info before creating new one
curGameInfo); // attempt to destory previous info before creating new one
mInfo = GameModeManager::instance()->createModeInfo<HideAndSeekInfo>();
mInfo = createModeInfo<HideAndSeekInfo>();
Client::setModeInfo(mInfo);
mModeTimer = new GameModeTimer(); mModeTimer = new GameModeTimer();
} }
@ -48,7 +57,6 @@ void HideAndSeekMode::init(const GameModeInitInfo& info) {
} }
void HideAndSeekMode::begin() { void HideAndSeekMode::begin() {
mModeLayout->appear(); mModeLayout->appear();
mIsFirstFrame = true; mIsFirstFrame = true;
@ -61,10 +69,10 @@ void HideAndSeekMode::begin() {
mModeLayout->showSeeking(); mModeLayout->showSeeking();
} }
CoinCounter *coinCollect = mCurScene->stageSceneLayout->mCoinCollectLyt; CoinCounter *coinCollect = mCurScene->mSceneLayout->mCoinCollectLyt;
CoinCounter* coinCounter = mCurScene->stageSceneLayout->mCoinCountLyt; CoinCounter* coinCounter = mCurScene->mSceneLayout->mCoinCountLyt;
MapMini* compass = mCurScene->stageSceneLayout->mMapMiniLyt; MapMini* compass = mCurScene->mSceneLayout->mMapMiniLyt;
al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->stageSceneLayout->mPlayGuideMenuLyt; al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->mSceneLayout->mPlayGuideMenuLyt;
if(coinCounter->mIsAlive) if(coinCounter->mIsAlive)
coinCounter->tryEnd(); coinCounter->tryEnd();
@ -84,10 +92,10 @@ void HideAndSeekMode::end() {
mModeTimer->disableTimer(); mModeTimer->disableTimer();
CoinCounter *coinCollect = mCurScene->stageSceneLayout->mCoinCollectLyt; CoinCounter *coinCollect = mCurScene->mSceneLayout->mCoinCollectLyt;
CoinCounter* coinCounter = mCurScene->stageSceneLayout->mCoinCountLyt; CoinCounter* coinCounter = mCurScene->mSceneLayout->mCoinCountLyt;
MapMini* compass = mCurScene->stageSceneLayout->mMapMiniLyt; MapMini* compass = mCurScene->mSceneLayout->mMapMiniLyt;
al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->stageSceneLayout->mPlayGuideMenuLyt; al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->mSceneLayout->mPlayGuideMenuLyt;
if(!coinCounter->mIsAlive) if(!coinCounter->mIsAlive)
coinCounter->tryStart(); coinCounter->tryStart();
@ -103,7 +111,9 @@ void HideAndSeekMode::end() {
void HideAndSeekMode::update() { void HideAndSeekMode::update() {
PlayerActorHakoniwa* mainPlayer = rs::getPlayerActor(mCurScene); PlayerActorBase* playerBase = rs::getPlayerActor(mCurScene);
bool isYukimaru = !playerBase->getPlayerInfo(); // if PlayerInfo is a nullptr, that means we're dealing with the bound bowl racer
if (mIsFirstFrame) { if (mIsFirstFrame) {
@ -117,24 +127,30 @@ void HideAndSeekMode::update() {
if (!mInfo->mIsPlayerIt) { if (!mInfo->mIsPlayerIt) {
if (mInvulnTime >= 5) { if (mInvulnTime >= 5) {
if (mainPlayer) { if (playerBase) {
for (size_t i = 0; i < mPuppetHolder->getSize(); i++) for (size_t i = 0; i < mPuppetHolder->getSize(); i++)
{ {
PuppetInfo *curInfo = Client::getPuppetInfo(i); PuppetInfo *curInfo = Client::getPuppetInfo(i);
if (!curInfo) {
Logger::log("Checking %d, hit bounds %d-%d\n", i, mPuppetHolder->getSize(), Client::getMaxPlayerCount());
break;
}
if(curInfo->isConnected && curInfo->isInSameStage && curInfo->isIt) { if(curInfo->isConnected && curInfo->isInSameStage && curInfo->isIt) {
float pupDist = al::calcDistance(mainPlayer, curInfo->playerPos); // TODO: remove distance calculations and use hit sensors to determine this float pupDist = al::calcDistance(playerBase, curInfo->playerPos); // TODO: remove distance calculations and use hit sensors to determine this
if(pupDist < 200.f && mainPlayer->mDimKeeper->is2DModel == curInfo->is2D) { if (!isYukimaru) {
if(!PlayerFunction::isPlayerDeadStatus(mainPlayer)) { if(pupDist < 200.f && ((PlayerActorHakoniwa*)playerBase)->mDimKeeper->is2DModel == curInfo->is2D) {
if(!PlayerFunction::isPlayerDeadStatus(playerBase)) {
GameDataFunction::killPlayer(GameDataHolderAccessor(this)); GameDataFunction::killPlayer(GameDataHolderAccessor(this));
mainPlayer->startDemoPuppetable(); playerBase->startDemoPuppetable();
al::setVelocityZero(mainPlayer); al::setVelocityZero(playerBase);
rs::faceToCamera(mainPlayer); rs::faceToCamera(playerBase);
mainPlayer->mPlayerAnimator->endSubAnim(); ((PlayerActorHakoniwa*)playerBase)->mPlayerAnimator->endSubAnim();
mainPlayer->mPlayerAnimator->startAnimDead(); ((PlayerActorHakoniwa*)playerBase)->mPlayerAnimator->startAnimDead();
mInfo->mIsPlayerIt = true; mInfo->mIsPlayerIt = true;
mModeTimer->disableTimer(); mModeTimer->disableTimer();
@ -142,7 +158,7 @@ void HideAndSeekMode::update() {
Client::sendTagInfPacket(); Client::sendTagInfPacket();
} }
} else if (PlayerFunction::isPlayerDeadStatus(mainPlayer)) { } else if (PlayerFunction::isPlayerDeadStatus(playerBase)) {
mInfo->mIsPlayerIt = true; mInfo->mIsPlayerIt = true;
mModeTimer->disableTimer(); mModeTimer->disableTimer();
@ -154,6 +170,7 @@ void HideAndSeekMode::update() {
} }
} }
} }
}
}else { }else {
mInvulnTime += Time::deltaTime; mInvulnTime += Time::deltaTime;
@ -162,13 +179,13 @@ void HideAndSeekMode::update() {
mModeTimer->updateTimer(); mModeTimer->updateTimer();
} }
if (mInfo->mIsUseGravity) { if (mInfo->mIsUseGravity && !isYukimaru) {
sead::Vector3f gravity; sead::Vector3f gravity;
if (rs::calcOnGroundNormalOrGravityDir(&gravity, mainPlayer, mainPlayer->mPlayerCollider)) { if (rs::calcOnGroundNormalOrGravityDir(&gravity, playerBase, playerBase->getPlayerCollision())) {
gravity = -gravity; gravity = -gravity;
al::normalize(&gravity); al::normalize(&gravity);
al::setGravity(mainPlayer, gravity); al::setGravity(playerBase, gravity);
al::setGravity(mainPlayer->mHackCap, gravity); al::setGravity(((PlayerActorHakoniwa*)playerBase)->mHackCap, gravity);
} }
if (al::isPadHoldL(-1)) { if (al::isPadHoldL(-1)) {
@ -183,7 +200,7 @@ void HideAndSeekMode::update() {
} }
} else if (al::isPadTriggerZL(-1)) { } else if (al::isPadTriggerZL(-1)) {
if (al::isPadTriggerLeft(-1)) { if (al::isPadTriggerLeft(-1)) {
killMainPlayer(mainPlayer); killMainPlayer(((PlayerActorHakoniwa*)playerBase));
} }
} }
} }

View file

@ -2,6 +2,10 @@
#include "helpers.hpp" #include "helpers.hpp"
#include "nn/result.h" #include "nn/result.h"
// If connection fails, try X ports above the specified one
// Useful for debugging multple clients on the same machine
constexpr u32 ADDITIONAL_LOG_PORT_COUNT = 2;
Logger* Logger::sInstance = nullptr; Logger* Logger::sInstance = nullptr;
void Logger::createInstance() { void Logger::createInstance() {
@ -51,17 +55,25 @@ nn::Result Logger::init(const char* ip, u16 port) {
serverAddress.family = 2; serverAddress.family = 2;
nn::Result result; nn::Result result;
bool connected = false;
for (u32 i = 0; i < ADDITIONAL_LOG_PORT_COUNT + 1; ++i) {
result = nn::socket::Connect(this->socket_log_socket, &serverAddress, sizeof(serverAddress));
if (result.isSuccess()) {
connected = true;
break;
}
this->port++;
serverAddress.port = nn::socket::InetHtons(this->port);
}
if ((result = nn::socket::Connect(this->socket_log_socket, &serverAddress, sizeof(serverAddress))).isFailure()) { if (connected) {
this->socket_log_state = SOCKET_LOG_CONNECTED;
this->isDisableName = false;
return 0;
} else {
this->socket_log_state = SOCKET_LOG_UNAVAILABLE; this->socket_log_state = SOCKET_LOG_UNAVAILABLE;
return result; return result;
} }
this->socket_log_state = SOCKET_LOG_CONNECTED;
this->isDisableName = false;
return 0;
} }
void Logger::log(const char *fmt, va_list args) { // impl for replacing seads system::print void Logger::log(const char *fmt, va_list args) { // impl for replacing seads system::print
@ -108,4 +120,3 @@ void tryInitSocket() {
Logger::createInstance(); // creates a static instance for debug logger Logger::createInstance(); // creates a static instance for debug logger
#endif #endif
} }

View file

@ -1,6 +1,11 @@
#include "game/StageScene/StageSceneStateServerConfig.hpp" #include "game/StageScene/StageSceneStateServerConfig.hpp"
#include <cstdlib> #include <cstdlib>
#include <cstring>
#include <math.h> #include <math.h>
#include "al/string/StringTmp.h"
#include "basis/seadNew.h"
#include "game/Layouts/CommonVerticalList.h"
#include "game/SaveData/SaveDataAccessFunction.h"
#include "server/Client.hpp" #include "server/Client.hpp"
#include "al/util.hpp" #include "al/util.hpp"
#include "al/util/NerveUtil.h" #include "al/util/NerveUtil.h"
@ -11,8 +16,14 @@
#include "prim/seadStringUtil.h" #include "prim/seadStringUtil.h"
#include "rs/util/InputUtil.h" #include "rs/util/InputUtil.h"
#include "server/gamemode/GameModeBase.hpp" #include "server/gamemode/GameModeBase.hpp"
#include "server/gamemode/GameModeConfigMenuFactory.hpp"
#include "server/gamemode/GameModeFactory.hpp" #include "server/gamemode/GameModeFactory.hpp"
#include "server/HideAndSeekMode.hpp" #include "server/gamemode/GameModeManager.hpp"
#include "server/hns/HideAndSeekMode.hpp"
// WIP work on RollPartsData, not exactly working out atm
const char16_t* testValues[] = {u"Test 1", u"Test 2", u"Test 3", u"Test 4", u"Test 5",
u"Test 6", u"Test 7", u"Test 8", u"Test 9"};
StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::Scene *scene, const al::LayoutInitInfo &initInfo, FooterParts *footerParts, GameDataHolder *dataHolder, bool) : al::HostStateBase<al::Scene>(name, scene) { StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::Scene *scene, const al::LayoutInitInfo &initInfo, FooterParts *footerParts, GameDataHolder *dataHolder, bool) : al::HostStateBase<al::Scene>(name, scene) {
mFooterParts = footerParts; mFooterParts = footerParts;
@ -28,18 +39,37 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S
al::setPaneString(mMainOptions, "TxtOption", u"Server Configuration", 0); al::setPaneString(mMainOptions, "TxtOption", u"Server Configuration", 0);
mMainOptionsList->initDataNoResetSelected(4); mMainOptionsList->unkInt1 = 1;
sead::SafeArray<sead::WFixedSafeString<0x200>, 4>* mainMenuOptions = mMainOptionsList->initDataNoResetSelected(5);
new sead::SafeArray<sead::WFixedSafeString<0x200>, 4>();
mainMenuOptions->mBuffer[0].copy(u"Gamemode Config"); sead::SafeArray<sead::WFixedSafeString<0x200>, 5>* mainMenuOptions =
mainMenuOptions->mBuffer[1].copy(u"Change Gamemode"); new sead::SafeArray<sead::WFixedSafeString<0x200>, 5>();
mainMenuOptions->mBuffer[2].copy(u"Reconnect to Server");
mainMenuOptions->mBuffer[3].copy(u"Change Server IP"); 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");
mMainOptionsList->addStringData(mainMenuOptions->mBuffer, "TxtContent"); mMainOptionsList->addStringData(mainMenuOptions->mBuffer, "TxtContent");
// WIP work on RollPartsData, not exactly working out atm
// RollPartsData* testArr = new RollPartsData[2]();
// for (int i = 0; i < 2; i++) {
// RollPartsData* part = &testArr[i];
// part->mRollMsgCount = 3;
// part->mRollMsgList = testValues;
// part->unkInt1 = 0;
// part->mUnkBool = i == 0;
// }
//mMainOptionsList->startLoopActionAll("Loop", "Loop");
// mMainOptionsList->setRollPartsData(testArr);
// gamemode select menu // gamemode select menu
mModeSelect = new SimpleLayoutMenu("GamemodeSelectMenu", "OptionSelect", initInfo, 0, false); mModeSelect = new SimpleLayoutMenu("GamemodeSelectMenu", "OptionSelect", initInfo, 0, false);
@ -62,19 +92,23 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S
mModeSelectList->addStringData(modeSelectOptions->mBuffer, "TxtContent"); mModeSelectList->addStringData(modeSelectOptions->mBuffer, "TxtContent");
// gamemode config menu // gamemode config menu
mGamemodeConfig = new SimpleLayoutMenu("GameModeConfigMenu", "OptionSelect", initInfo, 0, false); GameModeConfigMenuFactory factory("GameModeConfigFactory");
mGameModeConfigList = new CommonVerticalList(mGamemodeConfig, initInfo, true); for (int mode = 0; mode < factory.getMenuCount(); mode++) {
GameModeEntry& entry = mGamemodeConfigMenus[mode];
const char* name = factory.getMenuName(mode);
entry.mMenu = factory.getCreator(name)(name);
entry.mLayout = new SimpleLayoutMenu("GameModeConfigMenu", "OptionSelect", initInfo, 0, false);
entry.mList = new CommonVerticalList(entry.mLayout, initInfo, true);
al::setPaneString(mGamemodeConfig, "TxtOption", u"Gamemode Configuration", 0); al::setPaneString(entry.mLayout, "TxtOption", u"Gamemode Configuration", 0);
mGamemodeConfigMenu = Client::tryCreateModeMenu(); entry.mList->initDataNoResetSelected(entry.mMenu->getMenuSize());
if (mGamemodeConfigMenu) {
mGameModeConfigList->initDataNoResetSelected(mGamemodeConfigMenu->getMenuSize());
mGameModeConfigList->addStringData(mGamemodeConfigMenu->getStringData(), "TxtContent"); entry.mList->addStringData(entry.mMenu->getStringData(), "TxtContent");
} }
mCurrentList = mMainOptionsList; mCurrentList = mMainOptionsList;
mCurrentMenu = mMainOptions; mCurrentMenu = mMainOptions;
} }
@ -147,7 +181,11 @@ void StageSceneStateServerConfig::exeMainMenu() {
break; break;
} }
case ServerConfigOption::SETIP: { case ServerConfigOption::SETIP: {
al::setNerve(this, &nrvStageSceneStateServerConfigOpenKeyboard); al::setNerve(this, &nrvStageSceneStateServerConfigOpenKeyboardIP);
break;
}
case ServerConfigOption::SETPORT: {
al::setNerve(this, &nrvStageSceneStateServerConfigOpenKeyboardPort);
break; break;
} }
default: default:
@ -157,14 +195,40 @@ void StageSceneStateServerConfig::exeMainMenu() {
} }
} }
void StageSceneStateServerConfig::exeOpenKeyboard() { void StageSceneStateServerConfig::exeOpenKeyboardIP() {
if (al::isFirstStep(this)) { if (al::isFirstStep(this)) {
mCurrentList->deactivate(); mCurrentList->deactivate();
Client::openKeyboardIP(); Client::getKeyboard()->setHeaderText(u"Set a Server IP Below.");
// anything that happens after this will be ran after the keyboard closes Client::getKeyboard()->setSubText(u"");
bool isSave = Client::openKeyboardIP(); // anything that happens after this will be ran after the keyboard closes
al::startHitReaction(mCurrentMenu, "リセット", 0); al::startHitReaction(mCurrentMenu, "リセット", 0);
if(isSave)
al::setNerve(this, &nrvStageSceneStateServerConfigSaveData);
else
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
}
}
void StageSceneStateServerConfig::exeOpenKeyboardPort() {
if (al::isFirstStep(this)) {
mCurrentList->deactivate();
Client::getKeyboard()->setHeaderText(u"Set a Server Port Below.");
Client::getKeyboard()->setSubText(u"");
bool isSave = Client::openKeyboardPort(); // anything that happens after this will be ran after the keyboard closes
al::startHitReaction(mCurrentMenu, "リセット", 0);
if(isSave)
al::setNerve(this, &nrvStageSceneStateServerConfigSaveData);
else
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu); al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
} }
} }
@ -172,26 +236,36 @@ void StageSceneStateServerConfig::exeOpenKeyboard() {
void StageSceneStateServerConfig::exeRestartServer() { void StageSceneStateServerConfig::exeRestartServer() {
if (al::isFirstStep(this)) { if (al::isFirstStep(this)) {
mCurrentList->deactivate(); mCurrentList->deactivate();
Client::stopConnection();
Client::showConnect();
Client::restartConnection();
} }
if (Client::isSocketActive()) { if (Client::isSocketActive()) {
Client::hideConnect();
al::startHitReaction(mCurrentMenu, "リセット", 0); al::startHitReaction(mCurrentMenu, "リセット", 0);
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu); al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
} else {
al::setNerve(this, &nrvStageSceneStateServerConfigConnectError);
} }
} }
void StageSceneStateServerConfig::exeGamemodeConfig() { void StageSceneStateServerConfig::exeGamemodeConfig() {
if (al::isFirstStep(this)) { if (al::isFirstStep(this)) {
mCurrentList = mGameModeConfigList; mGamemodeConfigMenu = &mGamemodeConfigMenus[GameModeManager::instance()->getGameMode()];
mCurrentMenu = mGamemodeConfig; mCurrentList = mGamemodeConfigMenu->mList;
mCurrentMenu = mGamemodeConfigMenu->mLayout;
subMenuStart(); subMenuStart();
} }
subMenuUpdate(); subMenuUpdate();
if (mIsDecideConfig && mCurrentList->isDecideEnd()) { if (mIsDecideConfig && mCurrentList->isDecideEnd()) {
if (mGamemodeConfigMenu->updateMenu(mCurrentList->mCurSelected)) { if (mGamemodeConfigMenu->mMenu->updateMenu(mCurrentList->mCurSelected)) {
endSubMenu(); endSubMenu();
} }
} }
@ -211,11 +285,35 @@ void StageSceneStateServerConfig::exeGamemodeSelect() {
if (mIsDecideConfig && mCurrentList->isDecideEnd()) { if (mIsDecideConfig && mCurrentList->isDecideEnd()) {
Logger::log("Setting Server Mode to: %d\n", mCurrentList->mCurSelected); Logger::log("Setting Server Mode to: %d\n", mCurrentList->mCurSelected);
Client::setServerMode(static_cast<GameMode>(mCurrentList->mCurSelected)); GameModeManager::instance()->setMode(static_cast<GameMode>(mCurrentList->mCurSelected));
endSubMenu(); endSubMenu();
} }
} }
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)) {
SaveDataAccessFunction::startSaveDataWrite(mGameDataHolder);
}
if (SaveDataAccessFunction::updateSaveDataAccess(mGameDataHolder, false)) {
al::startHitReaction(mCurrentMenu, "リセット", 0);
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
}
}
void StageSceneStateServerConfig::endSubMenu() { void StageSceneStateServerConfig::endSubMenu() {
mCurrentList->deactivate(); mCurrentList->deactivate();
mCurrentMenu->kill(); mCurrentMenu->kill();
@ -270,10 +368,14 @@ void StageSceneStateServerConfig::subMenuUpdate() {
} }
} }
namespace { namespace {
NERVE_IMPL(StageSceneStateServerConfig, MainMenu) NERVE_IMPL(StageSceneStateServerConfig, MainMenu)
NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboard) NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboardIP)
NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboardPort)
NERVE_IMPL(StageSceneStateServerConfig, RestartServer) NERVE_IMPL(StageSceneStateServerConfig, RestartServer)
NERVE_IMPL(StageSceneStateServerConfig, GamemodeConfig) NERVE_IMPL(StageSceneStateServerConfig, GamemodeConfig)
NERVE_IMPL(StageSceneStateServerConfig, GamemodeSelect) NERVE_IMPL(StageSceneStateServerConfig, GamemodeSelect)
NERVE_IMPL(StageSceneStateServerConfig, SaveData)
NERVE_IMPL(StageSceneStateServerConfig, ConnectError)
} }